[svn r17756] logic changes-allows anonymous survey -(see FS#3470)

skala
Isaac Flores 16 years ago
parent 85704a56c9
commit f03aa061e7
  1. 9
      main/survey/fillsurvey.php
  2. 9
      main/survey/survey.lib.php

@ -627,11 +627,8 @@ if (isset ($_GET['show']) || isset ($_POST['personality']))
if (isset($_GET['user_id'])) {
// get the user into survey answer table (user or anonymus)
$sql = "SELECT user FROM $table_survey_answer
WHERE survey_id = (SELECT survey_id from $table_survey WHERE code ='".$survey_invitation['survey_code']."')";
$result_answer = api_sql_query($sql, __FILE__, __LINE__);
$row_answer = Database::fetch_array($result_answer,'ASSOC');
$my_user_id=($survey_data['anonymous']==1) ? $_SESSION['surveyuser'] :api_get_user_id();
$sql = "SELECT survey_question.survey_group_sec1, survey_question.survey_group_sec2, survey_question.survey_group_pri,
survey_question.question_id, survey_question.survey_id, survey_question.survey_question, survey_question.display, survey_question.sort, survey_question.type, survey_question.max_value,
survey_question_option.question_option_id, survey_question_option.option_text, survey_question_option.sort as option_sort
@ -639,7 +636,7 @@ if (isset ($_GET['show']) || isset ($_POST['personality']))
LEFT JOIN $table_survey_question_option survey_question_option
ON survey_question.question_id = survey_question_option.question_id
WHERE survey_question.survey_id = '" . Database :: escape_string($survey_invitation['survey_id']) . "'
AND survey_question.question_id NOT IN (SELECT sa.question_id FROM ".$table_survey_answer." sa WHERE sa.user='".$row_answer['user']."')
AND survey_question.question_id NOT IN (SELECT sa.question_id FROM ".$table_survey_answer." sa WHERE sa.user='".$my_user_id."')
ORDER BY survey_question.sort, survey_question_option.sort ASC";
} else {

@ -24,7 +24,7 @@
* @package dokeos.survey
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts (if not all) of the code
@author Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modification and rewriting large parts of the code
* @version $Id: survey.lib.php 17721 2009-01-14 17:31:23Z iflorespaz $
* @version $Id: survey.lib.php 17756 2009-01-15 23:28:02Z iflorespaz $
*
* @todo move this file to inc/lib
* @todo use consistent naming for the functions (save vs store for instance)
@ -4651,7 +4651,12 @@ class SurveyUtil {
echo ($row['anonymous'] == 1)?get_lang('Yes'):get_lang('No');
echo '</td>';
echo '</tr>';
$link_available=self::show_link_available(api_get_user_id(),$row['code'],$row_answer['user']);
if ($row['anonymous'] == 1) {
$current_user_id=$_SESSION['surveyuser'];
} else {
$current_user_id=api_get_user_id();
}
$link_available=self::show_link_available(api_get_user_id(),$row['code'],$current_user_id);
if ($link_add===true && $link_available===true) {
echo '<tr><td><a href="fillsurvey.php?user_id='.api_get_user_id().'&amp;course='.$_course['sysCode'].'&amp;invitationcode='.$row['invitation_code'].'&amp;cidReq='.$_course['sysCode'].'">'.get_lang('CompleteTheSurveysQuestions').'</a></td><td></td></tr>';
}

Loading…
Cancel
Save