ILIAS  release_8 Revision v8.24
class.ilWikiImportantPagesBlockGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 public static string $block_type = "wikiimppages";
27 protected bool $export = false;
28
29 public function __construct()
30 {
31 global $DIC;
32
33 $this->ctrl = $DIC->ctrl();
34 $this->lng = $DIC->language();
35 $this->access = $DIC->access();
36 $lng = $DIC->language();
37
39
40 $lng->loadLanguageModule("wiki");
41 $this->setEnableNumInfo(false);
42
43 $this->setTitle($lng->txt("wiki_navigation"));
44 $this->allow_moving = false;
45 }
46
47 public function getBlockType(): string
48 {
49 return self::$block_type;
50 }
51
52 protected function isRepositoryObject(): bool
53 {
54 return false;
55 }
56
60 public function executeCommand()
61 {
62 $ilCtrl = $this->ctrl;
63
64 $next_class = $ilCtrl->getNextClass();
65 $cmd = $ilCtrl->getCmd("getHTML");
66
67 switch ($next_class) {
68 default:
69 return $this->$cmd();
70 }
71 }
72
73 public function getHTML(bool $a_export = false): string
74 {
75 $ilCtrl = $this->ctrl;
77
78 $this->export = $a_export;
79
80 if (!$this->export && ilWikiPerm::check("edit_wiki_navigation", $this->requested_ref_id)) {
81 $this->addBlockCommand(
82 $ilCtrl->getLinkTargetByClass("ilobjwikigui", "editImportantPages"),
83 $lng->txt("edit")
84 );
85 }
86
87 return parent::getHTML();
88 }
89
90 public function fillDataSection(): void
91 {
92 $this->setDataSection($this->getLegacyContent());
93 }
94
95 //
96 // New rendering
97 //
98
99 protected bool $new_rendering = true;
100
101
102 protected function getLegacyContent(): string
103 {
104 $ilCtrl = $this->ctrl;
105 $cpar[1] = 0;
106
107 $list = new ilNestedList();
108 $list->setItemClass("ilWikiBlockItem");
109 $list->setListClass("ilWikiBlockList");
110 $list->setListClass("ilWikiBlockListNoIndent", 1);
111
112 $cnt = 1;
114 if (!$this->export) {
115 $list->addListNode("<a href='" .
116 $ilCtrl->getLinkTargetByClass("ilobjwikigui", "gotoStartPage")
117 . "'>" . $title . "</a>", 1, 0);
118 } else {
119 $list->addListNode("<a href='" .
120 "index.html" .
121 "'>" . $title . "</a>", 1, 0);
122 }
123 $cpar[0] = 1;
124
125 $ipages = ilObjWiki::_lookupImportantPagesList(ilObject::_lookupObjId($this->requested_ref_id));
126 foreach ($ipages as $p) {
127 $cnt++;
128 $title = ilWikiPage::lookupTitle($p["page_id"]);
129 if (!$this->export) {
130 $list->addListNode("<a href='" .
131 ilObjWikiGUI::getGotoLink($this->requested_ref_id, (string) $title)
132 . "'>" . $title . "</a>", $cnt, (int) ($cpar[$p["indent"] - 1] ?? 0));
133 } else {
134 $list->addListNode("<a href='" .
135 "wpg_" . $p["page_id"] . ".html" .
136 "'>" . $title . "</a>", $cnt, (int) ($cpar[$p["indent"] - 1] ?? 0));
137 }
138 $cpar[$p["indent"]] = $cnt;
139 }
140
141 return $list->getHTML();
142 }
143}
This class represents a block method of a block.
ilLanguage $lng
setDataSection(string $a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
setTitle(string $a_title)
addBlockCommand(string $a_href, string $a_text, string $a_onclick="")
setEnableNumInfo(bool $a_enablenuminfo)
getNextClass($a_gui_class=null)
@inheritDoc
loadLanguageModule(string $a_module)
Load language module.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getGotoLink(int $a_ref_id, string $a_page="")
static _lookupStartPage(int $a_wiki_id)
static _lookupImportantPagesList(int $a_wiki_id)
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isRepositoryObject()
Returns whether block has a corresponding repository object.
fillDataSection()
Standard implementation for row based data.
static lookupTitle(int $a_page_id)
static check(string $a_perm, int $a_ref_id, string $a_cmd="")
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc