ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilWikiPageTemplateGUI Class Reference

Wiki page template gui class. More...

+ Collaboration diagram for ilWikiPageTemplateGUI:

Public Member Functions

 executeCommand ()
 
 listTemplates ()
 
 add ()
 
 confirmRemove (array $ids=[])
 
 remove (array $ids=[])
 
 toggleNewPages (int $id)
 
 toggleAddToPage (int $id)
 
 saveTemplateSettings ()
 
 removePageTemplateFromPageAction ()
 
 addPageTemplateFromPageAction ()
 

Protected Member Functions

 getPageTemplateTable ()
 
 toggleTemplateSetting (int $id, bool $new_pages)
 

Protected Attributes

WikiGUIRequest $request
 
ilObjWiki $wiki
 
ilToolbarGUI $toolbar
 
ilLanguage $lng
 
ilObjWikiGUI $wiki_gui
 
ilCtrl $ctrl
 
ilGlobalTemplateInterface $tpl
 

Detailed Description

Wiki page template gui class.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file class.ilWikiPageTemplateGUI.php.

Member Function Documentation

◆ add()

ilWikiPageTemplateGUI::add ( )

Definition at line 114 of file class.ilWikiPageTemplateGUI.php.

114 : void
115 {
116 $wpt = new ilWikiPageTemplate($this->wiki->getId());
117 $wpt->save($this->request->getPageTemplateId());
118 $this->tpl->setOnScreenMessage('success', $this->lng->txt("wiki_template_added"), true);
119 $this->ctrl->redirect($this, "listTemplates");
120 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ addPageTemplateFromPageAction()

ilWikiPageTemplateGUI::addPageTemplateFromPageAction ( )

Definition at line 236 of file class.ilWikiPageTemplateGUI.php.

236 : void
237 {
238 $page_id = $this->request->getWikiPageId();
239 if ($page_id) {
240 $wpt = new ilWikiPageTemplate($this->wiki->getId());
241 $wpt->save($page_id);
242 $this->tpl->setOnScreenMessage('success', $this->lng->txt("wiki_template_added"), true);
243 }
244
245 $this->ctrl->redirect($this, "listTemplates");
246 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ confirmRemove()

ilWikiPageTemplateGUI::confirmRemove ( array  $ids = [])

Definition at line 133 of file class.ilWikiPageTemplateGUI.php.

133 : void
134 {
135 if (count($ids) === 0) {
136 $this->tpl->setOnScreenMessage('info', $this->lng->txt("no_checkbox"), true);
137 $this->ctrl->redirect($this, "listTemplates");
138 }
139
140 $items = [];
141 $templates = new ilWikiPageTemplate($this->wiki->getId());
142 foreach ($templates->getAllInfo() as $template) {
143 if (in_array((int) $template['wpage_id'], $ids, true)) {
144 $items[(int) $template['wpage_id']] = $template['title'];
145 }
146 }
147
148 $this->getPageTemplateTable()->renderDeletionConfirmation(
149 $this->lng->txt("wiki_remove_template_status"),
150 $this->lng->txt("wiki_remove_template_status"),
151 "remove",
152 $items
153 );
154 }

References ILIAS\Repository\ctrl(), getPageTemplateTable(), ILIAS\Repository\int(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ executeCommand()

ilWikiPageTemplateGUI::executeCommand ( )

Definition at line 62 of file class.ilWikiPageTemplateGUI.php.

62 : void
63 {
64 $nc = $this->ctrl->getNextClass();
65
66 switch ($nc) {
67 default:
68 $cmd = $this->ctrl->getCmd("listTemplates");
69 if (in_array($cmd, array("listTemplates", "add", "remove", "confirmRemove", "toggleNewPages", "toggleAddToPage", "saveTemplateSettings", "addPageTemplateFromPageAction", "removePageTemplateFromPageAction"))) {
70 $this->$cmd();
71 }
72 break;
73 }
74 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ getPageTemplateTable()

ilWikiPageTemplateGUI::getPageTemplateTable ( )
protected

Definition at line 122 of file class.ilWikiPageTemplateGUI.php.

123 {
124 global $DIC;
125
126 return $DIC->wiki()->internal()->gui()->page()->pageTemplateTableBuilder(
127 $this->wiki->getId(),
128 $this,
129 "listTemplates"
130 )->getTable();
131 }
global $DIC
Definition: shib_login.php:26

References $DIC.

Referenced by confirmRemove(), listTemplates(), and remove().

+ Here is the caller graph for this function:

◆ listTemplates()

ilWikiPageTemplateGUI::listTemplates ( )

Definition at line 76 of file class.ilWikiPageTemplateGUI.php.

76 : void
77 {
78 // list pages
79 $pages = ilWikiPage::getAllWikiPages($this->wiki->getId(), "-");
80 $options = array("" => $this->lng->txt("please_select"));
81 foreach ($pages as $p) {
82 //if (!in_array($p["id"], $ipages_ids))
83 //{
84 $options[$p["id"]] = ilStr::shortenTextExtended($p["title"], 60, true);
85 //}
86 }
87
88 $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
89 $this->toolbar->setOpenFormTag(true);
90 $this->toolbar->setCloseFormTag(false);
91
92 if (count($options) > 0) {
93 $si = new ilSelectInputGUI($this->lng->txt("wiki_pages"), "templ_page_id");
94 $si->setOptions($options);
95 $this->toolbar->addInputItem($si);
96 $this->toolbar->addFormButton($this->lng->txt("wiki_add_template"), "add");
97 $this->toolbar->addSeparator();
98 }
99
100 // empty page as template?
101 $cb = new ilCheckboxInputGUI($this->lng->txt("wiki_empty_page_template"), "empty_page_templ");
102 $cb->setChecked($this->wiki->getEmptyPageTemplate());
103 $this->toolbar->addInputItem($cb, true);
104 $this->toolbar->addFormButton($this->lng->txt("save"), "saveTemplateSettings");
105
106 $table = $this->getPageTemplateTable();
107 if ($table->handleCommand()) {
108 return;
109 }
110
111 $this->tpl->setContent($table->render() . "</form>");
112 }
This class represents a checkbox property in a property form.
This class represents a selection list property in a property form.
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
static getAllWikiPages(int $a_wiki_id, string $lang="-")

References ILIAS\UI\Implementation\Component\Input\Field\$options, ILIAS\Repository\ctrl(), ilWikiPage\getAllWikiPages(), getPageTemplateTable(), ILIAS\Repository\lng(), ilStr\shortenTextExtended(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

◆ remove()

ilWikiPageTemplateGUI::remove ( array  $ids = [])

Definition at line 156 of file class.ilWikiPageTemplateGUI.php.

156 : void
157 {
158 $wpt = new ilWikiPageTemplate($this->wiki->getId());
159
160 if (count($ids) === 0) {
161 $ids = $this->getPageTemplateTable()->getItemIds();
162 }
163 if (count($ids) > 0) {
164 foreach ($ids as $id) {
165 $wpt->remove((int) $id);
166 }
167 $this->tpl->setOnScreenMessage('success', $this->lng->txt("wiki_template_status_removed"), true);
168 }
169
170 $this->ctrl->redirect($this, "listTemplates");
171 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, ILIAS\Repository\ctrl(), getPageTemplateTable(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ removePageTemplateFromPageAction()

ilWikiPageTemplateGUI::removePageTemplateFromPageAction ( )

Definition at line 224 of file class.ilWikiPageTemplateGUI.php.

224 : void
225 {
226 $page_id = $this->request->getWikiPageId();
227 if ($page_id) {
228 $wpt = new ilWikiPageTemplate($this->wiki->getId());
229 $wpt->remove($page_id);
230 $this->tpl->setOnScreenMessage('success', $this->lng->txt("wiki_template_status_removed"), true);
231 }
232
233 $this->ctrl->redirect($this, "listTemplates");
234 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ saveTemplateSettings()

ilWikiPageTemplateGUI::saveTemplateSettings ( )

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

202 : void
203 {
204 $all_ids = $this->request->getAllIds();
205 $new_pages = $this->request->getNewPages();
206 $add_to_page = $this->request->getAddToPage();
207 foreach ($all_ids as $id) {
208 $wpt = new ilWikiPageTemplate($this->wiki->getId());
209 $wpt->save($id, $new_pages[$id] ?? 0, $add_to_page[$id] ?? 0);
210 }
211
212 $this->wiki->setEmptyPageTemplate($this->request->getEmptyPageTemplate());
213 $this->wiki->update();
214
215 $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
216 $this->ctrl->redirect($this, "listTemplates");
217 }

References $id, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ toggleAddToPage()

ilWikiPageTemplateGUI::toggleAddToPage ( int  $id)

Definition at line 178 of file class.ilWikiPageTemplateGUI.php.

178 : void
179 {
180 $this->toggleTemplateSetting($id, false);
181 }
toggleTemplateSetting(int $id, bool $new_pages)

References toggleTemplateSetting().

+ Here is the call graph for this function:

◆ toggleNewPages()

ilWikiPageTemplateGUI::toggleNewPages ( int  $id)

Definition at line 173 of file class.ilWikiPageTemplateGUI.php.

173 : void
174 {
175 $this->toggleTemplateSetting($id, true);
176 }

References toggleTemplateSetting().

+ Here is the call graph for this function:

◆ toggleTemplateSetting()

ilWikiPageTemplateGUI::toggleTemplateSetting ( int  $id,
bool  $new_pages 
)
protected

Definition at line 183 of file class.ilWikiPageTemplateGUI.php.

183 : void
184 {
185 $templates = new ilWikiPageTemplate($this->wiki->getId());
186 foreach ($templates->getAllInfo() as $template) {
187 if ((int) $template['wpage_id'] !== $id) {
188 continue;
189 }
190
191 $templates->save(
192 $id,
193 (int) ($new_pages ? !(bool) $template['new_pages'] : (int) $template['new_pages']),
194 (int) ($new_pages ? (int) $template['add_to_page'] : !(bool) $template['add_to_page'])
195 );
196 break;
197 }
198
199 $this->ctrl->redirect($this, "listTemplates");
200 }

References $id, and ILIAS\Repository\ctrl().

Referenced by toggleAddToPage(), and toggleNewPages().

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

Field Documentation

◆ $ctrl

ilCtrl ilWikiPageTemplateGUI::$ctrl
protected

Definition at line 33 of file class.ilWikiPageTemplateGUI.php.

◆ $lng

ilLanguage ilWikiPageTemplateGUI::$lng
protected

Definition at line 31 of file class.ilWikiPageTemplateGUI.php.

◆ $request

WikiGUIRequest ilWikiPageTemplateGUI::$request
protected

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

◆ $toolbar

ilToolbarGUI ilWikiPageTemplateGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilWikiPageTemplateGUI::$tpl
protected

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

◆ $wiki

ilObjWiki ilWikiPageTemplateGUI::$wiki
protected

Definition at line 29 of file class.ilWikiPageTemplateGUI.php.

◆ $wiki_gui

ilObjWikiGUI ilWikiPageTemplateGUI::$wiki_gui
protected

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


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