ILIAS  release_7 Revision v7.30-3-g800a261c036
ilObjSurveyAccess Class Reference

Class ilObjSurveyAccess. More...

+ Inheritance diagram for ilObjSurveyAccess:
+ Collaboration diagram for ilObjSurveyAccess:

Public Member Functions

 __construct ()
 Constructor. More...
 
 _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...
 
- 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_svy_id, $a_operator, $a_value, $a_usr_id)
 check condition More...
 
static _getCommands ()
 get commands More...
 
static _lookupCreationComplete ($a_obj_id)
 checks wether all necessary parts of the survey are given More...
 
static _lookupEvaluationAccess ($a_obj_id)
 get evaluation access More...
 
static _isSurveyParticipant ($user_id, $survey_id)
 
static _lookupAnonymize ($a_obj_id)
 
static _hasEvaluationAccess ($a_obj_id, $user_id)
 
static _lookupFinished ($a_obj_id, $a_user_id="")
 get finished status More...
 
static _lookupMode ($a_obj_id)
 Get survey mode. More...
 
static _lookup360Mode ($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...
 

Protected Attributes

 $user
 
 $lng
 
 $rbacsystem
 
 $access
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjSurveyAccess::__construct ( )

Constructor.

Definition at line 37 of file class.ilObjSurveyAccess.php.

38 {
39 global $DIC;
40
41 $this->user = $DIC->user();
42 $this->lng = $DIC->language();
43 $this->rbacsystem = $DIC->rbac()->system();
44 $this->access = $DIC->access();
45 }
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24

References $DIC, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _checkAccess()

ilObjSurveyAccess::_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)

Please do not check any preconditions handled by ilConditionHandler here.

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
boolean true, if everything is ok

Reimplemented from ilObjectAccess.

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

100 {
104 $ilAccess = $this->access;
105
106 if ($a_user_id == "") {
107 $a_user_id = $ilUser->getId();
108 }
109
110 $is_admin = $rbacsystem->checkAccessOfUser($a_user_id, 'write', $a_ref_id);
111
112 switch ($a_permission) {
113 case "visible":
114 case "read":
116 !$is_admin) {
117 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("warning_survey_not_complete"));
118 return false;
119 }
120 break;
121 }
122
123 switch ($a_cmd) {
124 case "run":
126 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("warning_survey_not_complete"));
127 return false;
128 }
129 break;
130
131 case "evaluation":
133 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("warning_survey_not_complete"));
134 return false;
135 }
136 if ($rbacsystem->checkAccess("write", $a_ref_id) || ilObjSurveyAccess::_hasEvaluationAccess($a_obj_id, $a_user_id)) {
137 return true;
138 } else {
139 $ilAccess->addInfoItem(IL_NO_OBJECT_ACCESS, $lng->txt("status_no_permission"));
140 return false;
141 }
142 break;
143 }
144
145 return true;
146 }
const IL_NO_OBJECT_ACCESS
static _lookupCreationComplete($a_obj_id)
checks wether all necessary parts of the survey are given
static _hasEvaluationAccess($a_obj_id, $user_id)
$ilUser
Definition: imgupload.php:18

References $access, $ilUser, $lng, $rbacsystem, $user, _hasEvaluationAccess(), _lookupCreationComplete(), and IL_NO_OBJECT_ACCESS.

+ Here is the call graph for this function:

◆ _checkGoto()

static ilObjSurveyAccess::_checkGoto (   $a_target)
static

check whether goto script will succeed

Reimplemented from ilObjectAccess.

Definition at line 423 of file class.ilObjSurveyAccess.php.

424 {
425 global $DIC;
426
427 $ilAccess = $DIC->access();
428
429 $t_arr = explode("_", $a_target);
430
431 if ($t_arr[0] != "svy" || ((int) $t_arr[1]) <= 0) {
432 return false;
433 }
434
435 // 360° external raters
436 if ($_GET["accesscode"]) {
437 if (ilObjSurvey::validateExternalRaterCode($t_arr[1], $_GET["accesscode"])) {
438 return true;
439 }
440 }
441
442 if ($ilAccess->checkAccess("visible", "", $t_arr[1]) ||
443 $ilAccess->checkAccess("read", "", $t_arr[1])) {
444 return true;
445 }
446 return false;
447 }
$_GET["client_id"]
static validateExternalRaterCode($a_ref_id, $a_code)

