41 $ilCtrl =
$DIC->ctrl();
43 $ilToolbar =
$DIC->toolbar();
46 $this->wiki_gui = $a_wiki_gui;
48 $wiki = $this->wiki_gui->getObject();
50 $this->
ctrl = $ilCtrl;
64 $nc = $this->
ctrl->getNextClass();
68 $cmd = $this->
ctrl->getCmd(
"listTemplates");
69 if (in_array($cmd, array(
"listTemplates",
"add",
"remove",
"saveTemplateSettings",
"addPageTemplateFromPageAction",
"removePageTemplateFromPageAction"))) {
80 $options = array(
"" => $this->
lng->txt(
"please_select"));
81 foreach ($pages as $p) {
88 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this));
89 $this->
toolbar->setOpenFormTag(
true);
90 $this->
toolbar->setCloseFormTag(
false);
92 if (count($options) > 0) {
94 $si->setOptions($options);
95 $this->
toolbar->addInputItem($si);
96 $this->
toolbar->addFormButton($this->
lng->txt(
"wiki_add_template"),
"add");
102 $cb->setChecked($this->wiki->getEmptyPageTemplate());
103 $this->
toolbar->addInputItem($cb,
true);
104 $this->
toolbar->addFormButton($this->
lng->txt(
"save"),
"saveTemplateSettings");
107 $tab->setOpenFormTag(
false);
108 $tab->setCloseFormTag(
true);
109 $this->tpl->setContent($tab->getHTML());
112 public function add(): void
115 $wpt->save($this->request->getPageTemplateId());
116 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"wiki_template_added"),
true);
117 $this->
ctrl->redirect($this,
"listTemplates");
120 public function remove():
void
124 $ids = $this->request->getIds();
125 if (count($ids) > 0) {
126 foreach ($ids as
$id) {
127 $wpt->remove((
int)
$id);
129 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"wiki_template_status_removed"),
true);
132 $this->
ctrl->redirect($this,
"listTemplates");
137 $all_ids = $this->request->getAllIds();
138 $new_pages = $this->request->getNewPages();
139 $add_to_page = $this->request->getAddToPage();
140 foreach ($all_ids as
$id) {
142 $wpt->save(
$id, $new_pages[
$id] ?? 0, $add_to_page[
$id] ?? 0);
145 $this->wiki->setEmptyPageTemplate($this->request->getEmptyPageTemplate());
146 $this->wiki->update();
148 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
149 $this->
ctrl->redirect($this,
"listTemplates");
159 $page_id = $this->request->getWikiPageId();
162 $wpt->remove($page_id);
163 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"wiki_template_status_removed"),
true);
166 $this->
ctrl->redirect($this,
"listTemplates");
171 $page_id = $this->request->getWikiPageId();
174 $wpt->save($page_id);
175 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"wiki_template_added"),
true);
178 $this->
ctrl->redirect($this,
"listTemplates");
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Class ilCtrl provides processing control methods.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
Wiki page template gui class.
removePageTemplateFromPageAction()
ilGlobalTemplateInterface $tpl
addPageTemplateFromPageAction()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
TableGUI class for wiki page templates.
static getAllWikiPages(int $a_wiki_id, string $lang="-")
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc