/** * Load the form */ protected function loadForm() { $groupCheckboxes = array(); // set hidden values $rbtActiveValues = array(); $rbtActiveValues[] = array('label' => ucfirst(BL::lbl('Active')), 'value' => 'Y'); $rbtActiveValues[] = array('label' => ucfirst(BL::lbl('NotActive')), 'value' => 'N'); // create form $this->frm = new BackendForm('edit'); $this->frm->addText('name', $this->record['name']); $this->frm->addText('email', $this->record['email']); $this->frm->addRadiobutton('active', $rbtActiveValues, $this->record['active']); //--Get all the groups $groups = BackendMailengineModel::getAllGroups(); //--Check if there are groups if (!empty($groups)) { //--Loop all the users foreach ($groups as $key => &$group) { $groupCheckboxes[] = array("label" => $group["title"], "value" => $group["id"]); } //--Get the users from the group $groupsUser = BackendMailengineModel::getGroupsForUser($this->id); //--Create a selected-array $groupCheckboxesSelected = count($groupsUser) > 0 ? array_keys($groupsUser) : null; //--Add multicheckboxes to form $this->frm->addMultiCheckbox("groups", $groupCheckboxes, $groupCheckboxesSelected); } }
/** * Load the form */ protected function loadForm() { $this->frm = new BackendForm('add'); $this->frm->addText('name'); $this->frm->addText('email'); //--Get all the users $groups = BackendMailengineModel::getAllGroups(); //--Check if there are groups if (!empty($groups)) { //--Loop all the group foreach ($groups as $key => &$group) { $groupCheckboxes[] = array("label" => $group["title"], "value" => $group["id"]); } //--Add multicheckboxes to form $this->frm->addMultiCheckbox("groups", $groupCheckboxes); } }
/** * Load the form */ private function loadForm() { //--Create form $this->frm = new BackendForm('import'); //--Create file $this->frm->addFile('csv'); //--Dropdown for languages $this->frm->addDropdown('languages', BL::getWorkingLanguages(), BL::getWorkingLanguage()); //--Get all the users $groups = BackendMailengineModel::getAllGroups(); //--Loop all the groups $groupCheckboxes = array(); foreach ($groups as &$group) { $groupCheckboxes[] = array("label" => $group["title"], "value" => $group["id"]); } //--Add multicheckboxes to form $this->frm->addMultiCheckbox("groups", $groupCheckboxes); $this->frm->parse($this->tpl); }