4 include_once(
"./Services/Tracking/classes/class.ilLPTableBaseGUI.php");
36 $this->in_group = $tree->checkForParentType($this->ref_id,
"grp");
43 $this->in_course = $tree->checkForParentType($this->ref_id,
"crs");
56 $this->
parseTitle($this->obj_id,
"trac_matrix");
59 $this->
setFormAction($ilCtrl->getFormActionByClass(get_class($this)));
60 $this->
setRowTemplate(
"tpl.user_object_matrix_row.html",
"Services/Tracking");
65 $this->
addColumn($this->lng->txt(
"login"),
"login");
69 foreach ($selected as $c)
71 $title = $labels[$c][
"txt"];
73 if(isset($labels[$c][
"no_permission"]) && (
bool)$labels[$c][
"no_permission"])
75 $title .=
" (".$lng->txt(
"status_no_permission").
")";
79 if(isset($labels[$c][
"icon"]))
81 $alt = $lng->txt($labels[$c][
"type"]);
82 $icon =
'<img src="'.$labels[$c][
"icon"].
'" alt="'.$alt.
'" />';
83 if(
sizeof($selected) > 5)
94 if(isset($labels[$c][
"id"]))
96 $sort_id = $labels[$c][
"id"];
101 $sort_id = (substr($c, 0, 4) ==
"udf_") ?
"" : $c;
115 $this->filter[
"name"] = $item->getValue();
118 if(isset(
$_GET[$this->prefix.
"_tpl"]))
120 $this->filter[
"name"] = null;
121 $item->setValue(null);
127 global $ilObjDataCache, $rbacsystem;
131 if($this->obj_ids === NULL)
135 $this->obj_ids = $this->
getItems(array_keys($user_cols[0]), $user_cols[1]);
140 foreach($this->obj_ids as $obj_id)
142 if($obj_id == $this->obj_id)
144 $parent = array(
"txt" => $this->lng->txt(
"status"),
151 $ref_id = $this->ref_ids[$obj_id];
153 !$rbacsystem->checkAccess(
'read_learning_progress',
$ref_id))
156 $this->privacy_cols[] = $obj_id;
159 $title = $ilObjDataCache->lookupTitle($obj_id);
160 $type = $ilObjDataCache->lookupType($obj_id);
164 include_once
"Modules/Session/classes/class.ilObjSession.php";
168 $tmp_cols[strtolower(
$title).
"#~#obj_".$obj_id] = array(
"txt" =>
$title,
"icon" =>
$icon,
"type" => $type,
"default" =>
true,
"no_permission" => $no_perm);
171 if(
sizeof($this->objective_ids))
173 foreach($this->objective_ids as $obj_id =>
$title)
175 $tmp_cols[strtolower(
$title).
"#~#objtv_".$obj_id] = array(
"txt" =>
$title,
"default" =>
true);
178 if(
sizeof($this->sco_ids))
180 foreach($this->sco_ids as $obj_id =>
$title)
183 $tmp_cols[strtolower(
$title).
"#~#objsco_".$obj_id] = array(
"txt" =>
$title,
"icon"=>
$icon,
"default" =>
true);
186 if(
sizeof($this->subitem_ids))
188 foreach($this->subitem_ids as $obj_id =>
$title)
191 $tmp_cols[strtolower(
$title).
"#~#objsub_".$obj_id] = array(
"txt" =>
$title,
"icon"=>
$icon,
"default" =>
true);
196 if(!
sizeof($this->sco_ids) && !
sizeof($this->subitem_ids))
200 foreach($tmp_cols as $id => $def)
202 $id = explode(
'#~#', $id);
209 $columns[
"obj_".$this->obj_id] = $parent;
213 unset($user_cols[0][
"status"]);
214 unset($user_cols[0][
"login"]);
215 foreach($user_cols[0] as $col_id => $col_def)
220 $col_def[
"default"] =
false;
228 function getItems(array $a_user_fields, array $a_privary_fields = null)
230 include_once(
"./Services/Tracking/classes/class.ilTrQuery.php");
232 if($collection[
"object_ids"])
235 $this->ref_ids = $collection[
"ref_ids"];
238 $check_agreement =
false;
242 include_once
"Services/PrivacySecurity/classes/class.ilPrivacySettings.php";
244 if($privacy->courseConfirmationRequired())
249 else if($this->in_group)
252 include_once
"Services/PrivacySecurity/classes/class.ilPrivacySettings.php";
254 if($privacy->groupConfirmationRequired())
261 if($collection[
"objectives_parent_id"] &&
$data[
"users"])
266 $this->objective_ids = array();
268 foreach($objectives as $user_id => $objectives)
270 if(isset(
$data[
"set"][$user_id]))
272 foreach($objectives as $objective_id => $status)
274 $obj_id =
"objtv_".$objective_id;
275 $data[
"set"][$user_id][$obj_id] = $status;
277 if(!in_array($obj_id, $this->objective_ids))
287 if($collection[
"scorm"] &&
$data[
"set"])
289 $this->sco_ids = array();
290 foreach(array_keys(
$data[
"set"]) as $user_id)
292 foreach($collection[
"scorm"][
"scos"] as $sco)
294 if(!in_array($sco, $this->sco_ids))
296 $this->sco_ids[$sco] = $collection[
"scorm"][
"scos_title"][$sco];
304 if(in_array($user_id, $collection[
"scorm"][
"failed"][$sco]))
308 else if(in_array($user_id, $collection[
"scorm"][
"completed"][$sco]))
312 else if(in_array($user_id, $collection[
"scorm"][
"in_progress"][$sco]))
317 $obj_id =
"objsco_".$sco;
318 $data[
"set"][$user_id][$obj_id] = $status;
324 if($collection[
"subitems"] &&
$data[
"set"])
326 foreach(array_keys(
$data[
"set"]) as $user_id)
328 foreach($collection[
"subitems"][
"items"] as $item_id)
330 $this->subitem_ids[$item_id] = $collection[
"subitems"][
"item_titles"][$item_id];
333 if(in_array($user_id, $collection[
"subitems"][
"completed"][$item_id]))
337 else if(is_array($collection[
"subitems"][
"in_progress"]) &&
338 in_array($user_id, $collection[
"subitems"][
"in_progress"][$item_id]))
343 $obj_id =
"objsub_".$item_id;
344 $data[
"set"][$user_id][$obj_id] = $status;
352 $this->perc_map = array();
355 foreach($row as $column => $value)
357 if(substr($column, -5) ==
"_perc")
361 $obj_id = explode(
"_", $column);
362 $obj_id = (int)$obj_id[1];
363 $this->perc_map[$obj_id] =
true;
373 return $collection[
"object_ids"];
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"])
393 $this->tpl->setCurrentBlock(
"objects");
394 $this->tpl->setVariable(
"VAL_STATUS",
" ");
395 $this->tpl->parseCurrentBlock();
399 $status = isset($a_set[$c])
402 $percentage = isset($a_set[$c.
"_perc"])
403 ? (int)$a_set[$c.
"_perc"]
419 $this->tpl->setCurrentBlock(
'warning_img');
421 $this->tpl->setVariable(
'WARNING_ALT', $this->lng->txt(
'trac_time_passed').$timing);
422 $this->tpl->parseCurrentBlock();
426 $this->tpl->setCurrentBlock(
"objects");
427 $this->tpl->setVariable(
"VAL_STATUS", $this->
parseValue(
"status", $status,
""));
428 $this->tpl->setVariable(
"VAL_PERCENTAGE", $this->
parseValue(
"percentage", $percentage,
""));
429 $this->tpl->parseCurrentBlock();
433 case (substr($c, 0, 6) ==
"objtv_"):
434 case (substr($c, 0, 7) ==
"objsco_"):
435 case (substr($c, 0, 7) ==
"objsub_"):
436 $status = isset($a_set[$c])
440 $this->tpl->setCurrentBlock(
"objects");
441 if(!$a_set[
"privacy_conflict"])
443 $this->tpl->setVariable(
"VAL_STATUS", $this->
parseValue(
"status", $status,
""));
447 $this->tpl->setVariable(
"VAL_STATUS",
" ");
449 $this->tpl->parseCurrentBlock();
453 $this->tpl->setCurrentBlock(
"user_field");
454 if(!$a_set[
"privacy_conflict"])
456 $this->tpl->setVariable(
"VAL_UF", $this->
parseValue($c, $a_set[$c],
""));
460 $this->tpl->setVariable(
"VAL_UF",
" ");
462 $this->tpl->parseCurrentBlock();
468 if(!$a_set[
"active"] || $a_set[
"privacy_conflict"])
471 if($a_set[
"privacy_conflict"])
473 $mess[] = $lng->txt(
"status_no_permission");
475 else if(!$a_set[
"active"])
477 $mess[] = $lng->txt(
"inactive");
479 $this->tpl->setCurrentBlock(
'inactive_bl');
480 $this->tpl->setVariable(
'TXT_INACTIVE', implode(
", ", $mess));
481 $this->tpl->parseCurrentBlock();
484 $login = !$a_set[
"privacy_conflict"]
487 $this->tpl->setVariable(
"VAL_LOGIN", $login);
492 global $ilObjDataCache;
494 $worksheet->write($a_row, 0, $this->lng->txt(
"login"));
500 if(substr($c, 0, 4) ==
"obj_")
502 $obj_id = substr($c, 4);
503 $type = $ilObjDataCache->lookupType($obj_id);
504 $worksheet->write($a_row, $cnt,
"(".$this->lng->txt($type).
") ".$labels[$c][
"txt"]);
506 if(is_array($this->perc_map) && $this->perc_map[$obj_id])
509 $worksheet->write($a_row, $cnt, $this->lng->txt(
"trac_percentage").
" (%)");
514 $worksheet->write($a_row, $cnt, $labels[$c][
"txt"]);
522 $worksheet->write($a_row, 0, $a_set[
"login"]);
529 case (substr($c, 0, 4) ==
"obj_"):
530 $obj_id = substr($c, 4);
532 $worksheet->write($a_row, $cnt, $val);
534 if(is_array($this->perc_map) && $this->perc_map[$obj_id])
537 $perc = (int)$a_set[$c.
"_perc"];
542 $worksheet->write($a_row, $cnt, $perc);
546 case (substr($c, 0, 6) ==
"objtv_"):
547 case (substr($c, 0, 7) ==
"objsco_"):
548 case (substr($c, 0, 7) ==
"objsub_"):
550 $worksheet->write($a_row, $cnt, $val);
559 $val = $this->
parseValue($c, $a_set[$c],
"user");
560 $worksheet->write($a_row, $cnt, $val);
570 global $ilObjDataCache;
572 $a_csv->addColumn($this->lng->txt(
"login"));
577 if(substr($c, 0, 4) ==
"obj_")
579 $obj_id = substr($c, 4);
580 $type = $ilObjDataCache->lookupType($obj_id);
581 $a_csv->addColumn(
"(".$this->lng->txt($type).
") ".$labels[$c][
"txt"]);
583 if(is_array($this->perc_map) && $this->perc_map[$obj_id])
585 $a_csv->addColumn($this->lng->txt(
"trac_percentage").
" (%)");
590 $a_csv->addColumn($labels[$c][
"txt"]);
599 $a_csv->addColumn($a_set[
"login"]);
605 case (substr($c, 0, 4) ==
"obj_"):
606 $obj_id = substr($c, 4);
608 $a_csv->addColumn($val);
610 if(is_array($this->perc_map) && $this->perc_map[$obj_id])
612 $perc = (int)$a_set[$c.
"_perc"];
617 $a_csv->addColumn($perc);
621 case (substr($c, 0, 6) ==
"objtv_"):
622 case (substr($c, 0, 7) ==
"objsco_"):
623 case (substr($c, 0, 7) ==
"objsub_"):
625 $a_csv->addColumn($val);
634 $val = $this->
parseValue($c, $a_set[$c],
"user");
635 $a_csv->addColumn($val);