예제 #1
0
 /**
  * Execute the controller.
  *
  * @return  boolean  True if controller finished execution, false if the controller did not
  *                   finish execution. A controller might return false if some precondition for
  *                   the controller to run has not been satisfied.
  *
  * @since   12.1
  * @throws  LogicException
  * @throws  RuntimeException
  */
 public function execute()
 {
     $model = new MonitorModelIssue();
     $id = $this->input->getInt('id');
     $user = JFactory::getUser();
     // Get the params
     // TODO: may be removed when new MVC is implemented completely
     $this->app = JFactory::getApplication();
     if ($this->app instanceof JApplicationSite) {
         $params = $this->app->getParams();
     }
     if (!$model->canEdit($user, $id)) {
         if ($user->guest && isset($params) && $params->get('redirect_login', 1)) {
             $this->app->enqueueMessage(JText::_('JGLOBAL_YOU_MUST_LOGIN_FIRST'), 'error');
             $this->app->redirect(JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode(JUri::getInstance()->toString()), '403'));
         } else {
             throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403);
         }
     }
     if ($id) {
         $model->setIssueId($id);
     }
     $model->loadForm();
     $view = new MonitorViewIssueHtml($model);
     $view->setLayout('edit');
     $view->loadForm();
     echo $view->render();
     return true;
 }
예제 #2
0
 /**
  * Execute the controller, instantiate model and view and display the issue.
  *
  * @return  boolean  True if controller finished execution.
  */
 public function execute()
 {
     $issueId = $this->input->getInt('id');
     $user = JFactory::getUser();
     $model = new MonitorModelIssue();
     $model->setIssueId($issueId);
     $modelComment = new MonitorModelComment();
     $modelSubscriptions = new MonitorModelSubscription();
     $view = new MonitorViewIssueHtml($model, null, $modelComment, $modelSubscriptions);
     echo $view->render();
     if (!$user->guest) {
         $modelNotifications = new MonitorModelNotifications();
         $modelNotifications->markRead($issueId, $user->id);
     }
 }
예제 #3
0
 /**
  * Execute the controller.
  *
  * @return  boolean  True if controller finished execution, false if the controller did not
  *                   finish execution. A controller might return false if some precondition for
  *                   the controller to run has not been satisfied.
  *
  * @since   12.1
  * @throws  LogicException
  * @throws  RuntimeException
  */
 public function execute()
 {
     $model = new MonitorModelIssue();
     $cid = $this->input->get('cid', array(), 'array');
     $id = $cid ? $cid[0] : $this->input->getInt('id');
     if (!$model->canEdit(JFactory::getUser(), $id)) {
         throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403);
     }
     $model->setIssueId($id);
     $model->loadForm();
     $view = new MonitorViewIssueHtml($model);
     $view->setLayout('edit');
     echo $view->render();
     return true;
 }