ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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...
 
 canBeDelivered (ilWACPath $ilWACPath)
 
Parameters
ilWACPath$ilWACPath
Returns
bool
More...
 
 canBeDelivered (ilWACPath $ilWACPath)
 

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 if object type does not support centralized offline handling. More...
 
static _preloadData ($a_obj_ids, $a_ref_ids)
 Preload data. More...
 
static getConditionOperators ()
 Returns an array with valid operators for the specific object type. More...
 
static checkCondition ($a_trigger_obj_id, $a_operator, $a_value, $a_usr_id)
 check condition for a specific user and object More...
 

Detailed Description

Member Function Documentation

◆ _checkGoto()

static ilObjExerciseAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

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

132 {
133 global $DIC;
134
135 $ilAccess = $DIC->access();
136
137 $t_arr = explode("_", $a_target);
138
139 if ($t_arr[0] != "exc" || ((int) $t_arr[1]) <= 0) {
140 return false;
141 }
142
143 if ($ilAccess->checkAccess("read", "", $t_arr[1]) ||
144 $ilAccess->checkAccess("visible", "", $t_arr[1])) {
145 return true;
146 }
147 return false;
148 }
$DIC
Definition: xapitoken.php:46

References $DIC.

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

Reimplemented from ilObjectAccess.

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

69 {
70 $commands = array(
71 array("permission" => "read", "cmd" => "showOverview", "lang_var" => "show",
72 "default" => true),
73 array("permission" => "write", "cmd" => "listAssignments", "lang_var" => "edit_assignments"),
74 array("permission" => "write", "cmd" => "edit", "lang_var" => "settings")
75 );
76
77 return $commands;
78 }

Referenced by ilObjExerciseListGUI\init().

+ Here is the caller graph for this function:

◆ _lookupRemainingWorkingTimeString()

static ilObjExerciseAccess::_lookupRemainingWorkingTimeString (   $a_obj_id)
static

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

81 {
82 global $DIC;
83
84 $ilDB = $DIC->database();
85
86 // #14077 - mind peer deadline, too
87
88 $dl = null;
89 $cnt = array();
90
91 $q = "SELECT id, time_stamp, deadline2, peer_dl" .
92 " FROM exc_assignment WHERE exc_id = " . $ilDB->quote($a_obj_id, "integer") .
93 " AND (time_stamp > " . $ilDB->quote(time(), "integer") .
94 " OR (peer_dl > " . $ilDB->quote(time(), "integer") .
95 " AND peer > " . $ilDB->quote(0, "integer") . "))";
96 $set = $ilDB->query($q);
97 while ($row = $ilDB->fetchAssoc($set)) {
98 if ($row["time_stamp"] > time() &&
99 ($row["time_stamp"] < $dl || !$dl)) {
100 $dl = $row["time_stamp"];
101 }
102 /* extended deadline should not be presented anywhere
103 if($row["deadline2"] > time() &&
104 ($row["deadline2"] < $dl || !$dl))
105 {
106 $dl = $row["deadline2"];
107 }
108 */
109 if ($row["peer_dl"] > time() &&
110 ($row["peer_dl"] < $dl || !$dl)) {
111 $dl = $row["peer_dl"];
112 }
113 $cnt[$row["id"]] = true;
114 }
115
116 // :TODO: mind personal deadline?
117
118 if ($dl) {
120 }
121
122 return array(
123 "mtime" => $dl,
124 "cnt" => sizeof($cnt)
125 );
126 }
const IL_CAL_UNIX
@classDescription Date and time handling
static period2String(ilDateTime $a_from, $a_to=null)
Return a string of time period.
global $ilDB

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

Referenced by ilObjExerciseListGUI\getProperties().

+ 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

Reimplemented from ilObjectAccess.

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

156 {
157 global $ilAccess;
158
159 return true;
160
161 // to do: check the path, extract the IDs from the path
162 // determine the object ID of the corresponding exercise
163 // get all ref IDs of the exercise from the object id and check if use
164 // has read access to any of these ref ids (if yes, return true)
165
166 preg_match("/\\/poll_([\\d]*)\\//uism", $ilWACPath->getPath(), $results);
167
168 foreach (ilObject2::_getAllReferences($results[1]) as $ref_id) {
169 if ($ilAccess->checkAccess('read', '', $ref_id)) {
170 return true;
171 }
172 }
173
174 return false;
175 }
static _getAllReferences($a_id)
get all reference ids of object
$results

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

+ 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 35 of file class.ilObjExerciseAccess.php.

36 {
37 switch ($a_operator) {
39 if (ilExerciseMembers::_lookupStatus($a_exc_id, $a_usr_id) == "passed") {
40 return true;
41 } else {
42 return false;
43 }
44 break;
45
47 return ilExerciseMembers::_lookupStatus($a_exc_id, $a_usr_id) == 'failed';
48
49 default:
50 return true;
51 }
52 return true;
53 }
static _lookupStatus($a_obj_id, $a_user_id)
Lookup current status (notgraded|passed|failed)

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

+ Here is the call graph for this function:

◆ getConditionOperators()

static ilObjExerciseAccess::getConditionOperators ( )
static

Get possible conditions operators.

Implements ilConditionHandling.

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

References ilConditionHandler\OPERATOR_FAILED, and ilConditionHandler\OPERATOR_PASSED.


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