Пример #1
0
 /**
  * Validate the form
  */
 protected function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         $this->frm->cleanupFields();
         // validation
         $fields = $this->frm->getFields();
         $fields['subject']->isFilled(BL::err('FieldIsRequired'));
         $fields['text']->isFilled(BL::err('FieldIsRequired'));
         $this->meta->validate();
         if ($this->frm->isCorrect()) {
             $item['meta_id'] = $this->meta->save();
             $item['subject'] = $fields['subject']->getValue();
             $item['text'] = $fields['text']->getValue();
             $item['hidden'] = $fields['hidden']->getValue();
             $item['language'] = BL::getWorkingLanguage();
             $item['template_id'] = $fields['template_id']->getValue();
             $item['show_on_website'] = $fields['show_on_website']->getValue();
             BackendMailengineModel::update($this->id, $item);
             $item['id'] = $this->id;
             BackendSearchModel::saveIndex($this->getModule(), $item['id'], array('title' => $item['subject'], 'text' => $item['text']));
             BackendModel::triggerEvent($this->getModule(), 'after_edit', $item);
             $this->redirect(BackendModel::createURLForAction('index') . '&report=edited&highlight=row-' . $item['id']);
         }
     }
 }