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 (!$rbacsystem->checkAccess(
'write', $a_ref_id)))
124 array(
"permission" =>
"read",
"cmd" =>
"infoScreen",
"lang_var" =>
"svy_run",
"default" =>
true),
125 array(
"permission" =>
"write",
"cmd" =>
"properties",
"lang_var" =>
"edit"),
126 array(
"permission" =>
"read",
"cmd" =>
"evaluation",
"lang_var" =>
"svy_evaluation")
143 $q = sprintf(
"SELECT * FROM survey_survey WHERE obj_fi=%s",
144 $ilDB->quote($a_obj_id)
148 if ($result->numRows() == 1)
150 $row = $result->fetchRow(MDB2_FETCHMODE_OBJECT);
167 $q = sprintf(
"SELECT * FROM survey_survey WHERE obj_fi=%s",
168 $ilDB->quote($a_obj_id)
171 if ($result->numRows() == 1)
173 $row = $result->fetchRow(MDB2_FETCHMODE_OBJECT);
176 return $row->evaluation_access;
183 $q = sprintf(
"SELECT finished_id FROM survey_finished WHERE user_fi = %s AND survey_fi = %s",
184 $ilDB->quote($user_id .
""),
185 $ilDB->quote($survey_id .
"")
188 if ($result->numRows() == 1)
202 $q = sprintf(
"SELECT anonymize FROM survey_survey WHERE obj_fi = %s",
203 $ilDB->quote($a_obj_id .
"")
206 if ($result->numRows() == 1)
208 $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
209 return $row[
"anonymize"];
220 switch ($evaluation_access)
228 if (($user_id > 0) && ($user_id != ANONYMOUS_USER_ID))
246 $q = sprintf(
"SELECT survey_id FROM survey_survey WHERE obj_fi = %s",
247 $ilDB->quote($a_obj_id .
"")
250 if ($result->numRows() == 1)
252 $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
270 $q = sprintf(
"SELECT * FROM survey_survey WHERE obj_fi=%s",
271 $ilDB->quote($a_obj_id)
274 if ($result->numRows() == 1) {
275 $row = $result->fetchRow(MDB2_FETCHMODE_OBJECT);
288 global $ilDB, $ilUser;
291 if (!strlen($a_user_id)) $a_user_id = $ilUser->getId();
293 $q = sprintf(
"SELECT * FROM survey_survey WHERE obj_fi = %s",
294 $ilDB->quote($a_obj_id)
297 if ($result->numRows() == 1)
299 $row = $result->fetchRow(MDB2_FETCHMODE_OBJECT);
300 if ($row->anonymize == 1)
302 $q = sprintf(
"SELECT * FROM survey_finished, survey_anonymous WHERE survey_finished.survey_fi = %s AND survey_finished.survey_fi = survey_anonymous.survey_fi AND survey_anonymous.user_key = %s AND survey_anonymous.survey_key = survey_finished.anonymous_id",
303 $ilDB->quote($row->survey_id),
304 $ilDB->quote(md5($a_user_id) .
"")
309 $q = sprintf(
"SELECT * FROM survey_finished WHERE survey_fi = %s AND user_fi = %s",
310 $ilDB->quote($row->survey_id),
311 $ilDB->quote($a_user_id)
314 $result = $ilDB->query($q);
315 if ($result->numRows() == 1)
317 $row = $result->fetchRow(MDB2_FETCHMODE_OBJECT);
318 $finished = (int)$row->state;
332 $t_arr = explode(
"_", $a_target);
334 if ($t_arr[0] !=
"svy" || ((
int) $t_arr[1]) <= 0)
339 if ($ilAccess->checkAccess(
"read",
"", $t_arr[1]))