function getItems() { include_once "Services/Tracking/classes/class.ilTrQuery.php"; $res = ilTrQuery::getObjectTypeStatisticsPerMonth($this->filter["aggregation"], $this->filter["year"]); // get plugin titles include_once "./Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php"; $plugins = array(); $plugins = ilRepositoryObjectPluginSlot::addCreatableSubObjects($plugins); $data = array(); foreach ($res as $type => $months) { $data[$type]["type"] = $type; // to enable sorting by title if (array_key_exists($type, $plugins)) { include_once "./Services/Component/classes/class.ilPlugin.php"; $data[$type]["title"] = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); $data[$type]["icon"] = ilObject::_getIcon("", "tiny", $type); } else { $data[$type]["title"] = $this->lng->txt("objs_" . $type); $data[$type]["icon"] = ilUtil::getTypeIconPath($type, null, "tiny"); } foreach ($months as $month => $row) { $value = $row[$this->filter["measure"]]; $data[$type]["month_" . $month] = $value; } } // add live data if ($this->filter["year"] == date("Y")) { $live = ilTrQuery::getObjectTypeStatistics(); foreach ($live as $type => $item) { $data[$type]["type"] = $type; // to enable sorting by title if (array_key_exists($type, $plugins)) { include_once "./Services/Component/classes/class.ilPlugin.php"; $data[$type]["title"] = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); $data[$type]["icon"] = ilObject::_getIcon("", "tiny", $type); } else { $data[$type]["title"] = $this->lng->txt("objs_" . $type); $data[$type]["icon"] = ilUtil::getTypeIconPath($type, null, "tiny"); } $value = $item[$this->filter["measure"]]; $data[$type]["month_live"] = $value; } } $this->setData($data); }
protected function gatherTypesData() { global $ilDB; $count = 0; include_once "Services/Tracking/classes/class.ilTrQuery.php"; $data = ilTrQuery::getObjectTypeStatistics(); foreach ($data as $type => $item) { // only save once per day $ilDB->manipulate("DELETE FROM obj_type_stat WHERE" . " type = " . $ilDB->quote($type, "text") . " AND fulldate = " . $ilDB->quote(date("Ymd", $this->date), "integer")); $set = array("type" => array("text", $type), "yyyy" => array("integer", date("Y", $this->date)), "mm" => array("integer", date("m", $this->date)), "dd" => array("integer", date("d", $this->date)), "fulldate" => array("integer", date("Ymd", $this->date)), "cnt_references" => array("integer", (int) $item["references"]), "cnt_objects" => array("integer", (int) $item["objects"]), "cnt_deleted" => array("integer", (int) $item["deleted"])); $ilDB->insert("obj_type_stat", $set); $count++; } return $count; }
function getItems() { global $objDefinition; include_once "Services/Tracking/classes/class.ilTrQuery.php"; $res = ilTrQuery::getObjectTypeStatisticsPerMonth($this->filter["aggregation"], $this->filter["year"]); $data = array(); foreach ($res as $type => $months) { // inactive plugins, etc. if (!$objDefinition->getLocation($type)) { continue; } $data[$type]["type"] = $type; // to enable sorting by title if ($objDefinition->isPluginTypeName($type)) { include_once "./Services/Component/classes/class.ilPlugin.php"; $data[$type]["title"] = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); $data[$type]["icon"] = ilObject::_getIcon("", "tiny", $type); } else { $data[$type]["title"] = $this->lng->txt("objs_" . $type); $data[$type]["icon"] = ilUtil::getTypeIconPath($type, null, "tiny"); } foreach ($months as $month => $row) { $value = $row[$this->filter["measure"]]; $data[$type]["month_" . $month] = $value; } } // add live data if ($this->filter["year"] == date("Y")) { $live = ilTrQuery::getObjectTypeStatistics(); foreach ($live as $type => $item) { // inactive plugins, etc. if (!$objDefinition->getLocation($type)) { continue; } $data[$type]["type"] = $type; // to enable sorting by title if ($objDefinition->isPluginTypeName($type)) { include_once "./Services/Component/classes/class.ilPlugin.php"; $data[$type]["title"] = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); $data[$type]["icon"] = ilObject::_getIcon("", "tiny", $type); } else { $data[$type]["title"] = $this->lng->txt("objs_" . $type); $data[$type]["icon"] = ilUtil::getTypeIconPath($type, null, "tiny"); } $value = $item[$this->filter["measure"]]; $data[$type]["month_live"] = $value; } } $this->setData($data); }