deliveryset_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',      'oxdelivery', 1, 1, 0 ),
00005                                         array( 'oxaddsum',     'oxdelivery', 1, 0, 0 ),
00006                                         array( 'oxaddsumtype', 'oxdelivery', 0, 0, 0 ),
00007                                         array( 'oxid',         'oxdelivery', 0, 0, 1 )
00008                                         ),
00009                      'container2' => array(
00010                                         array( 'oxtitle',      'oxdelivery', 1, 1, 0 ),
00011                                         array( 'oxaddsum',     'oxdelivery', 1, 0, 0 ),
00012                                         array( 'oxaddsumtype', 'oxdelivery', 0, 0, 0 ),
00013                                         array( 'oxid',  'oxdel2delset', 0, 0, 1 )
00014                                         )
00015                     );
00019 class ajaxComponent extends ajaxListComponent
00020 {
00026     protected function _getQuery()
00027     {
00028         $sId      = oxConfig::getParameter( 'oxid' );
00029         $sSynchId = oxConfig::getParameter( 'synchoxid' );
00030 
00031         $sDeliveryViewName = getViewName('oxdelivery');
00032 
00033         // category selected or not ?
00034         if ( !$sId) {
00035             $sQAdd  = " from $sDeliveryViewName where 1 ";
00036         } else {
00037             $sQAdd  = " from $sDeliveryViewName left join oxdel2delset on oxdel2delset.oxdelid=$sDeliveryViewName.oxid ";
00038             $sQAdd .= "where oxdel2delset.oxdelsetid = '$sId' ";
00039         }
00040 
00041         if ( $sSynchId && $sSynchId != $sId ) {
00042             $sQAdd .= "and $sDeliveryViewName.oxid not in ( select $sDeliveryViewName.oxid from $sDeliveryViewName left join oxdel2delset on oxdel2delset.oxdelid=$sDeliveryViewName.oxid ";
00043             $sQAdd .= "where oxdel2delset.oxdelsetid = '$sSynchId' ) ";
00044         }
00045 
00046         return $sQAdd;
00047     }
00048 
00054     public function removefromset()
00055     {
00056         $aRemoveGroups = $this->_getActionIds( 'oxdel2delset.oxid' );
00057         if ( oxConfig::getParameter( 'all' ) ) {
00058 
00059             $sQ = $this->_addFilter( "delete oxdel2delset.* ".$this->_getQuery() );
00060             oxDb::getDb()->Execute( $sQ );
00061 
00062         } elseif ( $aRemoveGroups && is_array( $aRemoveGroups ) ) {
00063             $sQ = "delete from oxdel2delset where oxdel2delset.oxid in (" . implode( ", ", oxDb::getInstance()->quoteArray( $aRemoveGroups ) ) . ") ";
00064             oxDb::getDb()->Execute( $sQ );
00065         }
00066     }
00067 
00073     public function addtoset()
00074     {
00075         $aChosenSets = $this->_getActionIds( 'oxdelivery.oxid' );
00076         $soxId       = oxConfig::getParameter( 'synchoxid');
00077 
00078         // adding
00079         if ( oxConfig::getParameter( 'all' ) ) {
00080             $sDeliveryViewName = getViewName('oxdelivery');
00081             $aChosenSets = $this->_getAll( $this->_addFilter( "select $sDeliveryViewName.oxid ".$this->_getQuery() ) );
00082         }
00083         if ( $soxId && $soxId != "-1" && is_array( $aChosenSets ) ) {
00084             $oDb = oxDb::getDb();
00085             foreach ( $aChosenSets as $sChosenSet) {
00086                 // check if we have this entry already in
00087                 $sID = $oDb->GetOne("select oxid from oxdel2delset where oxdelid =  " . $oDb->quote( $sChosenSet ) . " and oxdelsetid = '$soxId'");
00088                 if ( !isset( $sID) || !$sID) {
00089                     $oDel2delset = oxNew( 'oxbase' );
00090                     $oDel2delset->init( 'oxdel2delset' );
00091                     $oDel2delset->oxdel2delset__oxdelid    = new oxField($sChosenSet);
00092                     $oDel2delset->oxdel2delset__oxdelsetid = new oxField($soxId);
00093                     $oDel2delset->save();
00094                 }
00095             }
00096         }
00097     }
00098 }

Generated by  doxygen 1.6.2