예제 #1
0
 public function showStatisticsObject()
 {
     /**
      * @var $ilAccess ilAccessHandler
      */
     global $ilAccess;
     /// if globally deactivated, skip!!! intrusion detected
     if (!$this->ilias->getSetting('enable_fora_statistics', false)) {
         $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
     }
     // if no read access -> intrusion detected
     if (!$ilAccess->checkAccess('read', '', $_GET['ref_id'])) {
         $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
     }
     // if read access and statistics disabled -> intrusion detected
     if (!$ilAccess->checkAccess('read', '', $_GET['ref_id']) && !$this->objProperties->isStatisticEnabled()) {
         $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
     }
     // if write access and statistics disabled -> ok, for forum admin
     if ($ilAccess->checkAccess('write', '', $_GET['ref_id']) && !$this->objProperties->isStatisticEnabled()) {
         ilUtil::sendInfo($this->lng->txt('frm_statistics_disabled_for_participants'));
     }
     $this->object->Forum->setForumId($this->object->getId());
     require_once 'Modules/Forum/classes/class.ilForumStatisticsTableGUI.php';
     $tbl = new ilForumStatisticsTableGUI($this, 'showStatistics');
     $tbl->setId('il_frm_statistic_table_' . (int) $_GET['ref_id']);
     $tbl->setTitle($this->lng->txt('statistic'), 'icon_usr.svg', $this->lng->txt('obj_' . $this->object->getType()));
     $data = $this->object->Forum->getUserStatistic($this->is_moderator);
     $result = array();
     $counter = 0;
     foreach ($data as $row) {
         $result[$counter]['ranking'] = $row[0];
         $result[$counter]['login'] = $row[1];
         $result[$counter]['lastname'] = $row[2];
         $result[$counter]['firstname'] = $row[3];
         ++$counter;
     }
     $tbl->setData($result);
     $this->tpl->setContent($tbl->getHTML());
 }