ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilWikiImportantPagesBlockGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once("Services/Block/classes/class.ilBlockGUI.php");
6
16{
17 public static $block_type = "wikiimppages";
18 public static $st_data;
19 protected $export = false;
20
24 public function __construct()
25 {
26 global $DIC;
27
28 $this->ctrl = $DIC->ctrl();
29 $this->lng = $DIC->language();
30 $this->access = $DIC->access();
31 $ilCtrl = $DIC->ctrl();
32 $lng = $DIC->language();
33
35
36 $lng->loadLanguageModule("wiki");
37 $this->setEnableNumInfo(false);
38
39 $this->setTitle($lng->txt("wiki_navigation"));
40 $this->allow_moving = false;
41 }
42
46 public function getBlockType() : string
47 {
48 return self::$block_type;
49 }
50
54 protected function isRepositoryObject() : bool
55 {
56 return false;
57 }
58
62 public static function getScreenMode()
63 {
64 return IL_SCREEN_SIDE;
65 }
66
70 public function executeCommand()
71 {
73
74 $next_class = $ilCtrl->getNextClass();
75 $cmd = $ilCtrl->getCmd("getHTML");
76
77 switch ($next_class) {
78 default:
79 return $this->$cmd();
80 }
81 }
82
86 public function getHTML($a_export = false)
87 {
90
91 $this->export = $a_export;
92
93 include_once './Modules/Wiki/classes/class.ilWikiPerm.php';
94 if (!$this->export && ilWikiPerm::check("edit_wiki_navigation", $_GET["ref_id"])) {
95 $this->addBlockCommand(
96 $ilCtrl->getLinkTargetByClass("ilobjwikigui", "editImportantPages"),
97 $lng->txt("edit")
98 );
99 }
100
101 return parent::getHTML();
102 }
103
107 public function fillDataSection()
108 {
109 $this->setDataSection($this->getLegacyContent());
110 }
111
112 //
113 // New rendering
114 //
115
116 protected $new_rendering = true;
117
118
122 protected function getLegacyContent() : string
123 {
126 $ilAccess = $this->access;
127
128 $tpl = new ilTemplate("tpl.wiki_imp_pages_block.html", true, true, "Modules/Wiki");
129
130 $cpar[0] = $cpar[1] = 0;
131 include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
132
133 $list = new ilNestedList();
134 $list->setItemClass("ilWikiBlockItem");
135 $list->setListClass("ilWikiBlockList");
136 $list->setListClass("ilWikiBlockListNoIndent", 1);
137
138 $cnt = 1;
140 if (!$this->export) {
141 $list->addListNode("<p class='small'><a href='" .
142 $ilCtrl->getLinkTargetByClass("ilobjwikigui", "gotoStartPage")
143 . "'>" . $title . "</a></p>", 1, 0);
144 } else {
145 $list->addListNode("<p class='small'><a href='" .
146 "index.html" .
147 "'>" . $title . "</a></p>", 1, 0);
148 }
149 $cpar[0] = 1;
150
152 foreach ($ipages as $p) {
153 $cnt++;
154 $title = ilWikiPage::lookupTitle($p["page_id"]);
155 if (!$this->export) {
156 $list->addListNode("<p class='small'><a href='" .
158 . "'>" . $title . "</a></p>", $cnt, (int) $cpar[$p["indent"] - 1]);
159 } else {
160 $list->addListNode("<p class='small'><a href='" .
161 "wpg_" . $p["page_id"] . ".html" .
162 "'>" . $title . "</a></p>", $cnt, (int) $cpar[$p["indent"] - 1]);
163 }
164 $cpar[$p["indent"]] = $cnt;
165 }
166
167 return $list->getHTML();
168 }
169}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
const IL_SCREEN_SIDE
This class represents a block method of a block.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
Add Block Command.
setTitle($a_title)
Set Title.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
static getGotoLink($a_ref_id, $a_page="")
Get goto link.
static _lookupImportantPagesList($a_wiki_id)
Get important pages list.
static _lookupStartPage($a_wiki_id)
Lookup start page.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
getHTML($a_export=false)
Get bloch HTML code.
isRepositoryObject()
Returns whether block has a corresponding repository object.bool
static getScreenMode()
Get Screen Mode for current command.
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
static check($a_perm, $a_ref_id, $a_cmd="")
Check permission.
global $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46