4 include_once(
"./Services/Tracking/classes/class.ilLPTableBaseGUI.php");
20 public function __construct($a_parent_obj, $a_parent_cmd, $a_ref_id, $a_print_mode =
false)
25 $objDefinition = $DIC[
'objDefinition'];
27 $this->
setId(
"trsmy");
29 $this->ref_id = $a_ref_id;
31 $this->is_root = ($a_ref_id == ROOT_FOLDER_ID);
33 if (!$this->is_root) {
37 if (!$objDefinition->isContainer(
$type)) {
39 include_once
'./Services/Object/classes/class.ilObjectLP.php';
44 parent::__construct($a_parent_obj, $a_parent_cmd);
50 $this->
parseTitle($this->obj_id,
"trac_summary");
55 $this->
addColumn($this->lng->txt(
"title"),
"title");
64 $this->
addColumn($this->lng->txt(
"path"));
65 $this->
addColumn($this->lng->txt(
"action"));
72 $this->
setRowTemplate(
"tpl.trac_summary_row.html",
"Services/Tracking");
75 $this->
getItems($a_parent_obj->getObjId(), $a_ref_id);
85 $lng_map = array(
"user_total" =>
"users",
"first_access_min" =>
"trac_first_access",
86 "last_access_max" =>
"trac_last_access",
"mark" =>
"trac_mark",
"status" =>
"trac_status",
87 'status_changed_max' =>
'trac_status_changed',
88 "spent_seconds_avg" =>
"trac_spent_seconds",
"percentage_avg" =>
"trac_percentage",
89 "read_count_sum" =>
"trac_read_count",
"read_count_avg" =>
"trac_read_count",
90 "read_count_spent_seconds_avg" =>
"trac_read_count_spent_seconds" 94 $all = array(
"user_total");
98 include_once
'Services/Tracking/classes/class.ilObjUserTracking.php';
101 $all[] =
"read_count_sum";
102 $all[] =
"read_count_avg";
107 $all[] =
"spent_seconds_avg";
114 $all[] =
"read_count_spent_seconds_avg";
121 $all[] =
"percentage_avg";
124 if ($this->is_root || !$this->olp || $this->olp->isActive()) {
126 $all[] =
'status_changed_max';
133 $privacy = array(
"gender",
"city",
"country",
"sel_country");
134 foreach ($privacy as $field) {
135 if (
$ilSetting->get(
"usr_settings_course_export_" . $field)) {
147 $all[] =
"first_access_min";
148 $all[] =
"last_access_max";
151 $all[] =
"create_date_min";
152 $all[] =
"create_date_max";
155 foreach ($all as $column) {
159 if (substr(
$l, -3) ==
"avg") {
161 } elseif (substr(
$l, -3) ==
"sum" ||
$l ==
"user_total") {
165 if (isset($lng_map[
$l])) {
171 if (in_array($column, array(
"read_count_avg",
"spent_seconds_avg",
"percentage_avg"))) {
177 "default" => (in_array($column,
$default) ?
true :
false)
193 if ($this->is_root) {
194 return parent::initBaseFilter(
true,
false);
198 include_once
'Services/Tracking/classes/class.ilObjUserTracking.php';
205 "∑ " .
$lng->txt(
"users")
207 $this->filter[
"user_total"] = $item->getValue();
214 "∑ " .
$lng->txt(
"trac_read_count")
216 $this->filter[
"read_count"] = $item->getValue();
225 "Ø " .
$lng->txt(
"trac_spent_seconds") .
" / " .
$lng->txt(
"user")
227 $this->filter[
"spent_seconds"][
"from"] = $item->getCombinationItem(
"from")->getValueInSeconds();
228 $this->filter[
"spent_seconds"][
"to"] = $item->getCombinationItem(
"to")->getValueInSeconds();
237 "Ø " .
$lng->txt(
"trac_percentage") .
" / " .
$lng->txt(
"user")
239 $this->filter[
"percentage"] = $item->getValue();
242 if ($this->is_root || !$this->olp || $this->olp->isActive()) {
243 include_once
"Services/Tracking/classes/class.ilLPStatus.php";
245 $item->setOptions(array(
"" =>
$lng->txt(
"trac_all"),
250 $this->filter[
"status"] = $item->getValue();
251 if ($this->filter[
"status"]) {
252 $this->filter[
"status"]--;
256 $this->filter[
"status_changed"] = $item->getDate();
264 $lng->txt(
"trac_mark")
266 $this->filter[
"mark"] = $item->getValue();
269 if (
$ilSetting->get(
"usr_settings_course_export_gender")) {
271 $item->setOptions(array(
272 "" =>
$lng->txt(
"trac_all"),
273 "n" =>
$lng->txt(
"gender_n"),
274 "m" =>
$lng->txt(
"gender_m"),
275 "f" =>
$lng->txt(
"gender_f"),
277 $this->filter[
"gender"] = $item->getValue();
280 if (
$ilSetting->get(
"usr_settings_course_export_city")) {
282 $this->filter[
"city"] = $item->getValue();
285 if (
$ilSetting->get(
"usr_settings_course_export_country")) {
287 $this->filter[
"country"] = $item->getValue();
290 if (
$ilSetting->get(
"usr_settings_course_export_sel_country")) {
293 $this->filter[
"sel_country"] = $item->getValue();
297 $this->filter[
"language"] = $item->getValue();
301 $this->filter[
"first_access"] = $item->getDate();
304 $this->filter[
"last_access"] = $item->getDate();
308 $this->filter[
"registration"] = $item->getDate();
317 include_once(
"./Services/Utilities/classes/class.ilCountry.php");
337 $rbacsystem = $DIC[
'rbacsystem'];
339 include_once(
"./Services/Tracking/classes/class.ilTrQuery.php");
342 $preselected_obj_ids =
$filter = null;
350 $collection = $olp->getCollectionInstance();
351 $preselected_obj_ids[$a_object_id][] = $a_ref_id;
352 foreach ($collection->getItems() as $item => $item_info) {
354 if ($tmp_lp->isActive()) {
359 } elseif ($this->is_root) {
383 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
384 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
389 $status_map = array();
390 foreach ($valid_status as $status) {
397 $lng->loadLanguageModule(
"meta");
399 foreach (
$lng->getInstalledLanguages() as $lang_key) {
407 include_once
"Modules/Session/classes/class.ilObjSession.php";
409 $data[
"set"][$idx][
"title"] =
$sess->getFirstAppointment()->appointmentToString();
417 foreach (
$result[
"ref_ids"] as $check_ref_id) {
418 include_once
'./Services/Tracking/classes/class.ilLearningProgressAccess.php';
425 foreach (array_keys(
$data[
"set"][$idx]) as $col_id) {
426 if (!in_array($col_id, array(
"type",
"title",
"obj_id",
"ref_id",
"offline"))) {
427 $data[
"set"][$idx][$col_id] = null;
430 $data[
"set"][$idx][
"privacy_conflict"] =
true;
436 $users_no =
$result[
"user_total"];
439 "n" =>
$lng->txt(
"gender_n"),
440 "m" =>
$lng->txt(
"gender_m"),
441 "f" =>
$lng->txt(
"gender_f"),
449 foreach (
$result[
"status"] as $status_code => $status_counter) {
451 if ($status_code ===
"" || !in_array($status_code, $valid_status)) {
453 unset(
$result[
"status"][$status_code]);
459 $data[
"set"][$idx][
"percentage_avg"] = null;
494 $counter = $others_counter = $others_sum = 0;
500 if ($value_map && isset($value_map[
$id])) {
501 $caption = $value_map[
$id];
504 if ($caption ==
"") {
505 $caption =
$lng->txt(
"none");
508 $perc = round($count / $overall * 100);
510 "caption" => $caption,
511 "absolute" => $count,
512 "percentage" => $perc
515 $others_sum += $count;
520 if ($others_counter) {
521 $perc = round($others_sum / $overall * 100);
523 "caption" => $others_counter .
" " .
$lng->txt(
"trac_others"),
524 "absolute" => $others_sum,
525 "percentage" => $perc
548 foreach ($value_map as
$id => $caption) {
553 $perc = round($count / $overall * 100);
556 "caption" => $caption,
557 "absolute" => $count,
558 "percentage" => $perc
572 $pos = strrpos(
$id,
"_");
573 if ($pos !==
false) {
574 $function = strtoupper(substr(
$id, $pos + 1));
575 if (in_array($function, array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT"))) {
576 $id = substr(
$id, 0, $pos);
580 if (trim($value) ==
"") {
581 if (
$id ==
"title") {
582 return "--" .
$lng->txt(
"none") .
"--";
587 case 'status_changed':
597 case "spent_seconds":
598 case "read_count_spent_seconds":
610 $value = $value .
"%";
634 $this->tpl->setVariable(
"ICON", ilObject::_getIcon($a_set[
"obj_id"],
"tiny", $a_set[
"type"]));
635 $this->tpl->setVariable(
"ICON_ALT",
$lng->txt($a_set[
"type"]));
636 $this->tpl->setVariable(
"TITLE", $a_set[
"title"]);
638 if ($a_set[
"offline"] || $a_set[
"privacy_conflict"]) {
640 if ($a_set[
"offline"]) {
641 $mess[] =
$lng->txt(
"offline");
643 if ($a_set[
"privacy_conflict"]) {
644 $mess[] =
$lng->txt(
"status_no_permission");
646 $this->tpl->setCurrentBlock(
"status_bl");
647 $this->tpl->setVariable(
"TEXT_STATUS", implode(
", ", $mess));
648 $this->tpl->parseCurrentBlock();
663 case "percentage_avg":
665 $this->tpl->setVariable(strtoupper($c),
"");
671 $value = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
672 $this->tpl->setVariable(strtoupper($c), $value);
677 if ($this->is_root) {
680 $this->tpl->setCurrentBlock(
"item_path");
681 foreach (
$path as $ref_id => $path_item) {
682 $this->tpl->setVariable(
"PATH_ITEM", $path_item);
684 if (!$this->anonymized) {
685 $ilCtrl->setParameterByClass(
$ilCtrl->getCmdClass(),
'details_id', $ref_id);
686 $this->tpl->setVariable(
"URL_DETAILS",
$ilCtrl->getLinkTargetByClass(
$ilCtrl->getCmdClass(),
'details'));
687 $ilCtrl->setParameterByClass(
$ilCtrl->getCmdClass(),
'details_id',
'');
688 $this->tpl->setVariable(
"TXT_DETAILS",
$lng->txt(
'trac_participants'));
690 $this->tpl->setVariable(
"URL_DETAILS",
ilLink::_getLink($ref_id, $a_set[
"type"]));
691 $this->tpl->setVariable(
"TXT_DETAILS",
$lng->txt(
'view'));
694 $this->tpl->parseCurrentBlock();
698 $this->tpl->setCurrentBlock(
"item_command");
699 $ilCtrl->setParameterByClass(get_class($this),
'hide', $a_set[
"obj_id"]);
700 $this->tpl->setVariable(
"HREF_COMMAND",
$ilCtrl->getLinkTargetByClass(get_class($this),
'hide'));
701 $this->tpl->setVariable(
"TXT_COMMAND", $this->lng->txt(
'trac_hide'));
702 $this->tpl->parseCurrentBlock();
704 $this->tpl->touchBlock(
"path_action");
705 } elseif ($a_set[
"ref_ids"]) {
707 include_once
'./Services/Tree/classes/class.ilPathGUI.php';
709 $path =
$path->getPath($this->ref_id, array_pop($a_set[
"ref_ids"]));
711 $this->tpl->setVariable(
'COLL_PATH', $this->lng->txt(
'path') .
': ' .
$path);
719 foreach (
$data as $item) {
720 $this->tpl->setCurrentBlock(
$id .
"_row");
721 $this->tpl->setVariable(
"CAPTION", $item[
"caption"]);
722 $this->tpl->setVariable(
"ABSOLUTE", $item[
"absolute"]);
723 $this->tpl->setVariable(
"PERCENTAGE", $item[
"percentage"]);
724 $this->tpl->parseCurrentBlock();
727 $this->tpl->touchBlock(
$id);
734 if (in_array($a_name, array(
"country",
"gender",
"city",
"language",
"status",
"mark",
'sel_country'))) {
742 $pos = strrpos($a_field,
"_");
743 if ($pos !==
false) {
744 $function = strtoupper(substr($a_field, $pos + 1));
745 if (in_array($function, array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT",
"TOTAL"))) {
754 $a_excel->
setCell($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);
764 $a_excel->
setCell($a_row, $cnt, $label);
767 if ($c !=
"status") {
768 $a_excel->
setCell($a_row, $cnt, $label .
" #1");
769 $a_excel->
setCell($a_row, ++$cnt, $label .
" #1");
770 $a_excel->
setCell($a_row, ++$cnt, $label .
" #1 %");
771 $a_excel->
setCell($a_row, ++$cnt, $label .
" #2");
772 $a_excel->
setCell($a_row, ++$cnt, $label .
" #2");
773 $a_excel->
setCell($a_row, ++$cnt, $label .
" #2 %");
774 $a_excel->
setCell($a_row, ++$cnt, $label .
" #3");
775 $a_excel->
setCell($a_row, ++$cnt, $label .
" #3");
776 $a_excel->
setCell($a_row, ++$cnt, $label .
" #3 %");
777 $a_excel->
setCell($a_row, ++$cnt, $label .
" " . $this->lng->txt(
"trac_others"));
778 $a_excel->
setCell($a_row, ++$cnt, $label .
" " . $this->lng->txt(
"trac_others"));
779 $a_excel->
setCell($a_row, ++$cnt, $label .
" " . $this->lng->txt(
"trac_others") .
" %");
782 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
783 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
789 foreach ($valid_status as $status) {
804 $a_excel->
setCell($a_row, 0, $a_set[
"title"]);
809 $val = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
810 $a_excel->
setCell($a_row, $cnt, $val);
813 foreach ((array) $a_set[$c] as $idx => $value) {
814 if ($c ==
"status") {
815 $a_excel->
setCell($a_row, $cnt, (
int) $value[
"absolute"]);
816 $a_excel->
setCell($a_row, ++$cnt, $value[
"percentage"] .
"%");
818 $a_excel->
setCell($a_row, $cnt, $value[
"caption"]);
819 $a_excel->
setCell($a_row, ++$cnt, (
int) $value[
"absolute"]);
820 $a_excel->
setCell($a_row, ++$cnt, $value[
"percentage"] .
"%");
824 if (
sizeof($a_set[$c]) < 4 && $c !=
"status") {
825 for ($loop = 4; $loop >
sizeof($a_set[
$c]); $loop--) {
826 $a_excel->
setCell($a_row, $cnt,
"");
827 $a_excel->
setCell($a_row, ++$cnt,
"");
828 $a_excel->
setCell($a_row, ++$cnt,
"");
838 $a_csv->addColumn($this->lng->txt(
"title"));
842 $label = $labels[
$c][
"txt"];
843 $label = str_replace(
"Ø", $this->lng->txt(
"trac_average"), $label);
844 $label = str_replace(
"∑", $this->lng->txt(
"trac_sum"), $label);
847 $a_csv->addColumn($label);
849 if ($c !=
"status") {
850 $a_csv->addColumn($label .
" #1");
851 $a_csv->addColumn($label .
" #1");
852 $a_csv->addColumn($label .
" #1 %");
853 $a_csv->addColumn($label .
" #2");
854 $a_csv->addColumn($label .
" #2");
855 $a_csv->addColumn($label .
" #2 %");
856 $a_csv->addColumn($label .
" #3");
857 $a_csv->addColumn($label .
" #3");
858 $a_csv->addColumn($label .
" #3 %");
859 $a_csv->addColumn($label .
" " . $this->lng->txt(
"trac_others"));
860 $a_csv->addColumn($label .
" " . $this->lng->txt(
"trac_others"));
861 $a_csv->addColumn($label .
" " . $this->lng->txt(
"trac_others") .
" %");
864 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
865 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
870 foreach ($valid_status as $status) {
872 $a_csv->addColumn(
$text);
873 $a_csv->addColumn(
$text .
" %");
884 $a_csv->addColumn($a_set[
"title"]);
888 $val = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
889 $a_csv->addColumn($val);
891 foreach ((array) $a_set[$c] as $idx => $value) {
892 if ($c !=
"status") {
893 $a_csv->addColumn($value[
"caption"]);
895 $a_csv->addColumn((
int) $value[
"absolute"]);
896 $a_csv->addColumn($value[
"percentage"]);
898 if (
sizeof($a_set[$c]) < 4 && $c !=
"status") {
899 for ($loop = 4; $loop >
sizeof($a_set[
$c]); $loop--) {
900 $a_csv->addColumn(
"");
901 $a_csv->addColumn(
"");
902 $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.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setExportFormats(array $formats)
Set available export formats.
const LP_MODE_MANUAL_BY_TUTOR
static _getImagePathForStatus($a_status)
Get image path for status.
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.
getItemsPercentages(array $data=null, $overall, array $value_map=null, $limit=3)
Render data as needed for summary list (based on grouped values)
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
if(!array_key_exists('StateId', $_REQUEST)) $id
const LP_MODE_COLLECTION_MANUAL
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
Add filter by standard type.
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
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
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.
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)
isPercentageAvailable($a_obj_id)
getSelectedColumns()
Get selected columns.
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
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.
__construct($a_parent_obj, $a_parent_cmd, $a_ref_id, $a_print_mode=false)
Constructor.
fillRow($a_set)
Fill table row.
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
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)
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.
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)
getItemsPercentagesStatus(array $data=null, $overall, array $value_map=null)
Render status data as needed for summary list (based on grouped values)
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
setLimit($a_limit=0, $a_default_limit=0)
const LP_STATUS_FAILED_NUM