ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
5 include_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 
34  parent::__construct();
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  {
89  $lng = $this->lng;
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  "_top"
99  );
100  }
101 
102  return parent::getHTML();
103  }
104 
108  public function fillDataSection()
109  {
111  $lng = $this->lng;
112  $ilAccess = $this->access;
113 
114  $tpl = new ilTemplate("tpl.wiki_imp_pages_block.html", true, true, "Modules/Wiki");
115 
116  $cpar[0] = $cpar[1] = 0;
117  include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
118 
119  $list = new ilNestedList();
120  $list->setItemClass("ilWikiBlockItem");
121  $list->setListClass("ilWikiBlockList");
122  $list->setListClass("ilWikiBlockListNoIndent", 1);
123 
124  $cnt = 1;
126  if (!$this->export) {
127  $list->addListNode("<p class='small'><a href='" .
128  $ilCtrl->getLinkTargetByClass("ilobjwikigui", "gotoStartPage")
129  . "'>" . $title . "</a></p>", 1, 0);
130  } else {
131  $list->addListNode("<p class='small'><a href='" .
132  "index.html" .
133  "'>" . $title . "</a></p>", 1, 0);
134  }
135  $cpar[0] = 1;
136 
138  foreach ($ipages as $p) {
139  $cnt++;
140  $title = ilWikiPage::lookupTitle($p["page_id"]);
141  if (!$this->export) {
142  $list->addListNode("<p class='small'><a href='" .
144  . "'>" . $title . "</a></p>", $cnt, (int) $cpar[$p["indent"] - 1]);
145  } else {
146  $list->addListNode("<p class='small'><a href='" .
147  "wpg_" . $p["page_id"] . ".html" .
148  "'>" . $title . "</a></p>", $cnt, (int) $cpar[$p["indent"] - 1]);
149  }
150  $cpar[$p["indent"]] = $cnt;
151  }
152 
153  $this->setDataSection($list->getHTML());
154  }
155 }
static getGotoLink($a_ref_id, $a_page="")
Get goto link.
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
static check($a_perm, $a_ref_id, $a_cmd="")
Check permission.
static _lookupImportantPagesList($a_wiki_id)
Get important pages list.
global $DIC
Definition: saml.php:7
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
$_GET["client_id"]
Nested List.
static _lookupStartPage($a_wiki_id)
Lookup start page.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
static getScreenMode()
Get Screen Mode for current command.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title)
Set Title.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
addBlockCommand( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
getHTML($a_export=false)
Get bloch HTML code.
This class represents a block method of a block.
const IL_SCREEN_SIDE