References $_GET, $DIC, and ilObjSurvey\validateExternalRaterCode().

+ Here is the call graph for this function:

◆ _getCommands()

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

162 {
163 $commands = array(
164 array("permission" => "read", "cmd" => "infoScreen", "lang_var" => "svy_run", "default" => true),
165 array("permission" => "write", "cmd" => "questionsrepo", "lang_var" => "edit_questions"),
166 array("permission" => "write", "cmd" => "properties", "lang_var" => "settings"),
167 array("permission" => "read", "cmd" => "evaluation", "lang_var" => "svy_results")
168 );
169
170 return $commands;
171 }

Referenced by ilObjSurveyListGUI\init().

+ Here is the caller graph for this function:

◆ _hasEvaluationAccess()

static ilObjSurveyAccess::_hasEvaluationAccess (   $a_obj_id,
  $user_id 
)
static

Definition at line 255 of file class.ilObjSurveyAccess.php.

256 {
257 $evaluation_access = ilObjSurveyAccess::_lookupEvaluationAccess($a_obj_id);
258 switch ($evaluation_access) {
259 case 0:
260 // no evaluation access
261 return false;
262 break;
263 case 1:
264 // evaluation access for all registered users
265 if (($user_id > 0) && ($user_id != ANONYMOUS_USER_ID)) {
266 return true;
267 } else {
268 return false;
269 }
270 break;
271 case 2:
272 $svy_mode = self::_lookupMode($a_obj_id);
273 switch ($svy_mode) {
275 $svy = new ilObjSurvey($a_obj_id, false);
276 $svy->read();
277 switch ($svy->get360Results()) {
279 return false;
280
282 return $svy->isAppraiseeClosed($user_id);
283
285 return $svy->isAppraisee($user_id);
286 }
287 break;
288
290 $svy = new ilObjSurvey($a_obj_id, false);
291 $svy->read();
292 switch ($svy->getSelfEvaluationResults()) {
294 return false;
295 default:
296 return true;
297 }
298 break;
299
300 default:
301 // evaluation access for participants
302 // check if the user with the given id is a survey participant
303
304 // show the evaluation button for anonymized surveys for all users
305 // access is only granted with the survey access code
306 if (ilObjSurveyAccess::_lookupAnonymize($a_obj_id) == 1) {
307 return true;
308 }
309
310 global $DIC;
311
312 $ilDB = $DIC->database();
313 $result = $ilDB->queryF(
314 "SELECT survey_id FROM svy_svy WHERE obj_fi = %s",
315 array('integer'),
316 array($a_obj_id)
317 );
318 if ($result->numRows() == 1) {
319 $row = $ilDB->fetchAssoc($result);
320
321 if (ilObjSurveyAccess::_isSurveyParticipant($user_id, $row["survey_id"])) {
322 return true;
323 }
324 }
325 return false;
326 break;
327 }
328 break;
329 }
330 }
$result
static _isSurveyParticipant($user_id, $survey_id)
static _lookupEvaluationAccess($a_obj_id)
get evaluation access
static _lookupMode($a_obj_id)
Get survey mode.
static _lookupAnonymize($a_obj_id)
Class ilObjSurvey.
const RESULTS_SELF_EVAL_NONE
const ANONYMOUS_USER_ID
Definition: constants.php:25
global $ilDB

References $DIC, $ilDB, $result, _isSurveyParticipant(), _lookupAnonymize(), _lookupEvaluationAccess(), _lookupMode(), ANONYMOUS_USER_ID, ilObjSurvey\MODE_360, ilObjSurvey\MODE_SELF_EVAL, ilObjSurvey\RESULTS_360_ALL, ilObjSurvey\RESULTS_360_NONE, ilObjSurvey\RESULTS_360_OWN, and ilObjSurvey\RESULTS_SELF_EVAL_NONE.

Referenced by _checkAccess(), ilSurveyEvaluationGUI\checkAnonymizedEvaluationAccess(), ilObjSurveyGUI\executeCommand(), ilObjSurveyGUI\getTabs(), ilObjSurveyGUI\infoScreen(), and ilSurveyExecutionGUI\runShowFinishedPage().

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

