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(
'./Services/Link/classes/class.ilLink.php');
99 switch($usage[
"type"])
102 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
111 require_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
112 require_once(
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
113 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
117 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_".$cont_type);
118 $item[
"obj_title"] = $lm_obj->
getTitle();
119 $item[
"sub_txt"] = $this->lng->txt(
"pg");
130 require_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
131 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
132 require_once(
"./Modules/LearningModule/classes/class.ilObjDlBook.php");
135 $lm_obj =&
new ilObjDlBook($page_obj->getParentId(),
false);
136 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_".$cont_type);
137 $item[
"obj_title"] = $lm_obj->
getTitle();
138 $item[
"sub_txt"] = $this->lng->txt(
"pg");
149 require_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
150 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_wiki");
152 $item[
"sub_txt"] = $this->lng->txt(
"pg");
162 require_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
163 require_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
165 $glo_id = ilGlossaryTerm::_lookGlossaryId($term_id);
166 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_glo");
168 $item[
"sub_txt"] = $this->lng->txt(
"cont_term");
178 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_".$cont_type);
190 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_mep");
200 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_mob");
202 $item[
"sub_txt"] = $this->lng->txt(
"cont_link_area");
207 if (is_array($usage[
"hist_nr"]) &&
208 (count($usage[
"hist_nr"]) > 1 || $usage[
"hist_nr"][0] > 0))
210 asort($usage[
"hist_nr"]);
212 if ($usage[
"hist_nr"][0] == 0)
214 array_shift($usage[
"hist_nr"]);
215 $usage[
"hist_nr"][] = 0;
217 if (count($usage[
"hist_nr"]) > 5)
220 $cnt = count($usage[
"hist_nr"]) - 5;
221 for ($i = 0; $i < $cnt; $i++)
223 unset($usage[
"hist_nr"][$i]);
227 foreach ($usage[
"hist_nr"] as $nr)
235 $ver.= $sep.$this->lng->txt(
"cont_current_version");
240 $this->tpl->setCurrentBlock(
"versions");
241 $this->tpl->setVariable(
"TXT_VERSIONS", $this->lng->txt(
"cont_versions"));
242 $this->tpl->setVariable(
"VAL_VERSIONS", $ver);
243 $this->tpl->parseCurrentBlock();
246 if ($item[
"obj_type_txt"] !=
"")
248 $this->tpl->setCurrentBlock(
"type");
249 $this->tpl->setVariable(
"TXT_TYPE", $this->lng->txt(
"type"));
250 $this->tpl->setVariable(
"VAL_TYPE", $item[
"obj_type_txt"]);
251 $this->tpl->parseCurrentBlock();
254 if ($usage[
"type"] !=
"clip")
256 if ($item[
"obj_link"])
258 $this->tpl->setCurrentBlock(
"linked_item");
259 $this->tpl->setVariable(
"TXT_OBJECT", $item[
"obj_title"]);
260 $this->tpl->setVariable(
"HREF_LINK", $item[
"obj_link"]);
261 $this->tpl->parseCurrentBlock();
265 $this->tpl->setVariable(
"TXT_OBJECT_NO_LINK", $item[
"obj_title"]);
268 if ($item[
"sub_txt"] !=
"")
270 $this->tpl->setVariable(
"SEP",
", ");
271 $this->tpl->setVariable(
"SUB_TXT", $item[
"sub_txt"]);
272 if ($item[
"sub_title"] !=
"")
274 $this->tpl->setVariable(
"SEP2",
": ");
275 $this->tpl->setVariable(
"SUB_TITLE", $item[
"sub_title"]);
282 $this->tpl->setVariable(
"TXT_OBJECT_NO_LINK", $this->lng->txt(
"cont_users_have_mob_in_clip1").
283 " ".$usage[
"cnt"].
" ".$this->lng->txt(
"cont_users_have_mob_in_clip2"));
295 if ($ilAccess->checkAccess(
"write",
"", $ref_id))