Example #1
0
 /**
  * Load the form for step 2
  */
 private function loadFormForStep2()
 {
     // create form
     $this->frm = new BackendForm('step2');
     // fetch the templates
     $templates = BackendMailmotorModel::getTemplatesForCheckboxes($this->record['language']);
     // no templates found
     if (empty($templates)) {
         $this->redirect(BackendModel::createURLForAction('Edit') . '&id=' . $this->id . '&step=1&error=no-templates');
     }
     // loop the templates
     foreach ($templates as &$record) {
         // reformat custom variables
         $record['variables'] = array('language' => $record['language']);
         // set selected template
         if ($record['value'] == $this->record['template']) {
             $record['variables']['selected'] = true;
         }
         // unset the language field
         unset($record['language']);
     }
     // templates
     $this->frm->addRadiobutton('templates', $templates, !empty($this->record['template']) ? $this->record['template'] : null);
     // show the form
     $this->tpl->assign('step2', true);
 }