Exemplo n.º 1
0
 /**
  * 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);
     }
 }