discount_users.php

Go to the documentation of this file.
00001 <?php
00002 
00009 class Discount_Users extends oxAdminDetails
00010 {
00017     public function render()
00018     {
00019         parent::render();
00020 
00021         $soxId = $this->getEditObjectId();
00022         $sSelGroup = oxConfig::getParameter( "selgroup");
00023 
00024         // all usergroups
00025         $oGroups = oxNew( 'oxlist' );
00026         $oGroups->init( 'oxgroups' );
00027         $oGroups->selectString( "select * from ".getViewName( "oxgroups", $this->_iEditLang ) );
00028 
00029         $oRoot = new stdClass();
00030         $oRoot->oxgroups__oxid    = new oxField("");
00031         $oRoot->oxgroups__oxtitle = new oxField("-- ");
00032         // rebuild list as we need the "no value" entry at the first position
00033         $aNewList = array();
00034         $aNewList[] = $oRoot;
00035 
00036         foreach ( $oGroups as $val ) {
00037             $aNewList[$val->oxgroups__oxid->value] = new stdClass();
00038             $aNewList[$val->oxgroups__oxid->value]->oxgroups__oxid    = new oxField($val->oxgroups__oxid->value);
00039             $aNewList[$val->oxgroups__oxid->value]->oxgroups__oxtitle = new oxField($val->oxgroups__oxtitle->value);
00040         }
00041 
00042         $this->_aViewData["allgroups2"] = $aNewList;
00043 
00044         if ( isset($soxId) && $soxId != "-") {
00045             $oDiscount = oxNew( "oxdiscount" );
00046             $oDiscount->load( $soxId);
00047 
00048             if ($oDiscount->isDerived())
00049                 $this->_aViewData["readonly"] =  true;
00050         }
00051 
00052         $iAoc = oxConfig::getParameter("aoc");
00053         if ( $iAoc == 1 ) {
00054             $oDiscountGroupsAjax = oxNew( 'discount_groups_ajax' );
00055             $this->_aViewData['oxajax'] = $oDiscountGroupsAjax->getColumns();
00056 
00057             return "popups/discount_groups.tpl";
00058         } elseif ( $iAoc == 2 ) {
00059             $oDiscountUsersAjax = oxNew( 'discount_users_ajax' );
00060             $this->_aViewData['oxajax'] = $oDiscountUsersAjax->getColumns();
00061 
00062             return "popups/discount_users.tpl";
00063         }
00064 
00065         return "discount_users.tpl";
00066     }
00067 }