ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups 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 
31 
32  //$this->setImage(ilUtil::getImagePath("icon_news_s.png"));
33 
34  $lng->loadLanguageModule("wiki");
35  //$this->setBlockId(...);
36  /*$this->setLimit(5);
37  $this->setAvailableDetailLevels(3);*/
38  $this->setEnableNumInfo(false);
39 
40 // $this->setTitle($lng->txt("wiki_important_pages"));
41  $this->setTitle($lng->txt("wiki_navigation"));
42  //$this->setRowTemplate("tpl.block_row_news_for_context.html", "Services/News");
43  //$this->setData($data);
44  $this->allow_moving = false;
45  //$this->handleView();
46  }
47 
53  static function getBlockType()
54  {
55  return self::$block_type;
56  }
57 
63  static function isRepositoryObject()
64  {
65  return false;
66  }
67 
71  static function getScreenMode()
72  {
73  return IL_SCREEN_SIDE;
74  }
75 
79  function &executeCommand()
80  {
81  global $ilCtrl;
82 
83  $next_class = $ilCtrl->getNextClass();
84  $cmd = $ilCtrl->getCmd("getHTML");
85 
86  switch ($next_class)
87  {
88  default:
89  return $this->$cmd();
90  }
91  }
92 
96  function getHTML($a_export = false)
97  {
98  global $ilCtrl, $lng, $ilUser, $ilAccess;
99 
100  $this->export = $a_export;
101 
102  if (!$this->export && $ilAccess->checkAccess("write", "", $_GET["ref_id"]))
103  {
104  $this->addBlockCommand(
105  $ilCtrl->getLinkTargetByClass("ilobjwikigui", "editImportantPages"),
106  $lng->txt("edit"), "_top");
107  }
108 
109  return parent::getHTML();
110  }
111 
115  function fillDataSection()
116  {
117  global $ilCtrl, $lng, $ilAccess;
118 
119  $tpl = new ilTemplate("tpl.wiki_imp_pages_block.html", true, true, "Modules/Wiki");
120 
121  $cpar[0] = $cpar[1] = 0;
122  include_once("./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
123 
124  $list = new ilNestedList();
125  $list->setItemClass("ilWikiBlockItem");
126  $list->setListClass("ilWikiBlockList");
127  $list->setListClass("ilWikiBlockListNoIndent", 1);
128 
129  $cnt = 1;
131  if (!$this->export)
132  {
133  $list->addListNode("<p class='small'><a href='".
134  $ilCtrl->getLinkTargetByClass("ilobjwikigui", "gotoStartPage")
135  ."'>".$title."</a></p>", 1, 0);
136  }
137  else
138  {
139  $list->addListNode("<p class='small'><a href='".
140  "index.html".
141  "'>".$title."</a></p>", 1, 0);
142  }
143  $cpar[0] = 1;
144 
146  foreach ($ipages as $p)
147  {
148  $cnt++;
149  $title = ilWikiPage::lookupTitle($p["page_id"]);
150  if (!$this->export)
151  {
152  $list->addListNode("<p class='small'><a href='".
154  ."'>".$title."</a></p>", $cnt, (int) $cpar[$p["indent"] - 1]);
155  }
156  else
157  {
158  $list->addListNode("<p class='small'><a href='".
159  "wpg_".$p["page_id"].".html".
160  "'>".$title."</a></p>", $cnt, (int) $cpar[$p["indent"] - 1]);
161  }
162  $cpar[$p["indent"]] = $cnt;
163  }
164 
165  $this->setDataSection($list->getHTML());
166 return;
167  // old style
168 
169  // the start page
170  $tpl->setCurrentBlock("item");
171  $title = ilWikiPage::lookupTitle($p["page_id"]);
172  $tpl->setVariable("ITEM_TITLE", $lng->txt("wiki_start_page"));
173  $tpl->setVariable("PAD", (int) 5 + (0 * 20));
174  $tpl->setVariable("ITEM_HREF", $ilCtrl->getLinkTargetByClass("ilobjwikigui", "gotoStartPage"));
175  $tpl->parseCurrentBlock();
176 
178  foreach ($ipages as $p)
179  {
180  $tpl->setCurrentBlock("item");
181  $title = ilWikiPage::lookupTitle($p["page_id"]);
182  $tpl->setVariable("ITEM_TITLE", $title);
183  $tpl->setVariable("PAD", (int) 5 + ($p["indent"] * 20));
184  $tpl->setVariable("ITEM_HREF", ilObjWikiGUI::getGotoLink($_GET["ref_id"], $title));
185  $tpl->parseCurrentBlock();
186  }
187 
188  $this->setDataSection($tpl->get());
189  }
190 }
191 
192 ?>