36 $this->
user = $DIC->user();
37 $this->
lng = $DIC->language();
38 $this->rbacsystem = $DIC->rbac()->system();
39 $this->
access = $DIC->access();
50 public static function checkCondition(
int $a_trigger_obj_id,
string $a_operator,
string $a_value,
int $a_usr_id): bool
52 switch ($a_operator) {
54 if (self::_lookupFinished($a_trigger_obj_id, $a_usr_id)) {
79 switch ($permission) {
82 if (!self::_lookupCreationComplete($obj_id) &&
92 if (!self::_lookupCreationComplete($obj_id) &&
100 if (!self::_lookupCreationComplete($obj_id)) {
104 if ($rbacsystem->
checkAccess(
"write", $ref_id) || self::_hasEvaluationAccess($obj_id,
$user_id)) {
119 array(
"permission" =>
"read",
"cmd" =>
"run",
"lang_var" =>
"svy_run",
"default" =>
true),
120 array(
"permission" =>
"write",
"cmd" =>
"questions",
"lang_var" =>
"edit_questions"),
121 array(
"permission" =>
"write",
"cmd" =>
"properties",
"lang_var" =>
"settings"),
122 array(
"permission" =>
"read",
"cmd" =>
"evaluation",
"lang_var" =>
"svy_results")
139 $ilDB = $DIC->database();
141 $result =
$ilDB->queryF(
142 "SELECT * FROM svy_svy WHERE obj_fi=%s",
148 if ($result->numRows() === 1) {
149 $row =
$ilDB->fetchAssoc($result);
151 if (is_null($row) || !$row[
"complete"]) {
164 $ilDB = $DIC->database();
166 $result =
$ilDB->queryF(
167 "SELECT * FROM svy_svy WHERE obj_fi=%s",
171 if ($result->numRows() === 1) {
172 $row =
$ilDB->fetchAssoc($result);
173 return (
int) $row[
"evaluation_access"];
184 $ilDB = $DIC->database();
186 $result =
$ilDB->queryF(
187 "SELECT finished_id FROM svy_finished WHERE user_fi = %s AND survey_fi = %s",
188 array(
'integer',
'integer'),
189 array($user_id, $survey_id)
191 return $result->numRows() === 1;
199 $ilDB = $DIC->database();
201 $result =
$ilDB->queryF(
202 "SELECT anonymize FROM svy_svy WHERE obj_fi = %s",
206 if ($result->numRows() === 1) {
207 $row =
$ilDB->fetchAssoc($result);
208 return (
bool) $row[
"anonymize"];
218 $evaluation_access = self::_lookupEvaluationAccess($a_obj_id);
219 $svy_mode = self::_lookupMode($a_obj_id);
224 switch ($svy->get360Results()) {
236 switch ($evaluation_access) {
248 switch ($svy->get360Results()) {
253 return $svy->isAppraiseeClosed($user_id);
256 return $svy->isAppraisee($user_id);
263 switch ($svy->get360Results()) {
271 return $svy->isAppraisee($user_id);
278 switch ($svy->getSelfEvaluationResults()) {
292 if (self::_lookupAnonymize($a_obj_id)) {
298 $ilDB = $DIC->database();
299 $result =
$ilDB->queryF(
300 "SELECT survey_id FROM svy_svy WHERE obj_fi = %s",
304 if ($result->numRows() === 1) {
305 $row =
$ilDB->fetchAssoc($result);
307 if (self::_isSurveyParticipant($user_id, $row[
"survey_id"])) {
309 $run_manager = $DIC->survey()->internal()->domain()
310 ->execution()->run($survey, $user_id);
311 return $run_manager->hasFinished();
332 $ilDB = $DIC->database();
333 $ilUser = $DIC->user();
336 if ($a_user_id === 0) {
337 $a_user_id = $ilUser->getId();
340 $result =
$ilDB->queryF(
341 "SELECT * FROM svy_svy WHERE obj_fi = %s",
345 if ($result->numRows() === 1) {
346 $row =
$ilDB->fetchObject($result);
347 if ((
int) $row->anonymize === 1) {
348 $result =
$ilDB->queryF(
349 "SELECT * FROM svy_finished, svy_anonymous WHERE svy_finished.survey_fi = %s " .
350 "AND svy_finished.survey_fi = svy_anonymous.survey_fi AND svy_anonymous.user_key = %s " .
351 "AND svy_anonymous.survey_key = svy_finished.anonymous_id",
352 array(
'integer',
'text'),
353 array($row->survey_id, md5($a_user_id))
356 $result =
$ilDB->queryF(
357 "SELECT * FROM svy_finished WHERE survey_fi = %s AND user_fi = %s",
358 array(
'integer',
'integer'),
359 array($row->survey_id, $a_user_id)
362 if ($result->numRows() === 1) {
363 $foundrow =
$ilDB->fetchAssoc($result);
364 $finished = (
int) $foundrow[
"state"];
378 $ilDB = $DIC->database();
380 $result =
$ilDB->queryF(
381 "SELECT mode FROM svy_svy" .
382 " WHERE obj_fi = %s",
387 if ($result->numRows() === 1) {
388 $row =
$ilDB->fetchAssoc($result);
389 return (
int) $row[
"mode"];
400 $ilDB = $DIC->database();
402 $result =
$ilDB->queryF(
403 "SELECT mode FROM svy_svy" .
404 " WHERE obj_fi = %s AND mode = %s",
405 array(
'integer',
'integer'),
408 return (
bool)
$ilDB->numRows($result);
418 $request = $DIC->survey()
424 $ilAccess = $DIC->access();
426 $t_arr = explode(
"_", $target);
427 if ($t_arr[0] !==
"svy" || ((
int) $t_arr[1]) <= 0) {
432 $access_code = ($request->getAccessCode() !==
"")
433 ? $request->getAccessCode()
435 if ($access_code !==
"") {
437 $run_manager = $DIC->survey()->internal()->domain()->execution()->run($survey, $DIC->user()->getId());
439 $run_manager->initSession($access_code);
443 if (ilObjSurvey::validateExternalRaterCode((
int) $t_arr[1], $access_code)) {
448 if ($ilAccess->checkAccess(
"visible",
"", $t_arr[1]) ||
449 $ilAccess->checkAccess(
"read",
"", $t_arr[1])) {
static _lookupEvaluationAccess(int $a_obj_id)
get evaluation access
const IL_NO_OBJECT_ACCESS
static _isSurveyParticipant(int $user_id, int $survey_id)
static checkCondition(int $a_trigger_obj_id, string $a_operator, string $a_value, int $a_usr_id)
check condition for a specific user and object
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _checkGoto(string $target)
check whether goto script will succeed
static _lookupAnonymize(int $a_obj_id)
static _lookupFinished(int $a_obj_id, int $a_user_id=0)
get finished status
Interface for condition handling.
static getConditionOperators()
Returns an array with valid operators for the specific object type.
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
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
static _lookupMode(int $a_obj_id)
Get survey mode (see ilObjSurvey::MODE_...
_checkAccess(string $cmd, string $permission, int $ref_id, int $obj_id, ?int $user_id=null)
static _hasEvaluationAccess(int $a_obj_id, int $user_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const RESULTS_SELF_EVAL_NONE
static _lookupCreationComplete(int $a_obj_id)
checks whether all necessary parts of the survey are given
static _lookup360Mode(int $a_obj_id)