コード例 #1
0
 function getItems()
 {
     $data = array();
     $objects = $this->searchObjects($this->getCurrentFilter(true), "read");
     if ($objects) {
         include_once "Services/Tracking/classes/class.ilTrQuery.php";
         $yearmonth = explode("-", $this->filter["yearmonth"]);
         if (sizeof($yearmonth) == 1) {
             $stat_objects = ilTrQuery::getObjectDailyStatistics($objects, $yearmonth[0]);
         } else {
             $stat_objects = ilTrQuery::getObjectDailyStatistics($objects, $yearmonth[0], (int) $yearmonth[1]);
         }
         foreach ($stat_objects as $obj_id => $hours) {
             $data[$obj_id]["obj_id"] = $obj_id;
             $data[$obj_id]["title"] = ilObject::_lookupTitle($obj_id);
             foreach ($hours as $hour => $values) {
                 // table data
                 $data[$obj_id]["hour" . floor($hour / 2) * 2] += (int) $values[$this->filter["measure"]];
                 $data[$obj_id]["sum"] += (int) $values[$this->filter["measure"]];
                 // graph data
                 $data[$obj_id]["graph"]["hour" . $hour] = $values[$this->filter["measure"]];
             }
         }
         // add objects with no usage data
         foreach ($objects as $obj_id => $ref_ids) {
             if (!isset($data[$obj_id])) {
                 $data[$obj_id]["obj_id"] = $obj_id;
                 $data[$obj_id]["title"] = ilObject::_lookupTitle($obj_id);
             }
         }
     }
     $this->setData($data);
 }