ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilWikiPageTemplateGUI Class Reference

Wiki page template gui class. More...

+ Collaboration diagram for ilWikiPageTemplateGUI:

Public Member Functions

 __construct (ilObjWikiGUI $a_wiki_gui)
 Constructor.
 executeCommand ()
 Execute command.
 listTemplates ()
 List templates.
 add ()
 Add page as template page.
 remove ()
 Remove.
 saveTemplateSettings ()
 Save template settings.
 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

ilWikiPageTemplateGUI::__construct ( ilObjWikiGUI  $a_wiki_gui)

Constructor.

Parameters
ilObjWikiGUI$a_wiki_guiwiki gui object

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

References $ilCtrl, $lng, and $tpl.

{
global $ilCtrl, $tpl, $ilToolbar, $lng;
$this->wiki_gui = $a_wiki_gui;
$this->wiki = $this->wiki_gui->object;
$this->ctrl = $ilCtrl;
$this->tpl = $tpl;
$this->lng = $lng;
$this->toolbar = $ilToolbar;
}

Member Function Documentation

ilWikiPageTemplateGUI::add ( )

Add page as template page.

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

References $_POST, ilWikiPageTemplate\save(), and ilUtil\sendSuccess().

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

+ Here is the call graph for this function:

ilWikiPageTemplateGUI::addPageTemplateFromPageAction ( )

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

References $_GET, ilWikiPageTemplate\save(), and ilUtil\sendSuccess().

{
$page_id = (int)$_GET["wpg_id"];
if($page_id)
{
include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
$wpt = new ilWikiPageTemplate($this->wiki->getId());
$wpt->save($page_id);
ilUtil::sendSuccess($this->lng->txt("wiki_template_added"), true);
}
$this->ctrl->redirect($this, "listTemplates");
}

+ Here is the call graph for this function:

ilWikiPageTemplateGUI::executeCommand ( )

Execute command.

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

References $cmd.

{
$nc = $this->ctrl->getNextClass();
switch($nc)
{
default:
$cmd = $this->ctrl->getCmd("listTemplates");
if (in_array($cmd, array("listTemplates", "add", "remove", "saveTemplateSettings", "addPageTemplateFromPageAction", "removePageTemplateFromPageAction")))
{
$this->$cmd();
}
break;
}
}
ilWikiPageTemplateGUI::listTemplates ( )

List templates.

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

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

{
// list pages
include_once("./Modules/Wiki/classes/class.ilWikiPage.php");
$pages = ilWikiPage::getAllPages($this->wiki->getId());
$options = array("" => $this->lng->txt("please_select"));
foreach ($pages as $p)
{
//if (!in_array($p["id"], $ipages_ids))
//{
$options[$p["id"]] = ilUtil::shortenText($p["title"], 60, true);
//}
}
$this->toolbar->setFormAction($this->ctrl->getFormAction($this));
$this->toolbar->setOpenFormTag(true);
$this->toolbar->setCloseFormTag(false);
if (count($options) > 0)
{
include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
$si = new ilSelectInputGUI($this->lng->txt("wiki_pages"), "templ_page_id");
$si->setOptions($options);
$this->toolbar->addInputItem($si);
$this->toolbar->addFormButton($this->lng->txt("wiki_add_template"), "add");
$this->toolbar->addSeparator();
}
// empty page as template?
include_once("./Services/Form/classes/class.ilCheckboxInputGUI.php");
$cb = new ilCheckboxInputGUI($this->lng->txt("wiki_empty_page_template"), "empty_page_templ");
$cb->setChecked($this->wiki->getEmptyPageTemplate());
$this->toolbar->addInputItem($cb, true);
$this->toolbar->addFormButton($this->lng->txt("save"), "saveTemplateSettings");
include_once("./Modules/Wiki/classes/class.ilWikiPageTemplatesTableGUI.php");
$tab = new ilWikiPageTemplatesTableGUI($this, "listTemplates", $this->wiki->getId());
$tab->setOpenFormTag(false);
$tab->setCloseFormTag(true);
$this->tpl->setContent($tab->getHTML());
}

+ Here is the call graph for this function:

ilWikiPageTemplateGUI::remove ( )

Remove.

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

References $_POST, ilWikiPageTemplate\remove(), and ilUtil\sendSuccess().

{
include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
$wpt = new ilWikiPageTemplate($this->wiki->getId());
if (is_array($_POST["id"]))
{
foreach ($_POST["id"] as $id)
{
$wpt->remove((int) $id);
}
ilUtil::sendSuccess($this->lng->txt("wiki_template_status_removed"), true);
}
$this->ctrl->redirect($this, "listTemplates");
}

+ Here is the call graph for this function:

ilWikiPageTemplateGUI::removePageTemplateFromPageAction ( )

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

References $_GET, ilWikiPageTemplate\remove(), and ilUtil\sendSuccess().

{
$page_id = (int)$_GET["wpg_id"];
if($page_id)
{
include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
$wpt = new ilWikiPageTemplate($this->wiki->getId());
$wpt->remove($page_id);
ilUtil::sendSuccess($this->lng->txt("wiki_template_status_removed"), true);
}
$this->ctrl->redirect($this, "listTemplates");
}

+ Here is the call graph for this function:

ilWikiPageTemplateGUI::saveTemplateSettings ( )

Save template settings.

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

References $_POST, ilWikiPageTemplate\save(), and ilUtil\sendSuccess().

{
if (is_array($_POST["all_ids"]))
{
include_once("./Modules/Wiki/classes/class.ilWikiPageTemplate.php");
foreach ($_POST["all_ids"] as $id)
{
$wpt = new ilWikiPageTemplate($this->wiki->getId());
$wpt->save((int) $id, (int) $_POST["new_pages"][$id], (int) $_POST["add_to_page"][$id]);
}
}
$this->wiki->setEmptyPageTemplate((int) $_POST["empty_page_templ"]);
$this->wiki->update();
ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
$this->ctrl->redirect($this, "listTemplates");
}

+ Here is the call graph for this function:

Field Documentation

ilWikiPageTemplateGUI::$ctrl
protected

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

ilWikiPageTemplateGUI::$tpl
protected

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

Referenced by __construct().

ilWikiPageTemplateGUI::$wiki_gui
protected

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


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