OXID eShop CE  4.9.6
 All Classes Files Functions Variables Pages
discount_users.php
Go to the documentation of this file.
1 <?php
2 
10 {
11 
18  public function render()
19  {
21 
22  $soxId = $this->getEditObjectId();
23  $sSelGroup = oxRegistry::getConfig()->getRequestParameter("selgroup");
24 
25  // all usergroups
26  $oGroups = oxNew('oxlist');
27  $oGroups->init('oxgroups');
28  $oGroups->selectString("select * from " . getViewName("oxgroups", $this->_iEditLang));
29 
30  $oRoot = new stdClass();
31  $oRoot->oxgroups__oxid = new oxField("");
32  $oRoot->oxgroups__oxtitle = new oxField("-- ");
33  // rebuild list as we need the "no value" entry at the first position
34  $aNewList = array();
35  $aNewList[] = $oRoot;
36 
37  foreach ($oGroups as $val) {
38  $aNewList[$val->oxgroups__oxid->value] = new stdClass();
39  $aNewList[$val->oxgroups__oxid->value]->oxgroups__oxid = new oxField($val->oxgroups__oxid->value);
40  $aNewList[$val->oxgroups__oxid->value]->oxgroups__oxtitle = new oxField($val->oxgroups__oxtitle->value);
41  }
42 
43  $this->_aViewData["allgroups2"] = $aNewList;
44 
45  if (isset($soxId) && $soxId != "-") {
46  $oDiscount = oxNew("oxdiscount");
47  $oDiscount->load($soxId);
48 
49  if ($oDiscount->isDerived()) {
50  $this->_aViewData["readonly"] = true;
51  }
52  }
53 
54  $iAoc = oxRegistry::getConfig()->getRequestParameter("aoc");
55  if ($iAoc == 1) {
56  $oDiscountGroupsAjax = oxNew('discount_groups_ajax');
57  $this->_aViewData['oxajax'] = $oDiscountGroupsAjax->getColumns();
58 
59  return "popups/discount_groups.tpl";
60  } elseif ($iAoc == 2) {
61  $oDiscountUsersAjax = oxNew('discount_users_ajax');
62  $this->_aViewData['oxajax'] = $oDiscountUsersAjax->getColumns();
63 
64  return "popups/discount_users.tpl";
65  }
66 
67  return "discount_users.tpl";
68  }
69 }