ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjExerciseAccess 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 ilObjExerciseAccess:
+ Collaboration diagram for ilObjExerciseAccess:

Public Member Functions

 __construct ()
 
 canBeDelivered (ilWACPath $ilWACPath)
 
 _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 getConditionOperators ()
 Get possible conditions operators. More...
 
static checkCondition (int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id)
 check condition More...
 
static _getCommands ()
 get commands More...
 
static _lookupRemainingWorkingTimeString (int $a_obj_id)
 
static _checkGoto ($a_target)
 check whether goto script will succeed 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...
 

Protected Attributes

ilLanguage $lng
 
ilAccessHandler $access
 
ilRbacSystem $rbacsystem
 
ilObjUser $user
 

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

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 22 of file class.ilObjExerciseAccess.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjExerciseAccess::__construct ( )

Definition at line 29 of file class.ilObjExerciseAccess.php.

References $DIC, ILIAS\Repository\access(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

30  {
31  global $DIC;
32  $this->user = $DIC->user();
33  $this->lng = $DIC->language();
34  $this->access = $DIC->access();
35  $this->rbacsystem = $DIC->rbac()->system();
36  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ _checkAccess()

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

Definition at line 167 of file class.ilObjExerciseAccess.php.

References $rbacsystem, $user, $user_id, ILIAS\Repository\access(), ilRbacSystem\checkAccessOfUser(), ilAccessInfo\IL_NO_OBJECT_ACCESS, ILIAS\Repository\lng(), and null.

167  : bool
168  {
169  $ilUser = $this->user;
171 
172  if ($user_id === null) {
173  $user_id = $ilUser->getId();
174  }
175 
176  if (self::_isOffline($obj_id)) {
177  if (($permission === "visible" || $permission === "read") && !$rbacsystem->checkAccessOfUser($user_id, 'write', $ref_id)) {
178  $this->access->addInfoItem(ilAccessInfo::IL_NO_OBJECT_ACCESS, $this->lng->txt("offline"));
179  return false;
180  }
181  }
182 
183  return true;
184  }
checkAccessOfUser(int $a_user_id, string $a_operations, int $a_ref_id, string $a_type="")
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjExerciseAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

Definition at line 147 of file class.ilObjExerciseAccess.php.

References $DIC.

147  : bool
148  {
149  global $DIC;
150 
151  $ilAccess = $DIC->access();
152 
153  $t_arr = explode("_", $a_target);
154 
155  if ($t_arr[0] != "exc" || ((int) $t_arr[1]) <= 0) {
156  return false;
157  }
158  return $ilAccess->checkAccess("read", "", $t_arr[1]) ||
159  $ilAccess->checkAccess("visible", "", $t_arr[1]);
160  }
global $DIC
Definition: shib_login.php:22

◆ _getCommands()

static ilObjExerciseAccess::_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 82 of file class.ilObjExerciseAccess.php.

Referenced by ilObjExerciseListGUI\init().

82  : array
83  {
84  return array(
85  array("permission" => "read", "cmd" => "showOverview", "lang_var" => "show",
86  "default" => true),
87  array("permission" => "write", "cmd" => "listAssignments", "lang_var" => "edit_assignments"),
88  array("permission" => "write", "cmd" => "edit", "lang_var" => "settings")
89  );
90  }
+ Here is the caller graph for this function:

◆ _lookupRemainingWorkingTimeString()

static ilObjExerciseAccess::_lookupRemainingWorkingTimeString ( int  $a_obj_id)
static
Exceptions
ilDateTimeException

Definition at line 95 of file class.ilObjExerciseAccess.php.

References $DIC, $ilDB, $q, IL_CAL_UNIX, null, and ilLegacyFormElementsUtil\period2String().

Referenced by ilObjExerciseListGUI\getProperties().

97  : array {
98  global $DIC;
99 
100  $ilDB = $DIC->database();
101 
102  // #14077 - mind peer deadline, too
103 
104  $dl = null;
105  $cnt = array();
106 
107  $q = "SELECT id, time_stamp, deadline2, peer_dl" .
108  " FROM exc_assignment WHERE exc_id = " . $ilDB->quote($a_obj_id, "integer") .
109  " AND (time_stamp > " . $ilDB->quote(time(), "integer") .
110  " OR (peer_dl > " . $ilDB->quote(time(), "integer") .
111  " AND peer > " . $ilDB->quote(0, "integer") . "))";
112  $set = $ilDB->query($q);
113  while ($row = $ilDB->fetchAssoc($set)) {
114  if ($row["time_stamp"] > time() &&
115  ($row["time_stamp"] < $dl || !$dl)) {
116  $dl = $row["time_stamp"];
117  }
118  /* extended deadline should not be presented anywhere
119  if($row["deadline2"] > time() &&
120  ($row["deadline2"] < $dl || !$dl))
121  {
122  $dl = $row["deadline2"];
123  }
124  */
125  if ($row["peer_dl"] > time() &&
126  ($row["peer_dl"] < $dl || !$dl)) {
127  $dl = $row["peer_dl"];
128  }
129  $cnt[$row["id"]] = true;
130  }
131 
132  // :TODO: mind personal deadline?
133 
134  if ($dl) {
136  }
137 
138  return array(
139  "mtime" => $dl,
140  "cnt" => count($cnt)
141  );
142  }
static period2String(ilDateTime $a_from, $a_to=null)
Return a string of time period.
const IL_CAL_UNIX
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
$q
Definition: shib_logout.php:21
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canBeDelivered()

ilObjExerciseAccess::canBeDelivered ( ilWACPath  $ilWACPath)

Implements ilWACCheckingClass.

Definition at line 162 of file class.ilObjExerciseAccess.php.

162  : bool
163  {
164  return true;
165  }

◆ checkCondition()

static ilObjExerciseAccess::checkCondition ( int  $a_trigger_obj_id,
string  $a_operator,
string  $a_value,
int  $a_usr_id 
)
static

check condition

Implements ilConditionHandling.

Definition at line 55 of file class.ilObjExerciseAccess.php.

References ilExerciseMembers\_lookupStatus(), ilConditionHandler\OPERATOR_FAILED, and ilConditionHandler\OPERATOR_PASSED.

55  : bool
56  {
57  switch ($a_operator) {
59  return ilExerciseMembers::_lookupStatus($a_trigger_obj_id, $a_usr_id) == "passed";
60 
62  return ilExerciseMembers::_lookupStatus($a_trigger_obj_id, $a_usr_id) == 'failed';
63 
64  default:
65  return true;
66  }
67  }
static _lookupStatus(int $a_obj_id, int $a_user_id)
Lookup current status (notgraded|passed|failed)
+ Here is the call graph for this function:

◆ getConditionOperators()

static ilObjExerciseAccess::getConditionOperators ( )
static

Get possible conditions operators.

Returns
string[]

Implements ilConditionHandling.

Definition at line 43 of file class.ilObjExerciseAccess.php.

References ilConditionHandler\OPERATOR_FAILED, and ilConditionHandler\OPERATOR_PASSED.

43  : array
44  {
45  return array(
48  );
49  }

Field Documentation

◆ $access

ilAccessHandler ilObjExerciseAccess::$access
protected

Definition at line 25 of file class.ilObjExerciseAccess.php.

◆ $lng

ilLanguage ilObjExerciseAccess::$lng
protected

Definition at line 24 of file class.ilObjExerciseAccess.php.

◆ $rbacsystem

ilRbacSystem ilObjExerciseAccess::$rbacsystem
protected

Definition at line 26 of file class.ilObjExerciseAccess.php.

Referenced by _checkAccess().

◆ $user

ilObjUser ilObjExerciseAccess::$user
protected

Definition at line 27 of file class.ilObjExerciseAccess.php.

Referenced by _checkAccess().


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