payment_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                     );
00014 
00018 class ajaxComponent extends ajaxListComponent
00019 {
00025     protected function _getQuery()
00026     {
00027         // looking for table/view
00028         $sGroupTable   = $this->_getViewName('oxgroups');
00029         $sGroupId      = oxConfig::getParameter( 'oxid' );
00030         $sSynchGroupId = oxConfig::getParameter( 'synchoxid' );
00031         $oDb = oxDb::getDb();
00032 
00033         // category selected or not ?
00034         if ( !$sGroupId)
00035             $sQAdd  = " from $sGroupTable ";
00036         else {
00037             $sQAdd  = " from $sGroupTable, oxobject2group where ";
00038             $sQAdd .= " oxobject2group.oxobjectid = ".$oDb->quote( $sGroupId )." and oxobject2group.oxgroupsid = $sGroupTable.oxid ";
00039         }
00040 
00041         if ( !$sSynchGroupId )
00042             $sSynchGroupId = oxConfig::getParameter('oxajax_synchfid');
00043         if ( $sSynchGroupId && $sSynchGroupId != $sGroupId) {
00044             if ( !$sGroupId )
00045                 $sQAdd .= 'where ';
00046             else
00047                 $sQAdd .= 'and ';
00048             $sQAdd .= " $sGroupTable.oxid not in ( select $sGroupTable.oxid from $sGroupTable, oxobject2group where ";
00049             $sQAdd .= " oxobject2group.oxobjectid = ".$oDb->quote( $sSynchGroupId )." and oxobject2group.oxgroupsid = $sGroupTable.oxid ) ";
00050         }
00051 
00052         return $sQAdd;
00053     }
00054 
00060     public function removepaygroup()
00061     {
00062         $aRemoveGroups = $this->_getActionIds( 'oxobject2group.oxid' );
00063         if ( oxConfig::getParameter( 'all' ) ) {
00064 
00065             $sQ = $this->_addFilter( "delete oxobject2group.* ".$this->_getQuery() );
00066             oxDb::getDb()->Execute( $sQ );
00067 
00068         } elseif ( $aRemoveGroups && is_array( $aRemoveGroups ) ) {
00069             $sQ = "delete from oxobject2group where oxobject2group.oxid in (" . implode( ", ", oxDb::getInstance()->quoteArray( $aRemoveGroups ) ) . ") ";
00070             oxDb::getDb()->Execute( $sQ );
00071         }
00072     }
00073 
00079     public function addpaygroup()
00080     {
00081         $aAddGroups = $this->_getActionIds( 'oxgroups.oxid' );
00082         $soxId      = oxConfig::getParameter( 'synchoxid');
00083 
00084         if ( oxConfig::getParameter( 'all' ) ) {
00085             $sGroupTable   = $this->_getViewName('oxgroups');
00086             $aAddGroups = $this->_getAll( $this->_addFilter( "select $sGroupTable.oxid ".$this->_getQuery() ) );
00087         }
00088         if ( $soxId && $soxId != "-1" && is_array( $aAddGroups ) ) {
00089             foreach ($aAddGroups as $sAddgroup) {
00090                 $oNewGroup = oxNew( "oxobject2group" );
00091                 $oNewGroup->oxobject2group__oxobjectid = new oxField($soxId);
00092                 $oNewGroup->oxobject2group__oxgroupsid = new oxField($sAddgroup);
00093                 $oNewGroup->save();
00094             }
00095         }
00096     }
00097 }