delivery_main.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         $sCountryTable = getViewName('oxcountry');
00031 
00032         $sId      = oxConfig::getParameter( 'oxid' );
00033         $sSynchId = oxConfig::getParameter( 'synchoxid' );
00034 
00035         // category selected or not ?
00036         if ( !$sId) {
00037             $sQAdd  = " from $sCountryTable where $sCountryTable.oxactive = '1' ";
00038         } else {
00039             $sQAdd  = " from oxobject2delivery left join $sCountryTable on $sCountryTable.oxid=oxobject2delivery.oxobjectid ";
00040             $sQAdd .= " where oxobject2delivery.oxdeliveryid = '$sId' and oxobject2delivery.oxtype = 'oxcountry' ";
00041         }
00042 
00043         if ( $sSynchId && $sSynchId != $sId ) {
00044             $sQAdd .= " and $sCountryTable.oxid not in ( select $sCountryTable.oxid from oxobject2delivery left join $sCountryTable on $sCountryTable.oxid=oxobject2delivery.oxobjectid ";
00045             $sQAdd .= " where oxobject2delivery.oxdeliveryid = '$sSynchId' and oxobject2delivery.oxtype = 'oxcountry' ) ";
00046         }
00047 
00048         return $sQAdd;
00049     }
00050 
00056     public function removecountryfromdel()
00057     {
00058         $aChosenCntr = $this->_getActionIds( 'oxobject2delivery.oxid' );
00059         if ( oxConfig::getParameter( 'all' ) ) {
00060 
00061             $sQ = $this->_addFilter( "delete oxobject2delivery.* ".$this->_getQuery() );
00062             oxDb::getDb()->Execute( $sQ );
00063 
00064         } elseif ( is_array( $aChosenCntr ) ) {
00065             $sQ = "delete from oxobject2delivery where oxobject2delivery.oxid in ('" . implode( "', '", $aChosenCntr ) . "') ";
00066             oxDb::getDb()->Execute( $sQ );
00067         }
00068     }
00069 
00075     public function addcountrytodel()
00076     {
00077         $aChosenCntr = $this->_getActionIds( 'oxcountry.oxid' );
00078         $soxId       = oxConfig::getParameter( 'synchoxid');
00079 
00080         // adding
00081         if ( oxConfig::getParameter( 'all' ) ) {
00082             $sCountryTable = getViewName('oxcountry');
00083             $aChosenCntr = $this->_getAll( $this->_addFilter( "select $sCountryTable.oxid ".$this->_getQuery() ) );
00084         }
00085 
00086         if ( $soxId && $soxId != "-1" && is_array( $aChosenCntr ) ) {
00087             foreach ( $aChosenCntr as $sChosenCntr) {
00088                 $oObject2Delivery = oxNew( 'oxbase' );
00089                 $oObject2Delivery->init( 'oxobject2delivery' );
00090                 $oObject2Delivery->oxobject2delivery__oxdeliveryid = new oxField($soxId);
00091                 $oObject2Delivery->oxobject2delivery__oxobjectid   = new oxField($sChosenCntr);
00092                 $oObject2Delivery->oxobject2delivery__oxtype       = new oxField('oxcountry');
00093                 $oObject2Delivery->save();
00094             }
00095         }
00096     }
00097 }

Generated on Wed Apr 22 12:26:29 2009 for OXID eShop CE by  doxygen 1.5.5