article_selection.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',   'oxselectlist', 1, 1, 0 ),
00005                                         array( 'oxident',   'oxselectlist', 1, 0, 0 ),
00006                                         array( 'oxvaldesc', 'oxselectlist', 1, 0, 0 ),
00007                                         array( 'oxid',      'oxselectlist', 0, 0, 1 )
00008                                         ),
00009                      'container2' => array(
00010                                         array( 'oxtitle',   'oxselectlist', 1, 1, 0 ),
00011                                         array( 'oxident',   'oxselectlist', 1, 0, 0 ),
00012                                         array( 'oxvaldesc', 'oxselectlist', 1, 0, 0 ),
00013                                         array( 'oxid',      'oxobject2selectlist', 0, 0, 1 )
00014                                         )
00015                     );
00019 class ajaxComponent extends ajaxListComponent
00020 {
00026     protected function _getQuery()
00027     {
00028         $sSLViewName = getViewName('oxselectlist');
00029 
00030         $sArtId      = oxConfig::getParameter( 'oxid' );
00031         $sSynchArtId = oxConfig::getParameter( 'synchoxid' );
00032 
00033         if ( $sArtId ) {
00034             // all categories article is in
00035             $sQAdd  = " from oxobject2selectlist left join $sSLViewName on $sSLViewName.oxid=oxobject2selectlist.oxselnid ";
00036             $sQAdd .= " where oxobject2selectlist.oxobjectid = '$sArtId' ";
00037         } else {
00038             $sQAdd  = " from $sSLViewName  where $sSLViewName.oxid not in ( select oxobject2selectlist.oxselnid from oxobject2selectlist left join $sSLViewName on $sSLViewName.oxid=oxobject2selectlist.oxselnid ";
00039             $sQAdd .= " where oxobject2selectlist.oxobjectid = '$sSynchArtId' ) ";
00040         }
00041 
00042         return $sQAdd;
00043     }
00044 
00050     public function removesel()
00051     {
00052         $aChosenArt = $this->_getActionIds( 'oxobject2selectlist.oxid' );
00053         if ( oxConfig::getParameter( 'all' ) ) {
00054 
00055             $sQ = $this->_addFilter( "delete oxobject2selectlist.* ".$this->_getQuery() );
00056             oxDb::getDb()->Execute( $sQ );
00057 
00058         } elseif ( is_array( $aChosenArt ) ) {
00059             $sQ = "delete from oxobject2selectlist where oxobject2selectlist.oxid in ('" . implode( "', '", $aChosenArt ) . "') ";
00060             oxDb::getDb()->Execute( $sQ );
00061         }
00062     }
00063 
00069     public function addsel()
00070     {
00071         $aAddSel = $this->_getActionIds( 'oxselectlist.oxid' );
00072         $soxId   = oxConfig::getParameter( 'synchoxid');
00073 
00074         // adding
00075         if ( oxConfig::getParameter( 'all' ) ) {
00076             $sSLViewName = getViewName('oxselectlist');
00077             $aAddSel = $this->_getAll( $this->_addFilter( "select $sSLViewName.oxid ".$this->_getQuery() ) );
00078         }
00079 
00080         if ( $soxId && $soxId != "-1" && is_array( $aAddSel ) ) {
00081             foreach ($aAddSel as $sAdd) {
00082                 $oNew = oxNew( "oxbase" );
00083                 $oNew->init( "oxobject2selectlist" );
00084                 $oNew->oxobject2selectlist__oxobjectid = new oxField($soxId);
00085                 $oNew->oxobject2selectlist__oxselnid   = new oxField($sAdd);
00086                 $oNew->save();
00087             }
00088         }
00089     }
00090 }

Generated on Tue Apr 21 15:45:44 2009 for OXID eShop CE by  doxygen 1.5.5