4 include_once(
"./Services/Tracking/classes/class.ilLPTableBaseGUI.php");
20 function __construct($a_parent_obj, $a_parent_cmd,
array $a_preselect = null, $a_load_items =
true)
24 $this->preselected = $a_preselect;
26 $this->
setId(
"lpobjstattbl");
28 parent::__construct($a_parent_obj, $a_parent_cmd);
35 $this->
addColumn($lng->txt(
"trac_title"),
"title");
36 $this->
addColumn($lng->txt(
"object_id"),
"obj_id");
37 if(strpos($this->filter[
"yearmonth"],
"-") ===
false)
39 foreach($this->
getMonthsYear($this->filter[
"yearmonth"]) as $num => $caption)
41 $this->
addColumn($caption,
"month_".$num);
44 $this->
addColumn($lng->txt(
"total"),
"total");
46 $this->
setTitle($this->lng->txt(
"trac_object_stat_access"));
49 $this->
addMultiCommand(
"showAccessGraph", $lng->txt(
"trac_show_graph"));
53 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
54 $this->
setRowTemplate(
"tpl.lp_object_statistics_row.html",
"Services/Tracking");
71 if($a_field !=
"title")
88 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
92 $si->readFromSession();
97 $this->filter[
"type"] =
$si->getValue();
100 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
101 $ti =
new ilTextInputGUI($lng->txt(
"trac_title_description"),
"query");
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();
117 $si->setValue(
"read_count");
119 $this->filter[
"measure"] =
$si->getValue();
125 $si->readFromSession();
130 $this->filter[
"yearmonth"] =
$si->getValue();
137 if($this->filter[
"type"] !=
"prtf")
142 if($this->filter[
"type"] ==
"blog")
144 include_once
'./Services/Tracking/classes/class.ilTrQuery.php';
147 $objects[$obj_id] =
array($obj_id);
154 include_once
'./Services/Tracking/classes/class.ilTrQuery.php';
157 $objects[$obj_id] =
array($obj_id);
163 $yearmonth = explode(
"-", $this->filter[
"yearmonth"]);
164 if(
sizeof($yearmonth) == 1)
166 include_once
'./Services/Tracking/classes/class.ilTrQuery.php';
169 $data[$obj_id][
"obj_id"] = $obj_id;
172 foreach($months as $month => $values)
174 $idx = $yearmonth[0].
"-".str_pad($month, 2,
"0", STR_PAD_LEFT);
175 $data[$obj_id][
"month_".$idx] = (int)$values[$this->filter[
"measure"]];
176 $data[$obj_id][
"total"] += (int)$values[$this->filter[
"measure"]];
182 include_once
'./Services/Tracking/classes/class.ilTrQuery.php';
185 $data[$obj_id][
"obj_id"] = $obj_id;
188 foreach($days as $day => $values)
190 $data[$obj_id][
"day_".$day] = (int)$values[$this->filter[
"measure"]];
191 $data[$obj_id][
"total"] += (int)$values[$this->filter[
"measure"]];
197 foreach(array_keys($objects) as $obj_id)
199 if(!isset(
$data[$obj_id]))
201 $data[$obj_id][
"obj_id"] = $obj_id;
219 $this->tpl->setVariable(
"OBJ_ID", $a_set[
"obj_id"]);
221 $this->tpl->setVariable(
"ICON_ALT", $this->lng->txt($type));
222 $this->tpl->setVariable(
"TITLE_TEXT", $a_set[
"title"]);
224 if($this->preselected && in_array($a_set[
"obj_id"], $this->preselected))
226 $this->tpl->setVariable(
"CHECKBOX_STATE",
" checked=\"checked\"");
230 if(strpos($this->filter[
"yearmonth"],
"-") ===
false)
232 $this->tpl->setCurrentBlock(
"month");
233 foreach(array_keys($this->
getMonthsYear($this->filter[
"yearmonth"])) as $num)
235 $value = (int)$a_set[
"month_".$num];
236 if($this->filter[
"measure"] !=
"spent_seconds")
244 $this->tpl->setVariable(
"MONTH_VALUE", $value);
245 $this->tpl->parseCurrentBlock();
249 if($this->filter[
"measure"] ==
"spent_seconds")
257 $this->tpl->setVariable(
"TOTAL", $sum);
264 include_once
"Services/Chart/classes/class.ilChart.php";
266 $chart->setSize(700, 500);
272 foreach($this->
getData() as $object)
274 if(in_array($object[
"obj_id"], $a_graph_items))
279 if(strpos($this->filter[
"yearmonth"],
"-") ===
false)
281 foreach(array_keys($this->
getMonthsYear($this->filter[
"yearmonth"])) as $idx => $num)
283 $value = (int)$object[
"month_".$num];
284 $max_value = max($max_value, $value);
285 if($this->filter[
"measure"] !=
"spent_seconds")
289 $series->addPoint($idx, $value);
294 for($loop = 1; $loop<32; $loop++)
296 $value = (int)$object[
"day_".$loop];
297 $max_value = max($max_value, $value);
298 if($this->filter[
"measure"] !=
"spent_seconds")
302 $series->addPoint($loop, $value);
310 $value_ticks = $this->
buildValueScale($max_value, ($this->filter[
"measure"] !=
"spent_seconds"),
311 ($this->filter[
"measure"] ==
"spent_seconds"));
314 if(strpos($this->filter[
"yearmonth"],
"-") ===
false)
316 foreach(array_values($this->
getMonthsYear($this->filter[
"yearmonth"],
true)) as $idx => $caption)
318 $labels[$idx] = $caption;
323 for($loop = 1; $loop<32; $loop++)
325 $labels[$loop] = $loop.
".";
328 $chart->setTicks($labels, $value_ticks,
true);
341 $a_excel->
setCell($a_row, 1, $a_set[
"obj_id"]);
344 if(strpos($this->filter[
"yearmonth"],
"-") ===
false)
346 foreach(array_keys($this->
getMonthsYear($this->filter[
"yearmonth"])) as $num)
348 $value = (int)$a_set[
"month_".$num];
349 if($this->filter[
"measure"] !=
"spent_seconds")
354 $a_excel->
setCell($a_row, ++$col, $value);
358 if($this->filter[
"measure"] ==
"spent_seconds")
362 $sum = (int)$a_set[
"total"];
368 $a_excel->
setCell($a_row, ++$col, $sum);
379 $a_csv->addColumn($a_set[
"obj_id"]);
381 if(strpos($this->filter[
"yearmonth"],
"-") ===
false)
383 foreach(array_keys($this->
getMonthsYear($this->filter[
"yearmonth"])) as $num)
385 $value = (int)$a_set[
"month_".$num];
386 if($this->filter[
"measure"] !=
"spent_seconds")
391 $a_csv->addColumn($value);
395 if($this->filter[
"measure"] ==
"spent_seconds")
399 $sum = (int)$a_set[
"total"];
405 $a_csv->addColumn($sum);
fillRow($a_set)
Fill table row.
anonymizeValue($a_value, $a_force_number=false)
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
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.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
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.
setMaxLength($a_maxlength)
Set Max Length.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
setCell($a_row, $a_col, $a_value)
Set cell value.
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)
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)
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.
static getInstanceByType($a_type, $a_id)
Get type instance.
setFilterCommand($a_val, $a_caption=null)
Set filter command.