Go to the documentation of this file.00001 <?php
00002
00003 $aColumns = array( 'container1' => array(
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
00028 $sGroupTable = getViewName('oxgroups');
00029 $sGroupId = oxConfig::getParameter( 'oxid' );
00030 $sSynchGroupId = oxConfig::getParameter( 'synchoxid' );
00031
00032
00033 if ( !$sGroupId)
00034 $sQAdd = " from $sGroupTable ";
00035 else {
00036 $sQAdd = " from $sGroupTable, oxobject2group where ";
00037 $sQAdd .= " oxobject2group.oxobjectid = '$sGroupId' and oxobject2group.oxgroupsid = $sGroupTable.oxid ";
00038 }
00039
00040 if ( !$sSynchGroupId )
00041 $sSynchGroupId = oxConfig::getParameter('oxajax_synchfid');
00042 if ( $sSynchGroupId && $sSynchGroupId != $sGroupId) {
00043 if ( !$sGroupId )
00044 $sQAdd .= 'where ';
00045 else
00046 $sQAdd .= 'and ';
00047 $sQAdd .= " $sGroupTable.oxid not in ( select $sGroupTable.oxid from $sGroupTable, oxobject2group where ";
00048 $sQAdd .= " oxobject2group.oxobjectid = '$sSynchGroupId' and oxobject2group.oxgroupsid = $sGroupTable.oxid ) ";
00049 }
00050
00051 return $sQAdd;
00052 }
00053
00059 public function removepaygroup()
00060 {
00061 $aRemoveGroups = $this->_getActionIds( 'oxobject2group.oxid' );
00062 if ( oxConfig::getParameter( 'all' ) ) {
00063
00064 $sQ = $this->_addFilter( "delete oxobject2group.* ".$this->_getQuery() );
00065 oxDb::getDb()->Execute( $sQ );
00066
00067 } elseif ( $aRemoveGroups && is_array( $aRemoveGroups ) ) {
00068 $sQ = "delete from oxobject2group where oxobject2group.oxid in (" . implode( ", ", oxDb::getInstance()->quoteArray( $aRemoveGroups ) ) . ") ";
00069 oxDb::getDb()->Execute( $sQ );
00070 }
00071 }
00072
00078 public function addpaygroup()
00079 {
00080 $aAddGroups = $this->_getActionIds( 'oxgroups.oxid' );
00081 $soxId = oxConfig::getParameter( 'synchoxid');
00082
00083 if ( oxConfig::getParameter( 'all' ) ) {
00084 $sGroupTable = getViewName('oxgroups');
00085 $aAddGroups = $this->_getAll( $this->_addFilter( "select $sGroupTable.oxid ".$this->_getQuery() ) );
00086 }
00087 if ( $soxId && $soxId != "-1" && is_array( $aAddGroups ) ) {
00088 foreach ($aAddGroups as $sAddgroup) {
00089 $oNewGroup = oxNew( "oxobject2group" );
00090 $oNewGroup->oxobject2group__oxobjectid = new oxField($soxId);
00091 $oNewGroup->oxobject2group__oxgroupsid = new oxField($sAddgroup);
00092 $oNewGroup->save();
00093 }
00094 }
00095 }
00096 }