24 include_once
"./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 =
"")
56 global $ilUser,
$lng, $rbacsystem, $ilAccess;
60 $a_user_id = $ilUser->getId();
63 switch ($a_permission)
67 $admin = $rbacsystem->checkAccessOfUser($a_user_id,
"write",$a_ref_id);
80 if (!$active && !$admin)
87 if($rbacsystem->checkAccessOfUser($a_user_id,
"write",$a_ref_id))
147 array(
"permission" =>
"read",
"cmd" =>
"infoScreen",
"lang_var" =>
"svy_run",
"default" =>
true),
148 array(
"permission" =>
"write",
"cmd" =>
"questionsrepo",
"lang_var" =>
"edit_questions"),
149 array(
"permission" =>
"write",
"cmd" =>
"properties",
"lang_var" =>
"settings"),
150 array(
"permission" =>
"read",
"cmd" =>
"evaluation",
"lang_var" =>
"svy_evaluation")
167 $result = $ilDB->queryF(
"SELECT * FROM svy_svy WHERE obj_fi=%s",
176 if (!
$row[
"complete"])
190 $result = $ilDB->queryF(
"SELECT * FROM svy_svy WHERE obj_fi=%s",
199 return $row[
"evaluation_access"];
206 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished WHERE user_fi = %s AND survey_fi = %s",
207 array(
'integer',
'integer'),
208 array($user_id, $survey_id)
210 return (
$result->numRows() == 1) ?
true :
false;
217 $result = $ilDB->queryF(
"SELECT anonymize FROM svy_svy WHERE obj_fi = %s",
224 return $row[
"anonymize"];
235 switch ($evaluation_access)
243 if (($user_id > 0) && ($user_id != ANONYMOUS_USER_ID))
261 $result = $ilDB->queryF(
"SELECT survey_id FROM svy_svy WHERE obj_fi = %s",
285 $result = $ilDB->queryF(
"SELECT * FROM svy_svy WHERE obj_fi=%s",
293 return $row[
"status"];
303 global
$ilDB, $ilUser;
306 if (!strlen($a_user_id)) $a_user_id = $ilUser->getId();
308 $result = $ilDB->queryF(
"SELECT * FROM svy_svy WHERE obj_fi = %s",
315 if (
$row->anonymize == 1)
317 $result = $ilDB->queryF(
"SELECT * FROM svy_finished, svy_anonymous WHERE svy_finished.survey_fi = %s ".
318 "AND svy_finished.survey_fi = svy_anonymous.survey_fi AND svy_anonymous.user_key = %s ".
319 "AND svy_anonymous.survey_key = svy_finished.anonymous_id",
320 array(
'integer',
'text'),
321 array(
$row->survey_id, md5($a_user_id))
326 $result = $ilDB->queryF(
"SELECT * FROM svy_finished WHERE survey_fi = %s AND user_fi = %s",
327 array(
'integer',
'integer'),
328 array(
$row->survey_id, $a_user_id)
333 $foundrow = $ilDB->fetchAssoc(
$result);
334 $finished = (int)$foundrow[
"state"];
348 $t_arr = explode(
"_", $a_target);
350 if ($t_arr[0] !=
"svy" || ((
int) $t_arr[1]) <= 0)
355 if ($ilAccess->checkAccess(
"read",
"", $t_arr[1]))