Example #1
0
 /**
  * Load the form
  */
 protected function loadForm()
 {
     $userCheckboxes = array();
     // create form
     $this->frm = new BackendForm('edit');
     $this->frm->addText('title', $this->record['title']);
     //--Get all the users
     $users = BackendMailengineModel::getAllUsers();
     //--Check if there are users
     if (!empty($users)) {
         //--Loop all the users
         foreach ($users as $key => &$user) {
             $userCheckboxes[] = array("label" => $user["email"], "value" => $user["id"]);
         }
         //--Get the users from the group
         $usersGroup = BackendMailengineModel::getUsersForGroup($this->id);
         //--Create a selected-array
         $userCheckboxesSelected = count($usersGroup) > 0 ? array_keys($usersGroup) : null;
         //--Add multicheckboxes to form
         $this->frm->addMultiCheckbox("users", $userCheckboxes, $userCheckboxesSelected);
     }
 }