/** * Load the form * * @return void */ private function loadForm() { // create form $this->frm = new BackendForm('add'); // fetch the campaigns $campaigns = BackendMailmotorModel::getCampaignsAsPairs(); // fetch the groups $groupIds = BackendMailmotorModel::getGroupIDs(); $groups = BackendMailmotorModel::getGroupsWithRecipientsForCheckboxes(); // no groups were made yet if (empty($groups) && empty($groupIds)) { $this->redirect(BackendModel::createURLForAction('add_group') . '&error=add-mailing-no-groups'); } elseif (empty($groups)) { $this->redirect(BackendModel::createURLForAction('addresses') . '&error=no-subscribers'); } // fetch the languages $languages = BackendMailmotorModel::getLanguagesForCheckboxes(); // settings $this->frm->addText('name'); if (count($campaigns) > 1) { $this->frm->addDropdown('campaign', $campaigns); } // sender $this->frm->addText('from_name', BackendModel::getModuleSetting($this->getModule(), 'from_name')); $this->frm->addText('from_email', BackendModel::getModuleSetting($this->getModule(), 'from_email')); // reply-to address $this->frm->addText('reply_to_email', BackendModel::getModuleSetting($this->getModule(), 'reply_to_email')); // groups - if there is only 1 group present, we select it by default $this->frm->addMultiCheckbox('groups', $groups, count($groups) == 1 && isset($groups[0]) ? $groups[0]['value'] : false); // languages $this->frm->addRadiobutton('languages', $languages, BL::getWorkingLanguage()); }
/** * Load the form for step 1 * * @return void */ private function loadFormForStep1() { // create form $this->frm = new BackendForm('step1'); // fetch the campaigns $campaigns = BackendMailmotorModel::getCampaignsAsPairs(); // fetch the groups $groups = BackendMailmotorModel::getGroupsWithRecipientsForCheckboxes(); // fetch the languages $languages = BackendMailmotorModel::getLanguagesForCheckboxes(); // settings $this->frm->addText('name', $this->record['name']); if (count($campaigns) > 1) { $this->frm->addDropdown('campaign', $campaigns, $this->record['campaign_id']); } // sender $this->frm->addText('from_name', $this->record['from_name']); $this->frm->addText('from_email', $this->record['from_email']); // reply-to address $this->frm->addText('reply_to_email', $this->record['reply_to_email']); // groups $this->frm->addMultiCheckbox('groups', $groups, $this->record['groups']); // languages $this->frm->addRadiobutton('languages', $languages, $this->record['language']); // show the form $this->tpl->assign('step1', true); }