4 include_once(
"./Services/Tracking/classes/class.ilLPTableBaseGUI.php");
29 public function __construct($a_parent_obj, $a_parent_cmd, $ref_id)
37 $rbacsystem = $DIC[
'rbacsystem'];
39 $this->
setId(
"trsmtx_" . $ref_id);
40 $this->ref_id = $ref_id;
44 $this->in_group =
$tree->checkForParentType($this->ref_id,
"grp");
45 if ($this->in_group) {
48 $this->in_course =
$tree->checkForParentType($this->ref_id,
"crs");
49 if ($this->in_course) {
57 parent::__construct($a_parent_obj, $a_parent_cmd);
59 $this->
parseTitle($this->obj_id,
"trac_matrix");
63 $this->
setRowTemplate(
"tpl.user_object_matrix_row.html",
"Services/Tracking");
69 include_once
"Services/Mail/classes/class.ilMail.php";
71 if ($rbacsystem->checkAccess(
"internal_mail", $mail->getMailObjectReferenceId())) {
72 $this->
addMultiCommand(
"mailselectedusers", $this->lng->txt(
"send_mail"));
75 $this->lng->loadLanguageModule(
'user');
78 $this->lng->txt(
'clipboard_add_btn')
81 $this->has_multi =
true;
83 $this->
addColumn($this->lng->txt(
"login"),
"login");
87 foreach ($selected as
$c) {
90 if (isset($labels[$c][
"no_permission"]) && (
bool) $labels[$c][
"no_permission"]) {
91 $title .=
" (" .
$lng->txt(
"status_no_permission") .
")";
95 if (isset($labels[$c][
"icon"])) {
96 $alt =
$lng->txt($labels[$c][
"type"]);
97 $icon =
'<img class="ilListItemIcon" src="' . $labels[
$c][
"icon"] .
'" alt="' . $alt .
'" />';
98 if (
sizeof($selected) > 5) {
104 if ($labels[$c][
"path"]) {
105 $tooltip[] = $labels[
$c][
"path"];
109 if (isset($labels[$c][
"id"])) {
110 $sort_id = $labels[
$c][
"id"];
113 $sort_id = (substr($c, 0, 4) ==
"udf_") ?
"" : $c;
116 $this->
addColumn(
$title, $sort_id,
"",
false,
"", implode(
" - ", $tooltip));
129 $this->filter[
"name"] = $item->getValue();
132 if (isset(
$_GET[$this->prefix .
"_tpl"])) {
133 $this->filter[
"name"] = null;
142 $ilObjDataCache = $DIC[
'ilObjDataCache'];
143 $rbacsystem = $DIC[
'rbacsystem'];
147 if ($this->obj_ids === null) {
150 $this->obj_ids = $this->
getItems(array_keys($user_cols[0]), $user_cols[1]);
152 if (is_array($this->obj_ids)) {
154 foreach ($this->obj_ids as $obj_id) {
155 if ($obj_id == $this->obj_id) {
156 $parent = array(
"txt" => $this->lng->txt(
"status"),
161 $ref_id = $this->ref_ids[$obj_id];
162 include_once
'./Services/Tracking/classes/class.ilLearningProgressAccess.php';
166 $this->privacy_cols[] = $obj_id;
169 $title = $ilObjDataCache->lookupTitle($obj_id);
170 $type = $ilObjDataCache->lookupType($obj_id);
171 $icon = ilObject::_getIcon($obj_id,
"tiny",
$type);
172 if (
$type ==
"sess") {
173 include_once
"Modules/Session/classes/class.ilObjSession.php";
180 include_once
'./Services/Tree/classes/class.ilPathGUI.php';
182 $path =
$path->getPath($this->ref_id, $ref_id);
184 $relpath = $this->lng->txt(
'path') .
': ' .
$path;
187 $tmp_cols[strtolower(
$title) .
"#~#obj_" . $obj_id] = array(
192 "no_permission" => $no_perm,
196 if (
sizeof($this->objective_ids)) {
197 foreach ($this->objective_ids as $obj_id =>
$title) {
198 $tmp_cols[strtolower(
$title) .
"#~#objtv_" . $obj_id] = array(
"txt" =>
$title,
"default" =>
true);
201 if (
sizeof($this->sco_ids)) {
202 foreach ($this->sco_ids as $obj_id =>
$title) {
204 $tmp_cols[strtolower(
$title) .
"#~#objsco_" . $obj_id] = array(
"txt" =>
$title,
"icon" =>
$icon,
"default" =>
true);
207 if (
sizeof($this->subitem_ids)) {
208 foreach ($this->subitem_ids as $obj_id =>
$title) {
209 include_once(
"./Services/Tracking/classes/class.ilTrQuery.php");
211 $tmp_cols[strtolower(
$title) .
"#~#objsub_" . $obj_id] = array(
"txt" =>
$title,
"icon" =>
$icon,
"default" =>
true);
216 if (!
sizeof($this->sco_ids) && !
sizeof($this->subitem_ids)) {
219 foreach ($tmp_cols as
$id =>
$def) {
220 $id = explode(
'#~#',
$id);
226 $columns[
"obj_" . $this->obj_id] = $parent;
230 unset($user_cols[0][
"status"]);
231 unset($user_cols[0][
"login"]);
232 foreach ($user_cols[0] as $col_id => $col_def) {
235 $col_def[
"default"] =
false;
243 public function getItems(array $a_user_fields, array $a_privary_fields = null)
246 if ($this->restore_filter) {
247 $name = $this->restore_filter_values[
"name"];
249 $this->filter[
"name"] =
$name;
252 include_once(
"./Services/Tracking/classes/class.ilTrQuery.php");
254 if ($collection[
"object_ids"]) {
256 $this->ref_ids = $collection[
"ref_ids"];
259 $check_agreement =
false;
260 if ($this->in_course) {
262 include_once
"Services/PrivacySecurity/classes/class.ilPrivacySettings.php";
264 if ($privacy->courseConfirmationRequired()) {
267 } elseif ($this->in_group) {
269 include_once
"Services/PrivacySecurity/classes/class.ilPrivacySettings.php";
271 if ($privacy->groupConfirmationRequired()) {
277 if ($collection[
"objectives_parent_id"] &&
$data[
"users"]) {
281 $this->objective_ids = array();
283 foreach ($objectives as $user_id => $objectives) {
284 if (isset(
$data[
"set"][$user_id])) {
285 foreach ($objectives as $objective_id => $status) {
286 $obj_id =
"objtv_" . $objective_id;
287 $data[
"set"][$user_id][$obj_id] = $status;
289 if (!in_array($obj_id, $this->objective_ids)) {
298 if ($collection[
"scorm"] &&
$data[
"set"]) {
299 $this->sco_ids = array();
300 foreach (array_keys(
$data[
"set"]) as $user_id) {
301 foreach ($collection[
"scorm"][
"scos"] as $sco) {
302 if (!in_array($sco, $this->sco_ids)) {
303 $this->sco_ids[$sco] = $collection[
"scorm"][
"scos_title"][$sco];
311 if (in_array($user_id, $collection[
"scorm"][
"failed"][$sco])) {
313 } elseif (in_array($user_id, $collection[
"scorm"][
"completed"][$sco])) {
315 } elseif (in_array($user_id, $collection[
"scorm"][
"in_progress"][$sco])) {
319 $obj_id =
"objsco_" . $sco;
320 $data[
"set"][$user_id][$obj_id] = $status;
326 if ($collection[
"subitems"] &&
$data[
"set"]) {
327 foreach (array_keys(
$data[
"set"]) as $user_id) {
328 foreach ($collection[
"subitems"][
"items"] as $item_id) {
329 $this->subitem_ids[$item_id] = $collection[
"subitems"][
"item_titles"][$item_id];
332 if (in_array($user_id, $collection[
"subitems"][
"completed"][$item_id])) {
334 } elseif (is_array($collection[
"subitems"][
"in_progress"]) &&
335 in_array($user_id, $collection[
"subitems"][
"in_progress"][$item_id])) {
339 $obj_id =
"objsub_" . $item_id;
340 $data[
"set"][$user_id][$obj_id] = $status;
347 $this->perc_map = array();
348 foreach (
$data[
"set"] as $row_idx =>
$row) {
349 foreach (
$row as $column => $value) {
350 if (substr($column, -5) ==
"_perc") {
351 $obj_id = explode(
"_", $column);
352 $obj_id = (int) $obj_id[1];
357 unset(
$data[
"set"][$row_idx][$column]);
359 $this->perc_map[$obj_id] =
true;
369 return $collection[
"object_ids"];
380 if ($this->has_multi) {
381 $this->tpl->setVariable(
"USER_ID", $a_set[
"usr_id"]);
386 case (substr($c, 0, 4) ==
"obj_"):
387 $obj_id = substr($c, 4);
390 if (in_array($obj_id, $this->privacy_cols) ||
391 $a_set[
"privacy_conflict"]) {
392 $this->tpl->setCurrentBlock(
"objects");
393 $this->tpl->setVariable(
"VAL_STATUS",
" ");
394 $this->tpl->parseCurrentBlock();
398 $status = isset($a_set[$c])
401 $percentage = isset($a_set[$c .
"_perc"])
402 ? (int) $a_set[$c .
"_perc"]
408 if ($timing !==
true) {
413 $this->tpl->setCurrentBlock(
'warning_img');
415 $this->tpl->setVariable(
'WARNING_ALT', $this->lng->txt(
'trac_time_passed') . $timing);
416 $this->tpl->parseCurrentBlock();
420 $this->tpl->setCurrentBlock(
"objects");
421 $this->tpl->setVariable(
"VAL_STATUS", $this->
parseValue(
"status", $status,
""));
422 $this->tpl->setVariable(
"VAL_PERCENTAGE", $this->
parseValue(
"percentage", $percentage,
""));
423 $this->tpl->parseCurrentBlock();
427 case (substr($c, 0, 6) ==
"objtv_"):
428 case (substr($c, 0, 7) ==
"objsco_"):
429 case (substr($c, 0, 7) ==
"objsub_"):
430 $status = isset($a_set[$c])
434 $this->tpl->setCurrentBlock(
"objects");
435 if (!$a_set[
"privacy_conflict"]) {
436 $this->tpl->setVariable(
"VAL_STATUS", $this->
parseValue(
"status", $status,
""));
438 $this->tpl->setVariable(
"VAL_STATUS",
" ");
440 $this->tpl->parseCurrentBlock();
444 $this->tpl->setCurrentBlock(
"user_field");
445 if (!$a_set[
"privacy_conflict"]) {
446 $this->tpl->setVariable(
"VAL_UF", $this->
parseValue($c, $a_set[$c],
""));
448 $this->tpl->setVariable(
"VAL_UF",
" ");
450 $this->tpl->parseCurrentBlock();
456 if (!$a_set[
"active"] || $a_set[
"privacy_conflict"]) {
458 if ($a_set[
"privacy_conflict"]) {
459 $mess[] =
$lng->txt(
"status_no_permission");
460 } elseif (!$a_set[
"active"]) {
461 $mess[] =
$lng->txt(
"inactive");
463 $this->tpl->setCurrentBlock(
'inactive_bl');
464 $this->tpl->setVariable(
'TXT_INACTIVE', implode(
", ", $mess));
465 $this->tpl->parseCurrentBlock();
468 $login = !$a_set[
"privacy_conflict"]
471 $this->tpl->setVariable(
"VAL_LOGIN",
$login);
478 $ilObjDataCache = $DIC[
'ilObjDataCache'];
480 $a_excel->
setCell($a_row, 0, $this->lng->txt(
"login"));
485 if (substr($c, 0, 4) ==
"obj_") {
486 $obj_id = substr($c, 4);
488 $type = $ilObjDataCache->lookupType($obj_id);
489 if ($DIC[
'objDefinition']->isPlugin(
$type)) {
492 $type_text = $this->lng->txt(
$type);
495 $a_excel->
setCell($a_row, $cnt,
"(" . $type_text .
") " . $labels[$c][
"txt"]);
497 if (is_array($this->perc_map) && $this->perc_map[$obj_id]) {
499 $a_excel->
setCell($a_row, $cnt, $this->lng->txt(
"trac_percentage") .
" (%)");
502 $a_excel->
setCell($a_row, $cnt, $labels[$c][
"txt"]);
512 $a_excel->
setCell($a_row, 0, $a_set[
"login"]);
517 case (substr($c, 0, 4) ==
"obj_"):
518 $obj_id = substr($c, 4);
520 $a_excel->
setCell($a_row, $cnt, $val);
522 if (is_array($this->perc_map) && $this->perc_map[$obj_id]) {
524 $perc = (int) $a_set[$c .
"_perc"];
528 $a_excel->
setCell($a_row, $cnt, $perc);
532 case (substr($c, 0, 6) ==
"objtv_"):
533 case (substr($c, 0, 7) ==
"objsco_"):
534 case (substr($c, 0, 7) ==
"objsub_"):
536 $a_excel->
setCell($a_row, $cnt, $val);
545 $val = $this->
parseValue($c, $a_set[$c],
"user");
546 $a_excel->
setCell($a_row, $cnt, $val);
558 $ilObjDataCache = $DIC[
'ilObjDataCache'];
560 $a_csv->addColumn($this->lng->txt(
"login"));
564 if (substr($c, 0, 4) ==
"obj_") {
565 $obj_id = substr($c, 4);
567 $type = $ilObjDataCache->lookupType($obj_id);
568 if ($DIC[
'objDefinition']->isPlugin(
$type)) {
571 $type_text = $this->lng->txt(
$type);
574 $a_csv->addColumn(
"(" . $type_text .
") " . $labels[$c][
"txt"]);
576 if (is_array($this->perc_map) && $this->perc_map[$obj_id]) {
577 $a_csv->addColumn($this->lng->txt(
"trac_percentage") .
" (%)");
580 $a_csv->addColumn($labels[$c][
"txt"]);
589 $a_csv->addColumn($a_set[
"login"]);
593 case (substr($c, 0, 4) ==
"obj_"):
594 $obj_id = substr($c, 4);
596 $a_csv->addColumn($val);
598 if (is_array($this->perc_map) && $this->perc_map[$obj_id]) {
599 $perc = (int) $a_set[$c .
"_perc"];
603 $a_csv->addColumn($perc);
607 case (substr($c, 0, 6) ==
"objtv_"):
608 case (substr($c, 0, 7) ==
"objsco_"):
609 case (substr($c, 0, 7) ==
"objsub_"):
611 $a_csv->addColumn($val);
620 $val = $this->
parseValue($c, $a_set[$c],
"user");
621 $a_csv->addColumn($val);
const LP_STATUS_COMPLETED_NUM
fillRowExcel(ilExcel $a_excel, &$a_row, $a_set)
Creates a path for a start and endnode.
getSelectableUserColumns($a_in_course=false, $a_in_group=false)
static lookupObjectiveTitle($a_objective_id, $a_add_description=false)
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setExportFormats(array $formats)
Set available export formats.
static lookupTxtById($plugin_id, $lang_var)
fillHeaderExcel(ilExcel $a_excel, &$a_row)
setShowTemplates($a_value)
Toggle templates.
__construct($a_parent_obj, $a_parent_cmd, $ref_id)
Constructor.
static _getStatusText($a_status, $a_lng=null)
Get status alt text.
static getSubItemType($a_parent_obj_id)
Get sub-item object type for parent.
const LP_STATUS_IN_PROGRESS_NUM
if(!array_key_exists('StateId', $_REQUEST)) $id
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=null)
Add filter by standard type.
parseTitle($a_obj_id, $action, $a_user_id=false)
parseValue($id, $value, $type)
static checkPermission($a_permission, $a_ref_id, $a_user_id=null)
wrapper for rbac access checks
static getTypeIconPath($a_type, $a_obj_id, $a_size='small')
Get type icon path path Return image path for icon_xxx.pngs Or (if enabled) path to custom icon Depre...
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
getItems(array $a_user_fields, array $a_privary_fields=null)
getColumnCoord($a_col)
Get column "name" from number.
TableGUI class for learning progress.
setBold($a_coords)
Set cell(s) to bold.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
addMultiCommand($a_cmd, $a_text)
Add Command button.
fillRowCSV($a_csv, $a_set)
isPercentageAvailable($a_obj_id)
getSelectedColumns()
Get selected columns.
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
SetFilterValue(ilFormPropertyGUI $a_item, $a_value)
Set current filter value.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static _lookupType($a_id, $a_reference=false)
lookup object type
static getObjectIds($a_parent_obj_id, $a_parent_ref_id=false, $use_collection=true, $a_refresh_status=true, $a_user_ids=null)
Get (sub)objects for given object, also handles learning objectives (course only) ...
static getUserObjectiveMatrix($a_parent_obj_id, $a_users)
const LP_STATUS_NOT_ATTEMPTED_NUM
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
showTimingsWarning($a_ref_id, $a_user_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.
setEnableHeader($a_enableheader)
Set Enable Header.
static _getInstance()
Get instance of ilPrivacySettings.
static getUserObjectMatrix( $a_parent_ref_id, $a_obj_ids, $a_user_filter=null, array $a_additional_fields=null, array $a_privacy_fields=null, $a_check_agreement=null)
Get status matrix for users on objects.
setMaxCount($a_max_count)
set max.
const LP_STATUS_FAILED_NUM