ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilMediaCastManageTableGUI Class Reference
+ Inheritance diagram for ilMediaCastManageTableGUI:
+ Collaboration diagram for ilMediaCastManageTableGUI:

Public Member Functions

 __construct (ilObjMediaCastGUI $parent_gui, string $parent_cmd="", bool $a_edit_order=false, bool $a_presentation_mode=false)
 
 getRows (Table\DataRowBuilder $row_builder, array $visible_column_ids, Range $range, Order $order, ?array $filter_data, ?array $additional_parameters)
 
 getTotalRowCount (?array $filter_data, ?array $additional_parameters)
 
 handleCommand ()
 
 get ()
 

Protected Member Functions

 getColumns ()
 
 fillRow (array $a_set)
 

Protected Attributes

 $parent_obj
 
ilTemplate $tpl
 
URLBuilder $url_builder
 
ILIAS HTTP Services $http
 
ILIAS Data Factory $df
 
string $parent_cmd
 
ilLanguage $lng
 
ilCtrlInterface $ctrl
 
bool $preview
 
bool $playtime
 
ilObjMediaCast $mediacast
 
URLBuilderToken $action_parameter_token
 
URLBuilderToken $row_id_token
 
ilObjMediaCastGUI $parent_gui
 
ILIAS MediaObjects MediaType MediaTypeManager $media_type
 
bool $presentation_mode
 
StandardGUIRequest $request
 
ilAccessHandler $access
 
bool $downloadable = false
 
bool $edit_order
 
ILIAS DI UIServices $ui
 

Detailed Description

Definition at line 28 of file class.ilMediaCastManageTableGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMediaCastManageTableGUI::__construct ( ilObjMediaCastGUI  $parent_gui,
string  $parent_cmd = "",
bool  $a_edit_order = false,
bool  $a_presentation_mode = false 
)

Definition at line 53 of file class.ilMediaCastManageTableGUI.php.

