delivery_users.inc.php

Go to the documentation of this file.
00001 <?php
00002 
00003 $aColumns = array( 'container1' => array(    // field , table,  visible, multilanguage, ident
00004                                         array( 'oxusername',  'oxuser', 1, 0, 0 ),
00005                                         array( 'oxlname',     'oxuser', 0, 0, 0 ),
00006                                         array( 'oxfname',     'oxuser', 0, 0, 0 ),
00007                                         array( 'oxstreet',    'oxuser', 0, 0, 0 ),
00008                                         array( 'oxstreetnr',  'oxuser', 0, 0, 0 ),
00009                                         array( 'oxcity',      'oxuser', 0, 0, 0 ),
00010                                         array( 'oxzip',       'oxuser', 0, 0, 0 ),
00011                                         array( 'oxfon',       'oxuser', 0, 0, 0 ),
00012                                         array( 'oxbirthdate', 'oxuser', 0, 0, 0 ),
00013                                         array( 'oxid',        'oxuser', 0, 0, 1 ),
00014                                         ),
00015                      'container2' => array(
00016                                         array( 'oxusername',  'oxuser', 1, 0, 0 ),
00017                                         array( 'oxlname',     'oxuser', 0, 0, 0 ),
00018                                         array( 'oxfname',     'oxuser', 0, 0, 0 ),
00019                                         array( 'oxstreet',    'oxuser', 0, 0, 0 ),
00020                                         array( 'oxstreetnr',  'oxuser', 0, 0, 0 ),
00021                                         array( 'oxcity',      'oxuser', 0, 0, 0 ),
00022                                         array( 'oxzip',       'oxuser', 0, 0, 0 ),
00023                                         array( 'oxfon',       'oxuser', 0, 0, 0 ),
00024                                         array( 'oxbirthdate', 'oxuser', 0, 0, 0 ),
00025                                         array( 'oxid',     'oxobject2delivery', 0, 0, 1 ),
00026                                         )
00027                     );
00031 class ajaxComponent extends ajaxListComponent
00032 {
00038     protected function _getQuery()
00039     {
00040         $myConfig = $this->getConfig();
00041 
00042         $sUserTable = getViewName('oxuser');
00043 
00044         $sId      = oxConfig::getParameter( 'oxid' );
00045         $sSynchId = oxConfig::getParameter( 'synchoxid' );
00046 
00047         // category selected or not ?
00048         if ( !$sId) {
00049             $sQAdd  = " from $sUserTable where 1 ";
00050             if (!$myConfig->getConfigParam( 'blMallUsers' ) )
00051                 $sQAdd .= " and $sUserTable.oxshopid = '".$myConfig->getShopId()."' ";
00052         } else {
00053             // selected group ?
00054             if ( $sSynchId && $sSynchId != $sId ) {
00055                 $sQAdd  = " from oxobject2group left join $sUserTable on $sUserTable.oxid = oxobject2group.oxobjectid ";
00056                 $sQAdd .= " where oxobject2group.oxgroupsid = '$sId' ";
00057                 if (!$myConfig->getConfigParam( 'blMallUsers' ) )
00058                     $sQAdd .= " and $sUserTable.oxshopid = '".$myConfig->getShopId()."' ";
00059             } else {
00060                 $sQAdd  = " from oxobject2delivery left join $sUserTable on $sUserTable.oxid=oxobject2delivery.oxobjectid ";
00061                 $sQAdd .= " where oxobject2delivery.oxdeliveryid = '$sId' and oxobject2delivery.oxtype = 'oxuser' ";
00062             }
00063         }
00064 
00065         if ( $sSynchId && $sSynchId != $sId) {
00066             $sQAdd .= " and $sUserTable.oxid not in ( select $sUserTable.oxid from oxobject2delivery left join $sUserTable on $sUserTable.oxid=oxobject2delivery.oxobjectid ";
00067             $sQAdd .= " where oxobject2delivery.oxdeliveryid = '$sSynchId' and oxobject2delivery.oxtype = 'oxuser' ) ";
00068         }
00069 
00070         return $sQAdd;
00071     }
00072 
00078     public function removeuserfromdel()
00079     {
00080         $aRemoveGroups = $this->_getActionIds( 'oxobject2delivery.oxid' );
00081         if ( oxConfig::getParameter( 'all' ) ) {
00082 
00083             $sQ = $this->_addFilter( "delete oxobject2delivery.* ".$this->_getQuery() );
00084             oxDb::getDb()->Execute( $sQ );
00085 
00086         } elseif ( $aRemoveGroups && is_array( $aRemoveGroups ) ) {
00087             $sQ = "delete from oxobject2delivery where oxobject2delivery.oxid in ('" . implode( "', '", $aRemoveGroups ) . "') ";
00088             oxDb::getDb()->Execute( $sQ );
00089         }
00090     }
00091 
00097     public function addusertodel()
00098     {
00099         $aChosenUsr = $this->_getActionIds( 'oxuser.oxid' );
00100         $soxId      = oxConfig::getParameter( 'synchoxid' );
00101 
00102         // adding
00103         if ( oxConfig::getParameter( 'all' ) ) {
00104             $sUserTable = getViewName('oxuser');
00105             $aChosenUsr = $this->_getAll( $this->_addFilter( "select $sUserTable.oxid ".$this->_getQuery() ) );
00106         }
00107 
00108         if ( $soxId && $soxId != "-1" && is_array( $aChosenUsr ) ) {
00109             foreach ( $aChosenUsr as $sChosenUsr) {
00110                 $oObject2Delivery = oxNew( 'oxbase' );
00111                 $oObject2Delivery->init( 'oxobject2delivery' );
00112                 $oObject2Delivery->oxobject2delivery__oxdeliveryid = new oxField($soxId);
00113                 $oObject2Delivery->oxobject2delivery__oxobjectid   = new oxField($sChosenUsr);
00114                 $oObject2Delivery->oxobject2delivery__oxtype       = new oxField('oxuser');
00115                 $oObject2Delivery->save();
00116             }
00117         }
00118     }
00119 }

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