ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjQuestionPoolAccess Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilObjQuestionPoolAccess:
+ Collaboration diagram for ilObjQuestionPoolAccess:

Public Member Functions

 _checkAccess (string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
 
- Public Member Functions inherited from ilObjectAccess
 _checkAccess (string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
 Checks whether a user may invoke a command or not (this method is called by ilAccessHandler::checkAccess) More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

Static Public Member Functions

static _getCommands ()
 get commands More...
 
static isOnline ($a_obj_id)
 returns the objects's ONline status More...
 
- Static Public Member Functions inherited from ilObjectAccess
static _getCommands ()
 get commands More...
 
static _checkGoto (string $target)
 check whether goto script will succeed More...
 
static _isOffline (int $obj_id)
 Type-specific implementation of general status, has to be overwritten if object type does not support centralized offline handling. More...
 
static _preloadData (array $obj_ids, array $ref_ids)
 Preload data. More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilObjQuestionPoolAccess

Author
Helmut Schottmueller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 30 of file class.ilObjQuestionPoolAccess.php.

Member Function Documentation

◆ _checkAccess()

ilObjQuestionPoolAccess::_checkAccess ( string  $cmd,
string  $permission,
int  $ref_id,
int  $obj_id,
?int  $user_id = null 
)

Definition at line 58 of file class.ilObjQuestionPoolAccess.php.

References $DIC, $ilUser, $lng, and ilAccessInfo\IL_NO_OBJECT_ACCESS.

58  : bool
59  {
60  global $DIC;
61  $ilUser = $DIC['ilUser'];
62  $lng = $DIC['lng'];
63  $rbacsystem = $DIC['rbacsystem'];
64  $ilAccess = $DIC['ilAccess'];
65 
66  if (is_null($user_id)) {
67  $user_id = $ilUser->getId();
68  }
69 
70  if ($rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id)) {
71  return true;
72  }
73 
74  switch ($permission) {
75  case 'visible':
76  case 'read':
77  if (!self::isOnline($obj_id)) {
78  $ilAccess->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $lng->txt("tst_warning_pool_offline"));
79  return false;
80  }
81  break;
82  }
83 
84  return true;
85  }
$lng
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
$ilUser
Definition: imgupload.php:34

◆ _getCommands()

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

Definition at line 44 of file class.ilObjQuestionPoolAccess.php.

Referenced by ilObjQuestionPoolListGUI\init().

44  : array
45  {
46  $commands = array(
47  array("permission" => "write", "cmd" => "questions", "lang_var" => "tst_edit_questions"),
48  array("permission" => "write", "cmd" => "ilObjQuestionPoolSettingsGeneralGUI::showForm", "lang_var" => "settings"),
49  #array("permission" => "write", "cmd" => "questions", "lang_var" => "edit",
50  # "default" => false),
51  array("permission" => "read", "cmd" => "questions", "lang_var" => "edit",
52  "default" => true)
53  );
54 
55  return $commands;
56  }
+ Here is the caller graph for this function:

◆ isOnline()

static ilObjQuestionPoolAccess::isOnline (   $a_obj_id)
static

returns the objects's ONline status

Parameters
integer$a_obj_id
Returns
boolean $online

Definition at line 93 of file class.ilObjQuestionPoolAccess.php.

References $DIC, $ilDB, $query, and $res.

Referenced by ilContainer\legacyOnlineFilter().

93  : bool
94  {
95  global $DIC;
96  $ilDB = $DIC['ilDB'];
97 
98  $query = "
99  SELECT COUNT(id_questionpool) cnt
100  FROM qpl_questionpool
101  WHERE obj_fi = %s
102  AND isonline = 1
103  ";
104 
105  $res = $ilDB->queryF($query, array('integer'), array($a_obj_id));
106  $row = $ilDB->fetchAssoc($res);
107 
108  return $row['cnt'] > 0;
109  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ Here is the caller graph for this function:

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