Beispiel #1
0
 /**
  * Method to render the view.
  *
  * @return  string  The rendered view.
  *
  * @since   12.1
  * @throws  RuntimeException
  */
 public function render()
 {
     $this->items = $this->model->getComments();
     $this->filterForm = $this->model->getFilterForm();
     $this->defaultTitle = JText::_('COM_MONITOR_COMMENTS');
     $this->setLayout('default');
     return parent::render();
 }
Beispiel #2
0
 /**
  * Method to render the view.
  *
  * @return  string  The rendered view.
  *
  * @since   12.1
  * @throws  RuntimeException
  */
 public function render()
 {
     $this->prefix = 'comment';
     $comments = $this->model->getComments();
     $this->items = $comments;
     $user = JFactory::getUser();
     $this->canDeleteComments = $user->authorise('comment.delete', 'com_monitor');
     $this->canEditComments = $user->authorise('comment.edit', 'com_monitor');
     $this->canEditOwnComments = $user->authorise('comment.edit.own', 'com_monitor');
     $this->canEditIssues = $user->authorise('issue.edit', 'com_monitor');
     $this->canEditOwnIssues = $user->authorise('issue.edit.own', 'com_monitor');
     $this->canEditProjects = $user->authorise('project.edit', 'com_monitor');
     $this->setLayout('default');
     $this->addToolbar();
     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');
 }