ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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

 $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 23 of file class.ilWikiPageTemplateGUI.php.

24 {
25 global $ilCtrl, $tpl, $ilToolbar, $lng;
26
27 $this->wiki_gui = $a_wiki_gui;
28 $this->wiki = $this->wiki_gui->object;
29 $this->ctrl = $ilCtrl;
30 $this->tpl = $tpl;
31 $this->lng = $lng;
32 $this->toolbar = $ilToolbar;
33 }
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40

References $ilCtrl, $lng, and $tpl.

Member Function Documentation

◆ add()

ilWikiPageTemplateGUI::add ( )

Add page as template page.

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

105 {
106 include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
107 $wpt = new ilWikiPageTemplate($this->wiki->getId());
108 $wpt->save((int) $_POST["templ_page_id"]);
109 ilUtil::sendSuccess($this->lng->txt("wiki_template_added"), true);
110 $this->ctrl->redirect($this, "listTemplates");
111 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12

References $_POST, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ addPageTemplateFromPageAction()

ilWikiPageTemplateGUI::addPageTemplateFromPageAction ( )

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

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

References $_GET, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ executeCommand()

ilWikiPageTemplateGUI::executeCommand ( )

Execute command.

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

39 {
40 $nc = $this->ctrl->getNextClass();
41
42 switch($nc)
43 {
44 default:
45 $cmd = $this->ctrl->getCmd("listTemplates");
46 if (in_array($cmd, array("listTemplates", "add", "remove", "saveTemplateSettings", "addPageTemplateFromPageAction", "removePageTemplateFromPageAction")))
47 {
48 $this->$cmd();
49 }
50 break;
51 }
52 }
$cmd
Definition: sahs_server.php:35

References $cmd.

◆ listTemplates()

ilWikiPageTemplateGUI::listTemplates ( )

List templates.

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

58 {
59 // list pages
60 include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
61 $pages = ilWikiPage::getAllPages($this->wiki->getId());
62 $options = array("" => $this->lng->txt("please_select"));
63 foreach ($pages as $p)
64 {
65 //if (!in_array($p["id"], $ipages_ids))
66 //{
67 $options[$p["id"]] = ilUtil::shortenText($p["title"], 60, true);
68 //}
69 }
70
71 $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
72 $this->toolbar->setOpenFormTag(true);
73 $this->toolbar->setCloseFormTag(false);
74
75 if (count($options) > 0)
76 {
77 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
78 $si = new ilSelectInputGUI($this->lng->txt("wiki_pages"), "templ_page_id");
79 $si->setOptions($options);
80 $this->toolbar->addInputItem($si);
81 $this->toolbar->addFormButton($this->lng->txt("wiki_add_template"), "add");
82 $this->toolbar->addSeparator();
83
84 }
85
86 // empty page as template?
87 include_once("./Services/Form/classes/class.ilCheckboxInputGUI.php");
88 $cb = new ilCheckboxInputGUI($this->lng->txt("wiki_empty_page_template"), "empty_page_templ");
89 $cb->setChecked($this->wiki->getEmptyPageTemplate());
90 $this->toolbar->addInputItem($cb, true);
91 $this->toolbar->addFormButton($this->lng->txt("save"), "saveTemplateSettings");
92
93
94 include_once("./Modules/Wiki/classes/class.ilWikiPageTemplatesTableGUI.php");
95 $tab = new ilWikiPageTemplatesTableGUI($this, "listTemplates", $this->wiki->getId());
96 $tab->setOpenFormTag(false);
97 $tab->setCloseFormTag(true);
98 $this->tpl->setContent($tab->getHTML());
99 }
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 getAllPages($a_wiki_id)
Get all pages of wiki
if(!is_array($argv)) $options

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

+ Here is the call graph for this function:

◆ remove()

ilWikiPageTemplateGUI::remove ( )

Remove.

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

117 {
118 include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
119 $wpt = new ilWikiPageTemplate($this->wiki->getId());
120
121 if (is_array($_POST["id"]))
122 {
123 foreach ($_POST["id"] as $id)
124 {
125 $wpt->remove((int) $id);
126 }
127 ilUtil::sendSuccess($this->lng->txt("wiki_template_status_removed"), true);
128 }
129
130 $this->ctrl->redirect($this, "listTemplates");
131 }

References $_POST, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ removePageTemplateFromPageAction()

ilWikiPageTemplateGUI::removePageTemplateFromPageAction ( )

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

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

References $_GET, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ saveTemplateSettings()

ilWikiPageTemplateGUI::saveTemplateSettings ( )

Save template settings.

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

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

References $_POST, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilWikiPageTemplateGUI::$ctrl
protected

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

◆ $tpl

ilWikiPageTemplateGUI::$tpl
protected

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

Referenced by __construct().

◆ $wiki_gui

ilWikiPageTemplateGUI::$wiki_gui
protected

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


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