Ejemplo n.º 1
0
 /**
  * Forces event_id in all redirections
  *
  * Registers a redirection with an optional message. The redirection is
  * carried out when you use the redirect method.
  *
  * @param   string  $url   The URL to redirect to
  * @param   string  $msg   The message to be pushed to the application
  * @param   string  $type  The message type to be pushed to the application, e.g. 'error'
  *
  * @return  JController  This object to support chaining
  */
 public function setRedirect($url, $msg = null, $type = null)
 {
     $uri = JURI::getInstance($url);
     $id = $this->input->getInt('event_id', 0);
     if (!$id) {
         $formData = $this->input->get('jform', array(), 'array');
         if (!isset($formData['event_id']) || !$formData['event_id']) {
             throw new RuntimeException('event_id is required', 500);
         }
     }
     $uri->setVar('event_id', $id);
     $url = $uri->toString();
     return parent::setRedirect($url, $msg, $type);
 }