4 include_once(
"./Services/Tracking/classes/class.ilLPTableBaseGUI.php");
20 function __construct($a_parent_obj, $a_parent_cmd, $a_ref_id, $a_print_mode =
false)
24 $this->
setId(
"trsmy");
26 $this->ref_id = $a_ref_id;
36 $this->
parseTitle($this->obj_id,
"trac_summary");
41 $this->
addColumn($this->lng->txt(
"title"),
"title");
50 if($this->ref_id == ROOT_FOLDER_ID)
52 $this->
addColumn($this->lng->txt(
"path"));
53 $this->
addColumn($this->lng->txt(
"action"));
59 $this->
setFormAction($ilCtrl->getFormActionByClass(get_class($this)));
60 $this->
setRowTemplate(
"tpl.trac_summary_row.html",
"Services/Tracking");
62 $this->
getItems($a_parent_obj->getObjId(), $a_ref_id);
71 $lng_map = array(
"user_total" =>
"users",
"first_access_min" =>
"trac_first_access",
72 "last_access_max" =>
"trac_last_access",
"mark" =>
"trac_mark",
"status" =>
"trac_status",
73 'status_changed_max' =>
'trac_status_changed',
74 "spent_seconds_avg" =>
"trac_spent_seconds",
"percentage_avg" =>
"trac_percentage",
75 "read_count_sum" =>
"trac_read_count",
"read_count_avg" =>
"trac_read_count",
76 "read_count_spent_seconds_avg" =>
"trac_read_count_spent_seconds"
80 $all = array(
"user_total");
84 include_once
'Services/Tracking/classes/class.ilObjUserTracking.php';
88 $all[] =
"read_count_sum";
89 $all[] =
"read_count_avg";
90 $default[] =
"read_count_sum";
94 $all[] =
"spent_seconds_avg";
95 $default[] =
"spent_seconds_avg";
100 $all[] =
"read_count_spent_seconds_avg";
104 $all[] =
"percentage_avg";
111 $all[] =
'status_changed_max';
119 $privacy = array(
"gender",
"city",
"country",
"sel_country");
120 foreach($privacy as $field)
122 if($ilSetting->get(
"usr_settings_course_export_".$field))
130 $default[] =
"percentage_avg";
131 $default[] =
"status";
136 $all[] =
"first_access_min";
137 $all[] =
"last_access_max";
140 $all[] =
"create_date_min";
141 $all[] =
"create_date_max";
145 foreach($all as $column)
150 if(substr($l, -3) ==
"avg")
154 else if(substr($l, -3) ==
"sum" || $l ==
"user_total")
159 if(isset($lng_map[$l]))
166 if(in_array($column, array(
"read_count_avg",
"spent_seconds_avg",
"percentage_avg")))
168 $txt .=
" / ".$lng->txt(
"user");
173 "default" => (in_array($column, $default) ?
true :
false)
186 if($this->ref_id == ROOT_FOLDER_ID)
192 include_once
'Services/Tracking/classes/class.ilObjUserTracking.php';
196 "∑ ".$lng->txt(
"users"));
197 $this->filter[
"user_total"] = $item->getValue();
202 "∑ ".$lng->txt(
"trac_read_count"));
203 $this->filter[
"read_count"] = $item->getValue();
209 true,
"Ø ".$lng->txt(
"trac_spent_seconds").
" / ".$lng->txt(
"user"));
210 $this->filter[
"spent_seconds"][
"from"] = $item->getCombinationItem(
"from")->getValueInSeconds();
211 $this->filter[
"spent_seconds"][
"to"] = $item->getCombinationItem(
"to")->getValueInSeconds();
215 "Ø ".$lng->txt(
"trac_percentage").
" / ".$lng->txt(
"user"));
216 $this->filter[
"percentage"] = $item->getValue();
222 include_once
"Services/Tracking/classes/class.ilLPStatus.php";
224 $item->setOptions(array(
"" => $lng->txt(
"trac_all"),
229 $this->filter[
"status"] = $item->getValue();
230 if($this->filter[
"status"])
232 $this->filter[
"status"]--;
236 $this->filter[
"status_changed"] = $item->getDate();
242 $lng->txt(
"trac_mark"));
243 $this->filter[
"mark"] = $item->getValue();
246 if($ilSetting->get(
"usr_settings_course_export_gender"))
249 $item->setOptions(array(
"" => $lng->txt(
"trac_all"),
"m" => $lng->txt(
"gender_m"),
250 "f" => $lng->txt(
"gender_f")));
251 $this->filter[
"gender"] = $item->getValue();
254 if($ilSetting->get(
"usr_settings_course_export_city"))
257 $this->filter[
"city"] = $item->getValue();
260 if($ilSetting->get(
"usr_settings_course_export_country"))
263 $this->filter[
"country"] = $item->getValue();
266 if($ilSetting->get(
"usr_settings_course_export_sel_country"))
270 $this->filter[
"sel_country"] = $item->getValue();
274 $this->filter[
"language"] = $item->getValue();
279 $this->filter[
"first_access"] = $item->getDate();
282 $this->filter[
"last_access"] = $item->getDate();
286 $this->filter[
"registration"] = $item->getDate();
293 include_once(
"./Services/Utilities/classes/class.ilCountry.php");
297 $options[$c] = $lng->txt(
"meta_c_".$c);
313 include_once(
"./Services/Tracking/classes/class.ilTrQuery.php");
315 $preselected_obj_ids =
$filter = NULL;
316 if($this->ref_id == ROOT_FOLDER_ID)
341 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
342 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
344 $status_map = array();
345 foreach($valid_status as $status)
353 $lng->loadLanguageModule(
"meta");
354 $languages = array();
355 foreach ($lng->getInstalledLanguages() as $lang_key)
357 $languages[$lang_key] = $lng->txt(
"meta_l_".$lang_key);
366 include_once
"Modules/Session/classes/class.ilObjSession.php";
368 $data[
"set"][$idx][
"title"] =
$sess->getFirstAppointment()->appointmentToString();
374 $users_no =
$result[
"user_total"];
376 $data[
"set"][$idx][
"gender"] = $this->
getItemsPercentages(
$result[
"gender"], $users_no, array(
"m"=>$lng->txt(
"gender_m"),
"f"=>$lng->txt(
"gender_f")));
383 foreach(
$result[
"status"] as $status_code => $status_counter)
386 if($status_code ===
"" || !in_array($status_code, $valid_status))
389 unset(
$result[
"status"][$status_code]);
396 $data[
"set"][$idx][
"percentage_avg"] = NULL;
432 $counter = $others_counter = $others_sum = 0;
433 foreach(
$data as $id => $count)
440 if($value_map && isset($value_map[$id]))
442 $caption = $value_map[$id];
447 $caption = $lng->txt(
"none");
450 $perc = round($count/$overall*100);
452 "caption" => $caption,
453 "absolute" => $count,
454 "percentage" => $perc
459 $others_sum += $count;
466 $perc = round($others_sum/$overall*100);
468 "caption" => $otherss_counter.
" ".$lng->txt(
"trac_others"),
469 "absolute" => $others_sum,
470 "percentage" => $perc
491 foreach($value_map as $id => $caption)
494 if(isset(
$data[$id]))
498 $perc = round($count/$overall*100);
501 "caption" => $caption,
502 "absolute" => $count,
503 "percentage" => $perc
515 $pos = strrpos($id,
"_");
518 $function = strtoupper(substr($id, $pos+1));
519 if(in_array($function, array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT")))
521 $id = substr($id, 0, $pos);
525 if(trim($value) ==
"")
529 return "--".$lng->txt(
"none").
"--";
535 case 'status_changed':
545 case "spent_seconds":
546 case "read_count_spent_seconds":
547 if(in_array($type, array(
"exc")))
553 include_once(
"./Services/Utilities/classes/class.ilFormat.php");
575 if(in_array($type, array(
"lm",
"dbk")))
593 $this->tpl->setVariable(
"ICON_ALT", $lng->txt($a_set[
"type"]));
594 $this->tpl->setVariable(
"TITLE", $a_set[
"title"]);
596 if($a_set[
"offline"])
598 $this->tpl->setCurrentBlock(
"offline");
599 $this->tpl->setVariable(
"TEXT_STATUS", $this->lng->txt(
"status"));
600 $this->tpl->setVariable(
"TEXT_OFFLINE", $this->lng->txt(
"offline"));
601 $this->tpl->parseCurrentBlock();
618 case "percentage_avg":
621 $this->tpl->setVariable(strtoupper($c),
"");
626 $value = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
627 $this->tpl->setVariable(strtoupper($c), $value);
632 if($this->ref_id == ROOT_FOLDER_ID)
637 $this->tpl->setCurrentBlock(
"item_path");
640 $this->tpl->setVariable(
"PATH_ITEM", $path_item);
642 if(!$this->anonymized)
644 $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(),
'details_id',
$ref_id);
645 $this->tpl->setVariable(
"URL_DETAILS", $ilCtrl->getLinkTargetByClass($ilCtrl->getCmdClass(),
'details'));
646 $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(),
'details_id',
'');
647 $this->tpl->setVariable(
"TXT_DETAILS", $lng->txt(
'trac_participants'));
652 $this->tpl->setVariable(
"TXT_DETAILS", $lng->txt(
'view'));
655 $this->tpl->parseCurrentBlock();
659 $this->tpl->setCurrentBlock(
"item_command");
660 $ilCtrl->setParameterByClass(get_class($this),
'hide', $a_set[
"obj_id"]);
661 $this->tpl->setVariable(
"HREF_COMMAND", $ilCtrl->getLinkTargetByClass(get_class($this),
'hide'));
662 $this->tpl->setVariable(
"TXT_COMMAND", $this->lng->txt(
'trac_hide'));
663 $this->tpl->parseCurrentBlock();
665 $this->tpl->touchBlock(
"path_action");
673 foreach(
$data as $item)
675 $this->tpl->setCurrentBlock($id.
"_row");
676 $this->tpl->setVariable(
"CAPTION", $item[
"caption"]);
677 $this->tpl->setVariable(
"ABSOLUTE", $item[
"absolute"]);
678 $this->tpl->setVariable(
"PERCENTAGE", $item[
"percentage"]);
679 $this->tpl->parseCurrentBlock();
684 $this->tpl->touchBlock($id);;
690 if(in_array($a_name, array(
"country",
"gender",
"city",
"language",
"status",
"mark")))
699 $pos = strrpos($a_field,
"_");
702 $function = strtoupper(substr($a_field, $pos+1));
703 if(in_array($function, array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT",
"TOTAL")))
713 $worksheet->write($a_row, 0, $this->lng->txt(
"title"));
719 $label = $labels[$c][
"txt"];
720 $label = str_replace(
"Ø", $this->lng->txt(
"trac_average"), $label);
721 $label = str_replace(
"∑", $this->lng->txt(
"trac_sum"), $label);
725 $worksheet->write($a_row, $cnt, $label);
732 $worksheet->write($a_row, $cnt, $label.
" #1");
733 $worksheet->write($a_row, ++$cnt, $label.
" #1");
734 $worksheet->write($a_row, ++$cnt, $label.
" #1 %");
735 $worksheet->write($a_row, ++$cnt, $label.
" #2");
736 $worksheet->write($a_row, ++$cnt, $label.
" #2");
737 $worksheet->write($a_row, ++$cnt, $label.
" #2 %");
738 $worksheet->write($a_row, ++$cnt, $label.
" #3");
739 $worksheet->write($a_row, ++$cnt, $label.
" #3");
740 $worksheet->write($a_row, ++$cnt, $label.
" #3 %");
741 $worksheet->write($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others"));
742 $worksheet->write($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others"));
743 $worksheet->write($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others").
" %");
748 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
749 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
752 foreach($valid_status as $status)
755 $worksheet->write($a_row, ++$cnt, $text);
756 $worksheet->write($a_row, ++$cnt, $text.
" %");
766 $worksheet->write($a_row, 0, $a_set[
"title"]);
773 $val = $this->
parseValue($c, $a_set[$c],
"user");
774 $worksheet->write($a_row, $cnt, $val);
779 foreach($a_set[$c] as $idx => $value)
783 $worksheet->write($a_row, $cnt, (
int)$value[
"absolute"]);
784 $worksheet->write($a_row, ++$cnt, $value[
"percentage"]);
788 $worksheet->write($a_row, $cnt, $value[
"caption"]);
789 $worksheet->write($a_row, ++$cnt, (
int)$value[
"absolute"]);
790 $worksheet->write($a_row, ++$cnt, $value[
"percentage"]);
794 if(
sizeof($a_set[$c]) < 4 && $c !=
"status")
796 for($loop = 4; $loop >
sizeof($a_set[$c]); $loop--)
798 $worksheet->write($a_row, $cnt,
"");
799 $worksheet->write($a_row, ++$cnt,
"");
800 $worksheet->write($a_row, ++$cnt,
"");
810 $a_csv->addColumn($this->lng->txt(
"title"));
815 $label = $labels[$c][
"txt"];
816 $label = str_replace(
"Ø", $this->lng->txt(
"trac_average"), $label);
817 $label = str_replace(
"∑", $this->lng->txt(
"trac_sum"), $label);
821 $a_csv->addColumn($label);
827 $a_csv->addColumn($label.
" #1");
828 $a_csv->addColumn($label.
" #1");
829 $a_csv->addColumn($label.
" #1 %");
830 $a_csv->addColumn($label.
" #2");
831 $a_csv->addColumn($label.
" #2");
832 $a_csv->addColumn($label.
" #2 %");
833 $a_csv->addColumn($label.
" #3");
834 $a_csv->addColumn($label.
" #3");
835 $a_csv->addColumn($label.
" #3 %");
836 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others"));
837 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others"));
838 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others").
" %");
843 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
844 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
846 foreach($valid_status as $status)
849 $a_csv->addColumn($text);
850 $a_csv->addColumn($text.
" %");
861 $a_csv->addColumn($a_set[
"title"]);
867 $val = $this->
parseValue($c, $a_set[$c],
"user");
868 $a_csv->addColumn($val);
872 foreach($a_set[$c] as $idx => $value)
876 $a_csv->addColumn($value[
"caption"]);
878 $a_csv->addColumn((
int)$value[
"absolute"]);
879 $a_csv->addColumn($value[
"percentage"]);
881 if(
sizeof($a_set[$c]) < 4 && $c !=
"status")
883 for($loop = 4; $loop >
sizeof($a_set[$c]); $loop--)
885 $a_csv->addColumn(
"");
886 $a_csv->addColumn(
"");
887 $a_csv->addColumn(
"");