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,
"",
false,
"ilRight");
42 $this->
addColumn($lng->txt(
"total"),
"sum",
"",
false,
"ilRight");
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();
125 $si->setValue(date(
"Y-m"));
127 $this->filter[
"yearmonth"] =
$si->getValue();
142 include_once
"Services/Tracking/classes/class.ilTrQuery.php";
144 $yearmonth = explode(
"-", $this->filter[
"yearmonth"]);
145 if(
sizeof($yearmonth) == 1)
154 foreach($stat_objects as $obj_id => $hours)
156 $data[$obj_id][
"obj_id"] = $obj_id;
159 foreach($hours as $hour => $values)
162 $data[$obj_id][
"hour".floor($hour/2)*2] += (int)$values[$this->filter[
"measure"]];
163 $data[$obj_id][
"sum"] += (int)$values[$this->filter[
"measure"]];
166 $data[$obj_id][
"graph"][
"hour".$hour] = $values[$this->filter[
"measure"]];
171 foreach($objects as $obj_id => $ref_ids)
173 if(!isset(
$data[$obj_id]))
175 $data[$obj_id][
"obj_id"] = $obj_id;
193 $this->tpl->setVariable(
"OBJ_ID", $a_set[
"obj_id"]);
195 $this->tpl->setVariable(
"ICON_ALT", $this->lng->txt($type));
196 $this->tpl->setVariable(
"TITLE_TEXT", $a_set[
"title"]);
198 if($this->preselected && in_array($a_set[
"obj_id"], $this->preselected))
200 $this->tpl->setVariable(
"CHECKBOX_STATE",
" checked=\"checked\"");
203 $this->tpl->setCurrentBlock(
"hour");
204 for($loop = 0; $loop<24; $loop+=2)
206 $value = (int)$a_set[
"hour".$loop];
207 if($this->filter[
"measure"] !=
"spent_seconds")
215 $this->tpl->setVariable(
"HOUR_VALUE", $value);
216 $this->tpl->parseCurrentBlock();
219 if($this->filter[
"measure"] ==
"spent_seconds")
227 $this->tpl->setVariable(
"TOTAL", $sum);
234 include_once
"Services/Chart/classes/class.ilChart.php";
236 $chart->setsize(700, 500);
242 foreach($this->
getData() as $object)
244 if(in_array($object[
"obj_id"], $a_graph_items))
249 for($loop = 0; $loop<24; $loop++)
251 $value = (int)$object[
"graph"][
"hour".$loop];
252 $max_value = max($max_value, $value);
253 if($this->filter[
"measure"] !=
"spent_seconds")
257 $series->addPoint($loop, $value);
260 $chart->addData($series);
264 $value_ticks = $this->
buildValueScale($max_value, ($this->filter[
"measure"] !=
"spent_seconds"),
265 ($this->filter[
"measure"] ==
"spent_seconds"));
268 for($loop = 0; $loop<24; $loop++)
270 $labels[$loop] = str_pad($loop, 2,
"0", STR_PAD_LEFT);
272 $chart->setTicks($labels, $value_ticks,
true);
274 return $chart->getHTML();
285 $a_worksheet->write($a_row, 0, $a_set[
"obj_id"]);
288 for($loop = 0; $loop<24; $loop+=2)
290 $value = (int)$a_set[
"hour".$loop];
291 if($this->filter[
"measure"] !=
"spent_seconds")
297 $a_worksheet->write($a_row, $col, $value);
300 if($this->filter[
"measure"] ==
"spent_seconds")
304 $sum = (int)$a_set[
"sum"];
311 $a_worksheet->write($a_row, $col, $sum);
322 $a_csv->addColumn($a_set[
"obj_id"]);
324 for($loop = 0; $loop<24; $loop+=2)
326 $value = (int)$a_set[
"hour".$loop];
327 if($this->filter[
"measure"] !=
"spent_seconds")
332 $a_csv->addColumn($value);
335 if($this->filter[
"measure"] ==
"spent_seconds")
339 $sum = (int)$a_set[
"sum"];
345 $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.
getGraph(array $a_graph_items)
setExportFormats(array $formats)
Set available export formats.
fillRowExcel($a_worksheet, &$a_row, $a_set)
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
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.
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.
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)
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
TableGUI class for learning progress.
setEnableHeader($a_enableheader)
Set Enable Header.
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.