ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsGUI Class Reference
+ Collaboration diagram for ILIAS\MetaData\OERHarvester\Settings\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\MetaData\OERHarvester\Settings\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\MetaData\OERHarvester\Settings\Settings\SettingsGUI::edit ( )
protected

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

References ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsGUI\getEditForm().

56  : void
57  {
58  $mt = $this->gui->ui()->mainTemplate();
59  $form = $this->getEditForm();
60  $mt->setContent($form->render());
61  }
+ Here is the call graph for this function:

◆ executeCommand()

ILIAS\MetaData\OERHarvester\Settings\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\MetaData\OERHarvester\Settings\Settings\SettingsGUI::getEditForm ( )
protected

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

References $lng, ilBlockSetting\_lookup(), ilNewsItem\_lookupRSSPeriod(), ILIAS\Repository\Form\addOnline(), ILIAS\Repository\Form\addStdTile(), ILIAS\Repository\Form\addStdTitleAndDescription(), ilObjMediaCast\AUTOPLAY_ACT, ilObjMediaCast\AUTOPLAY_INACT, ilObjMediaCast\AUTOPLAY_NO, 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\MetaData\OERHarvester\Settings\Settings\SettingsGUI\edit(), and ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsGUI\save().

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  ->select(
97  "autoplaymode",
98  $lng->txt("mcst_autoplay"),
99  [
100  \ilObjMediaCast::AUTOPLAY_NO => $lng->txt("mcst_no_autoplay"),
101  \ilObjMediaCast::AUTOPLAY_ACT => $lng->txt("mcst_autoplay_active"),
102  \ilObjMediaCast::AUTOPLAY_INACT => $lng->txt("mcst_autoplay_inactive")
103  ],
104  "",
105  (string) $settings->getAutoplayMode()
106  )
107  ->number(
108  "nr_videos",
109  $lng->txt("mcst_nr_videos"),
110  "",
111  max(1, $settings->getNumberInitialVideos()),
112  1
113  )
114  ->end()
115  ->checkbox(
116  "downloadable",
117  $lng->txt("mcst_downloadable"),
118  $lng->txt("mcst_downloadable_info"),
119  $settings->getDownloadable()
120  );
121 
122  // Webfeed Section
123  $news_set = new \ilSetting("news");
124  if ($news_set->get("enable_rss_for_internal")) {
125  $form = $form
126  ->section("webfeed", $lng->txt("mcst_webfeed"))
127  ->switch(
128  "defaultaccess",
129  $lng->txt("news_default_visibility"),
130  "",
131  (string) $settings->getDefaultAccess()
132  )
133  ->group(
134  "0",
135  $lng->txt("news_visibility_users"),
136  $lng->txt("news_news_item_def_visibility_users_info")
137  )
138  ->group(
139  "1",
140  $lng->txt("news_visibility_public"),
141  $lng->txt("news_news_item_def_visibility_public_info")
142  )
143  ->end();
144 
145  // Extra Feed
146  $public_feed = \ilBlockSetting::_lookup("news", "public_feed", 0, $this->obj_id);
147  $form = $form
148  ->optional(
149  "extra_feed",
150  $lng->txt("news_public_feed"),
151  $lng->txt("news_public_feed_info"),
152  (bool) $public_feed
153  )
154  ->number(
155  "keep_rss_min",
156  $lng->txt("news_keep_minimal_x_items"),
157  $lng->txt("news_keep_minimal_x_items_info") . " (" . \ilNewsItem::_lookupRSSPeriod() . " " . ($lng->txt(\ilNewsItem::_lookupRSSPeriod() == 1 ? "day" : "days")) . ")",
159  "news",
160  "keep_rss_min",
161  0,
162  $this->obj_id
163  ),
164  0,
165  100
166  )->end();
167 
168  // Include Files in RSS
169  $form = $form->checkbox(
170  "public_files",
171  $lng->txt("mcst_incl_files_in_rss"),
172  $lng->txt("mcst_incl_files_in_rss_info"),
173  $settings->getPublicFiles()
174  );
175  }
176 
177  // Learning Progress Section
178  if (\ilLearningProgressAccess::checkAccess($this->ref_id)) {
179  $form = $form->section("learning_progress", $lng->txt("learning_progress"))
180  ->checkbox(
181  "auto_det_lp",
182  $lng->txt("mcst_new_items_det_lp"),
183  $lng->txt("mcst_new_items_det_lp_info"),
184  $settings->getNewItemsInLearningProgress()
185  );
186  }
187 
188  if (!$this->global_settings->get('disable_comments')) {
189  $lng->loadLanguageModule("notes");
190  // Features Section
191  $form = $form->section("features", $lng->txt('obj_features'));
192  $form = $form->checkbox(
193  "comments",
194  $lng->txt("notes_comments"),
195  "",
196  $this->domain->notes()->commentsActive($this->obj_id)
197  );
198  }
199  return $form;
200  }
static _lookupRSSPeriod()
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database.
addStdTitleAndDescription(int $obj_id, string $type)
addStdTile(int $obj_id, string $type)
global $lng
Definition: privfeed.php:31
addOnline(int $obj_id, string $type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsGUI::save ( )
protected

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

References $lng, ilBlockSetting\_write(), ilLearningProgressAccess\checkAccess(), ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsGUI\getEditForm(), and ILIAS\Repository\int().

202  : void
203  {
204  $mt = $this->gui->ui()->mainTemplate();
205  $form = $this->getEditForm();
206  $ctrl = $this->gui->ctrl();
207  $lng = $this->domain->lng();
208 
209  $old_settings = $this->domain->mediacastSettings()->getById($this->obj_id);
210 
211  if ($form->isValid()) {
212 
213  $form->saveStdTitleAndDescription($this->obj_id, "mcst");
214  $form->saveStdTile($this->obj_id, "mcst");
215  $form->saveOnline($this->obj_id, "mcst");
216 
217  $settings = $this->data->settings(
218  $this->obj_id,
219  (bool) $form->getData("public_files"),
220  (bool) $form->getData("downloadable"),
221  (int) $form->getData("defaultaccess"),
222  (int) $form->getData("order"),
223  (string) $form->getData("viewmode"),
224  (bool) $form->getData("autoplaymode"),
225  (int) $form->getData("nr_videos"),
226  \ilLearningProgressAccess::checkAccess($this->ref_id) && (bool) $form->getData("auto_det_lp")
227  );
228  $this->domain->mediacastSettings()->update($settings);
229 
230  if (!$this->global_settings->get('disable_comments')) {
231  $this->domain->notes()->activateComments(
232  $this->obj_id,
233  $form->getData("comments")
234  );
235  }
236 
237  $news_set = new \ilSetting("news");
238  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
239 
240  if ($enable_internal_rss) {
242  "news",
243  "public_feed",
244  (string) $form->getData("extra_feed"),
245  0,
246  $this->obj_id
247  );
248 
250  "news",
251  "keep_rss_min",
252  (string) $form->getData("keep_rss_min"),
253  0,
254  $this->obj_id
255  );
256  }
257 
258  $mt->setOnScreenMessage("success", $lng->txt("msg_obj_modified"), true);
259  $ctrl->redirectByClass(self::class, "edit");
260  } else {
261  $mt = $this->gui->ui()->mainTemplate();
262  $mt->setContent($form->render());
263  }
264  }
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

Field Documentation

◆ $global_settings

ilSetting ILIAS\MetaData\OERHarvester\Settings\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: