24 include_once(
"Services/Table/classes/class.ilTable2GUI.php");
40 function __construct($a_parent_obj, $a_parent_cmd, $a_media_object)
45 $this->media_object = $a_media_object;
50 $this->
setRowTemplate(
"tpl.mob_usage_row.html",
"Services/MediaObjects");
52 $this->
setTitle($lng->txt(
"cont_mob_usages"));
60 $usages = $this->media_object->getUsages();
64 $agg_usages = array();
65 foreach($usages as $k => $usage)
67 if ($usage[
"type"] ==
"clip")
73 if (empty($agg_usages[$usage[
"type"].
":".$usage[
"id"]]))
75 $usage[
"hist_nr"] = array($usage[
"hist_nr"]);
76 $agg_usages[$usage[
"type"].
":".$usage[
"id"]] = $usage;
80 $agg_usages[$usage[
"type"].
":".$usage[
"id"]][
"hist_nr"][] =
89 $agg_usages[] = array(
"type" =>
"clip",
"cnt" => $clip_cnt);
107 if(is_int(strpos($usage[
"type"],
":")))
109 $us_arr = explode(
":", $usage[
"type"]);
110 $usage[
"type"] = $us_arr[1];
111 $cont_type = $us_arr[0];
115 include_once(
'classes/class.ilLink.php');
117 switch($usage[
"type"])
121 require_once(
"./Services/COPage/classes/class.ilPageObject.php");
130 require_once(
"./Modules/LearningModule/classes/class.ilObjContentObject.php");
131 require_once(
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
132 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
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/LearningModule/classes/class.ilObjContentObject.php");
150 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
151 require_once(
"./Modules/LearningModule/classes/class.ilObjDlBook.php");
154 $lm_obj =&
new ilObjDlBook($page_obj->getParentId(),
false);
155 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_".$cont_type);
156 $item[
"obj_title"] = $lm_obj->
getTitle();
157 $item[
"sub_txt"] = $this->lng->txt(
"pg");
168 require_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
169 require_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
171 $glo_id = ilGlossaryTerm::_lookGlossaryId($term_id);
172 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_glo");
174 $item[
"sub_txt"] = $this->lng->txt(
"cont_term");
188 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_".$cont_type);
200 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_mep");
210 $item[
"obj_type_txt"] = $this->lng->txt(
"obj_mob");
212 $item[
"sub_txt"] = $this->lng->txt(
"cont_link_area");
217 if (is_array($usage[
"hist_nr"]) &&
218 (count($usage[
"hist_nr"]) > 1 || $usage[
"hist_nr"][0] > 0))
220 asort($usage[
"hist_nr"]);
222 if ($usage[
"hist_nr"][0] == 0)
224 array_shift($usage[
"hist_nr"]);
225 $usage[
"hist_nr"][] = 0;
227 if (count($usage[
"hist_nr"]) > 5)
230 $cnt = count($usage[
"hist_nr"]) - 5;
231 for ($i = 0; $i < $cnt; $i++)
233 unset($usage[
"hist_nr"][$i]);
237 foreach ($usage[
"hist_nr"] as $nr)
245 $ver.= $sep.$this->lng->txt(
"cont_current_version");
250 $this->tpl->setCurrentBlock(
"versions");
251 $this->tpl->setVariable(
"TXT_VERSIONS", $this->lng->txt(
"cont_versions"));
252 $this->tpl->setVariable(
"VAL_VERSIONS", $ver);
253 $this->tpl->parseCurrentBlock();
256 if ($item[
"obj_type_txt"] !=
"")
258 $this->tpl->setCurrentBlock(
"type");
259 $this->tpl->setVariable(
"TXT_TYPE", $this->lng->txt(
"type"));
260 $this->tpl->setVariable(
"VAL_TYPE", $item[
"obj_type_txt"]);
261 $this->tpl->parseCurrentBlock();
264 if ($usage[
"type"] !=
"clip")
266 if ($item[
"obj_link"])
268 $this->tpl->setCurrentBlock(
"linked_item");
269 $this->tpl->setVariable(
"TXT_OBJECT", $item[
"obj_title"]);
270 $this->tpl->setVariable(
"HREF_LINK", $item[
"obj_link"]);
271 $this->tpl->parseCurrentBlock();
275 $this->tpl->setVariable(
"TXT_OBJECT_NO_LINK", $item[
"obj_title"]);
278 if ($item[
"sub_txt"] !=
"")
280 $this->tpl->setVariable(
"SEP",
", ");
281 $this->tpl->setVariable(
"SUB_TXT", $item[
"sub_txt"]);
282 if ($item[
"sub_title"] !=
"")
284 $this->tpl->setVariable(
"SEP2",
": ");
285 $this->tpl->setVariable(
"SUB_TITLE", $item[
"sub_title"]);
292 $this->tpl->setVariable(
"TXT_OBJECT_NO_LINK", $this->lng->txt(
"cont_users_have_mob_in_clip1").
293 " ".$usage[
"cnt"].
" ".$this->lng->txt(
"cont_users_have_mob_in_clip2"));
305 if ($ilAccess->checkAccess(
"write",
"", $ref_id))