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) { foreach (ilTrQuery::getObjectAccessStatistics($objects, $yearmonth[0]) as $obj_id => $months) { $data[$obj_id]["obj_id"] = $obj_id; $data[$obj_id]["title"] = ilObject::_lookupTitle($obj_id); foreach ($months as $month => $values) { $idx = $yearmonth[0] . "-" . str_pad($month, 2, "0", STR_PAD_LEFT); $data[$obj_id]["month_" . $idx] = (int) $values[$this->filter["measure"]]; $data[$obj_id]["total"] += (int) $values[$this->filter["measure"]]; } } } else { foreach (ilTrQuery::getObjectAccessStatistics($objects, $yearmonth[0], (int) $yearmonth[1]) as $obj_id => $days) { $data[$obj_id]["obj_id"] = $obj_id; $data[$obj_id]["title"] = ilObject::_lookupTitle($obj_id); foreach ($days as $day => $values) { $data[$obj_id]["day_" . $day] = (int) $values[$this->filter["measure"]]; $data[$obj_id]["total"] += (int) $values[$this->filter["measure"]]; } } } // add objects with no usage data foreach (array_keys($objects) as $obj_id) { if (!isset($data[$obj_id])) { $data[$obj_id]["obj_id"] = $obj_id; $data[$obj_id]["title"] = ilObject::_lookupTitle($obj_id); } } } $this->setData($data); }