ILIAS  release_4-4 Revision
ilObjMediaCastAccess Class Reference

Class ilObjMediaCastAccess. More...

+ Inheritance diagram for ilObjMediaCastAccess:
+ Collaboration diagram for ilObjMediaCastAccess:

Public Member Functions

 _getCommands ()
 get commands More...
 
 _checkAccess ($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
 checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
 _checkGoto ($a_target)
 check whether goto script will succeed More...
 
 _lookupOnline ($a_id)
 Check wether media cast is online. More...
 
 _lookupPublicFiles ($a_id)
 Check wether files should be public. More...
 
 _lookupDiskUsage ($a_id)
 Returns the number of bytes used on the harddisk by the file object with the specified object id. More...
 
- Public Member Functions inherited from ilObjectAccess
 _checkAccess ($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id="")
 Checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
 _checkCondition ($a_obj_id, $a_operator, $a_value, $a_usr_id=0)
 check condition More...
 
 _getCommands ()
 get commands More...
 
 _checkGoto ($a_target)
 check whether goto script will succeed More...
 
 _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectAccess
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten. More...
 

Detailed Description

Class ilObjMediaCastAccess.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id
class.ilObjMediaCastAccess.php 12772 2006-12-07 09:34:01Z akill

Definition at line 16 of file class.ilObjMediaCastAccess.php.

Member Function Documentation

◆ _checkAccess()

ilObjMediaCastAccess::_checkAccess (   $a_cmd,
  $a_permission,
  $a_ref_id,
  $a_obj_id,
  $a_user_id = "" 
)

checks wether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess)

Parameters
string$a_cmdcommand (not permission!)
string$a_permissionpermission
int$a_ref_idreference id
int$a_obj_idobject id
int$a_user_iduser id (if not provided, current user is taken)
Returns
boolean true, if everything is ok

Definition at line 56 of file class.ilObjMediaCastAccess.php.

References $ilUser, $lng, _lookupOnline(), and IL_NO_OBJECT_ACCESS.

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  }
const IL_NO_OBJECT_ACCESS
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
_lookupOnline($a_id)
Check wether media cast is online.
+ Here is the call graph for this function:

◆ _checkGoto()

ilObjMediaCastAccess::_checkGoto (   $a_target)

check whether goto script will succeed

Definition at line 109 of file class.ilObjMediaCastAccess.php.

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  }

◆ _getCommands()

ilObjMediaCastAccess::_getCommands ( )

get commands

this method returns an array of all possible commands/permission combinations

example: $commands = array ( array("permission" => "read", "cmd" => "view", "lang_var" => "show"), array("permission" => "write", "cmd" => "edit", "lang_var" => "edit"), );

Definition at line 31 of file class.ilObjMediaCastAccess.php.

Referenced by ilObjMediaCastListGUI\init().

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  }
+ Here is the caller graph for this function:

◆ _lookupDiskUsage()

ilObjMediaCastAccess::_lookupDiskUsage (   $a_id)

Returns the number of bytes used on the harddisk by the file object with the specified object id.

Parameters
intobject id of a file object.

Definition at line 164 of file class.ilObjMediaCastAccess.php.

References $size, ilObjMediaObject\_getDirectory(), and ilUtil\dirsize().

Referenced by ilObjMediaCast\getDiskUsage().

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  }
$size
Definition: RandomTest.php:79
Class ilObjMediaCast.
static dirsize($directory)
get size of a directory or a file.
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupOnline()

ilObjMediaCastAccess::_lookupOnline (   $a_id)

Check wether media cast is online.

Parameters
int$a_idmedia cast id

Definition at line 132 of file class.ilObjMediaCastAccess.php.

References DB_FETCHMODE_ASSOC.

Referenced by _checkAccess(), ilObjMediaCastListGUI\getProperties(), ilObjectFeedWriter\ilObjectFeedWriter(), and ilUserFeedWriter\ilUserFeedWriter().

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  }
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
+ Here is the caller graph for this function:

◆ _lookupPublicFiles()

ilObjMediaCastAccess::_lookupPublicFiles (   $a_id)

Check wether files should be public.

Parameters
int$a_idmedia cast id

Definition at line 148 of file class.ilObjMediaCastAccess.php.

References DB_FETCHMODE_ASSOC.

Referenced by ilWebAccessChecker\checkAccessMob(), and ilObjectFeedWriter\ilObjectFeedWriter().

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  }
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: