ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjMediaPoolSubItemListGUI.php
Go to the documentation of this file.
1<?php
2
24{
25 public function getHTML(): string
26 {
28
29 $lng->loadLanguageModule('content');
30 foreach ($this->getSubItemIds(true) as $sub_item) {
31 if (
32 is_object($this->getHighlighter()) &&
33 $this->getHighlighter()->getContent($this->getObjId(), $sub_item) !== ''
34 ) {
35 $this->tpl->setCurrentBlock('sea_fragment');
36 $this->tpl->setVariable('TXT_FRAGMENT', $this->getHighlighter()->getContent($this->getObjId(), $sub_item));
37 $this->tpl->parseCurrentBlock();
38 }
39 $this->tpl->setCurrentBlock('subitem');
40 $this->tpl->setVariable('SEPERATOR', ':');
41
42 switch (ilMediaPoolItem::lookupType($sub_item)) {
43 case 'fold':
44 $this->tpl->setVariable('LINK', ilLink::_getLink($this->getRefId(), 'mep', array(), '_' . $sub_item));
45 $this->tpl->setVariable('TARGET', $this->getItemListGUI()->getCommandFrame(''));
46 break;
47
48 case 'mob':
49 $this->tpl->setVariable(
50 'LINK',
51 $this->getItemListGUI()->getCommandLink('allMedia') .
52 '&force_filter=' . $sub_item
53 );
54 $this->tpl->setVariable('TARGET', $this->getItemListGUI()->getCommandFrame(''));
55 break;
56
57 case 'pg':
58 $pool = new ilObjMediaPool($this->getRefId());
59 $parent_id = $pool->getParentId($sub_item);
60 if ($parent_id !== null) {
61 $this->tpl->setVariable('LINK', ilLink::_getLink($this->getRefId(), 'mep', [], '_' . $parent_id));
62 $this->tpl->setVariable('TARGET', $this->getItemListGUI()->getCommandFrame(''));
63 } else {
64 $this->tpl->setVariable('LINK', ilLink::_getLink($this->getRefId(), 'mep', []));
65 $this->tpl->setVariable('TARGET', $this->getItemListGUI()->getCommandFrame(''));
66 }
67 break;
68 }
69
70
71 $this->tpl->setVariable('SUBITEM_TYPE', $lng->txt('obj_' . ilMediaPoolItem::lookupType($sub_item)));
72 $this->tpl->setVariable('TITLE', ilMediaPoolItem::lookupTitle($sub_item));
73 #$this->getItemListGUI()->setChildId($sub_item);
74
75 // begin-patch mime_filter
76
77 if (!$this->parseImage($sub_item)) {
78 $this->tpl->setVariable('SUBITEM_TYPE', $lng->txt('obj_' . ilMediaPoolItem::lookupType($sub_item)));
79 $this->tpl->setVariable('SEPERATOR', ':');
80 }
81
82 $this->tpl->parseCurrentBlock();
83 }
84
85 $this->showDetailsLink();
86
87 return $this->tpl->get();
88 }
89
90 protected function parseImage(int $a_sub_id): bool
91 {
92 global $DIC;
93 $thumbs_gui = $DIC->mediaObjects()->internal()->gui()->thumbs();
94
95 $sub_id = ilMediaPoolItem::lookupForeignId($a_sub_id);
96 // output thumbnail (or mob icon)
97 if (ilObject::_lookupType($sub_id) === "mob") {
98 $mob = new ilObjMediaObject($sub_id);
99 $this->tpl->setVariable(
100 "SUB_ITEM_IMAGE",
101 $thumbs_gui->getThumbHtml($sub_id)
102 );
103 }
104 return false;
105 }
106}
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static lookupTitle(int $a_id)
static lookupForeignId(int $a_id)
static lookupType(int $a_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)
Base class for all sub item list gui's.
getSubItemIds(bool $limited=false)
global $DIC
Definition: shib_login.php:26