References $action_parameter_token, $DIC, $parent_cmd, $parent_gui, $row_id_token, $url_builder, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilObjectGUI\getObject(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\UI\examples\Symbol\Glyph\Preview\preview(), ILIAS\Repository\ui(), ilObjMediaCast\VIEW_IMG_GALLERY, and ilObjMediaCast\VIEW_PODCAST.

58  {
59  global $DIC;
60 
61  $this->ctrl = $DIC->ctrl();
62  $this->lng = $DIC->language();
63  $this->access = $DIC->access();
64  $this->request = $DIC->mediaCast()
65  ->internal()
66  ->gui()
67  ->standardRequest();
68  $this->ui = $DIC->ui();
69  $this->edit_order = $a_edit_order;
70  $this->presentation_mode = $a_presentation_mode;
71  $this->mediacast = $parent_gui->getObject();
72  $this->downloadable = $this->mediacast->getDownloadable();
73 
74  $this->parent_gui = $parent_gui;
75  $this->parent_cmd = $parent_cmd;
76  $this->media_type = $DIC->mediaObjects()->internal()->domain()->mediaType();
77  $this->df = new \ILIAS\Data\Factory();
78  $this->http = $DIC->http();
79 
80  $this->playtime = ($this->mediacast->getViewMode() !== ilObjMediaCast::VIEW_IMG_GALLERY);
81  $this->preview = ($this->mediacast->getViewMode() !== ilObjMediaCast::VIEW_PODCAST);
82 
83  $form_action = $this->df->uri(
84  ILIAS_HTTP_PATH . '/' .
85  $this->ctrl->getLinkTarget($this->parent_gui, $this->parent_cmd)
86  );
87  $this->url_builder = new URLBuilder($form_action);
89  $this->url_builder->acquireParameters(
90  ["mcst"], // namespace
91  "table_action", //this is the actions's parameter name
92  "ids" //this is the parameter name to be used for row-ids
93  );
94  }
preview()
description: > Example for rendering a Preview Glyph.
Definition: preview.php:41
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:22
URLBuilder.
Definition: URLBuilder.php:40
+ Here is the call graph for this function:

Member Function Documentation

◆ fillRow()

ilMediaCastManageTableGUI::fillRow ( array  $a_set)
protected

Definition at line 248 of file class.ilMediaCastManageTableGUI.php.

References $access, $ctrl, $lng, $presentation_mode, ilObjMediaCast\$purposes, $ui, ilObject\_exists(), ilObjMediaObject\_lookupItemPath(), NEWS_PUBLIC, null, and ilLanguage\txt().

248  : void
249  {
250  $lng = $this->lng;
251  $ilCtrl = $this->ctrl;
252  $ilAccess = $this->access;
253  $size = 0;
254  $ui = $this->ui;
255 
256  $news_set = new ilSetting("news");
257  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
258 
259  if ($this->presentation_mode) {
260  $ilCtrl->setParameterByClass("ilobjmediacastgui", "presentation", "1");
261  }
262 
263  // access
264  if ($enable_internal_rss && !$this->presentation_mode) {
265  $this->tpl->setCurrentBlock("access");
266  $this->tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
267  if ($a_set["visibility"] == NEWS_PUBLIC) {
268  $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
269  } else {
270  $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
271  }
272  $this->tpl->parseCurrentBlock();
273  }
274 
275  $ilCtrl->setParameterByClass("ilobjmediacastgui", "item_id", "");
276 
277  if (ilObject::_exists($a_set["mob_id"])) {
278 
279  $mob = new ilObjMediaObject($a_set["mob_id"]);
280  $med = $mob->getMediaItem("Standard");
281 
282  $this->tpl->setVariable(
283  "VAL_DESCRIPTION",
284  $a_set["content"]
285  );
286 
287  $this->tpl->setVariable(
288  "TXT_DURATION",
289  $lng->txt("mcst_play_time")
290  );
291 
292  if (!$this->edit_order) {
293  if ($this->downloadable) {
294  $ilCtrl->setParameterByClass("ilobjmediacastgui", "item_id", $a_set["id"]);
295  // to keep always the order of the purposes
296  // iterate through purposes and display the according mediaitems
297  foreach (ilObjMediaCast::$purposes as $purpose) {
298  $a_mob = $mob->getMediaItem($purpose);
299  if (!is_object($a_mob)) {
300  continue;
301  }
302  $ilCtrl->setParameterByClass("ilobjmediacastgui", "purpose", $a_mob->getPurpose());
303  $file = ilObjMediaObject::_lookupItemPath($a_mob->getMobId(), false, false, $a_mob->getPurpose());
304  $this->tpl->setCurrentBlock("downloadable");
305  $this->tpl->setVariable("TXT_DOWNLOAD", $lng->txt("mcst_download_" . strtolower($a_mob->getPurpose())));
306  $this->tpl->setVariable("CMD_DOWNLOAD", $ilCtrl->getLinkTargetByClass("ilobjmediacastgui", "downloadItem"));
307  $this->tpl->parseCurrentBlock();
308  }
309  }
310 
311  // the news id will be used as player id, see also ilObjMediaCastGUI
312  $event_url = ($this->presentation_mode)
313  ? $ilCtrl->getLinkTarget($this->parent_obj, "handlePlayerEvent", "", true, false)
314  : "";
315  if (!is_null($med)) {
316  $file = $mob->getStandardSrc();
317  $comp = null;
318  if ($this->media_type->isAudio($med->getFormat())) {
319  $comp = $ui->factory()->player()->audio(
320  $file,
321  ""
322  );
323  } elseif ($this->media_type->isVideo($med->getFormat())) {
324  $comp = $ui->factory()->player()->video(
325  $file
326  );
327  } elseif ($this->media_type->isImage($med->getFormat())) {
328  $comp = $ui->factory()->image()->responsive($file, "");
329  }
330  if (!is_null($comp)) {
331  $this->tpl->setVariable("PLAYER", $ui->renderer()->render($comp));
332  }
333  }
334 
335  // edit link
336  $ilCtrl->setParameterByClass("ilobjmediacastgui", "item_id", $a_set["id"]);
337  if ($ilAccess->checkAccess("write", "", $this->request->getRefId()) &&
338  !$this->presentation_mode) {
339 
340  if (!is_int(strpos($med->getFormat(), "image/"))) {
341  $this->tpl->setVariable("TXT_DET_PLAYTIME", $lng->txt("mcst_det_playtime"));
342  $this->tpl->setVariable(
343  "CMD_DET_PLAYTIME",
344  $ilCtrl->getLinkTargetByClass("ilobjmediacastgui", "determinePlaytime")
345  );
346  }
347  $this->tpl->parseCurrentBlock();
348 
349  $this->tpl->setCurrentBlock("edit_checkbox");
350  $this->tpl->setVariable("VAL_ID", $a_set["id"]);
351  $this->tpl->parseCurrentBlock();
352  // $this->tpl->touchBlock("contrl_col");
353  }
354  } else {
355  $this->tpl->setCurrentBlock("edit_order");
356  $this->tpl->setVariable("VAL_ID", $a_set["id"]);
357  $this->tpl->setVariable("VAL_ORDER", $a_set["order"]);
358  $this->tpl->parseCurrentBlock();
359  // $this->tpl->touchBlock("contrl_col");
360  }
361 
362  // download and play counter
363  if (!$this->presentation_mode) {
364  if ($a_set["mob_cnt_download"] > 0) {
365  $this->tpl->setCurrentBlock("prop");
366  $this->tpl->setVariable("TXT_PROP", $lng->txt("mcst_download_cnt"));
367  $this->tpl->setVariable("VAL_PROP", $a_set["mob_cnt_download"]);
368  $this->tpl->parseCurrentBlock();
369  }
370  if ($a_set["mob_cnt_play"] > 0) {
371  $this->tpl->setCurrentBlock("prop");
372  $this->tpl->setVariable("TXT_PROP", $lng->txt("mcst_play_cnt"));
373  $this->tpl->setVariable("VAL_PROP", $a_set["mob_cnt_play"]);
374  $this->tpl->parseCurrentBlock();
375  }
376  }
377  }
378  }
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...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
const NEWS_PUBLIC
static array $purposes
static _lookupItemPath(int $a_mob_id, bool $a_url_encode=false, bool $a_web=true, string $a_purpose="")
Get path for item with specific purpose.
+ Here is the call graph for this function:

◆ get()

ilMediaCastManageTableGUI::get ( )

Definition at line 193 of file class.ilMediaCastManageTableGUI.php.

References Vendor\Package\$a, $action_parameter_token, Vendor\Package\$f, $row_id_token, $url_builder, ILIAS\Repository\ctrl(), getColumns(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\ui(), and ILIAS\UI\URLBuilder\withParameter().

193  : Table\Data
194  {
195  $f = $this->ui->factory();
196  $a = $f->table()->action();
197 
198  $form_action = $this->df->uri(
199  ILIAS_HTTP_PATH . '/' .
200  $this->ctrl->getLinkTarget($this->parent_gui, $this->parent_cmd)
201  );
202 
206 
207  $actions["editCastItem"] = $a->single(
208  $this->lng->txt("edit"),
211  );
212 
213  $actions["showCastItem"] = $a->single(
214  $this->lng->txt("show"),
217  )->withAsync();
218 
219  if ($this->playtime) {
220  $actions["determinePlaytime"] = $a->single(
221  $this->lng->txt("mcst_det_playtime"),
222  $url_builder->withParameter($action_parameter_token, "determinePlaytime"),
224  );
225  }
226 
227  if ($this->downloadable) {
228  $actions["downloadItem"] = $a->single(
229  $this->lng->txt("download"),
232  );
233  }
234 
235  $actions["confirmItemDeletion"] = $a->standard(
236  $this->lng->txt("delete"),
237  $url_builder->withParameter($action_parameter_token, "confirmItemDeletion"),
239  )->withAsync();
240 
241  $table = $f->table()
242  ->data($this, $this->lng->txt("mcst_items"), $this->getColumns())
243  ->withActions($actions)
244  ->withRequest($this->http->request());
245  return $table;
246  }
static http()
Fetches the global http state from ILIAS.
withParameter(URLBuilderToken $token, string|array $value)
Change an acquired parameter's value if the supplied token is valid.
Definition: URLBuilder.php:166
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
+ Here is the call graph for this function:

◆ getColumns()

ilMediaCastManageTableGUI::getColumns ( )
protected

Definition at line 96 of file class.ilMediaCastManageTableGUI.php.

References $c, Vendor\Package\$f, ILIAS\Repository\lng(), ILIAS\UI\examples\Symbol\Glyph\Preview\preview(), and ILIAS\Repository\ui().

Referenced by get().

96  : array
97  {
98  $f = $this->ui->factory();
99  $c = $f->table()->column();
100  $columns = [
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)
104  ];
105  if ($this->playtime) {
106  $columns['playtime'] = $c->text($this->lng->txt("mcst_play_time"))->withIsSortable(false);
107  }
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);
110  if ($this->preview) {
111  $columns['preview'] = $c->text($this->lng->txt("preview"))->withIsSortable(false);
112  }
113 
114  return $columns;
115  }
$c
Definition: deliver.php:25
preview()
description: > Example for rendering a Preview Glyph.
Definition: preview.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRows()

