private function validateForm()
{
// is the form submitted?
if ($this->frm->isSubmitted()) {
// cleanup the submitted fields, ignore fields that were added by hackers
$this->frm->cleanupFields();
// validate fields
$this->frm->getField('synonym')->isFilled(BL::err('SynonymIsRequired'));
$this->frm->getField('term')->isFilled(BL::err('TermIsRequired'));
if (BackendSearchModel::existsSynonymByTerm($this->frm->getField('term')->getValue(), $this->id)) {
$this->frm->getField('term')->addError(BL::err('TermExists'));
}
// no errors?
if ($this->frm->isCorrect()) {
// build item
$item['id'] = $this->id;
$item['term'] = $this->frm->getField('term')->getValue();
$item['synonym'] = $this->frm->getField('synonym')->getValue();
$item['language'] = BL::getWorkingLanguage();
// update the item
BackendSearchModel::updateSynonym($item);
// trigger event
BackendModel::triggerEvent($this->getModule(), 'after_edit_synonym', array('item' => $item));
// everything is saved, so redirect to the overview
$this->redirect(BackendModel::createURLForAction('Synonyms') . '&report=edited-synonym&var=' . rawurlencode($item['term']) . '&highlight=row-' . $item['id']);
}
}
}