ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ILIAS\MediaCast\Settings\SettingsGUI Class Reference
+ Collaboration diagram for ILIAS\MediaCast\Settings\SettingsGUI:

Public Member Functions

 __construct (protected InternalDataService $data, protected InternalDomainService $domain, protected InternalGUIService $gui, protected int $obj_id, protected int $ref_id)
 
 executeCommand ()
 

Protected Member Functions

 edit ()
 
 getEditForm ()
 
 save ()
 

Protected Attributes

ilSetting $global_settings
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MediaCast\Settings\SettingsGUI::__construct ( protected InternalDataService  $data,
protected InternalDomainService  $domain,
protected InternalGUIService  $gui,
protected int  $obj_id,
protected int  $ref_id 
)

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

38 {
39 $this->global_settings = $this->domain->settings();
40 }

Member Function Documentation

◆ edit()

ILIAS\MediaCast\Settings\SettingsGUI::edit ( )
protected

Definition at line 56 of file class.SettingsGUI.php.

56 : void
57 {
58 $mt = $this->gui->ui()->mainTemplate();
59 $form = $this->getEditForm();
60 $mt->setContent($form->render());
61 }

References ILIAS\MediaCast\Settings\SettingsGUI\getEditForm().

+ Here is the call graph for this function:

◆ executeCommand()

ILIAS\MediaCast\Settings\SettingsGUI::executeCommand ( )

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

42 : void
43 {
44 $ctrl = $this->gui->ctrl();
45 $next_class = $ctrl->getNextClass($this);
46 $cmd = $ctrl->getCmd("edit");
47
48 switch ($next_class) {
49 default:
50 if (in_array($cmd, ["edit", "save"])) {
51 $this->$cmd();
52 }
53 }
54 }

◆ getEditForm()

ILIAS\MediaCast\Settings\SettingsGUI::getEditForm ( )
protected

Definition at line 63 of file class.SettingsGUI.php.

63 : FormAdapterGUI
64 {
65 $settings = $this->domain->mediacastSettings()->getById($this->obj_id);
66 $lng = $this->domain->lng();
67
68 $form = $this->gui
69 ->form([self::class], "save")
70 ->section("general", $lng->txt("mcst_settings"))
71 ->addStdTitleAndDescription($this->obj_id, "mcst")
72 ->section("avail", $lng->txt("rep_activation_availability"))
73 ->addOnline($this->obj_id, "mcst")
74 ->section("presentation", $lng->txt("obj_presentation"))
75 ->addStdTile($this->obj_id, "mcst")
76 ->switch(
77 "order",
78 $lng->txt("mcst_ordering"),
79 "",
80 (string) $settings->getSortMode()
81 )
82 ->group((string) \ilObjMediaCast::ORDER_TITLE, $lng->txt("mcst_ordering_title"))
83 ->group((string) \ilObjMediaCast::ORDER_CREATION_DATE_ASC, $lng->txt("mcst_ordering_creation_date_asc"))
84 ->group((string) \ilObjMediaCast::ORDER_CREATION_DATE_DESC, $lng->txt("mcst_ordering_creation_date_desc"))
85 ->group((string) \ilObjMediaCast::ORDER_MANUAL, $lng->txt("mcst_ordering_manual"))
86 ->end()
87 ->switch(
88 "viewmode",
89 $lng->txt("mcst_viewmode"),
90 "",
91 $settings->getViewMode()
92 )
93 ->group(\ilObjMediaCast::VIEW_IMG_GALLERY, $lng->txt("mcst_img_gallery"))
94 ->group(\ilObjMediaCast::VIEW_PODCAST, $lng->txt("mcst_podcast"))
95 ->group(\ilObjMediaCast::VIEW_VCAST, $lng->txt("mcst_video_cast"))
96 ->number(
97 "nr_videos",
98 $lng->txt("mcst_nr_videos"),
99 "",
100 max(1, $settings->getNumberInitialVideos()),
101 1
102 )
103 ->end()
104 ->checkbox(
105 "downloadable",
106 $lng->txt("mcst_downloadable"),
107 $lng->txt("mcst_downloadable_info"),
108 $settings->getDownloadable()
109 );
110
111 // Webfeed Section
112 $news_set = new \ilSetting("news");
113 if ($news_set->get("enable_rss_for_internal")) {
114 $form = $form
115 ->section("webfeed", $lng->txt("mcst_webfeed"))
116 ->switch(
117 "defaultaccess",
118 $lng->txt("news_default_visibility"),
119 "",
120 (string) $settings->getDefaultAccess()
121 )
122 ->group(
123 "0",
124 $lng->txt("news_visibility_users"),
125 $lng->txt("news_news_item_def_visibility_users_info")
126 )
127 ->group(
128 "1",
129 $lng->txt("news_visibility_public"),
130 $lng->txt("news_news_item_def_visibility_public_info")
131 )
132 ->end();
133
134 // Extra Feed
135 $public_feed = \ilBlockSetting::_lookup("news", "public_feed", 0, $this->obj_id);
136 $form = $form
137 ->optional(
138 "extra_feed",
139 $lng->txt("news_public_feed"),
140 $lng->txt("news_public_feed_info"),
141 (bool) $public_feed
142 )
143 ->number(
144 "keep_rss_min",
145 $lng->txt("news_keep_minimal_x_items"),
146 $lng->txt("news_keep_minimal_x_items_info") . " (" . \ilNewsItem::_lookupRSSPeriod() . " " . ($lng->txt(\ilNewsItem::_lookupRSSPeriod() == 1 ? "day" : "days")) . ")",
148 "news",
149 "keep_rss_min",
150 0,
151 $this->obj_id
152 ),
153 0,
154 100
155 )->end();
156
157 // Include Files in RSS
158 $form = $form->checkbox(
159 "public_files",
160 $lng->txt("mcst_incl_files_in_rss"),
161 $lng->txt("mcst_incl_files_in_rss_info"),
162 $settings->getPublicFiles()
163 );
164 }
165
166 // Learning Progress Section
167 if (\ilLearningProgressAccess::checkAccess($this->ref_id)) {
168 $form = $form->section("learning_progress", $lng->txt("learning_progress"))
169 ->checkbox(
170 "auto_det_lp",
171 $lng->txt("mcst_new_items_det_lp"),
172 $lng->txt("mcst_new_items_det_lp_info"),
173 $settings->getNewItemsInLearningProgress()
174 );
175 }
176
177 if (!$this->global_settings->get('disable_comments')) {
178 $lng->loadLanguageModule("notes");
179 // Features Section
180 $form = $form->section("features", $lng->txt('obj_features'));
181 $form = $form->checkbox(
182 "comments",
183 $lng->txt("notes_comments"),
184 "",
185 $this->domain->notes()->commentsActive($this->obj_id)
186 );
187 }
188 return $form;
189 }
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database.
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
static _lookupRSSPeriod()
global $lng
Definition: privfeed.php:31

