Exemple #1
0
 /**
  * Load the form
  */
 protected function loadForm()
 {
     //--Create form
     $this->frm = new BackendForm("send_preview");
     //--Get the groups
     $groups = BackendMailengineModel::getAllGroupsForDropdown(true);
     if (empty($groups)) {
         \SpoonHTTP::redirect(BackendModel::createURLForAction('index', $this->module) . "&id=" . $this->id . "&error=GroupsNeededToSendMailing");
     }
     //--Loop all the users
     foreach ($groups as $key => $value) {
         $groupCheckboxes[] = array("label" => $value, "value" => $key);
     }
     //--Add multicheckboxes to form
     $this->frm->addMultiCheckbox("groups", $groupCheckboxes, null);
     $this->frm->addDate('start_date');
     $this->frm->addTime('start_time', null, 'inputText time');
     if (BackendModel::isModuleInstalled('profiles')) {
         $profiles = BackendMailengineModel::getAllProfiles();
         $profileGroups = BackendMailengineModel::getAllProfileGroupsForDropdown(true);
         $profileGroupCheckboxes = array();
         $this->tpl->assign("profilesCount", count($profiles));
         //--Loop all the users
         foreach ($profileGroups as $key => $value) {
             $profileGroupCheckboxes[] = array("label" => $value, "value" => $key);
         }
         if (!empty($profileGroups)) {
             $this->frm->addMultiCheckbox("profile_groups", $profileGroupCheckboxes, null);
         }
         $this->frm->addCheckbox("profiles_all");
     }
     //--Create review form
     $this->frm_review = new BackendForm("send_review");
     //--Add hidden field as dummy
     $this->frm_review->addHidden("profiles_all");
     $this->frm_review->addHidden("profile_groups");
     $this->frm_review->addHidden("groups");
     $this->frm_review->addDate("start_date");
     $this->frm_review->addTime("start_time");
 }