ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.MediaCastManager.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\MediaCast;
22
28{
29 protected \ilSetting $settings;
30 protected \ilObjMediaCast $media_cast;
31 protected \ILIAS\MediaObjects\MediaType\MediaTypeManager $media_types;
32
33 public function __construct(
35 ) {
36 global $DIC;
37
38 $this->media_cast = $media_cast;
39 $this->settings = $DIC->settings();
40 $this->media_types = $DIC->mediaObjects()
41 ->internal()
42 ->domain()
43 ->mediaType();
44 }
45
46 public function getSuffixesForViewMode(string $view_mode): array
47 {
48 switch ($view_mode) {
49 case \ilObjMediaCast::VIEW_VCAST:
50 return iterator_to_array($this->media_types->getAllowedVideoSuffixes());
51 break;
52 case \ilObjMediaCast::VIEW_IMG_GALLERY:
53 return iterator_to_array($this->media_types->getAllowedImageSuffixes());
54 break;
55 case \ilObjMediaCast::VIEW_PODCAST:
56 return iterator_to_array($this->media_types->getAllowedAudioSuffixes());
57 break;
58 }
59 return [];
60 }
61
62 public function commentsActive(): bool
63 {
64 if ($this->settings->get("disable_comments")) {
65 return false;
66 }
67 if (!$this->media_cast->getComments()) {
68 return false;
69 }
70 return true;
71 }
72}
__construct(\ilObjMediaCast $media_cast)
ILIAS MediaObjects MediaType MediaTypeManager $media_types
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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