delivery_groups.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',  'oxgroups', 1, 0, 0 ),
00005                                         array( 'oxid',     'oxgroups', 0, 0, 0 ),
00006                                         array( 'oxid',     'oxgroups', 0, 0, 1 ),
00007                                         ),
00008                      'container2' => array(
00009                                         array( 'oxtitle',  'oxgroups', 1, 0, 0 ),
00010                                         array( 'oxid',     'oxgroups', 0, 0, 0 ),
00011                                         array( 'oxid',     'oxobject2delivery', 0, 0, 1 ),
00012                                         )
00013                     );
00017 class ajaxComponent extends ajaxListComponent
00018 {
00024     protected function _getQuery()
00025     {
00026         $myConfig = $this->getConfig();
00027 
00028         // active AJAX component
00029         $sGroupTable = getViewName('oxgroups');
00030 
00031         $sId      = oxConfig::getParameter( 'oxid' );
00032         $sSynchId = oxConfig::getParameter( 'synchoxid' );
00033 
00034         // category selected or not ?
00035         if ( !$sId ) {
00036             $sQAdd  = " from $sGroupTable where 1 ";
00037         } else {
00038             $sQAdd  = " from oxobject2delivery left join $sGroupTable on $sGroupTable.oxid=oxobject2delivery.oxobjectid ";
00039             $sQAdd .= " where oxobject2delivery.oxdeliveryid = '$sId' and oxobject2delivery.oxtype = 'oxgroups' ";
00040         }
00041 
00042         if ( $sSynchId && $sSynchId != $sId ) {
00043             $sQAdd .= " and $sGroupTable.oxid not in ( select $sGroupTable.oxid from oxobject2delivery left join $sGroupTable on $sGroupTable.oxid=oxobject2delivery.oxobjectid ";
00044             $sQAdd .= " where oxobject2delivery.oxdeliveryid = '$sSynchId' and oxobject2delivery.oxtype = 'oxgroups' ) ";
00045         }
00046 
00047         return $sQAdd;
00048     }
00049 
00055     public function removegroupfromdel()
00056     {
00057         $aRemoveGroups = $this->_getActionIds( 'oxobject2delivery.oxid' );
00058         if ( oxConfig::getParameter( 'all' ) ) {
00059 
00060             $sQ = $this->_addFilter( "delete oxobject2delivery.* ".$this->_getQuery() );
00061             oxDb::getDb()->Execute( $sQ );
00062 
00063         } elseif ( $aRemoveGroups && is_array( $aRemoveGroups ) ) {
00064             $sQ = "delete from oxobject2delivery where oxobject2delivery.oxid in ('" . implode( "', '", $aRemoveGroups ) . "') ";
00065             oxDb::getDb()->Execute( $sQ );
00066         }
00067     }
00068 
00074     public function addgrouptodel()
00075     {
00076         $aChosenCat = $this->_getActionIds( 'oxgroups.oxid' );
00077         $soxId      = oxConfig::getParameter( 'synchoxid' );
00078 
00079         // adding
00080         if ( oxConfig::getParameter( 'all' ) ) {
00081             $sGroupTable = getViewName('oxgroups');
00082             $aChosenCat = $this->_getAll( $this->_addFilter( "select $sGroupTable.oxid ".$this->_getQuery() ) );
00083         }
00084 
00085         if ( $soxId && $soxId != "-1" && is_array( $aChosenCat ) ) {
00086             foreach ( $aChosenCat as $sChosenCat) {
00087                 $oObject2Delivery = oxNew( 'oxbase' );
00088                 $oObject2Delivery->init( 'oxobject2delivery' );
00089                 $oObject2Delivery->oxobject2delivery__oxdeliveryid = new oxField($soxId);
00090                 $oObject2Delivery->oxobject2delivery__oxobjectid   = new oxField($sChosenCat);
00091                 $oObject2Delivery->oxobject2delivery__oxtype       = new oxField('oxgroups');
00092                 $oObject2Delivery->save();
00093             }
00094         }
00095     }
00096 }

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