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;
32 $this->
setRowTemplate(
"tpl.mob_usage_row.html",
"Services/MediaObjects");
34 $this->
setTitle($lng->txt(
"cont_mob_usages"));
42 $usages = $this->media_object->getUsages($this->include_hist);
46 $agg_usages = array();
47 foreach($usages as $k => $usage)
49 if ($usage[
"type"] ==
"clip")
55 if (empty($agg_usages[$usage[
"type"].
":".$usage[
"id"]]))
57 $usage[
"hist_nr"] = array($usage[
"hist_nr"]);
58 $agg_usages[$usage[
"type"].
":".$usage[
"id"]] = $usage;
62 $agg_usages[$usage[
"type"].
":".$usage[
"id"]][
"hist_nr"][] =
71 $agg_usages[] = array(
"type" =>
"clip",
"cnt" => $clip_cnt);
89 if(is_int(strpos($usage[
"type"],
":")))
91 $us_arr = explode(
":", $usage[
"type"]);
92 $usage[
"type"] = $us_arr[1];
93 $cont_type = $us_arr[0];
97 include_once(
'classes/class.ilLink.php');
99 switch($usage[
"type"])
103 require_once(
"./Services/COPage/classes/class.ilPageObject.php");
112 require_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
113 require_once(
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
114 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
118 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_".$cont_type);
119 $item[
"obj_title"] = $lm_obj->
getTitle();
120 $item[
"sub_txt"] = $this->lng->txt(
"pg");
131 require_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
132 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
133 require_once(
"./Modules/LearningModule/classes/class.ilObjDlBook.php");
136 $lm_obj =&
new ilObjDlBook($page_obj->getParentId(),
false);
137 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_".$cont_type);
138 $item[
"obj_title"] = $lm_obj->
getTitle();
139 $item[
"sub_txt"] = $this->lng->txt(
"pg");
150 require_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
151 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_wiki");
153 $item[
"sub_txt"] = $this->lng->txt(
"pg");
163 require_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
164 require_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
166 $glo_id = ilGlossaryTerm::_lookGlossaryId($term_id);
167 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_glo");
169 $item[
"sub_txt"] = $this->lng->txt(
"cont_term");
183 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_".$cont_type);
195 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_mep");
205 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_mob");
207 $item[
"sub_txt"] = $this->lng->txt(
"cont_link_area");
212 if (is_array($usage[
"hist_nr"]) &&
213 (count($usage[
"hist_nr"]) > 1 || $usage[
"hist_nr"][0] > 0))
215 asort($usage[
"hist_nr"]);
217 if ($usage[
"hist_nr"][0] == 0)
219 array_shift($usage[
"hist_nr"]);
220 $usage[
"hist_nr"][] = 0;
222 if (count($usage[
"hist_nr"]) > 5)
225 $cnt = count($usage[
"hist_nr"]) - 5;
226 for ($i = 0; $i < $cnt; $i++)
228 unset($usage[
"hist_nr"][$i]);
232 foreach ($usage[
"hist_nr"] as $nr)
240 $ver.= $sep.$this->lng->txt(
"cont_current_version");
245 $this->tpl->setCurrentBlock(
"versions");
246 $this->tpl->setVariable(
"TXT_VERSIONS", $this->lng->txt(
"cont_versions"));
247 $this->tpl->setVariable(
"VAL_VERSIONS", $ver);
248 $this->tpl->parseCurrentBlock();
251 if ($item[
"obj_type_txt"] !=
"")
253 $this->tpl->setCurrentBlock(
"type");
254 $this->tpl->setVariable(
"TXT_TYPE", $this->lng->txt(
"type"));
255 $this->tpl->setVariable(
"VAL_TYPE", $item[
"obj_type_txt"]);
256 $this->tpl->parseCurrentBlock();
259 if ($usage[
"type"] !=
"clip")
261 if ($item[
"obj_link"])
263 $this->tpl->setCurrentBlock(
"linked_item");
264 $this->tpl->setVariable(
"TXT_OBJECT", $item[
"obj_title"]);
265 $this->tpl->setVariable(
"HREF_LINK", $item[
"obj_link"]);
266 $this->tpl->parseCurrentBlock();
270 $this->tpl->setVariable(
"TXT_OBJECT_NO_LINK", $item[
"obj_title"]);
273 if ($item[
"sub_txt"] !=
"")
275 $this->tpl->setVariable(
"SEP",
", ");
276 $this->tpl->setVariable(
"SUB_TXT", $item[
"sub_txt"]);
277 if ($item[
"sub_title"] !=
"")
279 $this->tpl->setVariable(
"SEP2",
": ");
280 $this->tpl->setVariable(
"SUB_TITLE", $item[
"sub_title"]);
287 $this->tpl->setVariable(
"TXT_OBJECT_NO_LINK", $this->lng->txt(
"cont_users_have_mob_in_clip1").
288 " ".$usage[
"cnt"].
" ".$this->lng->txt(
"cont_users_have_mob_in_clip2"));
300 if ($ilAccess->checkAccess(
"write",
"", $ref_id))