ilMediaCastManageTableGUI::getRows ( Table\DataRowBuilder  $row_builder,
array  $visible_column_ids,
Range  $range,
Order  $order,
?array  $filter_data,
?array  $additional_parameters 
)

Definition at line 117 of file class.ilMediaCastManageTableGUI.php.

References $data, ilObjMediaObject\_lookupItemPath(), ilDatePresentation\formatDate(), ILIAS\Data\Range\getEnd(), IL_CAL_DATETIME, and ILIAS\Repository\ui().

124  : \Generator {
125  $cnt = 0;
126  foreach ($this->mediacast->getSortedItemsArray() as $item) {
127  $cnt++;
128  if ($cnt < $range->getStart() || $cnt > $range->getEnd()) {
129  continue;
130  }
131 
132  $row_id = (string) $item['id'];
133  $mob = new ilObjMediaObject($item["mob_id"]);
134  $med = $mob->getMediaItem("Standard");
135 
136 
137  $data['title'] = $item["title"];
138  $data['creation_date'] = ilDatePresentation::formatDate(new ilDateTime($item["creation_date"], IL_CAL_DATETIME));
139  if ($item["update_date"] !== $item["creation_date"]) {
140  $data['update_date'] =
141  ilDatePresentation::formatDate(new ilDateTime($item["update_date"], IL_CAL_DATETIME));
142  } else {
143  $data['update_date'] = "-";
144  }
145  if ($item["playtime"] !== "00:00:00") {
146  $data['playtime'] = $item["playtime"];
147  } else {
148  $data['playtime'] = "-";
149  }
150 
151  $file = ilObjMediaObject::_lookupItemPath($med->getMobId(), false, false, "Standard");
152  if (is_file($file)) {
153  $size = filesize($file);
154  $size = sprintf("%.1f MB", $size / 1024 / 1024);
155  $data['size'] = $size;
156  } else {
157  $data['size'] = "-";
158  }
159  $data['type'] = $med->getFormat();
160  if ($mob->getVideoPreviewPic() !== "") {
161  // workaround since we dont have image columns yet
162  $image = $this->ui->factory()->image()->responsive($mob->getVideoPreviewPic(), $item["title"]);
163  $html = $this->ui->renderer()->render($image);
164  $html = str_replace("<img ", "<img style='max-width:150px;' ", $html);
165  $data['preview'] = $html;
166  } else {
167  $data['preview'] = "";
168  }
169 
170 
171  yield $row_builder->buildDataRow($row_id, $data);
172  }
173  }
const IL_CAL_DATETIME
static _lookupItemPath(int $a_mob_id, bool $a_url_encode=false, bool $a_web=true, string $a_purpose="")
Get path for item with specific purpose.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
+ Here is the call graph for this function:

