Beispiel #1
0
 public function display($tpl = null)
 {
     $doc = JFactory::getDocument();
     $my = JFactory::getUser();
     EDC::setPageTitle(JText::_('COM_EASYDISCUSS_PAGETITLE_ASSIGNED'));
     $this->setPathway(JText::_('COM_EASYDISCUSS_BREADCRUMB_ASSIGNED'));
     if (!EDC::isModerator()) {
         return JError::raiseError(404, JText::_('COM_EASYDISCUSS_YOU_ARE_NOT_ALLOWED_HERE'));
     }
     $subs = array();
     // [Model:Assigned]
     $model = EDC::getModel('Assigned');
     $posts = $model->getPosts();
     $posts = EDC::formatPost($posts);
     $posts = Discusshelper::getPostStatusAndTypes($posts);
     // Get total number of posts assigned to the current user.
     $totalAssigned = $model->getTotalAssigned($my->id);
     // Get total number of posts that is assigned to this user and resolved.
     // [Model:Assigned]
     $totalResolved = $model->getTotalSolved($my->id);
     // Calculate percentage
     $percentage = 0;
     if ($posts) {
         $percentage = round($totalResolved / $totalAssigned * 100, 2);
     }
     $theme = new DiscussThemes();
     $theme->set('totalAssigned', $totalAssigned);
     $theme->set('totalResolved', $totalResolved);
     $theme->set('percentage', $percentage);
     $theme->set('posts', $posts);
     echo $theme->fetch('assigned.php');
 }