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)
24 $this->
setId(
"trsmy");
26 $this->ref_id = $a_ref_id;
28 $this->is_root = ($a_ref_id == ROOT_FOLDER_ID);
30 if (!$this->is_root) {
34 if (!$objDefinition->isContainer(
$type)) {
36 include_once
'./Services/Object/classes/class.ilObjectLP.php';
41 parent::__construct($a_parent_obj, $a_parent_cmd);
47 $this->
parseTitle($this->obj_id,
"trac_summary");
52 $this->
addColumn($this->lng->txt(
"title"),
"title");
61 $this->
addColumn($this->lng->txt(
"path"));
62 $this->
addColumn($this->lng->txt(
"action"));
68 $this->
setFormAction($ilCtrl->getFormActionByClass(get_class($this)));
69 $this->
setRowTemplate(
"tpl.trac_summary_row.html",
"Services/Tracking");
72 $this->
getItems($a_parent_obj->getObjId(), $a_ref_id);
79 $lng_map =
array(
"user_total" =>
"users",
"first_access_min" =>
"trac_first_access",
80 "last_access_max" =>
"trac_last_access",
"mark" =>
"trac_mark",
"status" =>
"trac_status",
81 'status_changed_max' =>
'trac_status_changed',
82 "spent_seconds_avg" =>
"trac_spent_seconds",
"percentage_avg" =>
"trac_percentage",
83 "read_count_sum" =>
"trac_read_count",
"read_count_avg" =>
"trac_read_count",
84 "read_count_spent_seconds_avg" =>
"trac_read_count_spent_seconds" 88 $all =
array(
"user_total");
92 include_once
'Services/Tracking/classes/class.ilObjUserTracking.php';
95 $all[] =
"read_count_sum";
96 $all[] =
"read_count_avg";
97 $default[] =
"read_count_sum";
101 $all[] =
"spent_seconds_avg";
102 $default[] =
"spent_seconds_avg";
108 $all[] =
"read_count_spent_seconds_avg";
115 $all[] =
"percentage_avg";
118 if ($this->is_root || !$this->olp || $this->olp->isActive()) {
120 $all[] =
'status_changed_max';
127 $privacy =
array(
"gender",
"city",
"country",
"sel_country");
128 foreach ($privacy as $field) {
129 if ($ilSetting->get(
"usr_settings_course_export_" . $field)) {
136 $default[] =
"percentage_avg";
137 $default[] =
"status";
141 $all[] =
"first_access_min";
142 $all[] =
"last_access_max";
145 $all[] =
"create_date_min";
146 $all[] =
"create_date_max";
153 if (substr(
$l, -3) ==
"avg") {
155 } elseif (substr(
$l, -3) ==
"sum" ||
$l ==
"user_total") {
159 if (isset($lng_map[
$l])) {
165 if (in_array($column,
array(
"read_count_avg",
"spent_seconds_avg",
"percentage_avg"))) {
166 $txt .=
" / " . $lng->txt(
"user");
171 "default" => (in_array($column, $default) ?
true :
false)
184 if ($this->is_root) {
185 return parent::initBaseFilter(
true,
false);
189 include_once
'Services/Tracking/classes/class.ilObjUserTracking.php';
196 "∑ " . $lng->txt(
"users")
198 $this->filter[
"user_total"] = $item->getValue();
205 "∑ " . $lng->txt(
"trac_read_count")
207 $this->filter[
"read_count"] = $item->getValue();
216 "Ø " . $lng->txt(
"trac_spent_seconds") .
" / " . $lng->txt(
"user")
218 $this->filter[
"spent_seconds"][
"from"] = $item->getCombinationItem(
"from")->getValueInSeconds();
219 $this->filter[
"spent_seconds"][
"to"] = $item->getCombinationItem(
"to")->getValueInSeconds();
228 "Ø " . $lng->txt(
"trac_percentage") .
" / " . $lng->txt(
"user")
230 $this->filter[
"percentage"] = $item->getValue();
233 if ($this->is_root || !$this->olp || $this->olp->isActive()) {
234 include_once
"Services/Tracking/classes/class.ilLPStatus.php";
236 $item->setOptions(
array(
"" => $lng->txt(
"trac_all"),
241 $this->filter[
"status"] = $item->getValue();
242 if ($this->filter[
"status"]) {
243 $this->filter[
"status"]--;
247 $this->filter[
"status_changed"] = $item->getDate();
255 $lng->txt(
"trac_mark")
257 $this->filter[
"mark"] = $item->getValue();
260 if ($ilSetting->get(
"usr_settings_course_export_gender")) {
262 $item->setOptions(
array(
263 "" => $lng->txt(
"trac_all"),
264 "n" => $lng->txt(
"gender_n"),
265 "m" => $lng->txt(
"gender_m"),
266 "f" => $lng->txt(
"gender_f"),
268 $this->filter[
"gender"] = $item->getValue();
271 if ($ilSetting->get(
"usr_settings_course_export_city")) {
273 $this->filter[
"city"] = $item->getValue();
276 if ($ilSetting->get(
"usr_settings_course_export_country")) {
278 $this->filter[
"country"] = $item->getValue();
281 if ($ilSetting->get(
"usr_settings_course_export_sel_country")) {
284 $this->filter[
"sel_country"] = $item->getValue();
288 $this->filter[
"language"] = $item->getValue();
292 $this->filter[
"first_access"] = $item->getDate();
295 $this->filter[
"last_access"] = $item->getDate();
299 $this->filter[
"registration"] = $item->getDate();
306 include_once(
"./Services/Utilities/classes/class.ilCountry.php");
309 $options[$c] = $lng->txt(
"meta_c_" . $c);
323 global
$lng, $rbacsystem;
325 include_once(
"./Services/Tracking/classes/class.ilTrQuery.php");
328 $preselected_obj_ids =
$filter = null;
336 $collection = $olp->getCollectionInstance();
337 $preselected_obj_ids[$a_object_id][] = $a_ref_id;
338 foreach ($collection->getItems() as $item => $item_info) {
340 if ($tmp_lp->isActive()) {
345 } elseif ($this->is_root) {
369 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
370 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
375 $status_map =
array();
376 foreach ($valid_status as $status) {
383 $lng->loadLanguageModule(
"meta");
384 $languages =
array();
385 foreach ($lng->getInstalledLanguages() as $lang_key) {
386 $languages[$lang_key] = $lng->txt(
"meta_l_" . $lang_key);
393 include_once
"Modules/Session/classes/class.ilObjSession.php";
395 $data[
"set"][$idx][
"title"] =
$sess->getFirstAppointment()->appointmentToString();
403 foreach (
$result[
"ref_ids"] as $check_ref_id) {
404 include_once
'./Services/Tracking/classes/class.ilLearningProgressAccess.php';
411 foreach (array_keys(
$data[
"set"][$idx]) as $col_id) {
412 if (!in_array($col_id,
array(
"type",
"title",
"obj_id",
"ref_id",
"offline"))) {
413 $data[
"set"][$idx][$col_id] = null;
416 $data[
"set"][$idx][
"privacy_conflict"] =
true;
422 $users_no =
$result[
"user_total"];
425 "n"=>$lng->txt(
"gender_n"),
426 "m"=>$lng->txt(
"gender_m"),
427 "f"=>$lng->txt(
"gender_f"),
435 foreach (
$result[
"status"] as $status_code => $status_counter) {
437 if ($status_code ===
"" || !in_array($status_code, $valid_status)) {
439 unset(
$result[
"status"][$status_code]);
445 $data[
"set"][$idx][
"percentage_avg"] = null;
478 $counter = $others_counter = $others_sum = 0;
484 if ($value_map && isset($value_map[
$id])) {
485 $caption = $value_map[
$id];
488 if ($caption ==
"") {
489 $caption = $lng->txt(
"none");
492 $perc = round($count/$overall*100);
494 "caption" => $caption,
495 "absolute" => $count,
496 "percentage" => $perc
499 $others_sum += $count;
504 if ($others_counter) {
505 $perc = round($others_sum/$overall*100);
507 "caption" => $otherss_counter .
" " . $lng->txt(
"trac_others"),
508 "absolute" => $others_sum,
509 "percentage" => $perc
530 foreach ($value_map as
$id => $caption) {
535 $perc = round($count/$overall*100);
538 "caption" => $caption,
539 "absolute" => $count,
540 "percentage" => $perc
552 $pos = strrpos(
$id,
"_");
553 if ($pos !==
false) {
555 if (in_array(
$function,
array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT"))) {
556 $id = substr(
$id, 0, $pos);
560 if (trim($value) ==
"") {
561 if (
$id ==
"title") {
562 return "--" . $lng->txt(
"none") .
"--";
567 case 'status_changed':
577 case "spent_seconds":
578 case "read_count_spent_seconds":
590 $value = $value .
"%";
612 $this->tpl->setVariable(
"ICON_ALT", $lng->txt($a_set[
"type"]));
613 $this->tpl->setVariable(
"TITLE", $a_set[
"title"]);
615 if ($a_set[
"offline"] || $a_set[
"privacy_conflict"]) {
617 if ($a_set[
"offline"]) {
618 $mess[] = $lng->txt(
"offline");
620 if ($a_set[
"privacy_conflict"]) {
621 $mess[] = $lng->txt(
"status_no_permission");
623 $this->tpl->setCurrentBlock(
"status_bl");
624 $this->tpl->setVariable(
"TEXT_STATUS", implode(
", ", $mess));
625 $this->tpl->parseCurrentBlock();
640 case "percentage_avg":
642 $this->tpl->setVariable(strtoupper($c),
"");
648 $value = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
649 $this->tpl->setVariable(strtoupper($c), $value);
654 if ($this->is_root) {
657 $this->tpl->setCurrentBlock(
"item_path");
658 foreach (
$path as $ref_id => $path_item) {
659 $this->tpl->setVariable(
"PATH_ITEM", $path_item);
661 if (!$this->anonymized) {
662 $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(),
'details_id', $ref_id);
663 $this->tpl->setVariable(
"URL_DETAILS", $ilCtrl->getLinkTargetByClass($ilCtrl->getCmdClass(),
'details'));
664 $ilCtrl->setParameterByClass($ilCtrl->getCmdClass(),
'details_id',
'');
665 $this->tpl->setVariable(
"TXT_DETAILS", $lng->txt(
'trac_participants'));
667 $this->tpl->setVariable(
"URL_DETAILS",
ilLink::_getLink($ref_id, $a_set[
"type"]));
668 $this->tpl->setVariable(
"TXT_DETAILS", $lng->txt(
'view'));
671 $this->tpl->parseCurrentBlock();
675 $this->tpl->setCurrentBlock(
"item_command");
676 $ilCtrl->setParameterByClass(get_class($this),
'hide', $a_set[
"obj_id"]);
677 $this->tpl->setVariable(
"HREF_COMMAND", $ilCtrl->getLinkTargetByClass(get_class($this),
'hide'));
678 $this->tpl->setVariable(
"TXT_COMMAND", $this->lng->txt(
'trac_hide'));
679 $this->tpl->parseCurrentBlock();
681 $this->tpl->touchBlock(
"path_action");
682 } elseif ($a_set[
"ref_ids"]) {
684 include_once
'./Services/Tree/classes/class.ilPathGUI.php';
686 $path =
$path->getPath($this->ref_id, array_pop($a_set[
"ref_ids"]));
688 $this->tpl->setVariable(
'COLL_PATH', $this->lng->txt(
'path') .
': ' .
$path);
696 foreach (
$data as $item) {
697 $this->tpl->setCurrentBlock(
$id .
"_row");
698 $this->tpl->setVariable(
"CAPTION", $item[
"caption"]);
699 $this->tpl->setVariable(
"ABSOLUTE", $item[
"absolute"]);
700 $this->tpl->setVariable(
"PERCENTAGE", $item[
"percentage"]);
701 $this->tpl->parseCurrentBlock();
704 $this->tpl->touchBlock(
$id);
711 if (in_array($a_name,
array(
"country",
"gender",
"city",
"language",
"status",
"mark",
'sel_country'))) {
719 $pos = strrpos($a_field,
"_");
720 if ($pos !==
false) {
721 $function = strtoupper(substr($a_field, $pos+1));
722 if (in_array(
$function,
array(
"MIN",
"MAX",
"SUM",
"AVG",
"COUNT",
"TOTAL"))) {
731 $a_excel->
setCell($a_row, 0, $this->lng->txt(
"title"));
736 $label = $labels[$c][
"txt"];
737 $label = str_replace(
"Ø", $this->lng->txt(
"trac_average"), $label);
738 $label = str_replace(
"∑", $this->lng->txt(
"trac_sum"), $label);
741 $a_excel->
setCell($a_row, $cnt, $label);
744 if ($c !=
"status") {
745 $a_excel->
setCell($a_row, $cnt, $label .
" #1");
746 $a_excel->
setCell($a_row, ++$cnt, $label .
" #1");
747 $a_excel->
setCell($a_row, ++$cnt, $label .
" #1 %");
748 $a_excel->
setCell($a_row, ++$cnt, $label .
" #2");
749 $a_excel->
setCell($a_row, ++$cnt, $label .
" #2");
750 $a_excel->
setCell($a_row, ++$cnt, $label .
" #2 %");
751 $a_excel->
setCell($a_row, ++$cnt, $label .
" #3");
752 $a_excel->
setCell($a_row, ++$cnt, $label .
" #3");
753 $a_excel->
setCell($a_row, ++$cnt, $label .
" #3 %");
754 $a_excel->
setCell($a_row, ++$cnt, $label .
" " . $this->lng->txt(
"trac_others"));
755 $a_excel->
setCell($a_row, ++$cnt, $label .
" " . $this->lng->txt(
"trac_others"));
756 $a_excel->
setCell($a_row, ++$cnt, $label .
" " . $this->lng->txt(
"trac_others") .
" %");
759 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
760 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
766 foreach ($valid_status as $status) {
781 $a_excel->
setCell($a_row, 0, $a_set[
"title"]);
786 $val = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
787 $a_excel->
setCell($a_row, $cnt, $val);
790 foreach ((
array) $a_set[$c] as $idx => $value) {
791 if ($c ==
"status") {
792 $a_excel->
setCell($a_row, $cnt, (
int) $value[
"absolute"]);
793 $a_excel->
setCell($a_row, ++$cnt, $value[
"percentage"] .
"%");
795 $a_excel->
setCell($a_row, $cnt, $value[
"caption"]);
796 $a_excel->
setCell($a_row, ++$cnt, (
int) $value[
"absolute"]);
797 $a_excel->
setCell($a_row, ++$cnt, $value[
"percentage"] .
"%");
801 if (
sizeof($a_set[$c]) < 4 && $c !=
"status") {
802 for ($loop = 4; $loop >
sizeof($a_set[$c]); $loop--) {
803 $a_excel->
setCell($a_row, $cnt,
"");
804 $a_excel->
setCell($a_row, ++$cnt,
"");
805 $a_excel->
setCell($a_row, ++$cnt,
"");
815 $a_csv->addColumn($this->lng->txt(
"title"));
819 $label = $labels[$c][
"txt"];
820 $label = str_replace(
"Ø", $this->lng->txt(
"trac_average"), $label);
821 $label = str_replace(
"∑", $this->lng->txt(
"trac_sum"), $label);
824 $a_csv->addColumn($label);
826 if ($c !=
"status") {
827 $a_csv->addColumn($label .
" #1");
828 $a_csv->addColumn($label .
" #1");
829 $a_csv->addColumn($label .
" #1 %");
830 $a_csv->addColumn($label .
" #2");
831 $a_csv->addColumn($label .
" #2");
832 $a_csv->addColumn($label .
" #2 %");
833 $a_csv->addColumn($label .
" #3");
834 $a_csv->addColumn($label .
" #3");
835 $a_csv->addColumn($label .
" #3 %");
836 $a_csv->addColumn($label .
" " . $this->lng->txt(
"trac_others"));
837 $a_csv->addColumn($label .
" " . $this->lng->txt(
"trac_others"));
838 $a_csv->addColumn($label .
" " . $this->lng->txt(
"trac_others") .
" %");
841 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
842 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
847 foreach ($valid_status as $status) {
849 $a_csv->addColumn(
$text);
850 $a_csv->addColumn(
$text .
" %");
861 $a_csv->addColumn($a_set[
"title"]);
865 $val = $this->
parseValue($c, $a_set[$c], $a_set[
"type"]);
866 $a_csv->addColumn($val);
868 foreach ((
array) $a_set[$c] as $idx => $value) {
869 if ($c !=
"status") {
870 $a_csv->addColumn($value[
"caption"]);
872 $a_csv->addColumn((
int) $value[
"absolute"]);
873 $a_csv->addColumn($value[
"percentage"]);
875 if (
sizeof($a_set[$c]) < 4 && $c !=
"status") {
876 for ($loop = 4; $loop >
sizeof($a_set[$c]); $loop--) {
877 $a_csv->addColumn(
"");
878 $a_csv->addColumn(
"");
879 $a_csv->addColumn(
"");
const LP_STATUS_COMPLETED_NUM
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
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)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
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
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.
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)
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.
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
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options