24 include_once
"./Services/Object/classes/class.ilObjectAccess.php";
25 include_once
"./Modules/Survey/classes/inc.SurveyConstants.php";
54 function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id =
"")
60 $a_user_id = $ilUser->getId();
63 $is_admin = $rbacsystem->checkAccessOfUser($a_user_id,
'write',$a_ref_id);
66 if(!self::_lookupOnline($a_obj_id) && !$is_admin)
72 switch ($a_permission)
134 array(
"permission" =>
"read",
"cmd" =>
"infoScreen",
"lang_var" =>
"svy_run",
"default" =>
true),
135 array(
"permission" =>
"write",
"cmd" =>
"questionsrepo",
"lang_var" =>
"edit_questions"),
136 array(
"permission" =>
"write",
"cmd" =>
"properties",
"lang_var" =>
"settings"),
137 array(
"permission" =>
"read",
"cmd" =>
"evaluation",
"lang_var" =>
"svy_evaluation")
154 $result = $ilDB->queryF(
"SELECT * FROM svy_svy WHERE obj_fi=%s",
163 if (!
$row[
"complete"])
177 $result = $ilDB->queryF(
"SELECT * FROM svy_svy WHERE obj_fi=%s",
186 return $row[
"evaluation_access"];
193 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished WHERE user_fi = %s AND survey_fi = %s",
194 array(
'integer',
'integer'),
195 array($user_id, $survey_id)
197 return (
$result->numRows() == 1) ?
true :
false;
204 $result = $ilDB->queryF(
"SELECT anonymize FROM svy_svy WHERE obj_fi = %s",
211 return $row[
"anonymize"];
222 switch ($evaluation_access)
230 if (($user_id > 0) && ($user_id != ANONYMOUS_USER_ID))
248 $result = $ilDB->queryF(
"SELECT survey_id FROM svy_svy WHERE obj_fi = %s",
272 $result = $ilDB->queryF(
"SELECT * FROM svy_svy WHERE obj_fi=%s",
280 return $row[
"status"];
293 if (!strlen($a_user_id)) $a_user_id = $ilUser->getId();
295 $result = $ilDB->queryF(
"SELECT * FROM svy_svy WHERE obj_fi = %s",
302 if (
$row->anonymize == 1)
304 $result = $ilDB->queryF(
"SELECT * FROM svy_finished, svy_anonymous WHERE svy_finished.survey_fi = %s ".
305 "AND svy_finished.survey_fi = svy_anonymous.survey_fi AND svy_anonymous.user_key = %s ".
306 "AND svy_anonymous.survey_key = svy_finished.anonymous_id",
307 array(
'integer',
'text'),
308 array(
$row->survey_id, md5($a_user_id))
313 $result = $ilDB->queryF(
"SELECT * FROM svy_finished WHERE survey_fi = %s AND user_fi = %s",
314 array(
'integer',
'integer'),
315 array(
$row->survey_id, $a_user_id)
320 $foundrow = $ilDB->fetchAssoc(
$result);
321 $finished = (int)$foundrow[
"state"];
335 $t_arr = explode(
"_", $a_target);
337 if ($t_arr[0] !=
"svy" || ((
int) $t_arr[1]) <= 0)
342 if ($ilAccess->checkAccess(
"read",
"", $t_arr[1]))