◆ _isSurveyParticipant()

static ilObjSurveyAccess::_isSurveyParticipant (   $user_id,
  $survey_id 
)
static

Definition at line 222 of file class.ilObjSurveyAccess.php.

223 {
224 global $DIC;
225
226 $ilDB = $DIC->database();
227
228 $result = $ilDB->queryF(
229 "SELECT finished_id FROM svy_finished WHERE user_fi = %s AND survey_fi = %s",
230 array('integer','integer'),
231 array($user_id, $survey_id)
232 );
233 return ($result->numRows() == 1) ? true : false;
234 }
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.

References $DIC, $ilDB, $result, and true.

Referenced by _hasEvaluationAccess(), and ilLPStatusSurveyFinished\determineStatus().

+ Here is the caller graph for this function:

◆ _lookup360Mode()

static ilObjSurveyAccess::_lookup360Mode (   $a_obj_id)
static

Definition at line 405 of file class.ilObjSurveyAccess.php.

406 {
407 global $DIC;
408
409 $ilDB = $DIC->database();
410
411 $result = $ilDB->queryF(
412 "SELECT mode FROM svy_svy" .
413 " WHERE obj_fi = %s AND mode = %s",
414 array('integer','integer'),
415 array($a_obj_id, ilObjSurvey::MODE_360)
416 );
417 return (bool) $ilDB->numRows($result);
418 }

References $DIC, $ilDB, $result, and ilObjSurvey\MODE_360.

◆ _lookupAnonymize()

static ilObjSurveyAccess::_lookupAnonymize (   $a_obj_id)
static

Definition at line 236 of file class.ilObjSurveyAccess.php.

237 {
238 global $DIC;
239
240 $ilDB = $DIC->database();
241
242 $result = $ilDB->queryF(
243 "SELECT anonymize FROM svy_svy WHERE obj_fi = %s",
244 array('integer'),
245 array($a_obj_id)
246 );
247 if ($result->numRows() == 1) {
248 $row = $ilDB->fetchAssoc($result);
249 return $row["anonymize"];
250 } else {
251 return 0;
252 }
253 }

References $DIC, $ilDB, and $result.

Referenced by _hasEvaluationAccess(), and ilSurveyLP\isAnonymized().

+ Here is the caller graph for this function:

◆ _lookupCreationComplete()

static ilObjSurveyAccess::_lookupCreationComplete (   $a_obj_id)
static

checks wether all necessary parts of the survey are given

Definition at line 180 of file class.ilObjSurveyAccess.php.

181 {
182 global $DIC;
183
184 $ilDB = $DIC->database();
185
186 $result = $ilDB->queryF(
187 "SELECT * FROM svy_svy WHERE obj_fi=%s",
188 array('integer'),
189 array($a_obj_id)
190 );
191
192 if ($result->numRows() == 1) {
193 $row = $ilDB->fetchAssoc($result);
194 }
195 if (!$row["complete"]) {
196 return false;
197 }
198 return true;
199 }

References $DIC, $ilDB, and $result.

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

+ Here is the caller graph for this function:

◆ _lookupEvaluationAccess()

static ilObjSurveyAccess::_lookupEvaluationAccess (   $a_obj_id)
static

get evaluation access

Definition at line 204 of file class.ilObjSurveyAccess.php.

205 {
206 global $DIC;
207
208 $ilDB = $DIC->database();
209
210 $result = $ilDB->queryF(
211 "SELECT * FROM svy_svy WHERE obj_fi=%s",
212 array('integer'),
213 array($a_obj_id)
214 );
215 if ($result->numRows() == 1) {
216 $row = $ilDB->fetchAssoc($result);
217 }
218
219 return $row["evaluation_access"];
220 }

References $DIC, $ilDB, and $result.

Referenced by _hasEvaluationAccess().

+ Here is the caller graph for this function:

◆ _lookupFinished()

static ilObjSurveyAccess::_lookupFinished (   $a_obj_id,
  $a_user_id = "" 
)
static

get finished status

Parameters
int$a_obj_idsurvey id

Definition at line 338 of file class.ilObjSurveyAccess.php.

