/** * Method to render the view. * * @return string The rendered view. * * @since 12.1 * @throws RuntimeException */ public function render() { $this->prefix = 'issue'; $this->items = $this->model->getIssues(); $this->setLayout('default'); $this->addToolbar(); return parent::render(); }
/** * Method to get the field input markup. * * @return string The field input markup. * * @since 11.1 */ protected function getOptions() { $options = array(); JLoader::register('MonitorModelAbstract', JPATH_ROOT . '/administrator/components/com_monitor/model/abstract.php'); JLoader::register('MonitorModelIssue', JPATH_ROOT . '/administrator/components/com_monitor/model/issue.php'); $model = new MonitorModelIssue(null, false); $issues = $model->getIssues(); foreach ($issues as $issue) { $options[] = JHtml::_('select.option', $issue->id, $issue->title); } $options = array_merge(parent::getOptions(), $options); return $options; }
/** * 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(); }
/** * Event called after display of content. * * @param string $context The context of the content being passed to the plugin. * @param mixed &$item The item displayed. * @param mixed $params Additional parameters. * @param integer $page Optional page number. * * @return string Returned value from this event will be displayed after the content of the item. */ public function onContentAfterDisplay($context, &$item, $params, $page = 0) { $allowed_contexts = array('com_contact.contact'); if (!in_array($context, $allowed_contexts)) { return null; } // Check if the component is installed and enabled. if (!JComponentHelper::isEnabled('com_monitor')) { return null; } JLoader::register('MonitorHelper', JPATH_ROOT . '/administrator/components/com_monitor/helper/helper.php'); JLoader::register('MonitorModelAbstract', JPATH_ROOT . '/administrator/components/com_monitor/model/abstract.php'); JLoader::register('MonitorModelComment', JPATH_ROOT . '/administrator/components/com_monitor/model/comment.php'); JLoader::register('MonitorModelIssue', JPATH_ROOT . '/administrator/components/com_monitor/model/issue.php'); $modelIssue = new MonitorModelIssue(null, false); $modelComment = new MonitorModelComment(null, false); // Load language files from the component. $lang = JFactory::getLanguage(); $lang->load('com_monitor', JPATH_SITE . '/components/com_monitor'); $filters = array('author' => $item->user_id); $listIssues = array('fullordering' => 'i.created DESC', 'limit' => $this->params->get('limit_issues', 10)); $listComments = array('fullordering' => 'c.created DESC', 'limit' => $this->params->get('limit_comments', 10)); $comments = $modelComment->getComments($filters, $listComments); // Process the content plugins on comments. $dispatcher = JEventDispatcher::getInstance(); JPluginHelper::importPlugin('content'); if ($comments) { foreach ($comments as $comment) { $dispatcher->trigger('onContentPrepare', array('plg_monitorcontributions.comment', &$comment, &$this->params, 0)); } } $displayData = array('item' => $item); $displayData['issues'] = $modelIssue->getIssues($filters, $listIssues); $displayData['comments'] = $comments; $displayData['params'] = $this->params->merge(JComponentHelper::getParams('com_monitor')); return JLayoutHelper::render('contributions', $displayData, __DIR__ . '/layouts'); }