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 = oxConfig::getParameter( "oxid");
00022         $sSelGroup = oxConfig::getParameter( "selgroup");
00023 
00024         // all usergroups
00025         $oGroups = oxNew( 'oxlist' );
00026         $oGroups->init( 'oxgroups' );
00027         $oGroups->selectString( 'select * from oxgroups' );
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 Oxstdclass();
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         $aColumns = array();
00053         $iAoc = oxConfig::getParameter("aoc");
00054         if ( $iAoc == 1 ) {
00055 
00056             include_once 'inc/discount_groups.inc.php';
00057             $this->_aViewData['oxajax'] = $aColumns;
00058 
00059             return "popups/discount_groups.tpl";
00060         } elseif ( $iAoc == 2 ) {
00061 
00062             include_once 'inc/discount_users.inc.php';
00063             $this->_aViewData['oxajax'] = $aColumns;
00064 
00065             return "popups/discount_users.tpl";
00066         }
00067 
00068         return "discount_users.tpl";
00069     }
00070 }