discount_users.php

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