deliveryset_country.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00003 $aColumns = array( 'container1' => array(    // field , table,         visible, multilanguage, ident
00004                                         array( 'oxtitle',     'oxcountry', 1, 1, 0 ),
00005                                         array( 'oxisoalpha2', 'oxcountry', 1, 0, 0 ),
00006                                         array( 'oxisoalpha3', 'oxcountry', 0, 0, 0 ),
00007                                         array( 'oxunnum3',    'oxcountry', 0, 0, 0 ),
00008                                         array( 'oxid',        'oxcountry', 0, 0, 1 )
00009                                         ),
00010                      'container2' => array(
00011                                         array( 'oxtitle',     'oxcountry', 1, 1, 0 ),
00012                                         array( 'oxisoalpha2', 'oxcountry', 1, 0, 0 ),
00013                                         array( 'oxisoalpha3', 'oxcountry', 0, 0, 0 ),
00014                                         array( 'oxunnum3',    'oxcountry', 0, 0, 0 ),
00015                                         array( 'oxid', 'oxobject2delivery', 0, 0, 1 )
00016                                         )
00017                     );
00021 class ajaxComponent extends ajaxListComponent
00022 {
00028     protected function _getQuery()
00029     {
00030         $sId      = oxConfig::getParameter( 'oxid' );
00031         $sSynchId = oxConfig::getParameter( 'synchoxid' );
00032 
00033         $sCountryTable = getViewName('oxcountry');
00034 
00035         // category selected or not ?
00036         if ( !$sId ) {
00037             $sQAdd  = " from $sCountryTable where $sCountryTable.oxactive = '1' ";
00038         } else {
00039             $sQAdd  = " from oxobject2delivery, $sCountryTable where oxobject2delivery.oxdeliveryid = '$sId' ";
00040             $sQAdd .= " and oxobject2delivery.oxobjectid = $sCountryTable.oxid and oxobject2delivery.oxtype = 'oxdelset' ";
00041         }
00042 
00043         if ( $sSynchId && $sSynchId != $sId) {
00044             $sQAdd .= "and $sCountryTable.oxid not in ( select $sCountryTable.oxid from oxobject2delivery, $sCountryTable where oxobject2delivery.oxdeliveryid = '$sSynchId' ";
00045             $sQAdd .= "and oxobject2delivery.oxobjectid = $sCountryTable.oxid and oxobject2delivery.oxtype = 'oxdelset' ) ";
00046         }
00047 
00048         return $sQAdd;
00049     }
00050 
00056     public function removecountryfromset()
00057     {
00058         $aChosenCntr = $this->_getActionIds( 'oxobject2delivery.oxid' );
00059         // removing all
00060         if ( oxConfig::getParameter( 'all' ) ) {
00061 
00062             $sQ = $this->_addFilter( "delete oxobject2delivery.* ".$this->_getQuery() );
00063             oxDb::getDb()->Execute( $sQ );
00064 
00065         } elseif ( is_array( $aChosenCntr ) ) {
00066             $sQ = "delete from oxobject2delivery where oxobject2delivery.oxid in ('" . implode( "', '", $aChosenCntr ) . "') ";
00067             oxDb::getDb()->Execute( $sQ );
00068         }
00069     }
00070 
00076     public function addcountrytoset()
00077     {
00078         $aChosenCntr = $this->_getActionIds( 'oxcountry.oxid' );
00079         $soxId       = oxConfig::getParameter( 'synchoxid');
00080 
00081         // adding
00082         if ( oxConfig::getParameter( 'all' ) ) {
00083             $sCountryTable = getViewName('oxcountry');
00084             $aChosenCntr = $this->_getAll( $this->_addFilter( "select $sCountryTable.oxid ".$this->_getQuery() ) );
00085         }
00086 
00087         if ( $soxId && $soxId != "-1" && is_array( $aChosenCntr ) ) {
00088             foreach ( $aChosenCntr as $sChosenCntr) {
00089                 $oObject2Delivery = oxNew( 'oxbase' );
00090                 $oObject2Delivery->init( 'oxobject2delivery' );
00091                 $oObject2Delivery->oxobject2delivery__oxdeliveryid = new oxField($soxId);
00092                 $oObject2Delivery->oxobject2delivery__oxobjectid   = new oxField($sChosenCntr);
00093                 $oObject2Delivery->oxobject2delivery__oxtype       = new oxField("oxdelset");
00094                 $oObject2Delivery->save();
00095             }
00096         }
00097     }
00098 }

Generated on Thu Dec 4 12:04:55 2008 for OXID eShop CE by  doxygen 1.5.5