Example #1
0
 /**
  * Method to render the view.
  *
  * @return  string  The rendered view.
  *
  * @since   12.1
  * @throws  RuntimeException
  */
 public function render()
 {
     $project = $this->model->getProject();
     $this->modelSubscription = new MonitorModelSubscription();
     $this->item = $project;
     $this->setLayout('default');
     if ($this->item) {
         $this->defaultTitle = $this->escape($this->item->name);
         $this->buttons['issues'] = array('url' => 'index.php?option=com_monitor&view=issues&project_id=' . $this->item->id, 'text' => 'COM_MONITOR_GO_TO_ISSUES', 'title' => 'COM_MONITOR_GO_TO_ISSUES', 'icon' => 'icon-chevron-right');
         $this->buttons['new-issue'] = array('url' => 'index.php?option=com_monitor&task=issue.edit&project_id=' . $this->item->id, 'text' => 'COM_MONITOR_CREATE_ISSUE', 'title' => 'COM_MONITOR_CREATE_ISSUE', 'icon' => 'icon-new');
         $user = JFactory::getUser();
         if ($this->params->get('enable_notifications', 1) && !$user->guest) {
             $subscribed = $this->modelSubscription->isSubscriberProject($this->item->id, $user->id);
             $task = $subscribed ? 'unsubscribe' : 'subscribe';
             $this->buttons['subscribe'] = array('url' => 'index.php?option=com_monitor&task=project.' . $task . '&id=' . $this->item->id, 'text' => $subscribed ? 'COM_MONITOR_UNSUBSCRIBE_PROJECT' : 'COM_MONITOR_SUBSCRIBE_PROJECT', 'title' => $subscribed ? 'COM_MONITOR_UNSUBSCRIBE_PROJECT_DESC' : 'COM_MONITOR_SUBSCRIBE_PROJECT_DESC', 'icon' => $subscribed ? 'icon-star' : 'icon-star-empty');
         }
     }
     return parent::render();
 }
Example #2
0
 /**
  * Method to render the view.
  *
  * @return  string  The rendered view.
  *
  * @since   12.1
  * @throws  RuntimeException
  */
 public function render()
 {
     $this->items = $this->model->getIssues();
     $this->filterForm = $this->model->getFilterForm();
     $this->defaultTitle = JText::_('COM_MONITOR_ISSUES');
     $this->setLayout('default');
     $projectId = $this->model->getProjectId();
     if ($projectId !== null) {
         $this->buttons['new-issue'] = array('url' => 'index.php?option=com_monitor&task=issue.edit&project_id=' . $projectId, 'text' => 'COM_MONITOR_CREATE_ISSUE', 'title' => 'COM_MONITOR_CREATE_ISSUE', 'icon' => 'icon-new');
         $user = JFactory::getUser();
         if (!$user->guest) {
             $this->modelSubscription = new MonitorModelSubscription();
             $this->modelNotifications = new MonitorModelNotifications();
             if ($this->params->get('enable_notifications', 1)) {
                 $subscribed = $this->modelSubscription->isSubscriberProject($projectId, $user->id);
                 $task = $subscribed ? 'unsubscribe' : 'subscribe';
                 $this->buttons['subscribe'] = array('url' => 'index.php?option=com_monitor&task=project.' . $task . '&id=' . $projectId . '&return=' . base64_encode(JUri::getInstance()->toString()), 'text' => $subscribed ? 'COM_MONITOR_UNSUBSCRIBE_PROJECT' : 'COM_MONITOR_SUBSCRIBE_PROJECT', 'title' => $subscribed ? 'COM_MONITOR_UNSUBSCRIBE_PROJECT_DESC' : 'COM_MONITOR_SUBSCRIBE_PROJECT_DESC', 'icon' => $subscribed ? 'icon-star' : 'icon-star-empty');
             }
             $this->buttons['all-read'] = array('url' => 'index.php?option=com_monitor&task=project.read&id=' . $projectId, 'text' => 'COM_MONITOR_PROJECT_MARK_ALL_READ', 'title' => 'COM_MONITOR_PROJECT_MARK_ALL_READ_DESC', 'icon' => 'icon-eye');
         }
     }
     return parent::render();
 }
Example #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()
 {
     $id = $this->input->getInt('id');
     $user = JFactory::getUser();
     if ($user->guest) {
         $this->app->enqueueMessage(JText::_('JGLOBAL_YOU_MUST_LOGIN_FIRST'), 'error');
     } else {
         $model = new MonitorModelSubscription();
         if (!$model->isSubscriberProject($id, $user->id)) {
             $model->subscribeProject($id, $user->id);
             $this->app->enqueueMessage(JText::_('COM_MONITOR_SUBSCRIPTION_PROJECT'), 'message');
         }
     }
     $return = base64_decode($this->app->input->get('return', '', 'BASE64'));
     if (!JUri::isInternal($return)) {
         $return = 'index.php?option=com_monitor&view=project&id=' . $id;
     }
     $this->app->redirect(JRoute::_($return, false));
 }