4 include_once(
"./Services/Tracking/classes/class.ilLPTableBaseGUI.php");
20 public function __construct($a_parent_obj, $a_parent_cmd, array $a_preselect = null, $a_load_items =
true)
27 $this->preselected = $a_preselect;
29 $this->
setId(
"lpobjstattbl");
31 parent::__construct($a_parent_obj, $a_parent_cmd);
40 if (strpos($this->filter[
"yearmonth"],
"-") ===
false) {
41 foreach ($this->
getMonthsYear($this->filter[
"yearmonth"]) as $num => $caption) {
42 $this->
addColumn($caption,
"month_" . $num);
47 $this->
setTitle($this->lng->txt(
"trac_object_stat_access"));
55 $this->
setRowTemplate(
"tpl.lp_object_statistics_row.html",
"Services/Tracking");
71 if ($a_field !=
"title") {
89 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
93 $si->readFromSession();
94 if (!
$si->getValue()) {
97 $this->filter[
"type"] =
$si->getValue();
100 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
105 $ti->readFromSession();
106 $this->filter[
"query"] = $ti->getValue();
110 $si->setOptions(array(
"read_count" =>
$lng->txt(
"trac_read_count"),
111 "spent_seconds" =>
$lng->txt(
"trac_spent_seconds"),
112 "users" =>
$lng->txt(
"users")));
114 $si->readFromSession();
115 if (!
$si->getValue()) {
116 $si->setValue(
"read_count");
118 $this->filter[
"measure"] =
$si->getValue();
124 $si->readFromSession();
125 if (!
$si->getValue()) {
126 $si->setValue(date(
"Y-m"));
128 $this->filter[
"yearmonth"] =
$si->getValue();
135 if ($this->filter[
"type"] !=
"prtf") {
139 if ($this->filter[
"type"] ==
"blog") {
140 include_once
'./Services/Tracking/classes/class.ilTrQuery.php';
142 $objects[$obj_id] = array($obj_id);
147 include_once
'./Services/Tracking/classes/class.ilTrQuery.php';
149 $objects[$obj_id] = array($obj_id);
154 $yearmonth = explode(
"-", $this->filter[
"yearmonth"]);
155 if (
sizeof($yearmonth) == 1) {
156 include_once
'./Services/Tracking/classes/class.ilTrQuery.php';
158 $data[$obj_id][
"obj_id"] = $obj_id;
161 foreach ($months as $month =>
$values) {
162 $idx = $yearmonth[0] .
"-" . str_pad($month, 2,
"0", STR_PAD_LEFT);
163 $data[$obj_id][
"month_" . $idx] = (int)
$values[$this->filter[
"measure"]];
164 $data[$obj_id][
"total"] += (int)
$values[$this->filter[
"measure"]];
168 include_once
'./Services/Tracking/classes/class.ilTrQuery.php';
170 $data[$obj_id][
"obj_id"] = $obj_id;
173 foreach ($days as $day =>
$values) {
174 $data[$obj_id][
"day_" . $day] = (int)
$values[$this->filter[
"measure"]];
175 $data[$obj_id][
"total"] += (int)
$values[$this->filter[
"measure"]];
181 foreach (array_keys($objects) as $obj_id) {
182 if (!isset(
$data[$obj_id])) {
183 $data[$obj_id][
"obj_id"] = $obj_id;
203 $this->tpl->setVariable(
"OBJ_ID", $a_set[
"obj_id"]);
204 $this->tpl->setVariable(
"ICON_SRC", ilObject::_getIcon(
"",
"tiny",
$type));
205 $this->tpl->setVariable(
"ICON_ALT", $this->lng->txt(
$type));
206 $this->tpl->setVariable(
"TITLE_TEXT", $a_set[
"title"]);
208 if ($this->preselected && in_array($a_set[
"obj_id"], $this->preselected)) {
209 $this->tpl->setVariable(
"CHECKBOX_STATE",
" checked=\"checked\"");
213 if (strpos($this->filter[
"yearmonth"],
"-") ===
false) {
214 $this->tpl->setCurrentBlock(
"month");
215 foreach (array_keys($this->
getMonthsYear($this->filter[
"yearmonth"])) as $num) {
216 $value = (int) $a_set[
"month_" . $num];
217 if ($this->filter[
"measure"] !=
"spent_seconds") {
222 $this->tpl->setVariable(
"MONTH_VALUE", $value);
223 $this->tpl->parseCurrentBlock();
227 if ($this->filter[
"measure"] ==
"spent_seconds") {
232 $this->tpl->setVariable(
"TOTAL", $sum);
241 include_once
"Services/Chart/classes/class.ilChart.php";
243 $chart->setSize(700, 500);
249 foreach ($this->
getData() as $object) {
250 if (in_array($object[
"obj_id"], $a_graph_items)) {
254 if (strpos($this->filter[
"yearmonth"],
"-") ===
false) {
255 foreach (array_keys($this->
getMonthsYear($this->filter[
"yearmonth"])) as $idx => $num) {
256 $value = (int) $object[
"month_" . $num];
257 $max_value = max($max_value, $value);
258 if ($this->filter[
"measure"] !=
"spent_seconds") {
261 $series->addPoint($idx, $value);
264 for ($loop = 1; $loop < 32; $loop++) {
265 $value = (int) $object[
"day_" . $loop];
266 $max_value = max($max_value, $value);
267 if ($this->filter[
"measure"] !=
"spent_seconds") {
270 $series->addPoint($loop, $value);
274 $chart->addData($series);
280 ($this->filter[
"measure"] !=
"spent_seconds"),
281 ($this->filter[
"measure"] ==
"spent_seconds")
285 if (strpos($this->filter[
"yearmonth"],
"-") ===
false) {
286 foreach (array_values($this->
getMonthsYear($this->filter[
"yearmonth"],
true)) as $idx => $caption) {
287 $labels[$idx] = $caption;
290 for ($loop = 1; $loop < 32; $loop++) {
291 $labels[$loop] = $loop .
".";
294 $chart->setTicks($labels, $value_ticks,
true);
296 return $chart->getHTML();
306 $a_excel->
setCell($a_row, 1, $a_set[
"obj_id"]);
309 if (strpos($this->filter[
"yearmonth"],
"-") ===
false) {
310 foreach (array_keys($this->
getMonthsYear($this->filter[
"yearmonth"])) as $num) {
311 $value = (int) $a_set[
"month_" . $num];
312 if ($this->filter[
"measure"] !=
"spent_seconds") {
316 $a_excel->
setCell($a_row, ++$col, $value);
320 if ($this->filter[
"measure"] ==
"spent_seconds") {
323 $sum = (int) $a_set[
"total"];
327 $a_excel->
setCell($a_row, ++$col, $sum);
337 $a_csv->addColumn($a_set[
"obj_id"]);
339 if (strpos($this->filter[
"yearmonth"],
"-") ===
false) {
340 foreach (array_keys($this->
getMonthsYear($this->filter[
"yearmonth"])) as $num) {
341 $value = (int) $a_set[
"month_" . $num];
342 if ($this->filter[
"measure"] !=
"spent_seconds") {
346 $a_csv->addColumn($value);
350 if ($this->filter[
"measure"] ==
"spent_seconds") {
353 $sum = (int) $a_set[
"total"];
357 $a_csv->addColumn($sum);
fillRow($a_set)
Fill table row.
anonymizeValue($a_value, $a_force_number=false)
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setExportFormats(array $formats)
Set available export formats.
setEnableNumInfo($a_val)
Set enable num info.
getMonthsYear($a_year=null, $a_short=false)
searchObjects(array $filter, $permission, array $preset_obj_ids=null, $a_check_lp_activation=true)
Search objects that match current filters.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
static _lookupTitle($a_id)
lookup object title
numericOrdering($a_field)
TableGUI class for learning progress.
getPossibleTypes($a_split_learning_resources=false, $a_include_digilib=false, $a_allow_undefined_lp=false)
Get possible subtypes.
fillMetaExcel(ilExcel $a_excel, &$a_row)
fillRowCSV($a_csv, $a_set)
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
TableGUI class for learning progress.
static getObjectAccessStatistics(array $a_ref_ids, $a_year, $a_month=null)
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
buildValueScale($a_max_value, $a_anonymize=false, $a_format_seconds=false)
addMultiCommand($a_cmd, $a_text)
Add Command button.
This class represents a text property in a property form.
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
setMaxLength($a_maxlength)
Set Max Length.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static _lookupType($a_id, $a_reference=false)
lookup object type
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
getMonthsFilter($a_short=false)
formatSeconds($seconds, $a_shorten_zero=false)
static getPortfolios($a_title=null)
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
fillRowExcel(ilExcel $a_excel, &$a_row, $a_set)
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
setEnableHeader($a_enableheader)
Set Enable Header.
static getWorkspaceBlogs($a_title=null)
getCurrentFilter($as_query=false)
setEnableTitle($a_enabletitle)
Set Enable Title.
__construct($a_parent_obj, $a_parent_cmd, array $a_preselect=null, $a_load_items=true)
Constructor.
getGraph(array $a_graph_items)
static getInstanceByType($a_type, $a_id)
Get type instance.
setFilterCommand($a_val, $a_caption=null)
Set filter command.