78 : string
79 {
80 $f = $this->
ui->factory();
85
86
88 if ($this->media_cast->getDownloadable()) {
90 }
91
92 if ($this->rss_link !== "") {
93 $b =
$f->link()->standard(
95 $this->rss_link
96 )->withOpenInNewViewport(true);
98 }
99
100
101 $cards = [];
102 $modals = [];
103
104 $pages = [];
105
106 $lp_collection_mode = $this->domain->learningProgress($this->media_cast)->isCollectionMode();
107
108 $mob_modals = [];
109 foreach ($this->media_cast->getSortedItemsArray() as $item) {
110 $mob = new \ilObjMediaObject($item["mob_id"]);
111 $med = $mob->getMediaItem("Standard");
112 if (!in_array($med->getFormat(), iterator_to_array($this->media_types->getAllowedImageMimeTypes()), true)) {
113 continue;
114 }
115
116 $resource = $mob->getStandardSrc();
117
118 $image =
$f->image()->responsive(
119 $resource,
120 $mob->getTitle()
121 );
122
123 $pages[] =
$f->modal()->lightboxImagePage($image, $mob->getTitle());
124 if ($lp_collection_mode) {
125 $mob_modals[$mob->getId()] =
$f->modal()->lightbox($pages);
126 $pages = [];
127 }
128 }
129 $main_modal = null;
130 if (!$lp_collection_mode) {
131 $main_modal =
$f->modal()->lightbox($pages);
132 }
133
134 $cnt = 0;
135 $items = $this->media_cast->getSortedItemsArray();
136 $total = count($items);
137 foreach ($items as $item) {
138 $mob = new \ilObjMediaObject($item["mob_id"]);
139 $med = $mob->getMediaItem("Standard");
140
141 if (!in_array($med->getFormat(), iterator_to_array($this->media_types->getAllowedImageMimeTypes()), true)) {
142 continue;
143 }
144
145 $resource = $mob->getStandardSrc();
146
147 $preview_resource = $resource;
148 if ($mob->getVideoPreviewPic() != "") {
149
150 }
151
152
153 $preview_image =
$f->image()->responsive(
154 $preview_resource,
155 $mob->getTitle()
156 );
157
158 $image =
$f->image()->responsive(
159 $resource,
160 $mob->getTitle()
161 );
162
163 if (!$lp_collection_mode) {
164 $modal = $main_modal;
165 } else {
166 $modal = $mob_modals[$mob->getId()];
167 }
168
169 $card_image = $preview_image->withAction($modal->getShowSignal());
170 $slide_to = "";
171 $completed_cb = "";
172 if (!$lp_collection_mode) {
173 if ($total > 1) {
174 $slide_to = "document.querySelector('.modal-body .carousel [data-slide-to=\"" . $cnt . "\"]').click();";
175 }
176 } else {
177 $completed_cb = $this->completed_callback . '&mob_id=' . $mob->getId();
178 $completed_cb = "$.ajax({type:'GET', url: '$completed_cb'});";
179 }
180
181 $card_image = $card_image->withAdditionalOnLoadCode(
function (
$id) use ($slide_to, $completed_cb) {
182 return "$('#$id').click(function(e) { $slide_to $completed_cb });";
183 });
184 if (!$lp_collection_mode) {
185 $cnt++;
186 }
187
188 $sections = ($mob->getDescription())
189 ? [
$f->legacy()->content($mob->getDescription())]
190 : [];
191
192 if ($this->media_cast->getDownloadable()) {
196 $sections[] =
$f->button()->standard(
$lng->
txt(
"download"), $download);
197 }
198
199
200 if ($this->mc_manager->commentsActive()) {
201 $comments_gui = $this->gui->comments()->commentGUI(
202 $this->media_cast->getRefId(),
204 );
205 $sections[] =
$f->legacy()->content($comments_gui->getGlyph());
206 }
207
208
209 $title = $mob->getTitle();
210
211 $card =
$f->card()->standard(
212 $title,
213 $card_image
214 )->withSections(
215 $sections
216 )->withTitleAction($modal->getShowSignal());
217
218
219 $cards[] = $card;
220 $modals[] = $modal;
221 }
222
223 $deck =
$f->deck($cards);
224
225 if (count($pages) === 0 && count($mob_modals) === 0) {
226 return "";
227 }
228 if (!$lp_collection_mode) {
229 $modals = [$main_modal];
230 } else {
231 $modals = $mob_modals;
232 }
233 return "<div id='il-mcst-img-gallery'>" .
$renderer->render(array_merge([$deck], $modals)) .
"</div>";
234 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getFormAction(object $a_gui_obj, ?string $a_fallback_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
getLinkTargetByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
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...