ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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 
18 {
19  static $block_type = "wikiimppages";
20  static $st_data;
21  protected $export = false;
22 
26  function __construct()
27  {
28  global $ilCtrl, $lng;
29 
30  parent::ilBlockGUI();
31 
32  $lng->loadLanguageModule("wiki");
33  $this->setEnableNumInfo(false);
34 
35  $this->setTitle($lng->txt("wiki_navigation"));
36  $this->allow_moving = false;
37  }
38 
44  static function getBlockType()
45  {
46  return self::$block_type;
47  }
48 
54  static function isRepositoryObject()
55  {
56  return false;
57  }
58 
62  static function getScreenMode()
63  {
64  return IL_SCREEN_SIDE;
65  }
66 
70  function &executeCommand()
71  {
72  global $ilCtrl;
73 
74  $next_class = $ilCtrl->getNextClass();
75  $cmd = $ilCtrl->getCmd("getHTML");
76 
77  switch ($next_class)
78  {
79  default:
80  return $this->$cmd();
81  }
82  }
83 
87  function getHTML($a_export = false)
88  {
89  global $ilCtrl, $lng, $ilUser, $ilAccess;
90 
91  $this->export = $a_export;
92 
93  if (!$this->export && $ilAccess->checkAccess("write", "", $_GET["ref_id"]))
94  {
95  $this->addBlockCommand(
96  $ilCtrl->getLinkTargetByClass("ilobjwikigui", "editImportantPages"),
97  $lng->txt("edit"), "_top");
98  }
99 
100  return parent::getHTML();
101  }
102 
106  function fillDataSection()
107  {
108  global $ilCtrl, $lng, $ilAccess;
109 
110  $tpl = new ilTemplate("tpl.wiki_imp_pages_block.html", true, true, "Modules/Wiki");
111 
112  $cpar[0] = $cpar[1] = 0;
113  include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
114 
115  $list = new ilNestedList();
116  $list->setItemClass("ilWikiBlockItem");
117  $list->setListClass("ilWikiBlockList");
118  $list->setListClass("ilWikiBlockListNoIndent", 1);
119 
120  $cnt = 1;
122  if (!$this->export)
123  {
124  $list->addListNode("<p class='small'><a href='".
125  $ilCtrl->getLinkTargetByClass("ilobjwikigui", "gotoStartPage")
126  ."'>".$title."</a></p>", 1, 0);
127  }
128  else
129  {
130  $list->addListNode("<p class='small'><a href='".
131  "index.html".
132  "'>".$title."</a></p>", 1, 0);
133  }
134  $cpar[0] = 1;
135 
137  foreach ($ipages as $p)
138  {
139  $cnt++;
140  $title = ilWikiPage::lookupTitle($p["page_id"]);
141  if (!$this->export)
142  {
143  $list->addListNode("<p class='small'><a href='".
144  ilObjWikiGUI::getGotoLink($_GET["ref_id"], $title)
145  ."'>".$title."</a></p>", $cnt, (int) $cpar[$p["indent"] - 1]);
146  }
147  else
148  {
149  $list->addListNode("<p class='small'><a href='".
150  "wpg_".$p["page_id"].".html".
151  "'>".$title."</a></p>", $cnt, (int) $cpar[$p["indent"] - 1]);
152  }
153  $cpar[$p["indent"]] = $cnt;
154  }
155 
156  $this->setDataSection($list->getHTML());
157 return;
158  // old style
159 
160  // the start page
161  $tpl->setCurrentBlock("item");
162  $title = ilWikiPage::lookupTitle($p["page_id"]);
163  $tpl->setVariable("ITEM_TITLE", $lng->txt("wiki_start_page"));
164  $tpl->setVariable("PAD", (int) 5 + (0 * 20));
165  $tpl->setVariable("ITEM_HREF", $ilCtrl->getLinkTargetByClass("ilobjwikigui", "gotoStartPage"));
166  $tpl->parseCurrentBlock();
167 
169  foreach ($ipages as $p)
170  {
171  $tpl->setCurrentBlock("item");
172  $title = ilWikiPage::lookupTitle($p["page_id"]);
173  $tpl->setVariable("ITEM_TITLE", $title);
174  $tpl->setVariable("PAD", (int) 5 + ($p["indent"] * 20));
175  $tpl->setVariable("ITEM_HREF", ilObjWikiGUI::getGotoLink($_GET["ref_id"], $title));
176  $tpl->parseCurrentBlock();
177  }
178 
179  $this->setDataSection($tpl->get());
180  }
181 }
182 
183 ?>
static getGotoLink($a_ref_id, $a_page="")
Get goto link.
static lookupTitle($a_page_id)
Checks whether a page with given title exists.
static _lookupImportantPagesList($a_wiki_id)
Get important pages list.
static isRepositoryObject()
Is this a repository object.
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.
$cmd
Definition: sahs_server.php:35
addBlockCommand($a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
Add Block Command.
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
global $tpl
Definition: ilias.php:8
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
getHTML($a_export=false)
Get bloch HTML code.
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
This class represents a block method of a block.
const IL_SCREEN_SIDE