◆ getTotalRowCount()

ilMediaCastManageTableGUI::getTotalRowCount ( ?array  $filter_data,
?array  $additional_parameters 
)

Definition at line 175 of file class.ilMediaCastManageTableGUI.php.

178  : ?int {
179  return count($this->mediacast->getSortedItemsArray());
180  }

◆ handleCommand()

ilMediaCastManageTableGUI::handleCommand ( )

Definition at line 182 of file class.ilMediaCastManageTableGUI.php.

182  : void
183  {
184  $action = $this->request->getTableAction($this->action_parameter_token->getName());
185  if ($action !== "") {
186  $action .= "Object";
187  // currently done in request wrapper
188  //$ids = $this->request->getTableIds($this->row_id_token->getName());
189  $this->parent_gui->$action();
190  }
191  }

Field Documentation

◆ $access

ilAccessHandler ilMediaCastManageTableGUI::$access
protected

Definition at line 48 of file class.ilMediaCastManageTableGUI.php.

Referenced by fillRow().

◆ $action_parameter_token

URLBuilderToken ilMediaCastManageTableGUI::$action_parameter_token
protected

Definition at line 41 of file class.ilMediaCastManageTableGUI.php.

Referenced by __construct(), and get().

◆ $ctrl

ilCtrlInterface ilMediaCastManageTableGUI::$ctrl
protected

