/** * Show the customer groups for editing * @return boolean True on success, false otherwise * @author Reto Kohli <*****@*****.**> */ function view_customer_groups() { global $_ARRAYLANG; if (isset($_GET['delete'])) { Discount::deleteCustomerGroup($_GET['id']); } if (isset($_POST['store'])) { Discount::storeCustomerGroup($_POST['groupName'], $_POST['id']); } Discount::flush(); self::$objTemplate->loadTemplateFile('module_shop_discount_groups_customer.html'); // Group overview $arrGroups = Discount::getCustomerGroupArray(); self::$objTemplate->setCurrentBlock('shopGroup'); $i = 0; foreach ($arrGroups as $id => $arrGroup) { self::$objTemplate->setVariable(array('SHOP_GROUP_ID' => $id, 'SHOP_GROUP_NAME' => $arrGroup['name'], 'SHOP_ROW_STYLE' => 'row' . (++$i % 2 + 1))); self::$objTemplate->parse('shopGroup'); } // Add/edit Group $id = 0; if (!empty($_GET['edit'])) { $id = intval($_GET['id']); self::$objTemplate->setGlobalVariable(array('SHOP_GROUP_EDIT_CLASS' => 'active', 'SHOP_GROUP_EDIT_DISPLAY' => 'block', 'SHOP_GROUP_LIST_CLASS' => '', 'SHOP_GROUP_LIST_DISPLAY' => 'none', 'TXT_ADD_OR_EDIT' => $_ARRAYLANG['TXT_EDIT'])); } else { self::$objTemplate->setGlobalVariable(array('SHOP_GROUP_EDIT_CLASS' => '', 'SHOP_GROUP_EDIT_DISPLAY' => 'none', 'SHOP_GROUP_LIST_CLASS' => 'active', 'SHOP_GROUP_LIST_DISPLAY' => 'block', 'TXT_ADD_OR_EDIT' => $_ARRAYLANG['TXT_ADD'])); } self::$objTemplate->setCurrentBlock('shopGroupName'); self::$objTemplate->setVariable(array('SHOP_GROUP_ID_EDIT' => $id, 'SHOP_ROW_STYLE' => 'row' . (++$i % 2 + 1))); if (isset($arrGroups[$id])) { self::$objTemplate->setVariable('SHOP_GROUP_NAME', $arrGroups[$id]['name']); } self::$objTemplate->parse('shopGroupName'); return true; }