ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.McstPodcastGUI.php
Go to the documentation of this file.
1<?php
2
26{
27 protected \ILIAS\MediaCast\InternalGUIService $gui;
28 protected \ILIAS\MediaCast\MediaCastManager $mc_manager;
29 protected string $rss_link = "";
31 protected ilCtrl $ctrl;
32 protected \ilObjMediaCast $media_cast;
34 protected \ILIAS\DI\UIServices $ui;
35 protected \ilLanguage $lng;
36 protected \ilObjUser $user;
37
38 public function __construct(
39 \ilObjMediaCast $obj,
41 string $rss_link = ""
42 ) {
43 global $DIC;
44
45 $this->ui = $DIC->ui();
46 $this->lng = $DIC->language();
47 $this->media_cast = $obj;
48 $this->tpl = $tpl;
49 $this->user = $DIC->user();
50 $this->ctrl = $DIC->ctrl();
51 $this->rss_link = $rss_link;
52 $this->player_wrapper = $DIC->mediaObjects()
53 ->internal()
54 ->gui()
55 ->player()
56 ->wrapper();
57 $this->mc_manager = $DIC->mediaCast()->internal()->domain()->mediaCast($obj);
58 $this->gui = $DIC->mediaCast()->internal()->gui();
59 }
60
64 public function executeCommand(): void
65 {
67
68 $next_class = $ctrl->getNextClass($this);
69 $cmd = $ctrl->getCmd("show");
70
71 switch ($next_class) {
72 case strtolower(ilMediaObjectsPlayerWrapperGUI::class):
73 $ctrl->forwardCommand($this->player_wrapper);
74 break;
75
76 default:
77 if (in_array($cmd, array(""))) {
78 $this->$cmd();
79 }
80 }
81 }
82
83 public function getHTML(): string
84 {
85 $f = $this->ui->factory();
86 $renderer = $this->ui->renderer();
87 $ctrl = $this->ctrl;
89
90 $items = [];
91 foreach ($this->media_cast->getSortedItemsArray() as $med_item) {
92 $mob = new \ilObjMediaObject($med_item["mob_id"]);
93 $ctrl->setParameterByClass("ilobjmediacastgui", "item_id", $med_item["id"]);
94
95 $audio = $this->player_wrapper->audio(
96 $mob,
97 $this->media_cast->getRefId()
98 );
99
100 if (is_null($audio)) {
101 continue;
102 }
103
104 $actions = [];
105 $properties = [];
106 $properties[$this->lng->txt("mcst_duration")] = $med_item["playtime"];
107
108 if ($this->mc_manager->commentsActive()) {
109 $comments_gui = $this->gui->comments()->commentGUI(
110 $this->media_cast->getRefId(),
111 (int) $med_item["id"]
112 );
113 //var_dump($med_item["id"]);
114 $properties[$this->lng->txt("comments")] = $renderer->render($f->legacy()->content($comments_gui->getNumber()));
115 $actions[] = $comments_gui->getTriggerShyButton();
116 }
117
118 $item = $f->item()->standard($mob->getTitle())
119 ->withAudioPlayer($audio)
120 ->withProperties($properties)
121 ->withDescription($mob->getDescription());
122
123 // $f->image()->responsive($mob->getVideoPreviewPic(), "")
124 if ($mob->getVideoPreviewPic() != "") {
125 $item = $item->withLeadImage(
126 $f->image()->responsive($mob->getVideoPreviewPic(), "")
127 );
128 }
129
130 if ($this->media_cast->getDownloadable()) {
131 $ctrl->setParameterByClass("ilobjmediacastgui", "purpose", "Standard");
132 $download = $ctrl->getLinkTargetByClass("ilobjmediacastgui", "downloadItem");
133 $actions[] = $f->button()->shy($lng->txt("download"), $download);
134 }
135
136 if (count($actions) > 0) {
137 $dd = $f->dropdown()->standard($actions);
138 $item = $item->withActions($dd);
139 }
140
141 $items[] = $item;
142 }
143 //exit;
144
145 $list = $f->panel()->listing()->standard(
146 $this->lng->txt("mcst_audio_files"),
147 [
148 $f->item()->group("", $items)
149 ]
150 );
151
152 if ($this->rss_link !== "") {
153 $actions = [
154 $f->link()->standard(
155 $lng->txt("mcst_webfeed"),
156 $this->rss_link
157 )->withOpenInNewViewport(true)
158 ];
159 $list = $list->withActions($f->dropdown()->standard($actions));
160 }
161
162 return $renderer->render($list);
163 }
164}
$renderer
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 MediaCast MediaCastManager $mc_manager
ILIAS MediaCast InternalGUIService $gui
ILIAS DI UIServices $ui
ilMediaObjectsPlayerWrapperGUI $player_wrapper
Class ilCtrl provides processing control methods.
getNextClass($a_gui_class=null)
@inheritDoc
forwardCommand(object $a_gui_object)
@inheritDoc
getCmd(?string $fallback_command=null)
@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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26