References $lng, ilBlockSetting\_lookup(), ilNewsItem\_lookupRSSPeriod(), ilLearningProgressAccess\checkAccess(), ilObjMediaCast\ORDER_CREATION_DATE_ASC, ilObjMediaCast\ORDER_CREATION_DATE_DESC, ilObjMediaCast\ORDER_MANUAL, ilObjMediaCast\ORDER_TITLE, ilObjMediaCast\VIEW_IMG_GALLERY, ilObjMediaCast\VIEW_PODCAST, and ilObjMediaCast\VIEW_VCAST.

Referenced by ILIAS\MediaCast\Settings\SettingsGUI\edit(), and ILIAS\MediaCast\Settings\SettingsGUI\save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ILIAS\MediaCast\Settings\SettingsGUI::save ( )
protected

Definition at line 191 of file class.SettingsGUI.php.

191 : void
192 {
193 $mt = $this->gui->ui()->mainTemplate();
194 $form = $this->getEditForm();
195 $ctrl = $this->gui->ctrl();
196 $lng = $this->domain->lng();
197
198 $old_settings = $this->domain->mediacastSettings()->getById($this->obj_id);
199
200 if ($form->isValid()) {
201
202 $form->saveStdTitleAndDescription($this->obj_id, "mcst");
203 $form->saveStdTile($this->obj_id, "mcst");
204 $form->saveOnline($this->obj_id, "mcst");
205
206 $settings = $this->data->settings(
207 $this->obj_id,
208 (bool) $form->getData("public_files"),
209 (bool) $form->getData("downloadable"),
210 (int) $form->getData("defaultaccess"),
211 (int) $form->getData("order"),
212 (string) $form->getData("viewmode"),
213 (int) $form->getData("nr_videos"),
214 \ilLearningProgressAccess::checkAccess($this->ref_id) && (bool) $form->getData("auto_det_lp")
215 );
216 $this->domain->mediacastSettings()->update($settings);
217
218 if (!$this->global_settings->get('disable_comments')) {
219 $this->domain->notes()->activateComments(
220 $this->obj_id,
221 $form->getData("comments")
222 );
223 }
224
225 $news_set = new \ilSetting("news");
226 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
227
228 if ($enable_internal_rss) {
230 "news",
231 "public_feed",
232 (string) $form->getData("extra_feed"),
233 0,
234 $this->obj_id
235 );
236
238 "news",
239 "keep_rss_min",
240 (string) $form->getData("keep_rss_min"),
241 0,
242 $this->obj_id
243 );
244 }
245
246 $mt->setOnScreenMessage("success", $lng->txt("msg_obj_modified"), true);
247 $ctrl->redirectByClass(self::class, "edit");
248 } else {
249 $mt = $this->gui->ui()->mainTemplate();
250 $mt->setContent($form->render());
251 }
252 }
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.

References $lng, ilBlockSetting\_write(), ilLearningProgressAccess\checkAccess(), and ILIAS\MediaCast\Settings\SettingsGUI\getEditForm().

+ Here is the call graph for this function:

Field Documentation

◆ $global_settings

ilSetting ILIAS\MediaCast\Settings\SettingsGUI::$global_settings
protected

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


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