4 include_once(
"./Services/Tracking/classes/class.ilLPTableBaseGUI.php");
35 $this->in_group = $tree->checkForParentType($this->ref_id,
"grp");
42 $this->in_course = $tree->checkForParentType($this->ref_id,
"crs");
53 $this->
parseTitle($this->obj_id,
"trac_matrix");
56 $this->
setFormAction($ilCtrl->getFormActionByClass(get_class($this)));
57 $this->
setRowTemplate(
"tpl.user_object_matrix_row.html",
"Services/Tracking");
62 $this->
addColumn($this->lng->txt(
"login"),
"login");
66 foreach ($selected as $c)
68 $title = $labels[$c][
"txt"];
70 if(isset($labels[$c][
"icon"]))
72 $alt = $lng->txt($labels[$c][
"type"]);
73 $icon =
'<img src="'.$labels[$c][
"icon"].
'" alt="'.$alt.
'" />';
74 if(
sizeof($selected) > 5)
85 if(isset($labels[$c][
"id"]))
87 $sort_id = $labels[$c][
"id"];
92 $sort_id = (substr($c, 0, 4) ==
"udf_") ?
"" : $c;
106 $this->filter[
"name"] = $item->getValue();
111 global $ilObjDataCache;
115 if($this->obj_ids === NULL)
119 $this->obj_ids = $this->
getItems(array_keys($user_cols[0]), $user_cols[1]);
124 foreach($this->obj_ids as $obj_id)
126 if($obj_id == $this->obj_id)
128 $parent = array(
"txt" => $this->lng->txt(
"status"),
133 $title = $ilObjDataCache->lookupTitle($obj_id);
134 $type = $ilObjDataCache->lookupType($obj_id);
138 include_once
"Modules/Session/classes/class.ilObjSession.php";
142 $tmp_cols[strtolower(
$title).
"#~#obj_".$obj_id] = array(
"txt" =>
$title,
"icon" =>
$icon,
"type" => $type,
"default" =>
true);
145 if(
sizeof($this->objective_ids))
147 foreach($this->objective_ids as $obj_id =>
$title)
149 $tmp_cols[strtolower(
$title).
"#~#objtv_".$obj_id] = array(
"txt" =>
$title,
"default" =>
true);
152 if(
sizeof($this->sco_ids))
154 foreach($this->sco_ids as $obj_id =>
$title)
157 $tmp_cols[strtolower(
$title).
"#~#objsco_".$obj_id] = array(
"txt" =>
$title,
"icon"=>
$icon,
"default" =>
true);
160 if(
sizeof($this->subitem_ids))
162 foreach($this->subitem_ids as $obj_id =>
$title)
165 $tmp_cols[strtolower(
$title).
"#~#objsub_".$obj_id] = array(
"txt" =>
$title,
"icon"=>
$icon,
"default" =>
true);
170 if(!
sizeof($this->sco_ids) && !
sizeof($this->subitem_ids))
174 foreach($tmp_cols as $id => $def)
176 $id = explode(
'#~#', $id);
183 $columns[
"obj_".$this->obj_id] = $parent;
187 unset($user_cols[0][
"status"]);
188 unset($user_cols[0][
"login"]);
189 foreach($user_cols[0] as $col_id => $col_def)
194 $col_def[
"default"] =
false;
202 function getItems(array $a_user_fields, array $a_privary_fields = null)
204 include_once(
"./Services/Tracking/classes/class.ilTrQuery.php");
206 if($collection[
"object_ids"])
209 $this->ref_ids = $collection[
"ref_ids"];
212 $check_agreement =
false;
216 include_once
"Services/PrivacySecurity/classes/class.ilPrivacySettings.php";
218 if($privacy->courseConfirmationRequired())
223 else if($this->in_group)
226 include_once
"Services/PrivacySecurity/classes/class.ilPrivacySettings.php";
228 if($privacy->groupConfirmationRequired())
235 if($collection[
"objectives_parent_id"] &&
$data[
"users"])
238 if($objectives[
"cnt"])
240 $this->objective_ids = array();
241 $objective_columns = array();
242 foreach($objectives[
"set"] as
$row)
244 if(isset(
$data[
"set"][$row[
"usr_id"]]))
246 $obj_id =
"objtv_".$row[
"obj_id"];
247 $data[
"set"][$row[
"usr_id"]][
"objects"][$obj_id] = array(
"status"=>$row[
"status"]);
249 if(!in_array($obj_id, $this->objective_ids))
251 $this->objective_ids[$obj_id] = $row[
"title"];
258 if($collection[
"scorm"] &&
$data[
"set"])
260 $this->sco_ids = array();
261 foreach(array_keys(
$data[
"set"]) as $user_id)
263 foreach($collection[
"scorm"][
"scos"] as $sco)
265 if(!in_array($sco, $this->sco_ids))
267 $this->sco_ids[$sco] = $collection[
"scorm"][
"scos_title"][$sco];
275 if(in_array($user_id, $collection[
"scorm"][
"failed"][$sco]))
279 else if(in_array($user_id, $collection[
"scorm"][
"completed"][$sco]))
283 else if(in_array($user_id, $collection[
"scorm"][
"in_progress"][$sco]))
288 $obj_id =
"objsco_".$sco;
289 $data[
"set"][$user_id][
"objects"][$obj_id] = array(
"status"=>$status);
294 if($collection[
"subitems"] &&
$data[
"set"])
296 foreach(array_keys(
$data[
"set"]) as $user_id)
298 foreach($collection[
"subitems"][
"items"] as $item_id)
300 $this->subitem_ids[$item_id] = $collection[
"subitems"][
"item_titles"][$item_id];
303 if(in_array($user_id, $collection[
"subitems"][
"completed"][$item_id]))
307 else if(is_array($collection[
"subitems"][
"in_progress"]) &&
308 in_array($user_id, $collection[
"subitems"][
"in_progress"][$item_id]))
313 $obj_id =
"objsub_".$item_id;
314 $data[
"set"][$user_id][
"objects"][$obj_id] = array(
"status"=>$status);
322 $this->perc_map = array();
323 foreach(
$data[
"set"] as $item)
325 if(is_array($item[
"objects"]))
327 foreach($item[
"objects"] as $obj_id => $obj_data)
329 if((
int)$obj_data[
"percentage"] > 0)
331 $this->perc_map[$obj_id] =
true;
341 return $collection[
"object_ids"];
351 if(!$a_set[
"active"])
353 $this->tpl->setCurrentBlock(
'inactive_bl');
354 $this->tpl->setVariable(
'TXT_INACTIVE', $lng->txt(
"inactive"));
355 $this->tpl->parseCurrentBlock();
358 $this->tpl->setVariable(
"VAL_LOGIN", $a_set[
"login"]);
364 case (substr($c, 0, 4) ==
"obj_"):
365 $obj_id = substr($c, 4);
366 if(!isset($a_set[
"objects"][$obj_id]))
368 $data = array(
"status"=>0);
372 $data = $a_set[
"objects"][$obj_id];
373 if(
$data[
"percentage"] ==
"0")
375 $data[
"percentage"] = NULL;
392 $this->tpl->setCurrentBlock(
'warning_img');
394 $this->tpl->setVariable(
'WARNING_ALT', $this->lng->txt(
'trac_time_passed').$timing);
395 $this->tpl->parseCurrentBlock();
399 $this->tpl->setCurrentBlock(
"objects");
400 $this->tpl->setVariable(
"VAL_STATUS", $this->
parseValue(
"status",
$data[
"status"],
""));
401 $this->tpl->setVariable(
"VAL_PERCENTAGE", $this->
parseValue(
"percentage",
$data[
"percentage"],
""));
402 $this->tpl->parseCurrentBlock();
406 case (substr($c, 0, 6) ==
"objtv_"):
407 case (substr($c, 0, 7) ==
"objsco_"):
408 case (substr($c, 0, 7) ==
"objsub_"):
410 if(!isset($a_set[
"objects"][$obj_id]))
412 $data = array(
"status"=>0);
416 $data = $a_set[
"objects"][$obj_id];
418 $this->tpl->setCurrentBlock(
"objects");
419 $this->tpl->setVariable(
"VAL_STATUS", $this->
parseValue(
"status",
$data[
"status"],
""));
420 $this->tpl->parseCurrentBlock();
424 $this->tpl->setCurrentBlock(
"user_field");
425 $this->tpl->setVariable(
"VAL_UF", $this->
parseValue($c, $a_set[$c],
""));
426 $this->tpl->parseCurrentBlock();
434 global $ilObjDataCache;
436 $worksheet->write($a_row, 0, $this->lng->txt(
"login"));
442 if(substr($c, 0, 4) ==
"obj_")
444 $obj_id = substr($c, 4);
445 $type = $ilObjDataCache->lookupType($obj_id);
446 $worksheet->write($a_row, $cnt,
"(".$this->lng->txt($type).
") ".$labels[$c][
"txt"]);
448 if(is_array($this->perc_map) && $this->perc_map[$obj_id])
451 $worksheet->write($a_row, $cnt, $this->lng->txt(
"trac_percentage").
" (%)");
456 $worksheet->write($a_row, $cnt, $labels[$c][
"txt"]);
464 $worksheet->write($a_row, 0, $a_set[
"login"]);
471 case (substr($c, 0, 4) ==
"obj_"):
472 $obj_id = substr($c, 4);
474 $worksheet->write($a_row, $cnt, $val);
476 if(is_array($this->perc_map) && $this->perc_map[$obj_id])
479 $perc = (int)$a_set[
"objects"][$obj_id][
"percentage"];
484 $worksheet->write($a_row, $cnt, $perc);
488 case (substr($c, 0, 6) ==
"objtv_"):
489 case (substr($c, 0, 7) ==
"objsco_"):
490 case (substr($c, 0, 7) ==
"objsub_"):
493 $worksheet->write($a_row, $cnt, $val);
502 $val = $this->
parseValue($c, $a_set[$c],
"user");
503 $worksheet->write($a_row, $cnt, $val);
513 global $ilObjDataCache;
515 $a_csv->addColumn($this->lng->txt(
"login"));
520 if(substr($c, 0, 4) ==
"obj_")
522 $obj_id = substr($c, 4);
523 $type = $ilObjDataCache->lookupType($obj_id);
524 $a_csv->addColumn(
"(".$this->lng->txt($type).
") ".$labels[$c][
"txt"]);
526 if(is_array($this->perc_map) && $this->perc_map[$obj_id])
528 $a_csv->addColumn($this->lng->txt(
"trac_percentage").
" (%)");
533 $a_csv->addColumn($labels[$c][
"txt"]);
542 $a_csv->addColumn($a_set[
"login"]);
548 case (substr($c, 0, 4) ==
"obj_"):
549 $obj_id = substr($c, 4);
551 $a_csv->addColumn($val);
553 if(is_array($this->perc_map) && $this->perc_map[$obj_id])
555 $perc = (int)$a_set[
"objects"][$obj_id][
"percentage"];
560 $a_csv->addColumn($perc);
564 case (substr($c, 0, 6) ==
"objtv_"):
565 case (substr($c, 0, 7) ==
"objsco_"):
566 case (substr($c, 0, 7) ==
"objsub_"):
569 $a_csv->addColumn($val);
578 $val = $this->
parseValue($c, $a_set[$c],
"user");
579 $a_csv->addColumn($val);