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 $result = $ilDB->queryF(
"SELECT * FROM svy_svy WHERE obj_fi=%s",
152 if (!
$row[
"complete"])
166 $result = $ilDB->queryF(
"SELECT * FROM svy_svy WHERE obj_fi=%s",
175 return $row[
"evaluation_access"];
182 $result = $ilDB->queryF(
"SELECT finished_id FROM svy_finished WHERE user_fi = %s AND survey_fi = %s",
183 array(
'integer',
'integer'),
184 array($user_id, $survey_id)
186 return (
$result->numRows() == 1) ?
true :
false;
193 $result = $ilDB->queryF(
"SELECT anonymize FROM svy_svy WHERE obj_fi = %s",
200 return $row[
"anonymize"];
211 switch ($evaluation_access)
219 if (($user_id > 0) && ($user_id != ANONYMOUS_USER_ID))
237 $result = $ilDB->queryF(
"SELECT survey_id FROM svy_svy WHERE obj_fi = %s",
261 $result = $ilDB->queryF(
"SELECT * FROM svy_svy WHERE obj_fi=%s",
269 return $row[
"status"];
279 global
$ilDB, $ilUser;
282 if (!strlen($a_user_id)) $a_user_id = $ilUser->getId();
284 $result = $ilDB->queryF(
"SELECT * FROM svy_svy WHERE obj_fi = %s",
291 if (
$row->anonymize == 1)
293 $result = $ilDB->queryF(
"SELECT * FROM svy_finished, svy_anonymous WHERE svy_finished.survey_fi = %s ".
294 "AND svy_finished.survey_fi = svy_anonymous.survey_fi AND svy_anonymous.user_key = %s ".
295 "AND svy_anonymous.survey_key = svy_finished.anonymous_id",
296 array(
'integer',
'text'),
297 array(
$row->survey_id, md5($a_user_id))
302 $result = $ilDB->queryF(
"SELECT * FROM svy_finished WHERE survey_fi = %s AND user_fi = %s",
303 array(
'integer',
'integer'),
304 array(
$row->survey_id, $a_user_id)
309 $foundrow = $ilDB->fetchAssoc(
$result);
310 $finished = (int)$foundrow[
"state"];
324 $t_arr = explode(
"_", $a_target);
326 if ($t_arr[0] !=
"svy" || ((
int) $t_arr[1]) <= 0)
331 if ($ilAccess->checkAccess(
"read",
"", $t_arr[1]))