/** * main action */ public function mainAction() { /** * initialise groups */ require_once 'models/client/client_group.php'; $ClientGroup = new client_group(); /** * Read data */ if (isset($_POST['customer-filter'])) { $customer_filter = $_POST['customer-filter']; } else { if (is_array($_SESSION['bo']['customer-filter'])) { $customer_filter = $_SESSION['bo']['customer-filter']; } else { $customer_filter = false; } } // default values if (!is_array($customer_filter)) { $customer_filter = array(); $customer_filter['invoice_status'] = 0; $customer_filter['account_type'] = -1; } //HACK: save selected group for use in filter update $_SESSION['bo']['customer-filter-selected_group_id'] = $customer_filter['group_id']; /** * list groups */ $list = $ClientGroup->listGroups(); foreach ($list as $item) { $this->tpl->assign('ITEM', $item); if ($item['id'] == $customer_filter['group_id']) { $this->tpl->assign('SELECTED', 'selected="selected"'); } else { $this->tpl->assign('SELECTED', ''); } $this->tpl->parse('content.item'); } // dropdowns $this->tpl->assign("SELECTED_group_{$customer_filter['group_id']}", 'selected="selected"'); $this->tpl->assign("SELECTED_account_type_{$customer_filter['account_type']}", 'selected="selected"'); // checkboxes if (is_numeric($customer_filter['backoffice_role_only']) && $customer_filter['backoffice_role_only'] == 1) { $this->tpl->assign('CHECKED_backoffice_role_only', 'checked="checked"'); } /** * save to the SESSION */ $_SESSION['bo']['customer-filter'] = $customer_filter; return true; }
/** * main action */ public function mainAction() { /** * initialise groups */ require_once 'models/client/client_group.php'; $ClientGroup = new client_group(); /** * Store submited data to the SESSION */ if (isset($_POST['customer-filter'])) { $_SESSION['bo']['customer-filter'] = $_POST['customer-filter']; } if (!is_array($_SESSION['bo']['customer-filter'])) { $_SESSION['bo']['customer-filter'] = array(); $_SESSION['bo']['customer-filter']['invoice_status'] = 0; $_SESSION['bo']['customer-filter']['account_type'] = -1; } //save selected group for use in filter update $_SESSION['bo']['customer-filter-selected_group_id'] = $_SESSION['bo']['customer-filter']['group_id']; /** * list groups */ $list = $ClientGroup->listGroups(); //select boxes $this->tpl->assign("SELECTED_group_{$_SESSION['bo']['customer-filter']['group_id']}", 'selected="selected"'); $this->tpl->assign("SELECTED_account_type_{$_SESSION['bo']['customer-filter']['account_type']}", 'selected="selected"'); foreach ($list as $item) { $this->tpl->assign('ITEM', $item); if ($item['id'] == $_SESSION['bo']['customer-filter']['group_id']) { $this->tpl->assign('SELECTED', 'selected="selected"'); } else { $this->tpl->assign('SELECTED', ''); } $this->tpl->parse('content.item'); } return true; }
/** * renderDisplayPersmissionGroupAcl */ public function renderDisplayPersmissionGroupAcl($node_data) { require_once 'models/client/client_group.php'; $ClientGroup = new client_group(); $client_group_list = $ClientGroup->listGroups(); if (count($client_group_list) > 0) { foreach ($client_group_list as $item) { //selected option for each group $selected = array(); if (is_array($node_data['display_permission_group_acl'])) { $item_value = $node_data['display_permission_group_acl'][$item['id']]; $selected['item_' . $item_value] = 'selected="selected"'; } else { $selected['item_-1'] = 'selected="selected"'; } $this->tpl->assign("SELECTED", $selected); $this->tpl->assign('GROUP', $item); $this->tpl->parse('content.display_permission_group_acl.item'); } //selected option for Everyone $selected = array(); if (is_array($node_data['display_permission_group_acl'])) { $item_value = $node_data['display_permission_group_acl'][0]; $selected['item_' . $item_value] = 'selected="selected"'; } else { $selected['item_-1'] = 'selected="selected"'; } $this->tpl->assign("SELECTED", $selected); } else { $this->tpl->assign('DISABLE_EMPTY', 'disabled="disabled"'); $this->tpl->parse('content.display_permission_group_acl.empty'); } $this->tpl->parse('content.display_permission_group_acl'); }
/** * parseGroupCheckboxes */ protected function parseGroupCheckboxes($group_ids) { $ClientGroup = new client_group(); $list = $ClientGroup->listGroups(); foreach ($list as $item) { $this->tpl->assign('ITEM', $item); if (in_array($item['id'], $group_ids)) { $this->tpl->assign('CHECKED', 'checked="checked"'); } else { $this->tpl->assign('CHECKED', ''); } $this->tpl->parse('content.group.item'); } $this->tpl->parse('content.group'); }