Definition at line 37 of file class.ilMediaCastManageTableGUI.php.

Referenced by fillRow().

◆ $df

ILIAS Data Factory ilMediaCastManageTableGUI::$df
protected

Definition at line 34 of file class.ilMediaCastManageTableGUI.php.

◆ $downloadable

bool ilMediaCastManageTableGUI::$downloadable = false
protected

Definition at line 49 of file class.ilMediaCastManageTableGUI.php.

◆ $edit_order

bool ilMediaCastManageTableGUI::$edit_order
protected

Definition at line 50 of file class.ilMediaCastManageTableGUI.php.

◆ $http

ILIAS HTTP Services ilMediaCastManageTableGUI::$http
protected

Definition at line 33 of file class.ilMediaCastManageTableGUI.php.

◆ $lng

ilLanguage ilMediaCastManageTableGUI::$lng
protected

Definition at line 36 of file class.ilMediaCastManageTableGUI.php.

Referenced by fillRow().

◆ $media_type

ILIAS MediaObjects MediaType MediaTypeManager ilMediaCastManageTableGUI::$media_type
protected

Definition at line 45 of file class.ilMediaCastManageTableGUI.php.

◆ $mediacast

ilObjMediaCast ilMediaCastManageTableGUI::$mediacast
protected

Definition at line 40 of file class.ilMediaCastManageTableGUI.php.

◆ $parent_cmd

string ilMediaCastManageTableGUI::$parent_cmd
protected

Definition at line 35 of file class.ilMediaCastManageTableGUI.php.

Referenced by __construct().

◆ $parent_gui

ilObjMediaCastGUI ilMediaCastManageTableGUI::$parent_gui
protected

Definition at line 44 of file class.ilMediaCastManageTableGUI.php.

Referenced by __construct().

◆ $parent_obj

ilMediaCastManageTableGUI::$parent_obj
protected

Definition at line 30 of file class.ilMediaCastManageTableGUI.php.

◆ $playtime

bool ilMediaCastManageTableGUI::$playtime
protected

Definition at line 39 of file class.ilMediaCastManageTableGUI.php.

◆ $presentation_mode

bool ilMediaCastManageTableGUI::$presentation_mode
protected

Definition at line 46 of file class.ilMediaCastManageTableGUI.php.

Referenced by fillRow().

◆ $preview

bool ilMediaCastManageTableGUI::$preview
protected

Definition at line 38 of file class.ilMediaCastManageTableGUI.php.

◆ $request

StandardGUIRequest ilMediaCastManageTableGUI::$request
protected

Definition at line 47 of file class.ilMediaCastManageTableGUI.php.

◆ $row_id_token

URLBuilderToken ilMediaCastManageTableGUI::$row_id_token
protected

Definition at line 42 of file class.ilMediaCastManageTableGUI.php.

Referenced by __construct(), and get().

◆ $tpl

ilTemplate ilMediaCastManageTableGUI::$tpl
protected

Definition at line 31 of file class.ilMediaCastManageTableGUI.php.

◆ $ui

ILIAS DI UIServices ilMediaCastManageTableGUI::$ui
protected

Definition at line 51 of file class.ilMediaCastManageTableGUI.php.

Referenced by fillRow().

◆ $url_builder

URLBuilder ilMediaCastManageTableGUI::$url_builder
protected

Definition at line 32 of file class.ilMediaCastManageTableGUI.php.

Referenced by __construct(), and get().


The documentation for this class was generated from the following file: