ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilWikiPageTemplateGUI Class Reference

Wiki page template gui class. More...

+ Collaboration diagram for ilWikiPageTemplateGUI:

Public Member Functions

 __construct (ilObjWikiGUI $a_wiki_gui)
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 listTemplates ()
 List templates. More...
 
 add ()
 Add page as template page. More...
 
 remove ()
 Remove. More...
 
 saveTemplateSettings ()
 Save template settings. More...
 
 removePageTemplateFromPageAction ()
 
 addPageTemplateFromPageAction ()
 

Protected Attributes

 $toolbar
 
 $lng
 
 $wiki_gui
 
 $ctrl
 
 $tpl
 

Detailed Description

Wiki page template gui class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilWikiPageTemplateGUI::__construct ( ilObjWikiGUI  $a_wiki_gui)

Constructor.

Parameters
ilObjWikiGUI$a_wiki_guiwiki gui object

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

34 {
35 global $DIC;
36
37 $ilCtrl = $DIC->ctrl();
38 $tpl = $DIC["tpl"];
39 $ilToolbar = $DIC->toolbar();
40 $lng = $DIC->language();
41
42 $this->wiki_gui = $a_wiki_gui;
43 $this->wiki = $this->wiki_gui->object;
44 $this->ctrl = $ilCtrl;
45 $this->tpl = $tpl;
46 $this->lng = $lng;
47 $this->toolbar = $ilToolbar;
48 }
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7

References $DIC, $ilCtrl, $lng, and $tpl.

Member Function Documentation

◆ add()

ilWikiPageTemplateGUI::add ( )

Add page as template page.

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

115 {
116 include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
117 $wpt = new ilWikiPageTemplate($this->wiki->getId());
118 $wpt->save((int) $_POST["templ_page_id"]);
119 ilUtil::sendSuccess($this->lng->txt("wiki_template_added"), true);
120 $this->ctrl->redirect($this, "listTemplates");
121 }
$_POST["username"]

References $_POST.

◆ addPageTemplateFromPageAction()

ilWikiPageTemplateGUI::addPageTemplateFromPageAction ( )

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

180 {
181 $page_id = (int) $_GET["wpg_id"];
182 if ($page_id) {
183 include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
184 $wpt = new ilWikiPageTemplate($this->wiki->getId());
185 $wpt->save($page_id);
186 ilUtil::sendSuccess($this->lng->txt("wiki_template_added"), true);
187 }
188
189 $this->ctrl->redirect($this, "listTemplates");
190 }
$_GET["client_id"]

References $_GET.

◆ executeCommand()

ilWikiPageTemplateGUI::executeCommand ( )

Execute command.

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

54 {
55 $nc = $this->ctrl->getNextClass();
56
57 switch ($nc) {
58 default:
59 $cmd = $this->ctrl->getCmd("listTemplates");
60 if (in_array($cmd, array("listTemplates", "add", "remove", "saveTemplateSettings", "addPageTemplateFromPageAction", "removePageTemplateFromPageAction"))) {
61 $this->$cmd();
62 }
63 break;
64 }
65 }

◆ listTemplates()

ilWikiPageTemplateGUI::listTemplates ( )

List templates.

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

71 {
72 // list pages
73 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
74 $pages = ilWikiPage::getAllWikiPages($this->wiki->getId());
75 $options = array("" => $this->lng->txt("please_select"));
76 foreach ($pages as $p) {
77 //if (!in_array($p["id"], $ipages_ids))
78 //{
79 $options[$p["id"]] = ilUtil::shortenText($p["title"], 60, true);
80 //}
81 }
82
83 $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
84 $this->toolbar->setOpenFormTag(true);
85 $this->toolbar->setCloseFormTag(false);
86
87 if (count($options) > 0) {
88 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
89 $si = new ilSelectInputGUI($this->lng->txt("wiki_pages"), "templ_page_id");
90 $si->setOptions($options);
91 $this->toolbar->addInputItem($si);
92 $this->toolbar->addFormButton($this->lng->txt("wiki_add_template"), "add");
93 $this->toolbar->addSeparator();
94 }
95
96 // empty page as template?
97 include_once("./Services/Form/classes/class.ilCheckboxInputGUI.php");
98 $cb = new ilCheckboxInputGUI($this->lng->txt("wiki_empty_page_template"), "empty_page_templ");
99 $cb->setChecked($this->wiki->getEmptyPageTemplate());
100 $this->toolbar->addInputItem($cb, true);
101 $this->toolbar->addFormButton($this->lng->txt("save"), "saveTemplateSettings");
102
103
104 include_once("./Modules/Wiki/classes/class.ilWikiPageTemplatesTableGUI.php");
105 $tab = new ilWikiPageTemplatesTableGUI($this, "listTemplates", $this->wiki->getId());
106 $tab->setOpenFormTag(false);
107 $tab->setCloseFormTag(true);
108 $this->tpl->setContent($tab->getHTML());
109 }
This class represents a checkbox property in a property form.
This class represents a selection list property in a property form.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
TableGUI class for wiki page templates.
static getAllWikiPages($a_wiki_id)
Get all pages of wiki.

References PHPMailer\PHPMailer\$options, $si, $tab, ilWikiPage\getAllWikiPages(), and ilUtil\shortenText().

+ Here is the call graph for this function:

◆ remove()

ilWikiPageTemplateGUI::remove ( )

Remove.

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

127 {
128 include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
129 $wpt = new ilWikiPageTemplate($this->wiki->getId());
130
131 if (is_array($_POST["id"])) {
132 foreach ($_POST["id"] as $id) {
133 $wpt->remove((int) $id);
134 }
135 ilUtil::sendSuccess($this->lng->txt("wiki_template_status_removed"), true);
136 }
137
138 $this->ctrl->redirect($this, "listTemplates");
139 }
if(!array_key_exists('StateId', $_REQUEST)) $id

References $_POST, and $id.

◆ removePageTemplateFromPageAction()

ilWikiPageTemplateGUI::removePageTemplateFromPageAction ( )

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

167 {
168 $page_id = (int) $_GET["wpg_id"];
169 if ($page_id) {
170 include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
171 $wpt = new ilWikiPageTemplate($this->wiki->getId());
172 $wpt->remove($page_id);
173 ilUtil::sendSuccess($this->lng->txt("wiki_template_status_removed"), true);
174 }
175
176 $this->ctrl->redirect($this, "listTemplates");
177 }

References $_GET.

◆ saveTemplateSettings()

ilWikiPageTemplateGUI::saveTemplateSettings ( )

Save template settings.

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

145 {
146 if (is_array($_POST["all_ids"])) {
147 include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
148 foreach ($_POST["all_ids"] as $id) {
149 $wpt = new ilWikiPageTemplate($this->wiki->getId());
150 $wpt->save((int) $id, (int) $_POST["new_pages"][$id], (int) $_POST["add_to_page"][$id]);
151 }
152 }
153
154 $this->wiki->setEmptyPageTemplate((int) $_POST["empty_page_templ"]);
155 $this->wiki->update();
156
157 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
158 $this->ctrl->redirect($this, "listTemplates");
159 }

References $_POST, and $id.

Field Documentation

◆ $ctrl

ilWikiPageTemplateGUI::$ctrl
protected

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

◆ $lng

ilWikiPageTemplateGUI::$lng
protected

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

Referenced by __construct().

◆ $toolbar

ilWikiPageTemplateGUI::$toolbar
protected

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

◆ $tpl

ilWikiPageTemplateGUI::$tpl
protected

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

Referenced by __construct().

◆ $wiki_gui

ilWikiPageTemplateGUI::$wiki_gui
protected

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


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