/** * Validate the form * * @return void */ 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('title')->isFilled(BL::err('TitleIsRequired')); // no errors? if ($this->frm->isCorrect()) { // build album array $album['language'] = BL::getWorkingLanguage(); $album['meta_id'] = $this->meta->save(); $album['title'] = (string) $this->frm->getField('title')->getValue(); $album['sequence'] = (int) BackendGalleriaModel::getMaximumAlbumSequence() + 1; $album['hidden'] = (string) $this->frm->getField('hidden')->getValue(); $album['show_in_overview'] = (string) $this->frm->getField('show_in_overview')->getValue(); $album['category_id'] = (int) $this->frm->getField('category')->getValue(); $album['publish_on'] = BackendModel::getUTCDate(); $album['description'] = (string) $this->frm->getField('description')->getValue(); // first, insert the album $album['id'] = BackendGalleriaModel::insertAlbum($album); // save the tags BackendTagsModel::saveTags($album['id'], $this->frm->getField('tags')->getValue(), $this->URL->getModule()); // trigger event BackendModel::triggerEvent($this->getModule(), 'after_add_album', array('item' => $album)); // everything is saved, so redirect to the overview $this->redirect(BackendModel::createURLForAction('albums') . '&report=added-album&var=' . urlencode($album['title']) . '&highlight=row-' . $album['id']); } } }