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(
"lpobjstatdlytbl");
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 for($loop = 0; $loop<24; $loop+=2)
39 $this->
addColumn(str_pad($loop, 2,
"0", STR_PAD_LEFT).
":00-<br />".
40 str_pad($loop+2, 2,
"0", STR_PAD_LEFT).
":00 ",
"hour".$loop);
42 $this->
addColumn($lng->txt(
"total"),
"sum");
44 $this->
setTitle($this->lng->txt(
"trac_object_stat_daily"));
51 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
52 $this->
setRowTemplate(
"tpl.lp_object_statistics_daily_row.html",
"Services/Tracking");
69 if($a_field !=
"title")
86 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
90 $si->readFromSession();
95 $this->filter[
"type"] =
$si->getValue();
98 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
99 $ti =
new ilTextInputGUI($lng->txt(
"trac_title_description"),
"query");
103 $ti->readFromSession();
104 $this->filter[
"query"] = $ti->getValue();
108 $si->setOptions(
array(
"read_count"=>$lng->txt(
"trac_read_count"),
109 "spent_seconds"=>$lng->txt(
"trac_spent_seconds")));
111 $si->readFromSession();
114 $si->setValue(
"read_count");
116 $this->filter[
"measure"] =
$si->getValue();
122 $si->readFromSession();
127 $this->filter[
"yearmonth"] =
$si->getValue();
134 if($this->filter[
"type"] !=
"prtf")
139 if($this->filter[
"type"] ==
"blog")
143 $objects[$obj_id] =
array($obj_id);
152 $objects[$obj_id] =
array($obj_id);
158 include_once
"Services/Tracking/classes/class.ilTrQuery.php";
160 $yearmonth = explode(
"-", $this->filter[
"yearmonth"]);
161 if(
sizeof($yearmonth) == 1)
170 foreach($stat_objects as $obj_id => $hours)
172 $data[$obj_id][
"obj_id"] = $obj_id;
175 foreach($hours as $hour => $values)
178 $data[$obj_id][
"hour".floor($hour/2)*2] += (int)$values[$this->filter[
"measure"]];
179 $data[$obj_id][
"sum"] += (int)$values[$this->filter[
"measure"]];
182 $data[$obj_id][
"graph"][
"hour".$hour] = $values[$this->filter[
"measure"]];
187 foreach($objects as $obj_id => $ref_ids)
189 if(!isset(
$data[$obj_id]))
191 $data[$obj_id][
"obj_id"] = $obj_id;
209 $this->tpl->setVariable(
"OBJ_ID", $a_set[
"obj_id"]);
211 $this->tpl->setVariable(
"ICON_ALT", $this->lng->txt($type));
212 $this->tpl->setVariable(
"TITLE_TEXT", $a_set[
"title"]);
214 if($this->preselected && in_array($a_set[
"obj_id"], $this->preselected))
216 $this->tpl->setVariable(
"CHECKBOX_STATE",
" checked=\"checked\"");
219 $this->tpl->setCurrentBlock(
"hour");
220 for($loop = 0; $loop<24; $loop+=2)
222 $value = (int)$a_set[
"hour".$loop];
223 if($this->filter[
"measure"] !=
"spent_seconds")
231 $this->tpl->setVariable(
"HOUR_VALUE", $value);
232 $this->tpl->parseCurrentBlock();
235 if($this->filter[
"measure"] ==
"spent_seconds")
243 $this->tpl->setVariable(
"TOTAL", $sum);
250 include_once
"Services/Chart/classes/class.ilChart.php";
252 $chart->setsize(700, 500);
258 foreach($this->
getData() as $object)
260 if(in_array($object[
"obj_id"], $a_graph_items))
265 for($loop = 0; $loop<24; $loop++)
267 $value = (int)$object[
"graph"][
"hour".$loop];
268 $max_value = max($max_value, $value);
269 if($this->filter[
"measure"] !=
"spent_seconds")
273 $series->addPoint($loop, $value);
280 $value_ticks = $this->
buildValueScale($max_value, ($this->filter[
"measure"] !=
"spent_seconds"),
281 ($this->filter[
"measure"] ==
"spent_seconds"));
284 for($loop = 0; $loop<24; $loop++)
286 $labels[$loop] = str_pad($loop, 2,
"0", STR_PAD_LEFT);
288 $chart->setTicks($labels, $value_ticks,
true);
301 $a_excel->
setCell($a_row, 1, $a_set[
"obj_id"]);
304 for($loop = 0; $loop<24; $loop+=2)
306 $value = (int)$a_set[
"hour".$loop];
307 if($this->filter[
"measure"] !=
"spent_seconds")
312 $a_excel->
setCell($a_row, ++$col, $value);
315 if($this->filter[
"measure"] ==
"spent_seconds")
319 $sum = (int)$a_set[
"sum"];
325 $a_excel->
setCell($a_row, ++$col, $sum);
336 $a_csv->addColumn($a_set[
"obj_id"]);
338 for($loop = 0; $loop<24; $loop+=2)
340 $value = (int)$a_set[
"hour".$loop];
341 if($this->filter[
"measure"] !=
"spent_seconds")
346 $a_csv->addColumn($value);
349 if($this->filter[
"measure"] ==
"spent_seconds")
353 $sum = (int)$a_set[
"sum"];
359 $a_csv->addColumn($sum);
anonymizeValue($a_value, $a_force_number=false)
__construct($a_parent_obj, $a_parent_cmd, array $a_preselect=null, $a_load_items=true)
Constructor.
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.
fillRowExcel(ilExcel $a_excel, &$a_row, $a_set)
getGraph(array $a_graph_items)
setExportFormats(array $formats)
Set available export formats.
setEnableNumInfo($a_val)
Set enable num info.
fillRow($a_set)
Fill table row.
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
fillMetaExcel(ilExcel $a_excel, &$a_row)
getPossibleTypes($a_split_learning_resources=false, $a_include_digilib=false, $a_allow_undefined_lp=false)
Get possible subtypes.
fillRowCSV($a_csv, $a_set)
numericOrdering($a_field)
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
static getObjectDailyStatistics(array $a_ref_ids, $a_year, $a_month=null)
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
TableGUI class for learning progress.
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)
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
TableGUI class for learning progress.
setEnableHeader($a_enableheader)
Set Enable Header.
static getWorkspaceBlogs($a_title=null)
getCurrentFilter($as_query=false)
setEnableTitle($a_enabletitle)
Set Enable Title.
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.