deliveryset_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         $sId      = oxConfig::getParameter( 'oxid' );
00027         $sSynchId = oxConfig::getParameter( 'synchoxid' );
00028 
00029         $sgroupTable = getViewName('oxgroups');
00030 
00031         // category selected or not ?
00032         if ( !$sId) {
00033             $sQAdd  = " from $sgroupTable where 1 ";
00034         } else {
00035             $sQAdd  = " from oxobject2delivery, $sgroupTable where oxobject2delivery.oxdeliveryid = '$sId' ";
00036             $sQAdd .= " and oxobject2delivery.oxobjectid = $sgroupTable.oxid and oxobject2delivery.oxtype = 'oxdelsetg' ";
00037         }
00038 
00039         if ( $sSynchId && $sSynchId != $sId ) {
00040             $sQAdd .= " and $sgroupTable.oxid not in ( select $sgroupTable.oxid from oxobject2delivery, $sgroupTable where oxobject2delivery.oxdeliveryid = '$sSynchId' ";
00041             $sQAdd .= " and oxobject2delivery.oxobjectid = $sgroupTable.oxid and oxobject2delivery.oxtype = 'oxdelsetg' ) ";
00042         }
00043 
00044         return $sQAdd;
00045     }
00046 
00052     public function removegroupfromset()
00053     {
00054         $aRemoveGroups = $this->_getActionIds( 'oxobject2delivery.oxid' );
00055         if ( oxConfig::getParameter( 'all' ) ) {
00056 
00057             $sQ = $this->_addFilter( "delete oxobject2delivery.* ".$this->_getQuery() );
00058             oxDb::getDb()->Execute( $sQ );
00059 
00060         } elseif ( $aRemoveGroups && is_array( $aRemoveGroups ) ) {
00061             $sQ = "delete from oxobject2delivery where oxobject2delivery.oxid in ('" . implode( "', '", $aRemoveGroups ) . "') ";
00062             oxDb::getDb()->Execute( $sQ );
00063         }
00064     }
00065 
00071     public function addgrouptoset()
00072     {
00073         $aChosenCat = $this->_getActionIds( 'oxgroups.oxid' );
00074         $soxId      = oxConfig::getParameter( 'synchoxid' );
00075 
00076         // adding
00077         if ( oxConfig::getParameter( 'all' ) ) {
00078             $sGroupTable = getViewName('oxgroups');
00079             $aChosenCat = $this->_getAll( $this->_addFilter( "select $sGroupTable.oxid ".$this->_getQuery() ) );
00080         }
00081         if ( $soxId && $soxId != "-1" && is_array( $aChosenCat ) ) {
00082             foreach ( $aChosenCat as $sChosenCat) {
00083                 $oObject2Delivery = oxNew( 'oxbase' );
00084                 $oObject2Delivery->init( 'oxobject2delivery' );
00085                 $oObject2Delivery->oxobject2delivery__oxdeliveryid = new oxField($soxId);
00086                 $oObject2Delivery->oxobject2delivery__oxobjectid   = new oxField($sChosenCat);
00087                 $oObject2Delivery->oxobject2delivery__oxtype       = new oxField("oxdelsetg");
00088                 $oObject2Delivery->save();
00089             }
00090         }
00091     }
00092 }

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