ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjChatroomAccess.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("classes/class.ilObjectAccess.php");
6 
16 {
17 
30  public function _getCommands()
31  {
32  $commands = array();
33  $commands[] = array("permission" => "read", "cmd" => "view", "lang_var" => "enter", "default" => true);
34  $commands[] = array("permission" => "write", "cmd" => "settings-general", "lang_var" => "edit");
35  $commands[] = array("permission" => "write", "cmd" => "versions", "lang_var" => "versions");
36 
37  return $commands;
38  }
39 
49  public function _checkGoto($a_target)
50  {
51  global $ilAccess;
52 
53  $t_arr = explode("_", $a_target);
54 
55  if ($t_arr[0] != "chtr" || ((int) $t_arr[1]) <= 0)
56  {
57  return false;
58  }
59 
60  if ($ilAccess->checkAccess("visible", "", $t_arr[1]))
61  {
62  return true;
63  }
64 
65  return false;
66  }
67 
68  private static $chat_enabled = null;
69 
70  function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
71  {
72  global $ilUser, $ilAccess, $rbacsystem;
73 
74  if (self::$chat_enabled === null) {
75  $chatSetting = new ilSetting('chatroom');
76  self::$chat_enabled = (boolean) $chatSetting->get('chat_enabled');
77  }
78 
79  if ($a_user_id == "")
80  {
81  $a_user_id = $ilUser->getId();
82  }
83 
84  if ($rbacsystem->checkAccess('write', $a_ref_id)) {
85  return true;
86  }
87  return self::$chat_enabled;
88  }
89 
90 }
91 
92 ?>