ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilObjExerciseAccess Class Reference

Class ilObjExerciseAccess. More...

+ Inheritance diagram for ilObjExerciseAccess:
+ Collaboration diagram for ilObjExerciseAccess:

Public Member Functions

 canBeDelivered (ilWACPath $ilWACPath)
 
- 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...
 

Static Public Member Functions

static getConditionOperators ()
 Get possible conditions operators. More...
 
static checkCondition ($a_exc_id, $a_operator, $a_value, $a_usr_id)
 check condition More...
 
static _getCommands ()
 get commands More...
 
static _lookupRemainingWorkingTimeString ($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 ($a_target)
 check whether goto script will succeed More...
 
static _isOffline ($a_obj_id)
 Type-specific implementation of general status, has to be overwritten. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 

Detailed Description

Class ilObjExerciseAccess.

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

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

Member Function Documentation

◆ _checkGoto()

static ilObjExerciseAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

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

References $DIC.

140  {
141  global $DIC;
142 
143  $ilAccess = $DIC->access();
144 
145  $t_arr = explode("_", $a_target);
146 
147  if ($t_arr[0] != "exc" || ((int) $t_arr[1]) <= 0) {
148  return false;
149  }
150 
151  if ($ilAccess->checkAccess("read", "", $t_arr[1])) {
152  return true;
153  }
154  return false;
155  }
global $DIC
Definition: saml.php:7

◆ _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 76 of file class.ilObjExerciseAccess.php.

References array.

Referenced by ilObjExerciseListGUI\init().

77  {
78  $commands = array(
79  array("permission" => "read", "cmd" => "showOverview", "lang_var" => "show",
80  "default" => true),
81  array("permission" => "write", "cmd" => "listAssignments", "lang_var" => "edit_assignments"),
82  array("permission" => "write", "cmd" => "edit", "lang_var" => "settings")
83  );
84 
85  return $commands;
86  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ _lookupRemainingWorkingTimeString()

static ilObjExerciseAccess::_lookupRemainingWorkingTimeString (   $a_obj_id)
static

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

References $DIC, $ilDB, $row, array, IL_CAL_UNIX, ilUtil\period2String(), and time.

Referenced by ilObjExerciseListGUI\getProperties().

89  {
90  global $DIC;
91 
92  $ilDB = $DIC->database();
93 
94  // #14077 - mind peer deadline, too
95 
96  $dl = null;
97  $cnt = array();
98 
99  $q = "SELECT id, time_stamp, deadline2, peer_dl" .
100  " FROM exc_assignment WHERE exc_id = " . $ilDB->quote($a_obj_id, "integer") .
101  " AND (time_stamp > " . $ilDB->quote(time(), "integer") .
102  " OR (peer_dl > " . $ilDB->quote(time(), "integer") .
103  " AND peer > " . $ilDB->quote(0, "integer") . "))";
104  $set = $ilDB->query($q);
105  while ($row = $ilDB->fetchAssoc($set)) {
106  if ($row["time_stamp"] > time() &&
107  ($row["time_stamp"] < $dl || !$dl)) {
108  $dl = $row["time_stamp"];
109  }
110  /* extended deadline should not be presented anywhere
111  if($row["deadline2"] > time() &&
112  ($row["deadline2"] < $dl || !$dl))
113  {
114  $dl = $row["deadline2"];
115  }
116  */
117  if ($row["peer_dl"] > time() &&
118  ($row["peer_dl"] < $dl || !$dl)) {
119  $dl = $row["peer_dl"];
120  }
121  $cnt[$row["id"]] = true;
122  }
123 
124  // :TODO: mind personal deadline?
125 
126  if ($dl) {
128  }
129 
130  return array(
131  "mtime" => $dl,
132  "cnt" => sizeof($cnt)
133  );
134  }
global $DIC
Definition: saml.php:7
const IL_CAL_UNIX
static period2String(ilDateTime $a_from, $a_to=null)
Return a string of time period.
Date and time handling
Create styles array
The data for the language used.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canBeDelivered()

ilObjExerciseAccess::canBeDelivered ( ilWACPath  $ilWACPath)
Parameters
ilWACPath$ilWACPath
Returns
bool

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

References $results, ilObject2\_getAllReferences(), and ilWACPath\getPath().

163  {
164  global $ilAccess;
165 
166  return true;
167 
168  // to do: check the path, extract the IDs from the path
169  // determine the object ID of the corresponding exercise
170  // get all ref IDs of the exercise from the object id and check if use
171  // has read access to any of these ref ids (if yes, return true)
172 
173  preg_match("/\\/poll_([\\d]*)\\//uism", $ilWACPath->getPath(), $results);
174 
175  foreach (ilObject2::_getAllReferences($results[1]) as $ref_id) {
176  if ($ilAccess->checkAccess('read', '', $ref_id)) {
177  return true;
178  }
179  }
180 
181  return false;
182  }
static _getAllReferences($a_id)
$results
Definition: svg-scanner.php:47
+ Here is the call graph for this function:

◆ checkCondition()

static ilObjExerciseAccess::checkCondition (   $a_exc_id,
  $a_operator,
  $a_value,
  $a_usr_id 
)
static

check condition

Parameters
type$a_exc_id
type$a_operator
type$a_value
type$a_usr_id
Returns
boolean

Implements ilConditionHandling.

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

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

41  {
42  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
43  include_once './Modules/Exercise/classes/class.ilExerciseMembers.php';
44 
45  switch ($a_operator) {
47  if (ilExerciseMembers::_lookupStatus($a_exc_id, $a_usr_id) == "passed") {
48  return true;
49  } else {
50  return false;
51  }
52  break;
53 
55  return ilExerciseMembers::_lookupStatus($a_exc_id, $a_usr_id) == 'failed';
56 
57  default:
58  return true;
59  }
60  return true;
61  }
static _lookupStatus($a_obj_id, $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.

Implements ilConditionHandling.

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

References array, ilConditionHandler\OPERATOR_FAILED, and ilConditionHandler\OPERATOR_PASSED.

23  {
24  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
25  return array(
28  );
29  }
Create styles array
The data for the language used.

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