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