ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilObjLinkResourceAccess Class Reference

Class ilObjLinkResourceAccess. More...

+ Inheritance diagram for ilObjLinkResourceAccess:
+ Collaboration diagram for ilObjLinkResourceAccess:

Public Member Functions

 _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...
 
- 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)
 check condition More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 
Parameters
ilWACPath$ilWACPath
Returns
bool
More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getCommands ()
 get commands More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
static _getFirstLink ($a_webr_id)
 Get first link item Check before with _isSingular() if there is more or less than one. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 
static _checkDirectLink ($a_obj_id)
 Check whether there is only one active link in the web resource. More...
 
- Static Public Member Functions inherited from ilObjectAccess
static _getCommands ()
 get commands More...
 
static _checkGoto ($a_target)
 check whether goto script will succeed More...
 
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten if object type does not support centralized offline handling. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 

Static Public Attributes

static $item = array()
 
static $single_link = array()
 

Detailed Description

Member Function Documentation

◆ _checkAccess()

ilObjLinkResourceAccess::_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

Reimplemented from ilObjectAccess.

Definition at line 80 of file class.ilObjLinkResourceAccess.php.

81 {
82 global $DIC;
83
84 $rbacsystem = $DIC['rbacsystem'];
85
86 // Set offline if no valid link exists
87 if ($a_permission == 'read') {
88 if (!self::_getFirstLink($a_obj_id) && !$rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id)) {
89 return false;
90 }
91 }
92
93 return parent::_checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id);
94 }
$DIC
Definition: xapitoken.php:46

References $DIC.

◆ _checkDirectLink()

static ilObjLinkResourceAccess::_checkDirectLink (   $a_obj_id)
static

Check whether there is only one active link in the web resource.

In this case this link is shown in a new browser window

Definition at line 174 of file class.ilObjLinkResourceAccess.php.

175 {
176 if (isset(self::$single_link[$a_obj_id])) {
177 return self::$single_link[$a_obj_id];
178 }
179 include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
180 return self::$single_link[$a_obj_id] = ilLinkResourceItems::_isSingular($a_obj_id);
181 }
static _isSingular($a_webr_id)
Check whether there is only one active link in the web resource.

References ilLinkResourceItems\_isSingular().

Referenced by ilObjLinkResourceListGUI\getCommandFrame(), ilObjLinkResourceListGUI\getCommandLink(), ilObjLinkResourceListGUI\getDescription(), and ilObjLinkResourceListGUI\getTitle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _checkGoto()

static ilObjLinkResourceAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

Definition at line 49 of file class.ilObjLinkResourceAccess.php.

50 {
51 global $DIC;
52
53 $ilAccess = $DIC['ilAccess'];
54
55 $t_arr = explode("_", $a_target);
56
57 if ($t_arr[0] != "webr" || ((int) $t_arr[1]) <= 0) {
58 return false;
59 }
60
61 if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
62 $ilAccess->checkAccess("visible", "", $t_arr[1])) {
63 return true;
64 }
65 return false;
66 }

References $DIC.

◆ _getCommands()

static ilObjLinkResourceAccess::_getCommands ( )
static

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"), );

Reimplemented from ilObjectAccess.

Definition at line 33 of file class.ilObjLinkResourceAccess.php.

34 {
35 $commands = array(
36 array("permission" => "read", "cmd" => "", "lang_var" => "show",
37 "default" => true),
38 array("permission" => "read", "cmd" => "exportHTML", "lang_var" => "export_html"),
39 array("permission" => "write", "cmd" => "editLinks", "lang_var" => "edit_content"),
40 array("permission" => "write", "cmd" => "settings", "lang_var" => "settings")
41 );
42
43 return $commands;
44 }

Referenced by ilObjLinkResourceListGUI\init().

+ Here is the caller graph for this function:

◆ _getFirstLink()

static ilObjLinkResourceAccess::_getFirstLink (   $a_webr_id)
static

Get first link item Check before with _isSingular() if there is more or less than one.

Parameters
int$a_webr_idobject id of web resource
Returns
array link item data

Definition at line 104 of file class.ilObjLinkResourceAccess.php.

105 {
106 global $DIC;
107
108 $ilDB = $DIC['ilDB'];
109
110 if (isset(self::$item[$a_webr_id])) {
111 return self::$item[$a_webr_id];
112 }
113 $query = "SELECT * FROM webr_items " .
114 "WHERE webr_id = " . $ilDB->quote($a_webr_id, 'integer') . ' ' .
115 "AND active = " . $ilDB->quote(1, 'integer') . ' ';
116 $res = $ilDB->query($query);
117
118 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
119 $item['title'] = $row->title;
120 $item['description'] = $row->description;
121 $item['target'] = $row->target;
122 $item['active'] = (bool) $row->active;
123 $item['disable_check'] = $row->disable_check;
124 $item['create_date'] = $row->create_date;
125 $item['last_update'] = $row->last_update;
126 $item['last_check'] = $row->last_check;
127 $item['valid'] = $row->valid;
128 $item['link_id'] = $row->link_id;
129 self::$item[$row->webr_id] = $item;
130 }
131 return $item ? $item : array();
132 }
$query
foreach($_POST as $key=> $value) $res
global $ilDB

References $DIC, $ilDB, $item, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilLinkResourceItems\_getFirstLink(), and ilObjLinkResourceListGUI\getCommandFrame().

+ Here is the caller graph for this function:

◆ _preloadData()

static ilObjLinkResourceAccess::_preloadData (   $a_obj_ids,
  $a_ref_ids 
)
static

Preload data.

Parameters
array$a_obj_idsarray of object ids

Reimplemented from ilObjectAccess.

Definition at line 139 of file class.ilObjLinkResourceAccess.php.

140 {
141 global $DIC;
142
143 $ilDB = $DIC['ilDB'];
144 $ilUser = $DIC['ilUser'];
145
146 $res = $ilDB->query(
147 "SELECT * FROM webr_items WHERE " .
148 $ilDB->in("webr_id", $a_obj_ids, false, "integer") .
149 " AND active = " . $ilDB->quote(1, 'integer')
150 );
151 foreach ($a_obj_ids as $id) {
152 self::$item[$id] = array();
153 }
154 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
155 $item['title'] = $row->title;
156 $item['description'] = $row->description;
157 $item['target'] = $row->target;
158 $item['active'] = (bool) $row->active;
159 $item['disable_check'] = $row->disable_check;
160 $item['create_date'] = $row->create_date;
161 $item['last_update'] = $row->last_update;
162 $item['last_check'] = $row->last_check;
163 $item['valid'] = $row->valid;
164 $item['link_id'] = $row->link_id;
165 self::$item[$row->webr_id] = $item;
166 }
167 }
$ilUser
Definition: imgupload.php:18

References $DIC, $ilDB, $ilUser, $item, $res, and ilDBConstants\FETCHMODE_OBJECT.

Field Documentation

◆ $item

ilObjLinkResourceAccess::$item = array()
static

Definition at line 18 of file class.ilObjLinkResourceAccess.php.

Referenced by _getFirstLink(), and _preloadData().

◆ $single_link

ilObjLinkResourceAccess::$single_link = array()
static

Definition at line 19 of file class.ilObjLinkResourceAccess.php.


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