ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjBibliographicAccess.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("./Services/Object/classes/class.ilObjectAccess.php");
6 
15 {
28  public function _getCommands()
29  {
30  $commands = array
31  (
32  array("permission" => "read", "cmd" => "render", "lang_var" => "show", "default" => true),
33  array("permission" => "write", "cmd" => "view", "lang_var" => "edit_content"),
34  array("permission" => "write", "cmd" => "edit", "lang_var" => "settings")
35  );
36 
37  return $commands;
38  }
39 
43  public function _checkGoto($a_target)
44  {
45  global $ilAccess, $lng;
46  $t_arr = explode("_", $a_target);
47 
48  if ($t_arr[0] != "bibl" || ((int) $t_arr[1]) <= 0)
49  {
50  return false;
51  }
52 
53  if ($ilAccess->checkAccess("visible", "", $t_arr[1]))
54  {
55  return true;
56  }
57 
58  $object_title = ilObject::_lookupTitle(ilObject::_lookupObjId($t_arr[1]));
59  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"), $object_title), true);
60  return false;
61  }
62 
75  public function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
76  {
77  global $ilUser, $lng, $rbacsystem, $ilAccess;
78 
79  if ($a_user_id == "")
80  {
81  $a_user_id = $ilUser->getId();
82  }
83 
84  switch ($a_cmd)
85  {
86  case "view":
87  if(!self::_lookupOnline($a_obj_id)
88  && !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
89  {
90  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
91  return false;
92  }
93  break;
94 
95  // for permission query feature
96  case "infoScreen":
97  if(!self::_lookupOnline($a_obj_id))
98  {
99  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
100  }
101  else
102  {
103  $ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("online"));
104  }
105  break;
106 
107  }
108  switch($a_permission)
109  {
110  case "read":
111  case "visible":
112  if (!self::_lookupOnline($a_obj_id) &&
113  (!$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)))
114  {
115  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
116  return false;
117  }
118  break;
119  }
120 
121  return true;
122  }
123 
129  public static function _lookupOnline($a_id){
130 
131  global $ilDB;
132 
133  $q = "SELECT is_online FROM il_bibl_data WHERE id = ".
134  $ilDB->quote($a_id, "integer");
135 
136  $bibl_set = $ilDB->query($q);
137  $bibl_rec = $ilDB->fetchAssoc($bibl_set);
138 
139  return $bibl_rec["is_online"];
140 
141  }
142 
143 }
144 
145 ?>