ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 bool $in_repository)
 
 executeCommand ()
 

Protected Member Functions

 edit ()
 
 getEditForm ()
 
 save ()
 

Protected Attributes

ILIAS Blog ReadingTime BlogSettingsGUI $reading_time_gui
 
ilSetting $global_settings
 
ILIAS Notes DomainService $notes
 

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 bool  $in_repository 
)

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

40  {
41  $this->notes = $domain->notes();
42  $this->global_settings = $domain->settings();
43  $this->reading_time_gui = $gui->readingTime()->settingsGUI($obj_id);
44  }

Member Function Documentation

◆ edit()

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

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

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

60  : void
61  {
62  $mt = $this->gui->ui()->mainTemplate();
63  $form = $this->getEditForm();
64  $mt->setContent($form->render());
65  }
+ Here is the call graph for this function:

◆ executeCommand()

ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsGUI::executeCommand ( )

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

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

◆ getEditForm()

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

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

References $lng, ILIAS\Repository\Form\addOnline(), ILIAS\Repository\Form\addStdTitleAndDescription(), ILIAS\Repository\int(), ilObjBlog\NAV_MODE_LIST, and ilObjBlog\NAV_MODE_MONTH.

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

67  : FormAdapterGUI
68  {
69  $settings = $this->domain->blogSettings()->getByObjId($this->obj_id);
70 
71  $lng = $this->domain->lng();
72  $form = $this->gui->form(self::class, "save")
73  ->section("general", $lng->txt("blog_edit"))
75  $this->obj_id,
76  "blog"
77  );
78 
79  if ($this->in_repository) {
80  $form = $form->checkbox(
81  "approval",
82  $lng->txt("blog_enable_approval"),
83  $lng->txt("blog_enable_approval_info"),
84  $settings->getApproval()
85  );
86  }
87 
88  $form = $form->checkbox(
89  "notes",
90  $lng->txt("blog_enable_notes"),
91  "",
92  $this->notes->commentsActive($this->obj_id)
93  );
94 
95  if ($this->global_settings->get('enable_global_profiles')) {
96  $form = $form->checkbox(
97  "rss",
98  $lng->txt("blog_enable_rss"),
99  "blog_enable_rss_info",
100  $settings->getRss()
101  );
102  }
103 
104  $form = $form->section("availibility", $lng->txt("rep_activation_availability"))
105  ->addOnline($this->obj_id, "blog");
106 
107  $form = $form->section("nav", $lng->txt("blog_settings_navigation"))
108  ->switch("nav_mode", $lng->txt("blog_nav_mode"), "", (string) $settings->getNavMode())
109  ->group(
110  (string) \ilObjBlog::NAV_MODE_LIST,
111  $lng->txt("blog_nav_mode_month_list"),
112  $lng->txt("blog_nav_mode_month_list_info")
113  )
114  ->number(
115  "nav_list_mon",
116  $lng->txt("blog_nav_mode_month_list_num_month"),
117  $lng->txt("blog_nav_mode_month_list_num_month_info"),
118  (int) $settings->getNavModeListMonths(),
119  1
120  )
121  ->number(
122  "nav_list_mon_with_post",
123  $lng->txt("blog_nav_mode_month_list_num_month_with_post"),
124  $lng->txt("blog_nav_mode_month_list_num_month_with_post_info"),
125  (int) $settings->getNavModeListMonthsWithPostings()
126  )
127  ->group(
129  $lng->txt("blog_nav_mode_month_single"),
130  $lng->txt("blog_nav_mode_month_single_info")
131  )
132  ->end();
133 
134  if ($this->in_repository) {
135  $form = $form->checkbox(
136  "nav_authors",
137  $lng->txt("blog_enable_nav_authors"),
138  $lng->txt("blog_enable_nav_authors_info"),
139  $settings->getAuthors()
140  );
141  }
142 
143  $form = $form
144  ->checkbox(
145  "keywords",
146  $lng->txt("blog_enable_keywords"),
147  $lng->txt("blog_enable_keywords_info"),
148  $settings->getKeywords()
149  )
150  ->section("presentation", $lng->txt("blog_presentation_frame"));
151 
152  if ($this->in_repository) {
153  $form = $form->addStdTile(
154  $this->obj_id,
155  "blog"
156  );
157  }
158 
159  $info = ($this->in_repository)
160  ? $lng->txt("blog_profile_picture_repository_info")
161  : "";
162 
163  $form = $form->checkbox(
164  "ppic",
165  $lng->txt("blog_profile_picture"),
166  $info,
167  $settings->getProfilePicture()
168  );
169 
170  $form = $this->reading_time_gui->addSettingToFormAdapter($form);
171 
172  $form = $form
173  ->section("pres_overview", $lng->txt("blog_presentation_overview"))
174  ->number(
175  "ov_list_post_num",
176  $lng->txt("blog_list_num_postings"),
177  $lng->txt("blog_list_num_postings_info"),
178  (int) $settings->getOverviewPostings()
179  )
180  ->optional(
181  "abss",
182  $lng->txt("blog_abstract_shorten"),
183  "",
184  $settings->getAbstractShorten()
185  )
186  ->number(
187  "abssl",
188  $lng->txt("blog_abstract_shorten_length"),
189  $lng->txt("blog_abstract_shorten_characters"),
190  $settings->getAbstractShortenLength()
191  )->required()
192  ->end()
193  ->optional(
194  "absi",
195  $lng->txt("blog_abstract_image"),
196  $lng->txt("blog_abstract_image_info"),
197  $settings->getAbstractImage()
198  )
199  ->number(
200  "absiw",
201  $lng->txt("blog_abstract_image_width"),
202  $lng->txt("blog_abstract_image_pixels"),
203  $settings->getAbstractImageWidth(),
204  32
205  )->required()
206  ->number(
207  "absih",
208  $lng->txt("blog_abstract_image_height"),
209  $lng->txt("blog_abstract_image_pixels"),
210  $settings->getAbstractImageHeight(),
211  32
212  )->required()
213  ->end();
214 
215  return $form;
216  }
const NAV_MODE_LIST
addStdTitleAndDescription(int $obj_id, string $type)
global $lng
Definition: privfeed.php:31
const NAV_MODE_MONTH
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 218 of file class.SettingsGUI.php.

