ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjMediaCastAccess.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/Object/classes/class.ilObjectAccess.php");
6 
17 {
18 
31  function _getCommands()
32  {
33  $commands = array
34  (
35  array("permission" => "read", "cmd" => "showContent", "lang_var" => "show",
36  "default" => true),
37  array("permission" => "write", "cmd" => "listItems", "lang_var" => "edit_content"),
38  array("permission" => "write", "cmd" => "editSettings", "lang_var" => "settings")
39  );
40 
41  return $commands;
42  }
43 
56  function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "")
57  {
58  global $ilUser, $lng, $rbacsystem, $ilAccess;
59 
60  if ($a_user_id == "")
61  {
62  $a_user_id = $ilUser->getId();
63  }
64 
65  switch ($a_cmd)
66  {
67  case "listItems":
68 
70  && !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
71  {
72  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
73  return false;
74  }
75  break;
76 
77  // for permission query feature
78  case "infoScreen":
80  {
81  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
82  }
83  else
84  {
85  $ilAccess->addInfoItem(IL_STATUS_MESSAGE, $lng->txt("online"));
86  }
87  break;
88 
89  }
90  switch ($a_permission)
91  {
92  case "read":
93  case "visible":
94  if (!ilObjMediaCastAccess::_lookupOnline($a_obj_id) &&
95  (!$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)))
96  {
97  $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
98  return false;
99  }
100  break;
101  }
102 
103  return true;
104  }
105 
109  function _checkGoto($a_target)
110  {
111  global $ilAccess;
112 
113  $t_arr = explode("_", $a_target);
114 
115  if ($t_arr[0] != "mcst" || ((int) $t_arr[1]) <= 0)
116  {
117  return false;
118  }
119 
120  if ($ilAccess->checkAccess("read", "", $t_arr[1]))
121  {
122  return true;
123  }
124  return false;
125  }
126 
132  function _lookupOnline($a_id)
133  {
134  global $ilDB;
135 
136  $q = "SELECT * FROM il_media_cast_data WHERE id = ".$ilDB->quote($a_id);
137  $mc_set = $ilDB->query($q);
138  $mc_rec = $mc_set->fetchRow(DB_FETCHMODE_ASSOC);
139 
140  return $mc_rec["is_online"];
141  }
142 
148  function _lookupPublicFiles($a_id)
149  {
150  global $ilDB;
151 
152  $q = "SELECT * FROM il_media_cast_data WHERE id = ".$ilDB->quote($a_id);
153  $mc_set = $ilDB->query($q);
154  $mc_rec = $mc_set->fetchRow(DB_FETCHMODE_ASSOC);
155 
156  return $mc_rec["public_files"];
157  }
158 
164  function _lookupDiskUsage($a_id)
165  {
166  require_once('Modules/MediaCast/classes/class.ilObjMediaCast.php');
167  require_once("./Services/News/classes/class.ilNewsItem.php");
168  require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
169  $obj = new ilObjMediaCast($a_id, false);
170  $obj->read();
171  $items = $obj->getItemsArray();
172  $size = 0;
173  foreach ($items as $item)
174  {
175  $news_item = new ilNewsItem($item["id"]);
176  $news_item->read();
177  $mobId = $news_item->getMobId();
179  }
180  return $size;
181  }
182 }
183 
184 ?>