ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilWikiFunctionsBlockGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("Services/Block/classes/class.ilBlockGUI.php");
5 
17 {
18  static $block_type = "wikiside";
19  static $st_data;
20 
24  function __construct()
25  {
26  global $ilCtrl, $lng;
27 
29 
30  //$this->setImage(ilUtil::getImagePath("icon_news_s.gif"));
31 
32  $lng->loadLanguageModule("wiki");
33  //$this->setBlockId(...);
34  /*$this->setLimit(5);
35  $this->setAvailableDetailLevels(3);*/
36  $this->setEnableNumInfo(false);
37 
38  $this->setTitle($lng->txt("wiki_functions"));
39  //$this->setRowTemplate("tpl.block_row_news_for_context.html", "Services/News");
40  //$this->setData($data);
41  $this->allow_moving = false;
42  //$this->handleView();
43  }
44 
50  static function getBlockType()
51  {
52  return self::$block_type;
53  }
54 
60  static function isRepositoryObject()
61  {
62  return false;
63  }
64 
68  static function getScreenMode()
69  {
70  return IL_SCREEN_SIDE;
71  }
72 
76  function &executeCommand()
77  {
78  global $ilCtrl;
79 
80  $next_class = $ilCtrl->getNextClass();
81  $cmd = $ilCtrl->getCmd("getHTML");
82 
83  switch ($next_class)
84  {
85  default:
86  return $this->$cmd();
87  }
88  }
89 
95  function setPageObject($a_pageob)
96  {
97  $this->pageob = $a_pageob;
98  }
99 
105  function getPageObject()
106  {
107  return $this->pageob;
108  }
109 
113  function getHTML()
114  {
115  global $ilCtrl, $lng, $ilUser;
116 
117  return parent::getHTML();
118  }
119 
123  function fillDataSection()
124  {
125  global $ilCtrl, $lng, $ilAccess;
126 
127  $tpl = new ilTemplate("tpl.wiki_side_block_content.html", true, true, "Modules/Wiki");
128 
129  $wp = $this->getPageObject();
130 
131  // info
132  $actions[] = array(
133  "txt" => $lng->txt("info_short"),
134  "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "infoScreen")
135  );
136 
137  // recent changes
138  $actions[] = array(
139  "txt" => $lng->txt("wiki_recent_changes"),
140  "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "recentChanges")
141  );
142 
143  foreach ($actions as $a)
144  {
145  $tpl->setCurrentBlock("action");
146  $tpl->setVariable("HREF", $a["href"]);
147  $tpl->setVariable("TXT", $a["txt"]);
148  $tpl->parseCurrentBlock();
149 
150  $tpl->touchBlock("item");
151  }
152 
153 
154  $actions = array();
155 
156  // all pages
157  $actions[] = array(
158  "txt" => $lng->txt("wiki_all_pages"),
159  "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "allPages")
160  );
161 
162  // new pages
163  $actions[] = array(
164  "txt" => $lng->txt("wiki_new_pages"),
165  "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "newPages")
166  );
167 
168  // popular pages
169  $actions[] = array(
170  "txt" => $lng->txt("wiki_popular_pages"),
171  "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "popularPages")
172  );
173 
174  // orphaned pages
175  $actions[] = array(
176  "txt" => $lng->txt("wiki_orphaned_pages"),
177  "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "orphanedPages")
178  );
179 
180 
181  // page lists
182  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
183  $list = new ilAdvancedSelectionListGUI();
184  $list->setListTitle($lng->txt("wiki_page_lists"));
185  $list->setId("wiki_pglists");
186 
187  foreach ($actions as $a)
188  {
189  $list->addItem($a["txt"], "",
190  $a["href"]);
191  }
192  $tpl->setCurrentBlock("plain");
193  $tpl->setVariable("PLAIN", $list->getHTML());
194  $tpl->parseCurrentBlock();
195  $tpl->touchBlock("item");
196 
197 
198  // page actions
199  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
200  {
201  $list = new ilAdvancedSelectionListGUI();
202  $list->setListTitle($lng->txt("wiki_page_actions"));
203  $list->setId("wiki_pgactions");
204 
205  // rename
206  $list->addItem($lng->txt("wiki_rename_page"), "",
207  $ilCtrl->getLinkTargetByClass("ilwikipagegui", "renameWikiPage"));
208 
209  // block/unblock
210  if ($this->getPageObject()->getBlocked())
211  {
212  $list->addItem($lng->txt("wiki_unblock_page"), "",
213  $ilCtrl->getLinkTargetByClass("ilwikipagegui", "unblockWikiPage"));
214  }
215  else
216  {
217  $list->addItem($lng->txt("wiki_block_page"), "",
218  $ilCtrl->getLinkTargetByClass("ilwikipagegui", "blockWikiPage"));
219  }
220 
221  // delete page
222  $st_page = ilObjWiki::_lookupStartPage($this->getPageObject()->getParentId());
223  if ($st_page != $this->getPageObject()->getTitle())
224  {
225  $list->addItem($lng->txt("wiki_delete_page"), "",
226  $ilCtrl->getLinkTargetByClass("ilwikipagegui", "deleteWikiPageConfirmationScreen"));
227  }
228  $tpl->setCurrentBlock("plain");
229  $tpl->setVariable("PLAIN", $list->getHTML());
230  $tpl->parseCurrentBlock();
231  $tpl->touchBlock("item");
232  }
233 
234 
235  // permissions
236 // if ($ilAccess->checkAccess('edit_permission', "", $_GET["ref_id"]))
237 // {
238 // $actions[] = array(
239 // "txt" => $lng->txt("perm_settings"),
240 // "href" => $ilCtrl->getLinkTargetByClass(array("ilobjwikigui", "ilpermissiongui"), "perm")
241 // );
242 // }
243 
244  $actions = array();
245 
246  // settings
247  if ($ilAccess->checkAccess('write', "", $_GET["ref_id"]))
248  {
249 // $actions[] = array(
250 // "txt" => $lng->txt("settings"),
251 // "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "editSettings")
252 // );
253  $actions[] = array(
254  "txt" => $lng->txt("wiki_contributors"),
255  "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "listContributors")
256  );
257  }
258 
259  // manage
260  if ($ilAccess->checkAccess('write', "", $_GET["ref_id"]))
261  {
262  $actions[] = array(
263  "txt" => $lng->txt("settings"),
264  "href" => $ilCtrl->getLinkTargetByClass("ilobjwikigui", "editSettings")
265  );
266  }
267 
268  foreach ($actions as $a)
269  {
270  $tpl->setCurrentBlock("action");
271  $tpl->setVariable("HREF", $a["href"]);
272  $tpl->setVariable("TXT", $a["txt"]);
273  $tpl->parseCurrentBlock();
274 
275  $tpl->touchBlock("item");
276  }
277 
278 
279  $this->setDataSection($tpl->get());
280  }
281 }
282 
283 ?>