ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilObjGlossaryAccess Class Reference

Class ilObjGlossaryAccess. More...

+ Inheritance diagram for ilObjGlossaryAccess:
+ Collaboration diagram for ilObjGlossaryAccess:

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...
 
 _getCommands ()
 get commands More...
 
 _lookupOnline ($a_id)
 check wether learning module is online More...
 
 _checkGoto ($a_target)
 check whether goto script will succeed 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...
 
 _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 ilObjGlossaryAccess.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 17 of file class.ilObjGlossaryAccess.php.

Member Function Documentation

◆ _checkAccess()

ilObjGlossaryAccess::_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
mixed true, if everything is ok, message (string) when access is not granted

Reimplemented from ilObjectAccess.

Definition at line 32 of file class.ilObjGlossaryAccess.php.

33 {
34 global $ilUser, $lng, $rbacsystem, $ilAccess;
35
36 if ($a_user_id == "")
37 {
38 $a_user_id = $ilUser->getId();
39 }
40
41 switch ($a_permission)
42 {
43 case "read":
45 && !$rbacsystem->checkAccessOfUser($a_user_id,'write',$a_ref_id))
46 {
47 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
48 return false;
49 }
50 break;
51
52 case "visible":
53 if (!ilObjGlossaryAccess::_lookupOnline($a_obj_id) &&
54 (!$rbacsystem->checkAccessOfUser($a_user_id,'write', $a_ref_id)))
55 {
56 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("offline"));
57 return false;
58 }
59 break;
60 }
61
62
63 return true;
64 }
const IL_NO_OBJECT_ACCESS
_lookupOnline($a_id)
check wether learning module is online
global $lng
Definition: privfeed.php:40
global $ilUser
Definition: imgupload.php:15

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

+ Here is the call graph for this function:

◆ _checkGoto()

ilObjGlossaryAccess::_checkGoto (   $a_target)

check whether goto script will succeed

Reimplemented from ilObjectAccess.

Definition at line 114 of file class.ilObjGlossaryAccess.php.

115 {
116 global $ilAccess;
117
118 $t_arr = explode("_", $a_target);
119
120 if (($t_arr[0] != "glo" && $t_arr[0] != "git") || ((int) $t_arr[1]) <= 0)
121 {
122 return false;
123 }
124
125 if ($t_arr[0] == "glo")
126 {
127 if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
128 $ilAccess->checkAccess("visible", "", $t_arr[1]))
129 {
130 return true;
131 }
132 }
133
134 if ($t_arr[0] == "git")
135 {
136 if ($t_arr[2] > 0)
137 {
138 $ref_ids = array($t_arr[2]);
139 }
140 else
141 {
142 // determine learning object
143 require_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
144 $glo_id = ilGlossaryTerm::_lookGlossaryID($t_arr[1]);
145 $ref_ids = ilObject::_getAllReferences($glo_id);
146 }
147 // check read permissions
148 foreach ($ref_ids as $ref_id)
149 {
150 // Permission check
151 if ($ilAccess->checkAccess("read", "", $ref_id))
152 {
153 return true;
154 }
155 }
156 }
157
158 return false;
159 }
static _lookGlossaryID($term_id)
get glossary id form term id
static _getAllReferences($a_id)
get all reference ids of object
$ref_id
Definition: sahs_server.php:39

References $ref_id, ilObject\_getAllReferences(), and ilGlossaryTerm\_lookGlossaryID().

+ Here is the call graph for this function:

◆ _getCommands()

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

Reimplemented from ilObjectAccess.

Definition at line 78 of file class.ilObjGlossaryAccess.php.

79 {
80 $commands = array
81 (
82 array("permission" => "read", "cmd" => "view", "lang_var" => "show",
83 "default" => true),
84 array("permission" => "write", "cmd" => "edit", "lang_var" => "edit_content"),
85 array("permission" => "edit_content", "cmd" => "edit", "lang_var" => "edit_content"), // #11099
86 array("permission" => "write", "cmd" => "properties", "lang_var" => "settings")
87 );
88
89 return $commands;
90 }

Referenced by ilObjGlossaryListGUI\init().

+ Here is the caller graph for this function:

◆ _lookupOnline()

ilObjGlossaryAccess::_lookupOnline (   $a_id)

check wether learning module is online

Definition at line 99 of file class.ilObjGlossaryAccess.php.

100 {
101 global $ilDB;
102
103 $q = "SELECT * FROM glossary WHERE id = ".
104 $ilDB->quote($a_id, "integer");
105 $lm_set = $ilDB->query($q);
106 $lm_rec = $ilDB->fetchAssoc($lm_set);
107
108 return ilUtil::yn2tf($lm_rec["is_online"]);
109 }
static yn2tf($a_yn)
convert "y"/"n" to true/false
global $ilDB
$lm_set

References $ilDB, $lm_set, and ilUtil\yn2tf().

Referenced by _checkAccess(), and ilObjGlossaryListGUI\getProperties().

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

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