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";
106 $all[] =
'status_changed_max';
109 $privacy = array(
"gender",
"city",
"country",
"sel_country");
110 foreach($privacy as $field)
112 if($ilSetting->get(
"usr_settings_course_export_".$field))
120 $default[] =
"percentage_avg";
121 $default[] =
"status";
126 $all[] =
"first_access_min";
127 $all[] =
"last_access_max";
130 $all[] =
"create_date_min";
131 $all[] =
"create_date_max";
135 foreach($all as $column)
140 if(substr($l, -3) ==
"avg")
144 else if(substr($l, -3) ==
"sum" || $l ==
"user_total")
149 if(isset($lng_map[$l]))
156 if(in_array($column, array(
"read_count_avg",
"spent_seconds_avg",
"percentage_avg")))
158 $txt .=
" / ".$lng->txt(
"user");
163 "default" => (in_array($column, $default) ?
true :
false)
176 if($this->ref_id == ROOT_FOLDER_ID)
182 $this->filter[
"user_total"] = $item->getValue();
185 $lng->txt(
"trac_read_count"));
186 $this->filter[
"read_count"] = $item->getValue();
189 true, $lng->txt(
"trac_spent_seconds"));
190 $this->filter[
"spent_seconds"][
"from"] = $item->getCombinationItem(
"from")->getValueInSeconds();
191 $this->filter[
"spent_seconds"][
"to"] = $item->getCombinationItem(
"to")->getValueInSeconds();
194 $lng->txt(
"trac_percentage"));
195 $this->filter[
"percentage"] = $item->getValue();
197 include_once
"Services/Tracking/classes/class.ilLPStatus.php";
199 $item->setOptions(array(
"" => $lng->txt(
"trac_all"),
204 $this->filter[
"status"] = $item->getValue();
205 if($this->filter[
"status"])
207 $this->filter[
"status"]--;
211 $this->filter[
"status_changed"] = $item->getDate();
214 $lng->txt(
"trac_mark"));
215 $this->filter[
"mark"] = $item->getValue();
217 if($ilSetting->get(
"usr_settings_course_export_gender"))
220 $item->setOptions(array(
"" => $lng->txt(
"trac_all"),
"m" => $lng->txt(
"gender_m"),
221 "f" => $lng->txt(
"gender_f")));
222 $this->filter[
"gender"] = $item->getValue();
225 if($ilSetting->get(
"usr_settings_course_export_city"))
228 $this->filter[
"city"] = $item->getValue();
231 if($ilSetting->get(
"usr_settings_course_export_country"))
234 $this->filter[
"country"] = $item->getValue();
237 if($ilSetting->get(
"usr_settings_course_export_sel_country"))
241 $this->filter[
"sel_country"] = $item->getValue();
245 $this->filter[
"language"] = $item->getValue();
248 $this->filter[
"first_access"] = $item->getDate();
251 $this->filter[
"last_access"] = $item->getDate();
254 $this->filter[
"registration"] = $item->getDate();
261 include_once(
"./Services/Utilities/classes/class.ilCountry.php");
265 $options[$c] = $lng->txt(
"meta_c_".$c);
281 include_once(
"./Services/Tracking/classes/class.ilTrQuery.php");
283 $preselected_obj_ids =
$filter = NULL;
284 if($this->ref_id == ROOT_FOLDER_ID)
309 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
310 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
312 $status_map = array();
313 foreach($valid_status as $status)
321 $languages = array();
322 foreach ($lng->getInstalledLanguages() as $lang_key)
324 $languages[$lang_key] = $lng->txt(
"lang_".$lang_key);
333 include_once
"Modules/Session/classes/class.ilObjSession.php";
335 $data[
"set"][$idx][
"title"] =
$sess->getFirstAppointment()->appointmentToString();
341 $users_no =
$result[
"user_total"];
343 $data[
"set"][$idx][
"gender"] = $this->
getItemsPercentages(
$result[
"gender"], $users_no, array(
"m"=>$lng->txt(
"gender_m"),
"f"=>$lng->txt(
"gender_f")));
350 foreach(
$result[
"status"] as $status_code => $status_counter)
353 if($status_code ===
"" || !in_array($status_code, $valid_status))
356 unset(
$result[
"status"][$status_code]);
363 $data[
"set"][$idx][
"percentage_avg"] = NULL;
399 $counter = $others_counter = $others_sum = 0;
400 foreach(
$data as $id => $count)
407 if($value_map && isset($value_map[$id]))
409 $caption = $value_map[$id];
414 $caption = $lng->txt(
"none");
417 $perc = round($count/$overall*100);
419 "caption" => $caption,
420 "absolute" => $count,
421 "percentage" => $perc
426 $others_sum += $count;
433 $perc = round($others_sum/$overall*100);
435 "caption" => $otherss_counter.
" ".$lng->txt(
"trac_others"),
436 "absolute" => $others_sum,
437 "percentage" => $perc
458 foreach($value_map as $id => $caption)
461 if(isset(
$data[$id]))
465 $perc = round($count/$overall*100);
468 "caption" => $caption,
469 "absolute" => $count,
470 "percentage" => $perc
482 $pos = strrpos($id,
"_");
485 $function = strtoupper(substr($id, $pos+1));
486 if(in_array($function, array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT")))
488 $id = substr($id, 0, $pos);
492 if(trim($value) ==
"")
496 return "--".$lng->txt(
"none").
"--";
502 case 'status_changed':
512 case "spent_seconds":
513 case "read_count_spent_seconds":
514 if(in_array($type, array(
"exc")))
520 include_once(
"./classes/class.ilFormat.php");
542 if(in_array($type, array(
"lm",
"dbk")))
560 $this->tpl->setVariable(
"ICON_ALT", $lng->txt($a_set[
"type"]));
561 $this->tpl->setVariable(
"TITLE", $a_set[
"title"]);
563 if($a_set[
"offline"])
565 $this->tpl->setCurrentBlock(
"offline");
566 $this->tpl->setVariable(
"TEXT_STATUS", $this->lng->txt(
"status"));
567 $this->tpl->setVariable(
"TEXT_OFFLINE", $this->lng->txt(
"offline"));
568 $this->tpl->parseCurrentBlock();
585 case "percentage_avg":
588 $this->tpl->setVariable(strtoupper($c),
"");
593 $value = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
594 $this->tpl->setVariable(strtoupper($c), $value);
599 if($this->ref_id == ROOT_FOLDER_ID)
604 $this->tpl->setCurrentBlock(
"item_path");
607 $this->tpl->setVariable(
"PATH_ITEM", $path_item);
609 if(!$this->anonymized)
611 $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(),
'details_id',
$ref_id);
612 $this->tpl->setVariable(
"URL_DETAILS", $ilCtrl->getLinkTargetByClass($ilCtrl->getCmdClass(),
'details'));
613 $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(),
'details_id',
'');
614 $this->tpl->setVariable(
"TXT_DETAILS", $lng->txt(
'trac_participants'));
619 $this->tpl->setVariable(
"TXT_DETAILS", $lng->txt(
'view'));
622 $this->tpl->parseCurrentBlock();
626 $this->tpl->setCurrentBlock(
"item_command");
627 $ilCtrl->setParameterByClass(get_class($this),
'hide', $a_set[
"obj_id"]);
628 $this->tpl->setVariable(
"HREF_COMMAND", $ilCtrl->getLinkTargetByClass(get_class($this),
'hide'));
629 $this->tpl->setVariable(
"TXT_COMMAND", $this->lng->txt(
'trac_hide'));
630 $this->tpl->parseCurrentBlock();
632 $this->tpl->touchBlock(
"path_action");
640 foreach(
$data as $item)
642 $this->tpl->setCurrentBlock($id.
"_row");
643 $this->tpl->setVariable(
"CAPTION", $item[
"caption"]);
644 $this->tpl->setVariable(
"ABSOLUTE", $item[
"absolute"]);
645 $this->tpl->setVariable(
"PERCENTAGE", $item[
"percentage"]);
646 $this->tpl->parseCurrentBlock();
651 $this->tpl->touchBlock($id);;
657 if(in_array($a_name, array(
"country",
"gender",
"city",
"language",
"status",
"mark")))
666 $pos = strrpos($a_field,
"_");
669 $function = strtoupper(substr($a_field, $pos+1));
670 if(in_array($function, array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT",
"TOTAL")))
680 $worksheet->write($a_row, 0, $this->lng->txt(
"title"));
686 $label = $labels[$c][
"txt"];
687 $label = str_replace(
"Ø", $this->lng->txt(
"trac_average"), $label);
688 $label = str_replace(
"∑", $this->lng->txt(
"trac_sum"), $label);
692 $worksheet->write($a_row, $cnt, $label);
699 $worksheet->write($a_row, $cnt, $label.
" #1");
700 $worksheet->write($a_row, ++$cnt, $label.
" #1");
701 $worksheet->write($a_row, ++$cnt, $label.
" #1 %");
702 $worksheet->write($a_row, ++$cnt, $label.
" #2");
703 $worksheet->write($a_row, ++$cnt, $label.
" #2");
704 $worksheet->write($a_row, ++$cnt, $label.
" #2 %");
705 $worksheet->write($a_row, ++$cnt, $label.
" #3");
706 $worksheet->write($a_row, ++$cnt, $label.
" #3");
707 $worksheet->write($a_row, ++$cnt, $label.
" #3 %");
708 $worksheet->write($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others"));
709 $worksheet->write($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others"));
710 $worksheet->write($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others").
" %");
715 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
716 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
719 foreach($valid_status as $status)
722 $worksheet->write($a_row, ++$cnt, $text);
723 $worksheet->write($a_row, ++$cnt, $text.
" %");
733 $worksheet->write($a_row, 0, $a_set[
"title"]);
740 $val = $this->
parseValue($c, $a_set[$c],
"user");
741 $worksheet->write($a_row, $cnt, $val);
746 foreach($a_set[$c] as $idx => $value)
750 $worksheet->write($a_row, $cnt, (
int)$value[
"absolute"]);
751 $worksheet->write($a_row, ++$cnt, $value[
"percentage"]);
755 $worksheet->write($a_row, $cnt, $value[
"caption"]);
756 $worksheet->write($a_row, ++$cnt, (
int)$value[
"absolute"]);
757 $worksheet->write($a_row, ++$cnt, $value[
"percentage"]);
761 if(
sizeof($a_set[$c]) < 4 && $c !=
"status")
763 for($loop = 4; $loop >
sizeof($a_set[$c]); $loop--)
765 $worksheet->write($a_row, $cnt,
"");
766 $worksheet->write($a_row, ++$cnt,
"");
767 $worksheet->write($a_row, ++$cnt,
"");
777 $a_csv->addColumn($this->lng->txt(
"title"));
782 $label = $labels[$c][
"txt"];
783 $label = str_replace(
"Ø", $this->lng->txt(
"trac_average"), $label);
784 $label = str_replace(
"∑", $this->lng->txt(
"trac_sum"), $label);
788 $a_csv->addColumn($label);
794 $a_csv->addColumn($label.
" #1");
795 $a_csv->addColumn($label.
" #1");
796 $a_csv->addColumn($label.
" #1 %");
797 $a_csv->addColumn($label.
" #2");
798 $a_csv->addColumn($label.
" #2");
799 $a_csv->addColumn($label.
" #2 %");
800 $a_csv->addColumn($label.
" #3");
801 $a_csv->addColumn($label.
" #3");
802 $a_csv->addColumn($label.
" #3 %");
803 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others"));
804 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others"));
805 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others").
" %");
810 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
811 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
813 foreach($valid_status as $status)
816 $a_csv->addColumn($text);
817 $a_csv->addColumn($text.
" %");
828 $a_csv->addColumn($a_set[
"title"]);
834 $val = $this->
parseValue($c, $a_set[$c],
"user");
835 $a_csv->addColumn($val);
839 foreach($a_set[$c] as $idx => $value)
843 $a_csv->addColumn($value[
"caption"]);
845 $a_csv->addColumn((
int)$value[
"absolute"]);
846 $a_csv->addColumn($value[
"percentage"]);
848 if(
sizeof($a_set[$c]) < 4 && $c !=
"status")
850 for($loop = 4; $loop >
sizeof($a_set[$c]); $loop--)
852 $a_csv->addColumn(
"");
853 $a_csv->addColumn(
"");
854 $a_csv->addColumn(
"");