339 {
340 global $DIC;
341
342 $ilDB = $DIC->database();
343 $ilUser = $DIC->user();
344
345 $finished = "";
346 if (!strlen($a_user_id)) {
347 $a_user_id = $ilUser->getId();
348 }
349
350 $result = $ilDB->queryF(
351 "SELECT * FROM svy_svy WHERE obj_fi = %s",
352 array('integer'),
353 array($a_obj_id)
354 );
355 if ($result->numRows() == 1) {
356 $row = $ilDB->fetchObject($result);
357 if ($row->anonymize == 1) {
358 $result = $ilDB->queryF(
359 "SELECT * FROM svy_finished, svy_anonymous WHERE svy_finished.survey_fi = %s " .
360 "AND svy_finished.survey_fi = svy_anonymous.survey_fi AND svy_anonymous.user_key = %s " .
361 "AND svy_anonymous.survey_key = svy_finished.anonymous_id",
362 array('integer','text'),
363 array($row->survey_id, md5($a_user_id))
364 );
365 } else {
366 $result = $ilDB->queryF(
367 "SELECT * FROM svy_finished WHERE survey_fi = %s AND user_fi = %s",
368 array('integer','integer'),
369 array($row->survey_id, $a_user_id)
370 );
371 }
372 if ($result->numRows() == 1) {
373 $foundrow = $ilDB->fetchAssoc($result);
374 $finished = (int) $foundrow["state"];
375 }
376 }
377
378 return $finished;
379 }

References $DIC, $ilDB, $ilUser, and $result.

Referenced by checkCondition(), ilLPStatusSurveyFinished\determineStatus(), ilObjSurveyListGUI\getProperties(), ilContainerStartObjects\isFullfilled(), and ilCourseStart\isFullfilled().

+ Here is the caller graph for this function:

◆ _lookupMode()

static ilObjSurveyAccess::_lookupMode (   $a_obj_id)
static

Get survey mode.

Parameters
$a_obj_id
Returns
int

Definition at line 386 of file class.ilObjSurveyAccess.php.

387 {
388 global $DIC;
389 $ilDB = $DIC->database();
390
391 $result = $ilDB->queryF(
392 "SELECT mode FROM svy_svy" .
393 " WHERE obj_fi = %s",
394 array('integer'),
395 array($a_obj_id)
396 );
397
398 if ($result->numRows() == 1) {
399 $row = $ilDB->fetchAssoc($result);
400 }
401
402 return $row["mode"];
403 }

References $DIC, $ilDB, and $result.

Referenced by _hasEvaluationAccess(), and ilObjSurveyListGUI\getProperties().

+ Here is the caller graph for this function:

◆ checkCondition()

static ilObjSurveyAccess::checkCondition (   $a_svy_id,
  $a_operator,
  $a_value,
  $a_usr_id 
)
static

check condition

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

Implements ilConditionHandling.

Definition at line 67 of file class.ilObjSurveyAccess.php.

68 {
69 switch ($a_operator) {
71 if (ilObjSurveyAccess::_lookupFinished($a_svy_id, $a_usr_id)) {
72 return true;
73 } else {
74 return false;
75 }
76 break;
77
78 default:
79 return true;
80 }
81 return true;
82 }
static _lookupFinished($a_obj_id, $a_user_id="")
get finished status

References _lookupFinished(), and ilConditionHandler\OPERATOR_FINISHED.

+ Here is the call graph for this function:

◆ getConditionOperators()

static ilObjSurveyAccess::getConditionOperators ( )
static

Get possible conditions operators.

Implements ilConditionHandling.

Definition at line 51 of file class.ilObjSurveyAccess.php.

52 {
53 return array(
55 );
56 }

References ilConditionHandler\OPERATOR_FINISHED.

Field Documentation

◆ $access

ilObjSurveyAccess::$access
protected

Definition at line 31 of file class.ilObjSurveyAccess.php.

Referenced by _checkAccess().

◆ $lng

ilObjSurveyAccess::$lng
protected

Definition at line 21 of file class.ilObjSurveyAccess.php.

Referenced by _checkAccess().

◆ $rbacsystem

ilObjSurveyAccess::$rbacsystem
protected

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

Referenced by _checkAccess().

◆ $user

ilObjSurveyAccess::$user
protected

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

Referenced by _checkAccess().


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