References $lng, ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsGUI\getEditForm(), ILIAS\Repository\int(), and ilObjBlog\NAV_MODE_LIST.

218  : void
219  {
220  $mt = $this->gui->ui()->mainTemplate();
221  $form = $this->getEditForm();
222  $ctrl = $this->gui->ctrl();
223  $lng = $this->domain->lng();
224 
225  $old_settings = $this->domain->blogSettings()->getByObjId($this->obj_id);
226 
227  if ($form->isValid()) {
228  $form->saveStdTitleAndDescription(
229  $this->obj_id,
230  "blog"
231  );
232  $form->saveStdTile(
233  $this->obj_id,
234  "blog"
235  );
236  $form->saveOnline(
237  $this->obj_id,
238  "blog"
239  );
240 
241  $this->notes->activateComments($this->obj_id, (bool) $form->getData("notes"));
242 
243  $this->reading_time_gui->saveSettingFromFormAdapter($form);
244 
245  $settings = $this->data->settings(
246  $this->obj_id,
247  (bool) $form->getData("ppic"),
248  "",
249  "",
250  $this->global_settings->get('enable_global_profiles')
251  ? (bool) $form->getData("ppic")
252  : false,
253  $this->in_repository
254  ? (bool) $form->getData("approval")
255  : false,
256  (bool) $form->getData("abss"),
257  (bool) $form->getData("abss")
258  ? (int) $form->getData("abssl")
259  : 0,
260  (bool) $form->getData("absi"),
261  (bool) $form->getData("absi")
262  ? (int) $form->getData("absiw")
263  : 0,
264  (bool) $form->getData("absi")
265  ? (int) $form->getData("absih")
266  : 0,
267  (bool) $form->getData("keywords"),
268  $this->in_repository
269  ? (bool) $form->getData("nav_authors")
270  : false,
271  (int) $form->getData("nav_mode"),
272  (int) $form->getData("nav_mode") === \ilObjBlog::NAV_MODE_LIST
273  ? (int) $form->getData("nav_list_mon_with_post")
274  : 0,
275  (int) $form->getData("nav_mode") === \ilObjBlog::NAV_MODE_LIST
276  ? (int) $form->getData("nav_list_mon")
277  : 0,
278  (int) $form->getData("ov_list_post_num"),
279  $old_settings->getOrder()
280  );
281 
282  $this->domain->blogSettings()->update($settings);
283 
284  $mt->setOnScreenMessage("success", $lng->txt("msg_obj_modified"), true);
285  $ctrl->redirectByClass(self::class, "edit");
286  } else {
287  $mt = $this->gui->ui()->mainTemplate();
288  $mt->setContent($form->render());
289  }
290  }
const NAV_MODE_LIST
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 31 of file class.SettingsGUI.php.

◆ $notes

ILIAS Notes DomainService ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsGUI::$notes
protected

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

◆ $reading_time_gui

ILIAS Blog ReadingTime BlogSettingsGUI ILIAS\MetaData\OERHarvester\Settings\Settings\SettingsGUI::$reading_time_gui
protected

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


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