/**
  * Constructor
  */
 function __construct($a_parent_obj, $a_parent_cmd, $a_wiki_id)
 {
     global $ilCtrl, $lng, $ilAccess, $lng;
     parent::__construct($a_parent_obj, $a_parent_cmd);
     include_once "./Modules/Wiki/classes/class.ilWikiPageTemplate.php";
     $templates = new ilWikiPageTemplate($a_wiki_id);
     $this->setData($templates->getAllInfo());
     $this->setTitle($lng->txt(""));
     $this->addColumn($this->lng->txt(""), "", "1");
     $this->addColumn($this->lng->txt("title"), "title");
     $this->addColumn($this->lng->txt("wiki_templ_new_pages"), "");
     $this->addColumn($this->lng->txt("wiki_templ_add_to_page"), "");
     $this->setDefaultOrderDirection("asc");
     $this->setDefaultOrderField("title");
     $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
     $this->setRowTemplate("tpl.wiki_page_templates_row.html", "Modules/Wiki");
     $this->addMultiCommand("remove", $lng->txt("wiki_remove_template_status"));
     $this->addCommandButton("saveTemplateSettings", $lng->txt("save"));
 }
Ejemplo n.º 2
0
 /**
  * Create new wiki page
  *
  * @param string $a_page_title page title
  * @param int $a_template_page template page id
  * @return ilWikiPage new wiki page
  */
 function createWikiPage($a_page_title, $a_template_page = 0)
 {
     // check if template has to be used
     if ($a_template_page == 0) {
         if (!$this->getEmptyPageTemplate()) {
             include_once "./Modules/Wiki/classes/class.ilWikiPageTemplate.php";
             $wt = new ilWikiPageTemplate($this->getId());
             $ts = $wt->getAllInfo(ilWikiPageTemplate::TYPE_NEW_PAGES);
             if (count($ts) == 1) {
                 $t = current($ts);
                 $a_template_page = $t["wpage_id"];
             }
         }
     }
     // create the page
     $page = new ilWikiPage();
     $page->setWikiId($this->getId());
     $page->setTitle(ilWikiUtil::makeDbTitle($a_page_title));
     if ($this->getRating() && $this->getRatingForNewPages()) {
         $page->setRating(true);
     }
     // needed for notification
     $page->setWikiRefId($this->getRefId());
     $page->create();
     // copy template into new page
     if ($a_template_page > 0) {
         $orig = new ilWikiPage($a_template_page);
         $orig->copy($page->getId());
     }
     return $page;
 }
Ejemplo n.º 3
0
 /**
  * Init template selection form.
  */
 public function initTemplateSelectionForm()
 {
     global $lng, $ilCtrl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     // page name
     $hi = new ilHiddenInputGUI("page");
     $hi->setValue($_GET["page"]);
     $form->addItem($hi);
     // page template
     $radg = new ilRadioGroupInputGUI($lng->txt("wiki_page_template"), "page_templ");
     $radg->setRequired(true);
     if ($this->object->getEmptyPageTemplate()) {
         $op1 = new ilRadioOption($lng->txt("wiki_empty_page"), 0);
         $radg->addOption($op1);
     }
     include_once "./Modules/Wiki/classes/class.ilWikiPageTemplate.php";
     $wt = new ilWikiPageTemplate($this->object->getId());
     $ts = $wt->getAllInfo(ilWikiPageTemplate::TYPE_NEW_PAGES);
     foreach ($ts as $t) {
         $op = new ilRadioOption($t["title"], $t["wpage_id"]);
         $radg->addOption($op);
     }
     $form->addItem($radg);
     // save and cancel commands
     $form->addCommandButton("createPageUsingTemplate", $lng->txt("wiki_create_page"));
     $form->addCommandButton("cancelCreationPageUsingTemplate", $lng->txt("cancel"));
     $form->setTitle($lng->txt("wiki_new_page") . ": " . $_GET["page"]);
     $form->setFormAction($ilCtrl->getFormAction($this));
     return $form;
 }
Ejemplo n.º 4
0
 /**
  * Get content templates
  *
  * @return array array of arrays with "id" => page id (int), "parent_type" => parent type (string), "title" => title (string)
  */
 function getContentTemplates()
 {
     include_once "./Modules/Wiki/classes/class.ilWikiPageTemplate.php";
     $wt = new ilWikiPageTemplate($this->getWikiId());
     $templates = array();
     foreach ($wt->getAllInfo(ilWikiPageTemplate::TYPE_ADD_TO_PAGE) as $t) {
         $templates[] = array("id" => $t["wpage_id"], "parent_type" => "wpg", "title" => $t["title"]);
     }
     return $templates;
 }