ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Wiki\Settings\SettingsGUI Class Reference
+ Collaboration diagram for ILIAS\Wiki\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\Wiki\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\Wiki\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\Wiki\Settings\SettingsGUI\getEditForm().

+ Here is the call graph for this function:

◆ executeCommand()

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

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

63 : FormAdapterGUI
64 {
65 $settings = $this->domain->wikiSettings()->getById($this->obj_id);
66 $start_page_options = $this->domain->wikiSettings()->getStartPageOptions($this->ref_id);
67 $start_page_id = $this->domain->wikiSettings()->getStartPageId($settings);
68
69 $lng = $this->domain->lng();
70 $lng->loadLanguageModule("rating");
71
72 $form = $this->gui
73 ->form(self::class, "save")
74 ->section("general", $lng->txt("wiki_settings"))
75 ->addStdTitleAndDescription($this->obj_id, "wiki")
76 ->textarea(
77 "introduction",
78 $lng->txt("wiki_introduction"),
79 "",
80 (string) $settings->getIntroduction()
81 )
82 ->select(
83 "start_page",
84 $lng->txt("wiki_start_page"),
85 $start_page_options,
86 "",
87 $start_page_id ? (string) $start_page_id : null
88 )->required()
89 ->section("avail", $lng->txt("rep_activation_availability"))
90 ->addOnline($this->obj_id, "wiki")
91 ->addStdAvailability($this->ref_id)
92 ->section("presentation", $lng->txt("obj_presentation"))
93 ->addStdTile($this->obj_id, "wiki")
94 ->checkbox(
95 "page_toc",
96 $lng->txt("wiki_page_toc"),
97 $lng->txt("wiki_page_toc_info"),
98 (bool) $settings->getPageToc()
99 );
100
101 if (count(\ilAdvancedMDRecord::_getSelectedRecordsByObject("wiki", $this->ref_id, "wpg")) > 0) {
102 $form = $form
103 ->checkbox(
104 "link_md_values",
105 $lng->txt("wiki_link_md_values"),
106 $lng->txt("wiki_link_md_values_info"),
107 (bool) $settings->getLinkMetadataValues()
108 );
109 }
110
111 $form = $form
112 ->addAdditionalFeatures(
113 $this->obj_id,
114 [
116 ]
117 )
118 ->checkbox(
119 "rating_overall",
120 $lng->txt("rating_activate_rating"),
121 $lng->txt("rating_activate_rating_info"),
122 (bool) $settings->getRatingOverall()
123 )
124 ->optional(
125 "rating",
126 $lng->txt("wiki_activate_rating"),
127 "",
128 (bool) $settings->getRating()
129 )
130 ->checkbox(
131 "rating_new",
132 $lng->txt("wiki_activate_new_page_rating"),
133 "",
134 (bool) $settings->getRatingForNewPages()
135 )
136 ->checkbox(
137 "rating_ext",
138 $lng->txt("wiki_activate_extended_rating"),
139 "",
140 (bool) $settings->getRatingCategories()
141 )
142 ->end();
143
144 if (!$this->global_settings->get("disable_comments")) {
145 $form = $form
146 ->checkbox(
147 "public_notes",
148 $lng->txt("wiki_public_comments"),
149 "",
150 (bool) $settings->getPublicNotes()
151 );
152 }
153
154 return $form;
155 }
static _getSelectedRecordsByObject(string $a_obj_type, int $a_id, string $a_sub_type="", bool $is_ref_id=true)
global $lng
Definition: privfeed.php:31

References $lng, ilAdvancedMDRecord\_getSelectedRecordsByObject(), and ilObjectServiceSettingsGUI\CUSTOM_METADATA.

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

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

◆ save()

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

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

157 : void
158 {
159 $mt = $this->gui->ui()->mainTemplate();
160 $form = $this->getEditForm();
161 $ctrl = $this->gui->ctrl();
162 $lng = $this->domain->lng();
163
164 $old_settings = $this->domain->wikiSettings()->getById($this->obj_id);
165
166 if ($form->isValid()) {
167
168 $form->saveStdTitleAndDescription($this->obj_id, "wiki");
169 $form->saveStdTile($this->obj_id, "wiki");
170 $form->saveOnline($this->obj_id, "wiki");
171 $form->saveStdAvailability($this->ref_id);
172 $form->saveAdditionalFeatures(
173 $this->obj_id,
174 [
176 ]
177 );
178
179 $link_md_values = $old_settings->getLinkMetadataValues();
180 if (count(\ilAdvancedMDRecord::_getSelectedRecordsByObject("wiki", $this->ref_id, "wpg")) > 0) {
181 $link_md_values = (bool) $form->getData("link_md_values");
182 }
183
184 $settings = $this->data->settings(
185 $this->obj_id,
186 \ilWikiPage::lookupTitle((int) $form->getData("start_page")),
187 $old_settings->getShortTitle(), // obsolete?
188 (bool) $form->getData("rating_overall"),
189 (bool) $form->getData("rating"),
190 $old_settings->getRatingAsBlock(), // obsolete?
191 (bool) $form->getData("rating_new"),
192 (bool) $form->getData("rating_ext"),
193 (bool) $form->getData("public_notes"),
194 $form->getData("introduction"),
195 (bool) $form->getData("page_toc"),
196 $link_md_values,
197 $old_settings->getEmptyPageTemplate() // obsolete?
198 );
199 $this->domain->wikiSettings()->update($settings);
200
201 $mt->setOnScreenMessage("success", $lng->txt("msg_obj_modified"), true);
202 $ctrl->redirectByClass(self::class, "edit");
203 } else {
204 $mt = $this->gui->ui()->mainTemplate();
205 $mt->setContent($form->render());
206 }
207 }
static lookupTitle(int $a_page_id, string $lang="-")

References $lng, ilAdvancedMDRecord\_getSelectedRecordsByObject(), ilObjectServiceSettingsGUI\CUSTOM_METADATA, ILIAS\Wiki\Settings\SettingsGUI\getEditForm(), and ilWikiPage\lookupTitle().

+ Here is the call graph for this function:

Field Documentation

◆ $global_settings

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

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


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