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)
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) {
38 $this->
addColumn(str_pad($loop, 2,
"0", STR_PAD_LEFT) .
":00-<br />" .
39 str_pad($loop+2, 2,
"0", STR_PAD_LEFT) .
":00 ",
"hour" . $loop);
41 $this->
addColumn($lng->txt(
"total"),
"sum");
43 $this->
setTitle($this->lng->txt(
"trac_object_stat_daily"));
50 $this->
setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
51 $this->
setRowTemplate(
"tpl.lp_object_statistics_daily_row.html",
"Services/Tracking");
67 if ($a_field !=
"title") {
83 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
87 $si->readFromSession();
88 if (!
$si->getValue()) {
91 $this->filter[
"type"] =
$si->getValue();
94 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
95 $ti =
new ilTextInputGUI($lng->txt(
"trac_title_description"),
"query");
99 $ti->readFromSession();
100 $this->filter[
"query"] = $ti->getValue();
104 $si->setOptions(
array(
"read_count"=>$lng->txt(
"trac_read_count"),
105 "spent_seconds"=>$lng->txt(
"trac_spent_seconds")));
107 $si->readFromSession();
108 if (!
$si->getValue()) {
109 $si->setValue(
"read_count");
111 $this->filter[
"measure"] =
$si->getValue();
117 $si->readFromSession();
118 if (!
$si->getValue()) {
121 $this->filter[
"yearmonth"] =
$si->getValue();
128 if ($this->filter[
"type"] !=
"prtf") {
132 if ($this->filter[
"type"] ==
"blog") {
134 $objects[$obj_id] =
array($obj_id);
140 $objects[$obj_id] =
array($obj_id);
145 include_once
"Services/Tracking/classes/class.ilTrQuery.php";
147 $yearmonth = explode(
"-", $this->filter[
"yearmonth"]);
148 if (
sizeof($yearmonth) == 1) {
154 foreach ($stat_objects as $obj_id => $hours) {
155 $data[$obj_id][
"obj_id"] = $obj_id;
158 foreach ($hours as $hour => $values) {
160 $data[$obj_id][
"hour" . floor($hour/2)*2] += (int) $values[$this->filter[
"measure"]];
161 $data[$obj_id][
"sum"] += (int) $values[$this->filter[
"measure"]];
164 $data[$obj_id][
"graph"][
"hour" . $hour] = $values[$this->filter[
"measure"]];
169 foreach ($objects as $obj_id => $ref_ids) {
170 if (!isset(
$data[$obj_id])) {
171 $data[$obj_id][
"obj_id"] = $obj_id;
189 $this->tpl->setVariable(
"OBJ_ID", $a_set[
"obj_id"]);
191 $this->tpl->setVariable(
"ICON_ALT", $this->lng->txt(
$type));
192 $this->tpl->setVariable(
"TITLE_TEXT", $a_set[
"title"]);
194 if ($this->preselected && in_array($a_set[
"obj_id"], $this->preselected)) {
195 $this->tpl->setVariable(
"CHECKBOX_STATE",
" checked=\"checked\"");
198 $this->tpl->setCurrentBlock(
"hour");
199 for ($loop = 0; $loop<24; $loop+=2) {
200 $value = (int) $a_set[
"hour" . $loop];
201 if ($this->filter[
"measure"] !=
"spent_seconds") {
206 $this->tpl->setVariable(
"HOUR_VALUE", $value);
207 $this->tpl->parseCurrentBlock();
210 if ($this->filter[
"measure"] ==
"spent_seconds") {
215 $this->tpl->setVariable(
"TOTAL", $sum);
222 include_once
"Services/Chart/classes/class.ilChart.php";
224 $chart->setsize(700, 500);
230 foreach ($this->
getData() as $object) {
231 if (in_array($object[
"obj_id"], $a_graph_items)) {
235 for ($loop = 0; $loop<24; $loop++) {
236 $value = (int) $object[
"graph"][
"hour" . $loop];
237 $max_value = max($max_value, $value);
238 if ($this->filter[
"measure"] !=
"spent_seconds") {
241 $series->addPoint($loop, $value);
250 ($this->filter[
"measure"] !=
"spent_seconds"),
251 ($this->filter[
"measure"] ==
"spent_seconds")
255 for ($loop = 0; $loop<24; $loop++) {
256 $labels[$loop] = str_pad($loop, 2,
"0", STR_PAD_LEFT);
258 $chart->setTicks($labels, $value_ticks,
true);
270 $a_excel->
setCell($a_row, 1, $a_set[
"obj_id"]);
273 for ($loop = 0; $loop<24; $loop+=2) {
274 $value = (int) $a_set[
"hour" . $loop];
275 if ($this->filter[
"measure"] !=
"spent_seconds") {
279 $a_excel->
setCell($a_row, ++$col, $value);
282 if ($this->filter[
"measure"] ==
"spent_seconds") {
285 $sum = (int) $a_set[
"sum"];
289 $a_excel->
setCell($a_row, ++$col, $sum);
299 $a_csv->addColumn($a_set[
"obj_id"]);
301 for ($loop = 0; $loop<24; $loop+=2) {
302 $value = (int) $a_set[
"hour" . $loop];
303 if ($this->filter[
"measure"] !=
"spent_seconds") {
307 $a_csv->addColumn($value);
310 if ($this->filter[
"measure"] ==
"spent_seconds") {
313 $sum = (int) $a_set[
"sum"];
317 $a_csv->addColumn($sum);
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
anonymizeValue($a_value, $a_force_number=false)
__construct($a_parent_obj, $a_parent_cmd, array $a_preselect=null, $a_load_items=true)
Constructor.
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.
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.
Create styles array
The data for the language used.
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.
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.
static getInstanceByType($a_type, $a_id)
Get type instance.
setFilterCommand($a_val, $a_caption=null)
Set filter command.