19declare(strict_types=1);
33 protected \ILIAS\HTTP\Services
$http;
34 protected \ILIAS\Data\Factory
$df;
45 protected \ILIAS\MediaObjects\MediaType\MediaTypeManager
$media_type;
51 protected \ILIAS\DI\UIServices
$ui;
56 bool $a_edit_order =
false,
57 bool $a_presentation_mode =
false
61 $this->
ctrl = $DIC->ctrl();
62 $this->
lng = $DIC->language();
63 $this->
access = $DIC->access();
64 $this->request =
$DIC->mediaCast()
68 $this->
ui = $DIC->ui();
69 $this->edit_order = $a_edit_order;
70 $this->presentation_mode = $a_presentation_mode;
72 $this->downloadable = $this->mediacast->getDownloadable();
76 $this->media_type =
$DIC->mediaObjects()->internal()->domain()->mediaType();
77 $this->df = new \ILIAS\Data\Factory();
78 $this->
http = $DIC->http();
83 $form_action = $this->df->uri(
84 ILIAS_HTTP_PATH .
'/' .
85 $this->
ctrl->getLinkTarget($this->parent_gui, $this->parent_cmd)
87 $this->url_builder =
new URLBuilder($form_action);
89 $this->url_builder->acquireParameters(
98 $f = $this->
ui->factory();
99 $c =
$f->table()->column();
101 'title' =>
$c->text($this->
lng->txt(
"title"))->withIsSortable(
false),
102 'type' =>
$c->text($this->
lng->txt(
"type"))->withIsSortable(
false),
103 'size' =>
$c->text($this->
lng->txt(
"size"))->withIsSortable(
false)
105 if ($this->playtime) {
106 $columns[
'playtime'] =
$c->text($this->
lng->txt(
"mcst_play_time"))->withIsSortable(
false);
108 $columns[
'creation_date'] =
$c->text($this->
lng->txt(
"created"))->withIsSortable(
false);
109 $columns[
'update_date'] =
$c->text($this->
lng->txt(
"last_update"))->withIsSortable(
false);
111 $columns[
'preview'] =
$c->text($this->
lng->txt(
"preview"))->withIsSortable(
false);
119 array $visible_column_ids,
122 mixed $additional_viewcontrol_data,
124 mixed $additional_parameters
127 foreach ($this->mediacast->getSortedItemsArray() as $item) {
129 if ($cnt < $range->getStart() || $cnt >
$range->
getEnd()) {
133 $row_id = (string) $item[
'id'];
135 $med = $mob->getMediaItem(
"Standard");
138 $data[
'title'] = $item[
"title"];
140 if ($item[
"update_date"] !== $item[
"creation_date"]) {
141 $data[
'update_date'] =
144 $data[
'update_date'] =
"-";
146 if ($item[
"playtime"] !==
"00:00:00") {
147 $data[
'playtime'] = $item[
"playtime"];
149 $data[
'playtime'] =
"-";
153 if (is_file($file)) {
154 $size = filesize($file);
155 $size = sprintf(
"%.1f MB", $size / 1024 / 1024);
156 $data[
'size'] = $size;
160 $data[
'type'] = $med->getFormat();
161 if ($mob->getVideoPreviewPic() !==
"") {
163 $image = $this->
ui->factory()->image()->responsive($mob->getVideoPreviewPic(), $item[
"title"]);
164 $html = $this->
ui->renderer()->render($image);
165 $html = str_replace(
"<img ",
"<img style='max-width:150px;' ", $html);
166 $data[
'preview'] = $html;
168 $data[
'preview'] =
"";
172 yield $row_builder->buildDataRow($row_id,
$data);
177 mixed $additional_viewcontrol_data,
179 mixed $additional_parameters
181 return count($this->mediacast->getSortedItemsArray());
186 $action = $this->request->getTableAction($this->action_parameter_token->getName());
187 if ($action !==
"") {
191 $this->parent_gui->$action();
197 $f = $this->
ui->factory();
198 $a =
$f->table()->action();
200 $form_action = $this->df->uri(
201 ILIAS_HTTP_PATH .
'/' .
202 $this->
ctrl->getLinkTarget($this->parent_gui, $this->parent_cmd)
205 $url_builder = $this->url_builder;
206 $action_parameter_token = $this->action_parameter_token;
207 $row_id_token = $this->row_id_token;
209 $actions[
"editCastItem"] =
$a->single(
210 $this->
lng->txt(
"edit"),
211 $url_builder->
withParameter($action_parameter_token,
"editCastItem"),
215 $actions[
"showCastItem"] =
$a->single(
216 $this->
lng->txt(
"show"),
217 $url_builder->
withParameter($action_parameter_token,
"showCastItem"),
221 if ($this->playtime) {
222 $actions[
"determinePlaytime"] =
$a->single(
223 $this->
lng->txt(
"mcst_det_playtime"),
224 $url_builder->
withParameter($action_parameter_token,
"determinePlaytime"),
229 if ($this->downloadable) {
230 $actions[
"downloadItem"] =
$a->single(
231 $this->
lng->txt(
"download"),
232 $url_builder->
withParameter($action_parameter_token,
"downloadItem"),
237 $actions[
"confirmItemDeletion"] =
$a->standard(
238 $this->
lng->txt(
"delete"),
239 $url_builder->
withParameter($action_parameter_token,
"confirmItemDeletion"),
244 ->data($this, $this->
lng->txt(
"mcst_items"), $this->getColumns())
245 ->withActions($actions)
246 ->withRequest($this->
http->request());
250 protected function fillRow(array $a_set): void
253 $ilCtrl = $this->ctrl;
254 $ilAccess = $this->access;
259 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
261 if ($this->presentation_mode) {
262 $ilCtrl->setParameterByClass(
"ilobjmediacastgui",
"presentation",
"1");
266 if ($enable_internal_rss && !$this->presentation_mode) {
267 $this->tpl->setCurrentBlock(
"access");
268 $this->tpl->setVariable(
"TXT_ACCESS",
$lng->txt(
"news_news_item_visibility"));
270 $this->tpl->setVariable(
"VAL_ACCESS",
$lng->txt(
"news_visibility_public"));
272 $this->tpl->setVariable(
"VAL_ACCESS",
$lng->txt(
"news_visibility_users"));
274 $this->tpl->parseCurrentBlock();
277 $ilCtrl->setParameterByClass(
"ilobjmediacastgui",
"item_id",
"");
282 $med = $mob->getMediaItem(
"Standard");
284 $this->tpl->setVariable(
289 $this->tpl->setVariable(
291 $lng->txt(
"mcst_play_time")
294 if (!$this->edit_order) {
295 if ($this->downloadable) {
296 $ilCtrl->setParameterByClass(
"ilobjmediacastgui",
"item_id", $a_set[
"id"]);
300 $a_mob = $mob->getMediaItem($purpose);
301 if (!is_object($a_mob)) {
304 $ilCtrl->setParameterByClass(
"ilobjmediacastgui",
"purpose", $a_mob->getPurpose());
306 $this->tpl->setCurrentBlock(
"downloadable");
307 $this->tpl->setVariable(
"TXT_DOWNLOAD",
$lng->txt(
"mcst_download_" . strtolower($a_mob->getPurpose())));
308 $this->tpl->setVariable(
"CMD_DOWNLOAD", $ilCtrl->getLinkTargetByClass(
"ilobjmediacastgui",
"downloadItem"));
309 $this->tpl->parseCurrentBlock();
314 $event_url = ($this->presentation_mode)
315 ? $ilCtrl->getLinkTarget($this->parent_obj,
"handlePlayerEvent",
"",
true,
false)
317 if (!is_null($med)) {
318 $file = $mob->getStandardSrc();
320 if ($this->media_type->isAudio($med->getFormat())) {
321 $comp = $ui->factory()->player()->audio(
325 } elseif ($this->media_type->isVideo($med->getFormat())) {
326 $comp = $ui->factory()->player()->video(
329 } elseif ($this->media_type->isImage($med->getFormat())) {
330 $comp = $ui->factory()->image()->responsive($file,
"");
332 if (!is_null($comp)) {
333 $this->tpl->setVariable(
"PLAYER", $ui->renderer()->render($comp));
338 $ilCtrl->setParameterByClass(
"ilobjmediacastgui",
"item_id", $a_set[
"id"]);
339 if ($ilAccess->checkAccess(
"write",
"", $this->request->getRefId()) &&
340 !$this->presentation_mode) {
342 if (!is_int(strpos($med->getFormat(),
"image/"))) {
343 $this->tpl->setVariable(
"TXT_DET_PLAYTIME",
$lng->txt(
"mcst_det_playtime"));
344 $this->tpl->setVariable(
346 $ilCtrl->getLinkTargetByClass(
"ilobjmediacastgui",
"determinePlaytime")
349 $this->tpl->parseCurrentBlock();
351 $this->tpl->setCurrentBlock(
"edit_checkbox");
352 $this->tpl->setVariable(
"VAL_ID", $a_set[
"id"]);
353 $this->tpl->parseCurrentBlock();
357 $this->tpl->setCurrentBlock(
"edit_order");
358 $this->tpl->setVariable(
"VAL_ID", $a_set[
"id"]);
359 $this->tpl->setVariable(
"VAL_ORDER", $a_set[
"order"]);
360 $this->tpl->parseCurrentBlock();
365 if (!$this->presentation_mode) {
366 if ($a_set[
"mob_cnt_download"] > 0) {
367 $this->tpl->setCurrentBlock(
"prop");
368 $this->tpl->setVariable(
"TXT_PROP",
$lng->txt(
"mcst_download_cnt"));
369 $this->tpl->setVariable(
"VAL_PROP", $a_set[
"mob_cnt_download"]);
370 $this->tpl->parseCurrentBlock();
372 if ($a_set[
"mob_cnt_play"] > 0) {
373 $this->tpl->setCurrentBlock(
"prop");
374 $this->tpl->setVariable(
"TXT_PROP",
$lng->txt(
"mcst_play_cnt"));
375 $this->tpl->setVariable(
"VAL_PROP", $a_set[
"mob_cnt_play"]);
376 $this->tpl->parseCurrentBlock();
Both the subject and the direction need to be specified when expressing an order.
A simple class to express a naive range of whole positive numbers.
withParameter(URLBuilderToken $token, string|array $value)
Change an acquired parameter's value if the supplied token is valid.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
special template class to simplify handling of ITX/PEAR
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This describes a Data Table.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples