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);
35 if(!$objDefinition->isContainer($type))
38 include_once
'./Services/Object/classes/class.ilObjectLP.php';
43 parent::__construct($a_parent_obj, $a_parent_cmd);
50 $this->
parseTitle($this->obj_id,
"trac_summary");
55 $this->
addColumn($this->lng->txt(
"title"),
"title");
66 $this->
addColumn($this->lng->txt(
"path"));
67 $this->
addColumn($this->lng->txt(
"action"));
74 $this->
setFormAction($ilCtrl->getFormActionByClass(get_class($this)));
75 $this->
setRowTemplate(
"tpl.trac_summary_row.html",
"Services/Tracking");
77 $this->
getItems($a_parent_obj->getObjId(), $a_ref_id);
84 $lng_map = array(
"user_total" =>
"users",
"first_access_min" =>
"trac_first_access",
85 "last_access_max" =>
"trac_last_access",
"mark" =>
"trac_mark",
"status" =>
"trac_status",
86 'status_changed_max' =>
'trac_status_changed',
87 "spent_seconds_avg" =>
"trac_spent_seconds",
"percentage_avg" =>
"trac_percentage",
88 "read_count_sum" =>
"trac_read_count",
"read_count_avg" =>
"trac_read_count",
89 "read_count_spent_seconds_avg" =>
"trac_read_count_spent_seconds" 93 $all = array(
"user_total");
97 include_once
'Services/Tracking/classes/class.ilObjUserTracking.php';
101 $all[] =
"read_count_sum";
102 $all[] =
"read_count_avg";
103 $default[] =
"read_count_sum";
109 $all[] =
"spent_seconds_avg";
110 $default[] =
"spent_seconds_avg";
118 $all[] =
"read_count_spent_seconds_avg";
126 $all[] =
"percentage_avg";
129 if($this->is_root || !$this->olp || $this->olp->isActive())
132 $all[] =
'status_changed_max';
140 $privacy = array(
"gender",
"city",
"country",
"sel_country");
141 foreach($privacy as $field)
143 if($ilSetting->get(
"usr_settings_course_export_".$field))
151 $default[] =
"percentage_avg";
152 $default[] =
"status";
157 $all[] =
"first_access_min";
158 $all[] =
"last_access_max";
161 $all[] =
"create_date_min";
162 $all[] =
"create_date_max";
165 foreach($all as $column)
170 if(substr(
$l, -3) ==
"avg")
174 else if(substr(
$l, -3) ==
"sum" ||
$l ==
"user_total")
179 if(isset($lng_map[
$l]))
186 if(in_array($column, array(
"read_count_avg",
"spent_seconds_avg",
"percentage_avg")))
188 $txt .=
" / ".$lng->txt(
"user");
193 "default" => (in_array($column, $default) ?
true :
false)
208 return parent::initFilter(
true,
false);
212 include_once
'Services/Tracking/classes/class.ilObjUserTracking.php';
216 "∑ ".$lng->txt(
"users"));
217 $this->filter[
"user_total"] = $item->getValue();
222 "∑ ".$lng->txt(
"trac_read_count"));
223 $this->filter[
"read_count"] = $item->getValue();
231 true,
"Ø ".$lng->txt(
"trac_spent_seconds").
" / ".$lng->txt(
"user"));
232 $this->filter[
"spent_seconds"][
"from"] = $item->getCombinationItem(
"from")->getValueInSeconds();
233 $this->filter[
"spent_seconds"][
"to"] = $item->getCombinationItem(
"to")->getValueInSeconds();
240 "Ø ".$lng->txt(
"trac_percentage").
" / ".$lng->txt(
"user"));
241 $this->filter[
"percentage"] = $item->getValue();
244 if($this->is_root || !$this->olp || $this->olp->isActive())
246 include_once
"Services/Tracking/classes/class.ilLPStatus.php";
248 $item->setOptions(array(
"" => $lng->txt(
"trac_all"),
253 $this->filter[
"status"] = $item->getValue();
254 if($this->filter[
"status"])
256 $this->filter[
"status"]--;
260 $this->filter[
"status_changed"] = $item->getDate();
266 $lng->txt(
"trac_mark"));
267 $this->filter[
"mark"] = $item->getValue();
270 if($ilSetting->get(
"usr_settings_course_export_gender"))
273 $item->setOptions(array(
"" => $lng->txt(
"trac_all"),
"m" => $lng->txt(
"gender_m"),
274 "f" => $lng->txt(
"gender_f")));
275 $this->filter[
"gender"] = $item->getValue();
278 if($ilSetting->get(
"usr_settings_course_export_city"))
281 $this->filter[
"city"] = $item->getValue();
284 if($ilSetting->get(
"usr_settings_course_export_country"))
287 $this->filter[
"country"] = $item->getValue();
290 if($ilSetting->get(
"usr_settings_course_export_sel_country"))
294 $this->filter[
"sel_country"] = $item->getValue();
298 $this->filter[
"language"] = $item->getValue();
303 $this->filter[
"first_access"] = $item->getDate();
306 $this->filter[
"last_access"] = $item->getDate();
310 $this->filter[
"registration"] = $item->getDate();
317 include_once(
"./Services/Utilities/classes/class.ilCountry.php");
321 $options[$c] = $lng->txt(
"meta_c_".$c);
335 global
$lng, $rbacsystem;
337 include_once(
"./Services/Tracking/classes/class.ilTrQuery.php");
340 $preselected_obj_ids =
$filter = NULL;
349 $collection = $olp->getCollectionInstance();
350 $preselected_obj_ids[$a_object_id][] = $a_ref_id;
351 foreach($collection->getItems() as $item => $item_info)
354 if($tmp_lp->isActive())
361 elseif($this->is_root)
386 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
387 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
392 $status_map = array();
393 foreach($valid_status as $status)
401 $lng->loadLanguageModule(
"meta");
402 $languages = array();
403 foreach ($lng->getInstalledLanguages() as $lang_key)
405 $languages[$lang_key] = $lng->txt(
"meta_l_".$lang_key);
414 include_once
"Modules/Session/classes/class.ilObjSession.php";
416 $data[
"set"][$idx][
"title"] =
$sess->getFirstAppointment()->appointmentToString();
425 foreach(
$result[
"ref_ids"] as $check_ref_id)
427 include_once
'./Services/Tracking/classes/class.ilLearningProgressAccess.php';
436 foreach(array_keys(
$data[
"set"][$idx]) as $col_id)
438 if(!in_array($col_id, array(
"type",
"title",
"obj_id",
"ref_id",
"offline")))
440 $data[
"set"][$idx][$col_id] = null;
443 $data[
"set"][$idx][
"privacy_conflict"] =
true;
449 $users_no =
$result[
"user_total"];
451 $data[
"set"][$idx][
"gender"] = $this->
getItemsPercentages(
$result[
"gender"], $users_no, array(
"m"=>$lng->txt(
"gender_m"),
"f"=>$lng->txt(
"gender_f")));
458 foreach(
$result[
"status"] as $status_code => $status_counter)
461 if($status_code ===
"" || !in_array($status_code, $valid_status))
464 unset(
$result[
"status"][$status_code]);
471 $data[
"set"][$idx][
"percentage_avg"] = NULL;
507 $counter = $others_counter = $others_sum = 0;
508 foreach(
$data as $id => $count)
515 if($value_map && isset($value_map[$id]))
517 $caption = $value_map[$id];
522 $caption = $lng->txt(
"none");
525 $perc = round($count/$overall*100);
527 "caption" => $caption,
528 "absolute" => $count,
529 "percentage" => $perc
534 $others_sum += $count;
541 $perc = round($others_sum/$overall*100);
543 "caption" => $otherss_counter.
" ".$lng->txt(
"trac_others"),
544 "absolute" => $others_sum,
545 "percentage" => $perc
566 foreach($value_map as $id => $caption)
569 if(isset(
$data[$id]))
573 $perc = round($count/$overall*100);
576 "caption" => $caption,
577 "absolute" => $count,
578 "percentage" => $perc
590 $pos = strrpos($id,
"_");
593 $function = strtoupper(substr($id, $pos+1));
594 if(in_array($function, array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT")))
596 $id = substr($id, 0, $pos);
600 if(trim($value) ==
"")
604 return "--".$lng->txt(
"none").
"--";
610 case 'status_changed':
620 case "spent_seconds":
621 case "read_count_spent_seconds":
628 include_once(
"./Services/Utilities/classes/class.ilFormat.php");
663 $this->tpl->setVariable(
"ICON_ALT", $lng->txt($a_set[
"type"]));
664 $this->tpl->setVariable(
"TITLE", $a_set[
"title"]);
666 if($a_set[
"offline"] || $a_set[
"privacy_conflict"])
669 if($a_set[
"offline"])
671 $mess[] = $lng->txt(
"offline");
673 if($a_set[
"privacy_conflict"])
675 $mess[] = $lng->txt(
"status_no_permission");
677 $this->tpl->setCurrentBlock(
"status_bl");
678 $this->tpl->setVariable(
"TEXT_STATUS", implode(
", ", $mess));
679 $this->tpl->parseCurrentBlock();
696 case "percentage_avg":
699 $this->tpl->setVariable(strtoupper($c),
"");
704 $value = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
705 $this->tpl->setVariable(strtoupper($c), $value);
715 $this->tpl->setCurrentBlock(
"item_path");
718 $this->tpl->setVariable(
"PATH_ITEM", $path_item);
720 if(!$this->anonymized)
722 $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(),
'details_id',
$ref_id);
723 $this->tpl->setVariable(
"URL_DETAILS", $ilCtrl->getLinkTargetByClass($ilCtrl->getCmdClass(),
'details'));
724 $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(),
'details_id',
'');
725 $this->tpl->setVariable(
"TXT_DETAILS", $lng->txt(
'trac_participants'));
730 $this->tpl->setVariable(
"TXT_DETAILS", $lng->txt(
'view'));
733 $this->tpl->parseCurrentBlock();
737 $this->tpl->setCurrentBlock(
"item_command");
738 $ilCtrl->setParameterByClass(get_class($this),
'hide', $a_set[
"obj_id"]);
739 $this->tpl->setVariable(
"HREF_COMMAND", $ilCtrl->getLinkTargetByClass(get_class($this),
'hide'));
740 $this->tpl->setVariable(
"TXT_COMMAND", $this->lng->txt(
'trac_hide'));
741 $this->tpl->parseCurrentBlock();
743 $this->tpl->touchBlock(
"path_action");
745 else if($a_set[
"ref_ids"])
748 include_once
'./Services/Tree/classes/class.ilPathGUI.php';
750 $path =
$path->getPath($this->ref_id, array_pop($a_set[
"ref_ids"]));
753 $this->tpl->setVariable(
'COLL_PATH', $this->lng->txt(
'path').
': '.
$path);
762 foreach(
$data as $item)
764 $this->tpl->setCurrentBlock($id.
"_row");
765 $this->tpl->setVariable(
"CAPTION", $item[
"caption"]);
766 $this->tpl->setVariable(
"ABSOLUTE", $item[
"absolute"]);
767 $this->tpl->setVariable(
"PERCENTAGE", $item[
"percentage"]);
768 $this->tpl->parseCurrentBlock();
773 $this->tpl->touchBlock($id);;
779 if(in_array($a_name, array(
"country",
"gender",
"city",
"language",
"status",
"mark")))
788 $pos = strrpos($a_field,
"_");
791 $function = strtoupper(substr($a_field, $pos+1));
792 if(in_array($function, array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT",
"TOTAL")))
802 $worksheet->write($a_row, 0, $this->lng->txt(
"title"));
808 $label = $labels[$c][
"txt"];
809 $label = str_replace(
"Ø", $this->lng->txt(
"trac_average"), $label);
810 $label = str_replace(
"∑", $this->lng->txt(
"trac_sum"), $label);
814 $worksheet->write($a_row, $cnt, $label);
821 $worksheet->write($a_row, $cnt, $label.
" #1");
822 $worksheet->write($a_row, ++$cnt, $label.
" #1");
823 $worksheet->write($a_row, ++$cnt, $label.
" #1 %");
824 $worksheet->write($a_row, ++$cnt, $label.
" #2");
825 $worksheet->write($a_row, ++$cnt, $label.
" #2");
826 $worksheet->write($a_row, ++$cnt, $label.
" #2 %");
827 $worksheet->write($a_row, ++$cnt, $label.
" #3");
828 $worksheet->write($a_row, ++$cnt, $label.
" #3");
829 $worksheet->write($a_row, ++$cnt, $label.
" #3 %");
830 $worksheet->write($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others"));
831 $worksheet->write($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others"));
832 $worksheet->write($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others").
" %");
837 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
838 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
844 foreach($valid_status as $status)
847 $worksheet->write($a_row, ++$cnt,
$text);
848 $worksheet->write($a_row, ++$cnt,
$text.
" %");
858 $worksheet->write($a_row, 0, $a_set[
"title"]);
865 $val = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
866 $worksheet->write($a_row, $cnt, $val);
871 foreach((array) $a_set[$c] as $idx => $value)
875 $worksheet->write($a_row, $cnt, (
int)$value[
"absolute"]);
876 $worksheet->write($a_row, ++$cnt, $value[
"percentage"]);
880 $worksheet->write($a_row, $cnt, $value[
"caption"]);
881 $worksheet->write($a_row, ++$cnt, (
int)$value[
"absolute"]);
882 $worksheet->write($a_row, ++$cnt, $value[
"percentage"]);
886 if(
sizeof($a_set[$c]) < 4 && $c !=
"status")
888 for($loop = 4; $loop >
sizeof($a_set[$c]); $loop--)
890 $worksheet->write($a_row, $cnt,
"");
891 $worksheet->write($a_row, ++$cnt,
"");
892 $worksheet->write($a_row, ++$cnt,
"");
902 $a_csv->addColumn($this->lng->txt(
"title"));
907 $label = $labels[$c][
"txt"];
908 $label = str_replace(
"Ø", $this->lng->txt(
"trac_average"), $label);
909 $label = str_replace(
"∑", $this->lng->txt(
"trac_sum"), $label);
913 $a_csv->addColumn($label);
919 $a_csv->addColumn($label.
" #1");
920 $a_csv->addColumn($label.
" #1");
921 $a_csv->addColumn($label.
" #1 %");
922 $a_csv->addColumn($label.
" #2");
923 $a_csv->addColumn($label.
" #2");
924 $a_csv->addColumn($label.
" #2 %");
925 $a_csv->addColumn($label.
" #3");
926 $a_csv->addColumn($label.
" #3");
927 $a_csv->addColumn($label.
" #3 %");
928 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others"));
929 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others"));
930 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others").
" %");
935 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
936 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
941 foreach($valid_status as $status)
944 $a_csv->addColumn(
$text);
945 $a_csv->addColumn(
$text.
" %");
956 $a_csv->addColumn($a_set[
"title"]);
962 $val = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
963 $a_csv->addColumn($val);
967 foreach((array) $a_set[$c] as $idx => $value)
971 $a_csv->addColumn($value[
"caption"]);
973 $a_csv->addColumn((
int)$value[
"absolute"]);
974 $a_csv->addColumn($value[
"percentage"]);
976 if(
sizeof($a_set[$c]) < 4 && $c !=
"status")
978 for($loop = 4; $loop >
sizeof($a_set[$c]); $loop--)
980 $a_csv->addColumn(
"");
981 $a_csv->addColumn(
"");
982 $a_csv->addColumn(
"");
const LP_STATUS_COMPLETED_NUM
renderPercentages($id, $data)
Creates a path for a start and endnode.
const EXTENDED_DATA_LAST_ACCESS
buildPath($ref_ids)
Build path with deep-link.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setExportFormats(array $formats)
Set available export formats.
const LP_MODE_MANUAL_BY_TUTOR
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=NULL)
Add filter by standard type.
getItemsPercentages(array $data=NULL, $overall, array $value_map=NULL, $limit=3)
Render data as needed for summary list (based on grouped values)
setPrintMode($a_value=false)
Toogle print mode.
fillRowCSV($a_csv, $a_set)
setShowTemplates($a_value)
Toggle templates.
const LP_STATUS_NOT_ATTEMPTED
searchObjects(array $filter, $permission, array $preset_obj_ids=null, $a_check_lp_activation=true)
Search objects that match current filters.
const LP_STATUS_IN_PROGRESS_NUM
const LP_MODE_COLLECTION_MANUAL
_getImagePathForStatus($a_status)
Get image path for status.
const EXTENDED_DATA_READ_COUNT
parseTitle($a_obj_id, $action, $a_user_id=false)
fillHeaderExcel($worksheet, &$a_row)
getItems($a_object_id, $a_ref_id)
Build summary item rows for given object and filter(s.
getOrderDirection()
Get order direction.
static checkPermission($a_permission, $a_ref_id, $a_user_id=null)
wrapper for rbac access checks
const FILTER_NUMBER_RANGE
const LP_STATUS_IN_PROGRESS
fillRowExcel($worksheet, &$a_row, $a_set)
const FILTER_DATETIME_RANGE
TableGUI class for learning progress.
if(!is_array($argv)) $options
static isObjectOffline($a_obj_id, $a_type=null)
const FILTER_DURATION_RANGE
static _lookupObjId($a_id)
_getStatusText($a_status, $a_lng=null)
Get status alt text.
parseValue($id, $value, $type)
static formatDate(ilDateTime $date)
Format a date public.
static getObjectsSummaryForObject($a_parent_obj_id, $a_parent_ref_id, $a_order_field="", $a_order_dir="", $a_offset=0, $a_limit=9999, array $a_filters=NULL, array $a_additional_fields=NULL, $a_preselected_obj_ids=NULL)
Get all aggregated tracking data for parent object.
isPercentageAvailable($a_obj_id)
getSelectedColumns()
Get selected columns.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
__construct($a_parent_obj, $a_parent_cmd, $a_ref_id, $a_print_mode=false)
Constructor.
fillRow($a_set)
Fill table row.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static _lookupType($a_id, $a_reference=false)
lookup object type
const EXTENDED_DATA_SPENT_SECONDS
static supportsMark($a_obj_type)
const LP_STATUS_NOT_ATTEMPTED_NUM
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
static supportsSpentSeconds($a_obj_type)
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
getItemsPercentagesStatus(array $data=NULL, $overall, array $value_map=NULL)
Render status data as needed for summary list (based on grouped values)
setEnableHeader($a_enableheader)
Set Enable Header.
static getCountryCodes()
Get country codes (DIN EN 3166-1)
numericOrdering($a_field)
setMaxCount($a_max_count)
set max.
getCurrentFilter($as_query=false)
const LP_STATUS_COMPLETED
static getInstance($a_obj_id)
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.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
setLimit($a_limit=0, $a_default_limit=0)
const LP_STATUS_FAILED_NUM