27 $this->wiki_gui = $a_wiki_gui;
28 $this->wiki = $this->wiki_gui->object;
32 $this->toolbar = $ilToolbar;
40 $nc = $this->ctrl->getNextClass();
45 $cmd = $this->ctrl->getCmd(
"listTemplates");
46 if (in_array(
$cmd, array(
"listTemplates",
"add",
"remove",
"saveTemplateSettings",
"addPageTemplateFromPageAction",
"removePageTemplateFromPageAction")))
60 include_once(
"./Modules/Wiki/classes/class.ilWikiPage.php");
62 $options = array(
"" => $this->lng->txt(
"please_select"));
63 foreach ($pages as $p)
71 $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
72 $this->toolbar->setOpenFormTag(
true);
73 $this->toolbar->setCloseFormTag(
false);
75 if (count($options) > 0)
77 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
79 $si->setOptions($options);
80 $this->toolbar->addInputItem(
$si);
81 $this->toolbar->addFormButton($this->lng->txt(
"wiki_add_template"),
"add");
82 $this->toolbar->addSeparator();
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");
94 include_once(
"./Modules/Wiki/classes/class.ilWikiPageTemplatesTableGUI.php");
96 $tab->setOpenFormTag(
false);
97 $tab->setCloseFormTag(
true);
98 $this->tpl->setContent(
$tab->getHTML());
106 include_once(
"./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
110 $this->ctrl->redirect($this,
"listTemplates");
118 include_once(
"./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
121 if (is_array(
$_POST[
"id"]))
123 foreach (
$_POST[
"id"] as $id)
130 $this->ctrl->redirect($this,
"listTemplates");
138 if (is_array(
$_POST[
"all_ids"]))
140 include_once(
"./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
141 foreach (
$_POST[
"all_ids"] as $id)
144 $wpt->
save((
int) $id, (
int)
$_POST[
"new_pages"][$id], (
int)
$_POST[
"add_to_page"][$id]);
148 $this->wiki->setEmptyPageTemplate((
int)
$_POST[
"empty_page_templ"]);
149 $this->wiki->update();
152 $this->ctrl->redirect($this,
"listTemplates");
162 $page_id = (int)
$_GET[
"wpg_id"];
165 include_once(
"./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
171 $this->ctrl->redirect($this,
"listTemplates");
176 $page_id = (int)
$_GET[
"wpg_id"];
179 include_once(
"./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
181 $wpt->
save($page_id);
185 $this->ctrl->redirect($this,
"listTemplates");