/** * Saves the vent * * @return bool|object */ public function saveEvent() { // Check authorization if (!JFactory::getUser()->authorise('core.edit', 'com_matukio')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } $msg = JText::_('COM_MATUKIO_EVENT_SAVE'); $res = MatukioHelperUtilsEvents::saveEvent(true); $fehler = $res->error; $link = JRoute::_("index.php?option=com_matukio&art=2"); $link2 = JRoute::_("index.php?option=com_matukio&view=createevent&cid=" . $res->id); if (!empty($fehler)) { $tempmsg = implode(",", $fehler); // Hack for dirks empty array $tempmsg = str_replace(",", "", $tempmsg); if (!empty($tempmsg)) { $msg = implode(",", $fehler); } } // Ausgabe der Kurse $fehlerzahl = array_unique($fehler); if (MatukioHelperUtilsEvents::checkRequiredFieldValues($res->event->pattern, 'leer')) { $this->setRedirect($link2, $msg); } elseif (count($fehlerzahl) > 1 and $res->saved == true) { $link = JRoute::_("index.php?option=com_matukio&view=eventlist&art=2", $msg); } else { $link = JRoute::_("index.php?option=com_matukio&view=eventlist&art=2", $msg); } $this->setRedirect($link, $msg); }
/** * Saves the event * * @throws exception - if query fails * @return void */ public function save() { $res = MatukioHelperUtilsEvents::saveEvent(); $id = $res->id; // Ausgabe der Kurse switch ($this->task) { case 'apply': $msg = JText::_('COM_MATUKIO_EVENT_APPLY'); $link = 'index.php?option=com_matukio&controller=eventlist&task=editEvent&id=' . $id; break; case 'save': default: $msg = JText::_('COM_MATUKIO_EVENT_SAVE'); $link = 'index.php?option=com_matukio&view=eventlist'; break; } $this->setRedirect($link, $msg); }