5 include_once(
"Services/Table/classes/class.ilTable2GUI.php");
21 function __construct($a_parent_obj, $a_parent_cmd, $a_media_object,
22 $a_include_hist =
false)
27 $this->media_object = $a_media_object;
28 $this->include_hist = $a_include_hist;
29 $this->
addColumn($lng->txt(
"mob_object"));
30 $this->
addColumn($this->lng->txt(
"type"));
33 $this->
addColumn($this->lng->txt(
"cont_versions"));
37 $this->
setRowTemplate(
"tpl.mob_usage_row.html",
"Services/MediaObjects");
39 $this->
setTitle($lng->txt(
"cont_mob_usages"));
47 $usages = $this->media_object->getUsages($this->include_hist);
51 $agg_usages = array();
52 foreach($usages as $k => $usage)
54 if ($usage[
"type"] ==
"clip")
60 if (empty($agg_usages[$usage[
"type"].
":".$usage[
"id"]]))
62 $usage[
"hist_nr"] = array($usage[
"hist_nr"]);
63 $agg_usages[$usage[
"type"].
":".$usage[
"id"]] = $usage;
67 $agg_usages[$usage[
"type"].
":".$usage[
"id"]][
"hist_nr"][] =
76 $agg_usages[] = array(
"type" =>
"clip",
"cnt" => $clip_cnt);
94 if(is_int(strpos($usage[
"type"],
":")))
96 $us_arr = explode(
":", $usage[
"type"]);
97 $usage[
"type"] = $us_arr[1];
98 $cont_type = $us_arr[0];
101 include_once(
'./Services/Link/classes/class.ilLink.php');
103 switch($usage[
"type"])
106 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
115 require_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
116 require_once(
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
117 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
121 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_".$cont_type);
122 $item[
"obj_title"] = $lm_obj->
getTitle();
123 $item[
"sub_txt"] = $this->lng->txt(
"pg");
134 require_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
135 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
136 require_once(
"./Modules/LearningModule/classes/class.ilObjDlBook.php");
139 $lm_obj =&
new ilObjDlBook($page_obj->getParentId(),
false);
140 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_".$cont_type);
141 $item[
"obj_title"] = $lm_obj->
getTitle();
142 $item[
"sub_txt"] = $this->lng->txt(
"pg");
153 require_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
154 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_wiki");
156 $item[
"sub_txt"] = $this->lng->txt(
"pg");
166 require_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
167 require_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
169 $glo_id = ilGlossaryTerm::_lookGlossaryId($term_id);
170 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_glo");
172 $item[
"sub_txt"] = $this->lng->txt(
"cont_term");
182 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_".$cont_type);
192 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
197 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_".$type);
210 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_mep");
220 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_mob");
222 $item[
"sub_txt"] = $this->lng->txt(
"cont_link_area");
227 if ($this->include_hist)
230 if (is_array($usage[
"hist_nr"]) &&
231 (count($usage[
"hist_nr"]) > 1 || $usage[
"hist_nr"][0] > 0))
233 asort($usage[
"hist_nr"]);
235 if ($usage[
"hist_nr"][0] == 0)
237 array_shift($usage[
"hist_nr"]);
238 $usage[
"hist_nr"][] = 0;
240 if (count($usage[
"hist_nr"]) > 5)
243 $cnt = count($usage[
"hist_nr"]) - 5;
244 for ($i = 0; $i < $cnt; $i++)
246 unset($usage[
"hist_nr"][$i]);
250 foreach ($usage[
"hist_nr"] as $nr)
258 $ver.= $sep.$this->lng->txt(
"cont_current_version");
264 $this->tpl->setCurrentBlock(
"versions");
265 $this->tpl->setVariable(
"VAL_VERSIONS", $ver);
266 $this->tpl->parseCurrentBlock();
269 if ($item[
"obj_type_txt"] !=
"")
271 $this->tpl->setVariable(
"VAL_TYPE", $item[
"obj_type_txt"]);
274 if ($usage[
"type"] !=
"clip")
276 if ($item[
"obj_link"])
278 $this->tpl->setCurrentBlock(
"linked_item");
279 $this->tpl->setVariable(
"TXT_OBJECT", $item[
"obj_title"]);
280 $this->tpl->setVariable(
"HREF_LINK", $item[
"obj_link"]);
281 $this->tpl->parseCurrentBlock();
285 $this->tpl->setVariable(
"TXT_OBJECT_NO_LINK", $item[
"obj_title"]);
288 if ($item[
"sub_txt"] !=
"")
290 $this->tpl->setVariable(
"SEP",
", ");
291 $this->tpl->setVariable(
"SUB_TXT", $item[
"sub_txt"]);
292 if ($item[
"sub_title"] !=
"")
294 $this->tpl->setVariable(
"SEP2",
": ");
295 $this->tpl->setVariable(
"SUB_TITLE", $item[
"sub_title"]);
302 $this->tpl->setVariable(
"TXT_OBJECT_NO_LINK", $this->lng->txt(
"cont_users_have_mob_in_clip1").
303 " ".$usage[
"cnt"].
" ".$this->lng->txt(
"cont_users_have_mob_in_clip2"));
315 if ($ilAccess->checkAccess(
"write",
"", $ref_id))