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);
314 global
$lng, $rbacsystem;
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();
383 foreach(
$result[
"ref_ids"] as $check_ref_id)
385 if($rbacsystem->checkAccess(
"read_learning_progress", $check_ref_id))
393 foreach(array_keys(
$data[
"set"][$idx]) as $col_id)
395 if(!in_array($col_id, array(
"type",
"title",
"obj_id",
"ref_id",
"offline")))
397 $data[
"set"][$idx][$col_id] = null;
400 $data[
"set"][$idx][
"privacy_conflict"] =
true;
406 $users_no =
$result[
"user_total"];
408 $data[
"set"][$idx][
"gender"] = $this->
getItemsPercentages(
$result[
"gender"], $users_no, array(
"m"=>$lng->txt(
"gender_m"),
"f"=>$lng->txt(
"gender_f")));
415 foreach(
$result[
"status"] as $status_code => $status_counter)
418 if($status_code ===
"" || !in_array($status_code, $valid_status))
421 unset(
$result[
"status"][$status_code]);
428 $data[
"set"][$idx][
"percentage_avg"] = NULL;
464 $counter = $others_counter = $others_sum = 0;
465 foreach(
$data as $id => $count)
472 if($value_map && isset($value_map[$id]))
474 $caption = $value_map[$id];
479 $caption = $lng->txt(
"none");
482 $perc = round($count/$overall*100);
484 "caption" => $caption,
485 "absolute" => $count,
486 "percentage" => $perc
491 $others_sum += $count;
498 $perc = round($others_sum/$overall*100);
500 "caption" => $otherss_counter.
" ".$lng->txt(
"trac_others"),
501 "absolute" => $others_sum,
502 "percentage" => $perc
523 foreach($value_map as $id => $caption)
526 if(isset(
$data[$id]))
530 $perc = round($count/$overall*100);
533 "caption" => $caption,
534 "absolute" => $count,
535 "percentage" => $perc
547 $pos = strrpos($id,
"_");
550 $function = strtoupper(substr($id, $pos+1));
551 if(in_array($function, array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT")))
553 $id = substr($id, 0, $pos);
557 if(trim($value) ==
"")
561 return "--".$lng->txt(
"none").
"--";
567 case 'status_changed':
577 case "spent_seconds":
578 case "read_count_spent_seconds":
579 if(in_array($type, array(
"exc")))
585 include_once(
"./Services/Utilities/classes/class.ilFormat.php");
607 if(in_array($type, array(
"lm",
"dbk")))
625 $this->tpl->setVariable(
"ICON_ALT", $lng->txt($a_set[
"type"]));
626 $this->tpl->setVariable(
"TITLE", $a_set[
"title"]);
628 if($a_set[
"offline"] || $a_set[
"privacy_conflict"])
631 if($a_set[
"offline"])
633 $mess[] = $lng->txt(
"offline");
635 if($a_set[
"privacy_conflict"])
637 $mess[] = $lng->txt(
"status_no_permission");
639 $this->tpl->setCurrentBlock(
"status_bl");
640 $this->tpl->setVariable(
"TEXT_STATUS", implode(
", ", $mess));
641 $this->tpl->parseCurrentBlock();
658 case "percentage_avg":
661 $this->tpl->setVariable(strtoupper($c),
"");
666 $value = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
667 $this->tpl->setVariable(strtoupper($c), $value);
677 $this->tpl->setCurrentBlock(
"item_path");
680 $this->tpl->setVariable(
"PATH_ITEM", $path_item);
682 if(!$this->anonymized)
684 $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(),
'details_id',
$ref_id);
685 $this->tpl->setVariable(
"URL_DETAILS", $ilCtrl->getLinkTargetByClass($ilCtrl->getCmdClass(),
'details'));
686 $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(),
'details_id',
'');
687 $this->tpl->setVariable(
"TXT_DETAILS", $lng->txt(
'trac_participants'));
692 $this->tpl->setVariable(
"TXT_DETAILS", $lng->txt(
'view'));
695 $this->tpl->parseCurrentBlock();
699 $this->tpl->setCurrentBlock(
"item_command");
700 $ilCtrl->setParameterByClass(get_class($this),
'hide', $a_set[
"obj_id"]);
701 $this->tpl->setVariable(
"HREF_COMMAND", $ilCtrl->getLinkTargetByClass(get_class($this),
'hide'));
702 $this->tpl->setVariable(
"TXT_COMMAND", $this->lng->txt(
'trac_hide'));
703 $this->tpl->parseCurrentBlock();
705 $this->tpl->touchBlock(
"path_action");
713 foreach(
$data as $item)
715 $this->tpl->setCurrentBlock($id.
"_row");
716 $this->tpl->setVariable(
"CAPTION", $item[
"caption"]);
717 $this->tpl->setVariable(
"ABSOLUTE", $item[
"absolute"]);
718 $this->tpl->setVariable(
"PERCENTAGE", $item[
"percentage"]);
719 $this->tpl->parseCurrentBlock();
724 $this->tpl->touchBlock($id);;
730 if(in_array($a_name, array(
"country",
"gender",
"city",
"language",
"status",
"mark")))
739 $pos = strrpos($a_field,
"_");
742 $function = strtoupper(substr($a_field, $pos+1));
743 if(in_array($function, array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT",
"TOTAL")))
753 $worksheet->write($a_row, 0, $this->lng->txt(
"title"));
759 $label = $labels[$c][
"txt"];
760 $label = str_replace(
"Ø", $this->lng->txt(
"trac_average"), $label);
761 $label = str_replace(
"∑", $this->lng->txt(
"trac_sum"), $label);
765 $worksheet->write($a_row, $cnt, $label);
772 $worksheet->write($a_row, $cnt, $label.
" #1");
773 $worksheet->write($a_row, ++$cnt, $label.
" #1");
774 $worksheet->write($a_row, ++$cnt, $label.
" #1 %");
775 $worksheet->write($a_row, ++$cnt, $label.
" #2");
776 $worksheet->write($a_row, ++$cnt, $label.
" #2");
777 $worksheet->write($a_row, ++$cnt, $label.
" #2 %");
778 $worksheet->write($a_row, ++$cnt, $label.
" #3");
779 $worksheet->write($a_row, ++$cnt, $label.
" #3");
780 $worksheet->write($a_row, ++$cnt, $label.
" #3 %");
781 $worksheet->write($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others"));
782 $worksheet->write($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others"));
783 $worksheet->write($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others").
" %");
788 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
789 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
795 foreach($valid_status as $status)
798 $worksheet->write($a_row, ++$cnt, $text);
799 $worksheet->write($a_row, ++$cnt, $text.
" %");
809 $worksheet->write($a_row, 0, $a_set[
"title"]);
816 $val = $this->
parseValue($c, $a_set[$c],
"user");
817 $worksheet->write($a_row, $cnt, $val);
822 foreach($a_set[$c] as $idx => $value)
826 $worksheet->write($a_row, $cnt, (
int)$value[
"absolute"]);
827 $worksheet->write($a_row, ++$cnt, $value[
"percentage"]);
831 $worksheet->write($a_row, $cnt, $value[
"caption"]);
832 $worksheet->write($a_row, ++$cnt, (
int)$value[
"absolute"]);
833 $worksheet->write($a_row, ++$cnt, $value[
"percentage"]);
837 if(
sizeof($a_set[$c]) < 4 && $c !=
"status")
839 for($loop = 4; $loop >
sizeof($a_set[$c]); $loop--)
841 $worksheet->write($a_row, $cnt,
"");
842 $worksheet->write($a_row, ++$cnt,
"");
843 $worksheet->write($a_row, ++$cnt,
"");
853 $a_csv->addColumn($this->lng->txt(
"title"));
858 $label = $labels[$c][
"txt"];
859 $label = str_replace(
"Ø", $this->lng->txt(
"trac_average"), $label);
860 $label = str_replace(
"∑", $this->lng->txt(
"trac_sum"), $label);
864 $a_csv->addColumn($label);
870 $a_csv->addColumn($label.
" #1");
871 $a_csv->addColumn($label.
" #1");
872 $a_csv->addColumn($label.
" #1 %");
873 $a_csv->addColumn($label.
" #2");
874 $a_csv->addColumn($label.
" #2");
875 $a_csv->addColumn($label.
" #2 %");
876 $a_csv->addColumn($label.
" #3");
877 $a_csv->addColumn($label.
" #3");
878 $a_csv->addColumn($label.
" #3 %");
879 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others"));
880 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others"));
881 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others").
" %");
886 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
887 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
892 foreach($valid_status as $status)
895 $a_csv->addColumn($text);
896 $a_csv->addColumn($text.
" %");
907 $a_csv->addColumn($a_set[
"title"]);
913 $val = $this->
parseValue($c, $a_set[$c],
"user");
914 $a_csv->addColumn($val);
918 foreach($a_set[$c] as $idx => $value)
922 $a_csv->addColumn($value[
"caption"]);
924 $a_csv->addColumn((
int)$value[
"absolute"]);
925 $a_csv->addColumn($value[
"percentage"]);
927 if(
sizeof($a_set[$c]) < 4 && $c !=
"status")
929 for($loop = 4; $loop >
sizeof($a_set[$c]); $loop--)
931 $a_csv->addColumn(
"");
932 $a_csv->addColumn(
"");
933 $a_csv->addColumn(
"");