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"));
73 $this->
setFormAction($ilCtrl->getFormActionByClass(get_class($this)));
74 $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";
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::initBaseFilter(
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)
388 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
389 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
394 $status_map =
array();
395 foreach($valid_status as $status)
403 $lng->loadLanguageModule(
"meta");
405 foreach ($lng->getInstalledLanguages() as $lang_key)
407 $languages[$lang_key] = $lng->txt(
"meta_l_".$lang_key);
416 include_once
"Modules/Session/classes/class.ilObjSession.php";
418 $data[
"set"][$idx][
"title"] =
$sess->getFirstAppointment()->appointmentToString();
427 foreach(
$result[
"ref_ids"] as $check_ref_id)
429 include_once
'./Services/Tracking/classes/class.ilLearningProgressAccess.php';
438 foreach(array_keys(
$data[
"set"][$idx]) as $col_id)
440 if(!in_array($col_id,
array(
"type",
"title",
"obj_id",
"ref_id",
"offline")))
442 $data[
"set"][$idx][$col_id] = null;
445 $data[
"set"][$idx][
"privacy_conflict"] =
true;
451 $users_no =
$result[
"user_total"];
460 foreach(
$result[
"status"] as $status_code => $status_counter)
463 if($status_code ===
"" || !in_array($status_code, $valid_status))
466 unset(
$result[
"status"][$status_code]);
473 $data[
"set"][$idx][
"percentage_avg"] = NULL;
509 $counter = $others_counter = $others_sum = 0;
510 foreach(
$data as $id => $count)
517 if($value_map && isset($value_map[$id]))
519 $caption = $value_map[$id];
524 $caption = $lng->txt(
"none");
527 $perc = round($count/$overall*100);
529 "caption" => $caption,
530 "absolute" => $count,
531 "percentage" => $perc
536 $others_sum += $count;
543 $perc = round($others_sum/$overall*100);
545 "caption" => $otherss_counter.
" ".$lng->txt(
"trac_others"),
546 "absolute" => $others_sum,
547 "percentage" => $perc
568 foreach($value_map as $id => $caption)
571 if(isset(
$data[$id]))
575 $perc = round($count/$overall*100);
578 "caption" => $caption,
579 "absolute" => $count,
580 "percentage" => $perc
592 $pos = strrpos($id,
"_");
595 $function = strtoupper(substr($id, $pos+1));
596 if(in_array($function,
array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT")))
598 $id = substr($id, 0, $pos);
602 if(trim($value) ==
"")
606 return "--".$lng->txt(
"none").
"--";
612 case 'status_changed':
622 case "spent_seconds":
623 case "read_count_spent_seconds":
664 $this->tpl->setVariable(
"ICON_ALT", $lng->txt($a_set[
"type"]));
665 $this->tpl->setVariable(
"TITLE", $a_set[
"title"]);
667 if($a_set[
"offline"] || $a_set[
"privacy_conflict"])
670 if($a_set[
"offline"])
672 $mess[] = $lng->txt(
"offline");
674 if($a_set[
"privacy_conflict"])
676 $mess[] = $lng->txt(
"status_no_permission");
678 $this->tpl->setCurrentBlock(
"status_bl");
679 $this->tpl->setVariable(
"TEXT_STATUS", implode(
", ", $mess));
680 $this->tpl->parseCurrentBlock();
697 case "percentage_avg":
700 $this->tpl->setVariable(strtoupper($c),
"");
705 $value = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
706 $this->tpl->setVariable(strtoupper($c), $value);
716 $this->tpl->setCurrentBlock(
"item_path");
719 $this->tpl->setVariable(
"PATH_ITEM", $path_item);
721 if(!$this->anonymized)
723 $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(),
'details_id',
$ref_id);
724 $this->tpl->setVariable(
"URL_DETAILS", $ilCtrl->getLinkTargetByClass($ilCtrl->getCmdClass(),
'details'));
725 $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(),
'details_id',
'');
726 $this->tpl->setVariable(
"TXT_DETAILS", $lng->txt(
'trac_participants'));
731 $this->tpl->setVariable(
"TXT_DETAILS", $lng->txt(
'view'));
734 $this->tpl->parseCurrentBlock();
738 $this->tpl->setCurrentBlock(
"item_command");
739 $ilCtrl->setParameterByClass(get_class($this),
'hide', $a_set[
"obj_id"]);
740 $this->tpl->setVariable(
"HREF_COMMAND", $ilCtrl->getLinkTargetByClass(get_class($this),
'hide'));
741 $this->tpl->setVariable(
"TXT_COMMAND", $this->lng->txt(
'trac_hide'));
742 $this->tpl->parseCurrentBlock();
744 $this->tpl->touchBlock(
"path_action");
746 else if($a_set[
"ref_ids"])
749 include_once
'./Services/Tree/classes/class.ilPathGUI.php';
751 $path =
$path->getPath($this->ref_id, array_pop($a_set[
"ref_ids"]));
754 $this->tpl->setVariable(
'COLL_PATH', $this->lng->txt(
'path').
': '.
$path);
763 foreach(
$data as $item)
765 $this->tpl->setCurrentBlock($id.
"_row");
766 $this->tpl->setVariable(
"CAPTION", $item[
"caption"]);
767 $this->tpl->setVariable(
"ABSOLUTE", $item[
"absolute"]);
768 $this->tpl->setVariable(
"PERCENTAGE", $item[
"percentage"]);
769 $this->tpl->parseCurrentBlock();
774 $this->tpl->touchBlock($id);;
780 if(in_array($a_name,
array(
"country",
"gender",
"city",
"language",
"status",
"mark",
'sel_country')))
789 $pos = strrpos($a_field,
"_");
792 $function = strtoupper(substr($a_field, $pos+1));
793 if(in_array($function,
array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT",
"TOTAL")))
803 $a_excel->
setCell($a_row, 0, $this->lng->txt(
"title"));
809 $label = $labels[$c][
"txt"];
810 $label = str_replace(
"Ø", $this->lng->txt(
"trac_average"), $label);
811 $label = str_replace(
"∑", $this->lng->txt(
"trac_sum"), $label);
815 $a_excel->
setCell($a_row, $cnt, $label);
822 $a_excel->
setCell($a_row, $cnt, $label.
" #1");
823 $a_excel->
setCell($a_row, ++$cnt, $label.
" #1");
824 $a_excel->
setCell($a_row, ++$cnt, $label.
" #1 %");
825 $a_excel->
setCell($a_row, ++$cnt, $label.
" #2");
826 $a_excel->
setCell($a_row, ++$cnt, $label.
" #2");
827 $a_excel->
setCell($a_row, ++$cnt, $label.
" #2 %");
828 $a_excel->
setCell($a_row, ++$cnt, $label.
" #3");
829 $a_excel->
setCell($a_row, ++$cnt, $label.
" #3");
830 $a_excel->
setCell($a_row, ++$cnt, $label.
" #3 %");
831 $a_excel->
setCell($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others"));
832 $a_excel->
setCell($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others"));
833 $a_excel->
setCell($a_row, ++$cnt, $label.
" ".$this->lng->txt(
"trac_others").
" %");
838 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
839 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
845 foreach($valid_status as $status)
861 $a_excel->
setCell($a_row, 0, $a_set[
"title"]);
868 $val = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
869 $a_excel->
setCell($a_row, $cnt, $val);
874 foreach((
array) $a_set[$c] as $idx => $value)
878 $a_excel->
setCell($a_row, $cnt, (
int)$value[
"absolute"]);
879 $a_excel->
setCell($a_row, ++$cnt, $value[
"percentage"].
"%");
883 $a_excel->
setCell($a_row, $cnt, $value[
"caption"]);
884 $a_excel->
setCell($a_row, ++$cnt, (
int)$value[
"absolute"]);
885 $a_excel->
setCell($a_row, ++$cnt, $value[
"percentage"].
"%");
889 if(
sizeof($a_set[$c]) < 4 && $c !=
"status")
891 for($loop = 4; $loop >
sizeof($a_set[$c]); $loop--)
893 $a_excel->
setCell($a_row, $cnt,
"");
894 $a_excel->
setCell($a_row, ++$cnt,
"");
895 $a_excel->
setCell($a_row, ++$cnt,
"");
905 $a_csv->addColumn($this->lng->txt(
"title"));
910 $label = $labels[$c][
"txt"];
911 $label = str_replace(
"Ø", $this->lng->txt(
"trac_average"), $label);
912 $label = str_replace(
"∑", $this->lng->txt(
"trac_sum"), $label);
916 $a_csv->addColumn($label);
922 $a_csv->addColumn($label.
" #1");
923 $a_csv->addColumn($label.
" #1");
924 $a_csv->addColumn($label.
" #1 %");
925 $a_csv->addColumn($label.
" #2");
926 $a_csv->addColumn($label.
" #2");
927 $a_csv->addColumn($label.
" #2 %");
928 $a_csv->addColumn($label.
" #3");
929 $a_csv->addColumn($label.
" #3");
930 $a_csv->addColumn($label.
" #3 %");
931 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others"));
932 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others"));
933 $a_csv->addColumn($label.
" ".$this->lng->txt(
"trac_others").
" %");
938 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
939 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
944 foreach($valid_status as $status)
947 $a_csv->addColumn(
$text);
948 $a_csv->addColumn(
$text.
" %");
959 $a_csv->addColumn($a_set[
"title"]);
965 $val = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
966 $a_csv->addColumn($val);
970 foreach((
array) $a_set[$c] as $idx => $value)
974 $a_csv->addColumn($value[
"caption"]);
976 $a_csv->addColumn((
int)$value[
"absolute"]);
977 $a_csv->addColumn($value[
"percentage"]);
979 if(
sizeof($a_set[$c]) < 4 && $c !=
"status")
981 for($loop = 4; $loop >
sizeof($a_set[$c]); $loop--)
983 $a_csv->addColumn(
"");
984 $a_csv->addColumn(
"");
985 $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.
static _getImagePathForStatus($a_status)
Get image path for status.
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
static _getStatusText($a_status, $a_lng=null)
Get status alt text.
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
const EXTENDED_DATA_READ_COUNT
fillRowExcel(ilExcel $a_excel, &$a_row, $a_set)
parseTitle($a_obj_id, $action, $a_user_id=false)
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
fillHeaderExcel(ilExcel $a_excel, &$a_row)
const FILTER_DATETIME_RANGE
static secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
getColumnCoord($a_col)
Get column "name" from number.
TableGUI class for learning progress.
if(!is_array($argv)) $options
setBold($a_coords)
Set cell(s) to bold.
static isObjectOffline($a_obj_id, $a_type=null)
const FILTER_DURATION_RANGE
static _lookupObjId($a_id)
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.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
const EXTENDED_DATA_SPENT_SECONDS
static supportsMark($a_obj_type)
setCell($a_row, $a_col, $a_value)
Set cell value.
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