ILIAS  release_8 Revision v8.24
class.McstPodcastGUI.php
Go to the documentation of this file.
1<?php
2
26{
27 protected string $rss_link = "";
29 protected ilCtrl $ctrl;
30 protected \ilObjMediaCast $media_cast;
32 protected \ILIAS\DI\UIServices $ui;
33 protected \ilLanguage $lng;
34 protected \ilObjUser $user;
35
36 public function __construct(
37 \ilObjMediaCast $obj,
39 string $rss_link = ""
40 ) {
41 global $DIC;
42
43 $this->ui = $DIC->ui();
44 $this->lng = $DIC->language();
45 $this->media_cast = $obj;
46 $this->tpl = $tpl;
47 $this->user = $DIC->user();
48 $this->ctrl = $DIC->ctrl();
49 $this->rss_link = $rss_link;
50 $this->player_wrapper = $DIC->mediaObjects()
51 ->internal()
52 ->gui()
53 ->player()
54 ->wrapper();
55 }
56
60 public function executeCommand() : void
61 {
63
64 $next_class = $ctrl->getNextClass($this);
65 $cmd = $ctrl->getCmd("show");
66
67 switch ($next_class) {
68 case strtolower(ilMediaObjectsPlayerWrapperGUI::class):
69 $ctrl->forwardCommand($this->player_wrapper);
70 break;
71
72 default:
73 if (in_array($cmd, array(""))) {
74 $this->$cmd();
75 }
76 }
77 }
78
79 public function getHTML(): string
80 {
81 $f = $this->ui->factory();
82 $renderer = $this->ui->renderer();
83 $ctrl = $this->ctrl;
85
86 $items = [];
87 foreach ($this->media_cast->getSortedItemsArray() as $med_item) {
88 $mob = new \ilObjMediaObject($med_item["mob_id"]);
89
90 $audio = $this->player_wrapper->audio(
91 $mob,
92 $this->media_cast->getRefId()
93 );
94
95 if (is_null($audio)) {
96 continue;
97 }
98
99 $item = $f->item()->standard($mob->getTitle())
100 ->withAudioPlayer($audio)
101 ->withProperties([$this->lng->txt("mcst_duration") => $med_item["playtime"]])
102 ->withDescription($mob->getDescription());
103
104 // $f->image()->responsive($mob->getVideoPreviewPic(), "")
105 if ($mob->getVideoPreviewPic() != "") {
106 $item = $item->withLeadImage(
107 $f->image()->responsive($mob->getVideoPreviewPic(), "")
108 );
109 }
110
111 if ($this->media_cast->getDownloadable()) {
112 $ctrl->setParameterByClass("ilobjmediacastgui", "item_id", $med_item["id"]);
113 $ctrl->setParameterByClass("ilobjmediacastgui", "purpose", "Standard");
114 $download = $ctrl->getLinkTargetByClass("ilobjmediacastgui", "downloadItem");
115 $actions = $f->dropdown()->standard(array(
116 $f->button()->shy($lng->txt("download"), $download),
117 ));
118 $item = $item->withActions($actions);
119 }
120
121
122 $items[] = $item;
123 }
124
125 $list = $f->panel()->listing()->standard(
126 $this->lng->txt("mcst_audio_files"),
127 [
128 $f->item()->group("", $items)
129 ]
130 );
131
132 if ($this->rss_link !== "") {
133 $actions = [
134 $f->link()->standard(
135 $lng->txt("mcst_webfeed"),
136 $this->rss_link
137 )->withOpenInNewViewport(true)
138 ];
139 $list = $list->withActions($f->dropdown()->standard($actions));
140 }
141
142 return $renderer->render($list);
143 }
144}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(\ilObjMediaCast $obj, ilGlobalTemplateInterface $tpl=null, string $rss_link="")
ilGlobalTemplateInterface $tpl
ilObjMediaCast $media_cast
ILIAS DI UIServices $ui
ilMediaObjectsPlayerWrapperGUI $player_wrapper
Class ilCtrl provides processing control methods.
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
getNextClass($a_gui_class=null)
@inheritDoc
getCmd(string $fallback_command=null)
@inheritDoc
forwardCommand(object $a_gui_object)
@inheritDoc
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...