user_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',  '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',     'oxobject2group', 0, 0, 1 ),
00012                                         )
00013                     );
00017 class ajaxComponent extends ajaxListComponent
00018 {
00024     protected function _getQuery()
00025     {
00026         // looking for table/view
00027         $sGroupTable = getViewName('oxgroups');
00028 
00029         $sDeldId     = oxConfig::getParameter( 'oxid' );
00030         $sSynchDelId = oxConfig::getParameter( 'synchoxid' );
00031 
00032         // category selected or not ?
00033         if ( !$sDeldId) {
00034             $sQAdd  = " from $sGroupTable where 1 ";
00035         } else {
00036             $sQAdd  = " from $sGroupTable left join oxobject2group on oxobject2group.oxgroupsid=$sGroupTable.oxid ";
00037             $sQAdd .= " where oxobject2group.oxobjectid = '$sDeldId' ";
00038         }
00039 
00040         if ( $sSynchDelId && $sSynchDelId != $sDeldId) {
00041             $sQAdd .= " and $sGroupTable.oxid not in ( select $sGroupTable.oxid from $sGroupTable left join oxobject2group on oxobject2group.oxgroupsid=$sGroupTable.oxid ";
00042             $sQAdd .= " where oxobject2group.oxobjectid = '$sSynchDelId' ) ";
00043         }
00044 
00045         return $sQAdd;
00046     }
00047 
00053     public function removeuserfromgroup()
00054     {
00055         $aRemoveGroups = $this->_getActionIds( 'oxobject2group.oxid' );
00056         if ( oxConfig::getParameter( 'all' ) ) {
00057 
00058             $sQ = $this->_addFilter( "delete oxobject2group.* ".$this->_getQuery() );
00059             oxDb::getDb()->Execute( $sQ );
00060 
00061         } elseif ( $aRemoveGroups && is_array( $aRemoveGroups ) ) {
00062             $sQ = "delete from oxobject2group where oxobject2group.oxid in ('" . implode( "', '", $aRemoveGroups ) . "') ";
00063             oxDb::getDb()->Execute( $sQ );
00064         }
00065     }
00066 
00072     public function addusertogroup()
00073     {
00074         $aAddGroups = $this->_getActionIds( 'oxgroups.oxid' );
00075         $soxId      = oxConfig::getParameter( 'synchoxid');
00076 
00077         if ( oxConfig::getParameter( 'all' ) ) {
00078             $sGroupTable = getViewName('oxgroups');
00079             $aAddGroups = $this->_getAll( $this->_addFilter( "select $sGroupTable.oxid ".$this->_getQuery() ) );
00080         }
00081         if ( $soxId && $soxId != "-1" && is_array( $aAddGroups ) ) {
00082             foreach ($aAddGroups as $sAddgroup) {
00083                 $oNewGroup = oxNew( "oxobject2group" );
00084                 $oNewGroup->oxobject2group__oxobjectid = new oxField($soxId);
00085                 $oNewGroup->oxobject2group__oxgroupsid = new oxField($sAddgroup);
00086                 $oNewGroup->save();
00087             }
00088         }
00089     }
00090 }

Generated on Thu Dec 4 12:04:55 2008 for OXID eShop CE by  doxygen 1.5.5