/** * redirect to events page */ function back() { $this->setRedirect(JRoute::_(JEMHelperRoute::getMyEventsRoute(), false)); $this->redirect(); }
/** * Logic to trash events * * @access public * @return void */ function trash() { $cid = $input->get('cid', array(), 'post', 'array'); JArrayHelper::toInteger($cid); if (empty($cid)) { $this->setRedirect(JEMHelperRoute::getMyEventsRoute(), JText::_('COM_JEM_SELECT_ITEM_TO_TRASH'), 'warning'); return; } $model = $this->getModel('myevents'); if (!$model->publish($cid, -2)) { $msg = $model->getError(); $this->setRedirect(JEMHelperRoute::getMyEventsRoute(), $msg); return; } $total = count($cid); $msg = $total . ' ' . JText::_('COM_JEM_EVENT_TRASHED'); $this->setRedirect(JEMHelperRoute::getMyEventsRoute(), $msg); }
/** * Logic to trash events * * @access public * @return void */ function trash() { // Check for request forgeries JSession::checkToken() or jexit('Invalid Token'); $app = JFactory::getApplication(); $input = $app->input; $cid = $input->get('cid', array(), 'array'); if (empty($cid)) { JError::raiseNotice(100, JText::_('COM_JEM_SELECT_ITEM_TO_TRASH')); $this->setRedirect(JEMHelperRoute::getMyEventsRoute()); return; } $model = $this->getModel('myevents'); if (!$model->publish($cid, -2)) { echo "<script> alert('".$model->getError()."'); window.history.go(-1); </script>\n"; } $total = count($cid); $msg = $total.' '.JText::_('COM_JEM_EVENT_TRASHED'); $this->setRedirect(JEMHelperRoute::getMyEventsRoute(), $msg); }