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;
28 $this->is_root = ($a_ref_id == ROOT_FOLDER_ID);
32 include_once
'./Services/Object/classes/class.ilObjectLP.php';
43 $this->
parseTitle($this->obj_id,
"trac_summary");
48 $this->
addColumn($this->lng->txt(
"title"),
"title");
59 $this->
addColumn($this->lng->txt(
"path"));
60 $this->
addColumn($this->lng->txt(
"action"));
66 $this->
setFormAction($ilCtrl->getFormActionByClass(get_class($this)));
67 $this->
setRowTemplate(
"tpl.trac_summary_row.html",
"Services/Tracking");
69 $this->
getItems($a_parent_obj->getObjId(), $a_ref_id);
76 $lng_map = array(
"user_total" =>
"users",
"first_access_min" =>
"trac_first_access",
77 "last_access_max" =>
"trac_last_access",
"mark" =>
"trac_mark",
"status" =>
"trac_status",
78 'status_changed_max' =>
'trac_status_changed',
79 "spent_seconds_avg" =>
"trac_spent_seconds",
"percentage_avg" =>
"trac_percentage",
80 "read_count_sum" =>
"trac_read_count",
"read_count_avg" =>
"trac_read_count",
81 "read_count_spent_seconds_avg" =>
"trac_read_count_spent_seconds"
85 $all = array(
"user_total");
89 include_once
'Services/Tracking/classes/class.ilObjUserTracking.php';
93 $all[] =
"read_count_sum";
94 $all[] =
"read_count_avg";
95 $default[] =
"read_count_sum";
99 $all[] =
"spent_seconds_avg";
100 $default[] =
"spent_seconds_avg";
105 $all[] =
"read_count_spent_seconds_avg";
109 $all[] =
"percentage_avg";
112 if($this->is_root || $this->olp->isActive())
115 $all[] =
'status_changed_max';
123 $privacy = array(
"gender",
"city",
"country",
"sel_country");
124 foreach($privacy as $field)
126 if($ilSetting->get(
"usr_settings_course_export_".$field))
134 $default[] =
"percentage_avg";
135 $default[] =
"status";
140 $all[] =
"first_access_min";
141 $all[] =
"last_access_max";
144 $all[] =
"create_date_min";
145 $all[] =
"create_date_max";
149 foreach($all as $column)
154 if(substr($l, -3) ==
"avg")
158 else if(substr($l, -3) ==
"sum" || $l ==
"user_total")
163 if(isset($lng_map[$l]))
170 if(in_array($column, array(
"read_count_avg",
"spent_seconds_avg",
"percentage_avg")))
172 $txt .=
" / ".$lng->txt(
"user");
177 "default" => (in_array($column, $default) ?
true :
false)
196 include_once
'Services/Tracking/classes/class.ilObjUserTracking.php';
200 "∑ ".$lng->txt(
"users"));
201 $this->filter[
"user_total"] = $item->getValue();
206 "∑ ".$lng->txt(
"trac_read_count"));
207 $this->filter[
"read_count"] = $item->getValue();
213 true,
"Ø ".$lng->txt(
"trac_spent_seconds").
" / ".$lng->txt(
"user"));
214 $this->filter[
"spent_seconds"][
"from"] = $item->getCombinationItem(
"from")->getValueInSeconds();
215 $this->filter[
"spent_seconds"][
"to"] = $item->getCombinationItem(
"to")->getValueInSeconds();
219 "Ø ".$lng->txt(
"trac_percentage").
" / ".$lng->txt(
"user"));
220 $this->filter[
"percentage"] = $item->getValue();
223 if($this->olp->isActive())
225 include_once
"Services/Tracking/classes/class.ilLPStatus.php";
227 $item->setOptions(array(
"" => $lng->txt(
"trac_all"),
232 $this->filter[
"status"] = $item->getValue();
233 if($this->filter[
"status"])
235 $this->filter[
"status"]--;
239 $this->filter[
"status_changed"] = $item->getDate();
245 $lng->txt(
"trac_mark"));
246 $this->filter[
"mark"] = $item->getValue();
249 if($ilSetting->get(
"usr_settings_course_export_gender"))
252 $item->setOptions(array(
"" => $lng->txt(
"trac_all"),
"m" => $lng->txt(
"gender_m"),
253 "f" => $lng->txt(
"gender_f")));
254 $this->filter[
"gender"] = $item->getValue();
257 if($ilSetting->get(
"usr_settings_course_export_city"))
260 $this->filter[
"city"] = $item->getValue();
263 if($ilSetting->get(
"usr_settings_course_export_country"))
266 $this->filter[
"country"] = $item->getValue();
269 if($ilSetting->get(
"usr_settings_course_export_sel_country"))
273 $this->filter[
"sel_country"] = $item->getValue();
277 $this->filter[
"language"] = $item->getValue();
282 $this->filter[
"first_access"] = $item->getDate();
285 $this->filter[
"last_access"] = $item->getDate();
289 $this->filter[
"registration"] = $item->getDate();
296 include_once(
"./Services/Utilities/classes/class.ilCountry.php");
300 $options[$c] = $lng->txt(
"meta_c_".$c);
316 include_once(
"./Services/Tracking/classes/class.ilTrQuery.php");
318 $preselected_obj_ids =
$filter = NULL;
344 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
345 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
350 $status_map = array();
351 foreach($valid_status as $status)
359 $lng->loadLanguageModule(
"meta");
360 $languages = array();
361 foreach ($lng->getInstalledLanguages() as $lang_key)
363 $languages[$lang_key] = $lng->txt(
"meta_l_".$lang_key);
372 include_once
"Modules/Session/classes/class.ilObjSession.php";
374 $data[
"set"][$idx][
"title"] =
$sess->getFirstAppointment()->appointmentToString();
380 $users_no =
$result[
"user_total"];
382 $data[
"set"][$idx][
"gender"] = $this->
getItemsPercentages(
$result[
"gender"], $users_no, array(
"m"=>$lng->txt(
"gender_m"),
"f"=>$lng->txt(
"gender_f")));
389 foreach(
$result[
"status"] as $status_code => $status_counter)
392 if($status_code ===
"" || !in_array($status_code, $valid_status))
395 unset(
$result[
"status"][$status_code]);
402 $data[
"set"][$idx][
"percentage_avg"] = NULL;
438 $counter = $others_counter = $others_sum = 0;
439 foreach(
$data as $id => $count)
446 if($value_map && isset($value_map[$id]))
448 $caption = $value_map[$id];
453 $caption = $lng->txt(
"none");
456 $perc = round($count/$overall*100);
458 "caption" => $caption,
459 "absolute" => $count,
460 "percentage" => $perc
465 $others_sum += $count;
472 $perc = round($others_sum/$overall*100);
474 "caption" => $otherss_counter.
" ".$lng->txt(
"trac_others"),
475 "absolute" => $others_sum,
476 "percentage" => $perc
497 foreach($value_map as $id => $caption)
500 if(isset(
$data[$id]))
504 $perc = round($count/$overall*100);
507 "caption" => $caption,
508 "absolute" => $count,
509 "percentage" => $perc
521 $pos = strrpos($id,
"_");
524 $function = strtoupper(substr($id, $pos+1));
525 if(in_array($function, array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT")))
527 $id = substr($id, 0, $pos);
531 if(trim($value) ==
"")
535 return "--".$lng->txt(
"none").
"--";
541 case 'status_changed':
551 case "spent_seconds":
552 case "read_count_spent_seconds":
553 if(in_array($type, array(
"exc")))
559 include_once(
"./Services/Utilities/classes/class.ilFormat.php");
581 if(in_array($type, array(
"lm",
"dbk")))
599 $this->tpl->setVariable(
"ICON_ALT", $lng->txt($a_set[
"type"]));
600 $this->tpl->setVariable(
"TITLE", $a_set[
"title"]);
602 if($a_set[
"offline"])
604 $this->tpl->setCurrentBlock(
"offline");
605 $this->tpl->setVariable(
"TEXT_STATUS", $this->lng->txt(
"status"));
606 $this->tpl->setVariable(
"TEXT_OFFLINE", $this->lng->txt(
"offline"));
607 $this->tpl->parseCurrentBlock();
624 case "percentage_avg":
627 $this->tpl->setVariable(strtoupper($c),
"");
632 $value = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
633 $this->tpl->setVariable(strtoupper($c), $value);
643 $this->tpl->setCurrentBlock(
"item_path");
646 $this->tpl->setVariable(
"PATH_ITEM", $path_item);
648 if(!$this->anonymized)
650 $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(),
'details_id',
$ref_id);
651 $this->tpl->setVariable(
"URL_DETAILS", $ilCtrl->getLinkTargetByClass($ilCtrl->getCmdClass(),
'details'));
652 $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(),
'details_id',
'');
653 $this->tpl->setVariable(
"TXT_DETAILS", $lng->txt(
'trac_participants'));
658 $this->tpl->setVariable(
"TXT_DETAILS", $lng->txt(
'view'));
661 $this->tpl->parseCurrentBlock();
665 $this->tpl->setCurrentBlock(
"item_command");
666 $ilCtrl->setParameterByClass(get_class($this),
'hide', $a_set[
"obj_id"]);
667 $this->tpl->setVariable(
"HREF_COMMAND", $ilCtrl->getLinkTargetByClass(get_class($this),
'hide'));
668 $this->tpl->setVariable(
"TXT_COMMAND", $this->lng->txt(
'trac_hide'));
669 $this->tpl->parseCurrentBlock();
671 $this->tpl->touchBlock(
"path_action");
679 foreach(
$data as $item)
681 $this->tpl->setCurrentBlock($id.
"_row");
682 $this->tpl->setVariable(
"CAPTION", $item[
"caption"]);
683 $this->tpl->setVariable(
"ABSOLUTE", $item[
"absolute"]);
684 $this->tpl->setVariable(
"PERCENTAGE", $item[
"percentage"]);
685 $this->tpl->parseCurrentBlock();
690 $this->tpl->touchBlock($id);;
696 if(in_array($a_name, array(
"country",
"gender",
"city",
"language",
"status",
"mark")))
705 $pos = strrpos($a_field,
"_");
708 $function = strtoupper(substr($a_field, $pos+1));
709 if(in_array($function, array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT",
"TOTAL")))
719 $worksheet->write($a_row, 0, $this->lng->txt(
"title"));
725 $label = $labels[$c][
"txt"];
726 $label = str_replace(
"Ø", $this->lng->txt(
"trac_average"), $label);
727 $label = str_replace(
"∑", $this->lng->txt(
"trac_sum"), $label);
731 $worksheet->write($a_row, $cnt, $label);
738 $worksheet->write($a_row, $cnt, $label.
" #1");
739 $worksheet->write($a_row, ++$cnt, $label.
" #1");
740 $worksheet->write($a_row, ++$cnt, $label.
" #1 %");
741 $worksheet->write($a_row, ++$cnt, $label.
" #2");
742 $worksheet->write($a_row, ++$cnt, $label.
" #2");
743 $worksheet->write($a_row, ++$cnt, $label.
" #2 %");
744 $worksheet->write($a_row, ++$cnt, $label.
" #3");
745 $worksheet->write($a_row, ++$cnt, $label.
" #3");
746 $worksheet->write($a_row, ++$cnt, $label.
" #3 %");
747 $worksheet->write($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others"));
748 $worksheet->write($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others"));
749 $worksheet->write($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others").
" %");
754 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
755 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
761 foreach($valid_status as $status)
764 $worksheet->write($a_row, ++$cnt, $text);
765 $worksheet->write($a_row, ++$cnt, $text.
" %");
775 $worksheet->write($a_row, 0, $a_set[
"title"]);
782 $val = $this->
parseValue($c, $a_set[$c],
"user");
783 $worksheet->write($a_row, $cnt, $val);
788 foreach($a_set[$c] as $idx => $value)
792 $worksheet->write($a_row, $cnt, (
int)$value[
"absolute"]);
793 $worksheet->write($a_row, ++$cnt, $value[
"percentage"]);
797 $worksheet->write($a_row, $cnt, $value[
"caption"]);
798 $worksheet->write($a_row, ++$cnt, (
int)$value[
"absolute"]);
799 $worksheet->write($a_row, ++$cnt, $value[
"percentage"]);
803 if(
sizeof($a_set[$c]) < 4 && $c !=
"status")
805 for($loop = 4; $loop >
sizeof($a_set[$c]); $loop--)
807 $worksheet->write($a_row, $cnt,
"");
808 $worksheet->write($a_row, ++$cnt,
"");
809 $worksheet->write($a_row, ++$cnt,
"");
819 $a_csv->addColumn($this->lng->txt(
"title"));
824 $label = $labels[$c][
"txt"];
825 $label = str_replace(
"Ø", $this->lng->txt(
"trac_average"), $label);
826 $label = str_replace(
"∑", $this->lng->txt(
"trac_sum"), $label);
830 $a_csv->addColumn($label);
836 $a_csv->addColumn($label.
" #1");
837 $a_csv->addColumn($label.
" #1");
838 $a_csv->addColumn($label.
" #1 %");
839 $a_csv->addColumn($label.
" #2");
840 $a_csv->addColumn($label.
" #2");
841 $a_csv->addColumn($label.
" #2 %");
842 $a_csv->addColumn($label.
" #3");
843 $a_csv->addColumn($label.
" #3");
844 $a_csv->addColumn($label.
" #3 %");
845 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others"));
846 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others"));
847 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others").
" %");
852 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
853 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
858 foreach($valid_status as $status)
861 $a_csv->addColumn($text);
862 $a_csv->addColumn($text.
" %");
873 $a_csv->addColumn($a_set[
"title"]);
879 $val = $this->
parseValue($c, $a_set[$c],
"user");
880 $a_csv->addColumn($val);
884 foreach($a_set[$c] as $idx => $value)
888 $a_csv->addColumn($value[
"caption"]);
890 $a_csv->addColumn((
int)$value[
"absolute"]);
891 $a_csv->addColumn($value[
"percentage"]);
893 if(
sizeof($a_set[$c]) < 4 && $c !=
"status")
895 for($loop = 4; $loop >
sizeof($a_set[$c]); $loop--)
897 $a_csv->addColumn(
"");
898 $a_csv->addColumn(
"");
899 $a_csv->addColumn(
"");