[svn r12912] bugfix: preview and fillsurvey now correctly works with multi-page surveys

bugfix: the answers on open answers are now displayed correctly in the reports
improvement: the number of users invited and the number of users answered are now displayed on the invitation page.
bugfix: more than one simultaneous surveys are possible. Previously when answering one survey it was stored as you answered all.
bugfix: survey_invitation now correctly shows who has filled the survey and a link to the answers of this user
bugfix: survey_invitation.php cannot display who answered the survey if it is an anonymous survey.
skala
Patrick Cool 17 years ago
parent 4c9480f79c
commit 8be479d967
  1. 106
      main/survey/fillsurvey.php
  2. 112
      main/survey/preview.php
  3. 81
      main/survey/reporting.php
  4. 55
      main/survey/survey.lib.php
  5. 4
      main/survey/survey.php
  6. 7
      main/survey/survey_invitation.php
  7. 10
      main/survey/survey_invite.php
  8. 4
      main/survey/survey_list.php

@ -186,8 +186,7 @@ if ($_POST)
if($types[$survey_question_id] == 'open')
{
$option_value = $value;
$value = 0;
//$value = 0;
}
}
@ -216,57 +215,90 @@ if (!isset($_GET['show']))
if ($_POST['finish_survey'])
{
echo '<div id="survey_content" class="survey_content"><strong>'.get_lang('SurveyFinished').'</strong> <br />'.$survey_data['survey_thanks'].'</div>';
survey_manager::update_survey_answered($survey_data['survey_id'], $survey_invitation['user']);
survey_manager::update_survey_answered($survey_data['survey_id'], $survey_invitation['user'], $survey_invitation['survey_code']);
Display :: display_footer();
exit;
}
if (isset($_GET['show']))
{
// Getting all the questions for this page
$sql = "SELECT survey_question.question_id, survey_question.survey_id, survey_question.survey_question, survey_question.display, survey_question.sort, survey_question.type, max_value,
survey_question_option.question_option_id, survey_question_option.option_text, survey_question_option.sort as option_sort
FROM $table_survey_question survey_question
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'])."'
ORDER BY survey_question.sort ASC";
if ($_GET['show'])
{
$sql .= ' LIMIT '.($_GET['show']+1).',1000';
}
$result = api_sql_query($sql, __FILE__, __LINE__);
$question_counter_max = mysql_num_rows($result);
// Getting all the questions for this page and add them to a multidimensional array where the first index is the page.
// as long as there is no pagebreak fount we keep adding questions to the page
$questions_displayed = array();
$counter = 0;
$sql = "SELECT * FROM $table_survey_question
WHERE survey_id = '".Database::escape_string($survey_invitation['survey_id'])."'
ORDER BY sort ASC";
$result = api_sql_query($sql, __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result))
{
// if the type is not a pagebreak we store it in the $questions array
// which is used for displaying the page
if($row['type'] <> 'pagebreak')
if($row['type'] == 'pagebreak')
{
$questions[$row['sort']]['question_id'] = $row['question_id'];
$questions[$row['sort']]['survey_id'] = $row['survey_id'];
$questions[$row['sort']]['survey_question'] = $row['survey_question'];
$questions[$row['sort']]['display'] = $row['display'];
$questions[$row['sort']]['type'] = $row['type'];
$questions[$row['sort']]['options'][$row['question_option_id']] = $row['option_text'];
$questions[$row['sort']]['maximum_score'] = $row['max_value'];
// we also store the type of the questions in an array
$types[$row['question_id']] = $row['type'];
$counter++;
}
// if the type is a pagebreak we are finished loading the questions for this page
else
{
$limit = $counter;
break;
$paged_questions[$counter][] = $row['question_id'];
}
$counter++;
}
if (key_exists($_GET['show'],$paged_questions))
{
$sql = "SELECT 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
FROM $table_survey_question survey_question
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 IN (".implode(',',$paged_questions[$_GET['show']]).")
ORDER BY survey_question.sort ASC";
$result = api_sql_query($sql, __FILE__, __LINE__);
$question_counter_max = mysql_num_rows($result);
$counter = 0;
$limit=0;
$questions = array();
while ($row = mysql_fetch_assoc($result))
{
// if the type is not a pagebreak we store it in the $questions array
if($row['type'] <> 'pagebreak')
{
$questions[$row['sort']]['question_id'] = $row['question_id'];
$questions[$row['sort']]['survey_id'] = $row['survey_id'];
$questions[$row['sort']]['survey_question'] = $row['survey_question'];
$questions[$row['sort']]['display'] = $row['display'];
$questions[$row['sort']]['type'] = $row['type'];
$questions[$row['sort']]['options'][$row['question_option_id']] = $row['option_text'];
$questions[$row['sort']]['maximum_score'] = $row['max_value'];
}
// if the type is a pagebreak we are finished loading the questions for this page
else
{
break;
}
$counter++;
}
}
}
// selecting the maximum number of pages
$sql = "SELECT * FROM $table_survey_question WHERE type='".Database::escape_string('pagebreak')."' AND survey_id='".Database::escape_string($survey_invitation['survey_id'])."'";
$result = api_sql_query($sql, __FILE__, __LINE__);
$numberofpages = mysql_num_rows($result) + 1;
// Displaying the form with the questions
if (isset($_GET['show']))
{
$show = (int)$_GET['show'] + 1;
}
else
{
$show = 0;
}
// Displaying the form with the questions
echo '<form id="question" name="question" method="post" action="'.api_get_self().'?course='.$_GET['course'].'&invitationcode='.$_GET['invitationcode'].'&show='.$limit.'">';
echo '<form id="question" name="question" method="post" action="'.api_get_self().'?course='.$_GET['course'].'&invitationcode='.$_GET['invitationcode'].'&show='.$show.'">';
echo '<input type="hidden" name="language" value="'.$_POST['language'].'" />';
foreach ($questions as $key=>$question)
{
@ -274,12 +306,12 @@ foreach ($questions as $key=>$question)
$display->render_question($question);
}
if (($limit AND $limit <> $question_counter_max) OR !isset($_GET['show']))
if (($show < $numberofpages) OR !$_GET['show'])
{
//echo '<a href="'.api_get_self().'?survey_id='.$survey_invitation['survey_id'].'&amp;show='.$limit.'">NEXT</a>';
echo '<input type="submit" name="next_survey_page" value="'.get_lang('Next').' >> " />';
}
if (!$limit AND isset($_GET['show']))
if ($show >= $numberofpages AND $_GET['show'])
{
echo '<input type="submit" name="finish_survey" value="'.get_lang('FinishSurvey').' >> " />';
}

@ -43,6 +43,15 @@ $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUEST
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
// We exit here if ther is no valid $_GET parameter
if (!isset($_GET['survey_id']) OR !is_numeric($_GET['survey_id']))
{
Display :: display_header();
Display :: display_error_message(get_lang('InvallidSurvey'), false);
Display :: display_footer();
exit;
}
// getting the survey information
$survey_data = survey_manager::get_survey($_GET['survey_id']);
$urlname = substr(strip_tags($survey_data['title']), 0, 40);
@ -58,6 +67,9 @@ $interbreadcrumb[] = array ("url" => "survey.php?survey_id=".$_GET['survey_id'],
// Header
Display :: display_header(get_lang('SurveyPreview'));
// We exit here is the first or last question is a pagebreak (which causes errors)
check_first_last_question($_GET['survey_id'], false);
// only a course admin is allowed to preview a survey: you are NOT a course admin => error message
if (!api_is_allowed_to_edit())
{
@ -66,11 +78,6 @@ if (!api_is_allowed_to_edit())
// only a course admin is allowed to preview a survey: you are a course admin
else
{
if (!isset($_GET['survey_id']) OR !is_numeric($_GET['survey_id']))
{
Display :: display_error_message(get_lang('InvallidSurvey'), false);
}
// survey information
echo '<div id="survey_title">'.$survey_data['survey_title'].'</div>';
echo '<div id="survey_subtitle">'.$survey_data['survey_subtitle'].'</div>';
@ -92,58 +99,91 @@ else
if (isset($_GET['show']))
{
// Getting all the questions for this page
$sql = "SELECT 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
FROM $table_survey_question survey_question
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($_GET['survey_id'])."'
ORDER BY survey_question.sort ASC";
if ($_GET['show'])
{
$sql .= ' LIMIT '.($_GET['show']+1).',1000';
}
$result = api_sql_query($sql, __FILE__, __LINE__);
$question_counter_max = mysql_num_rows($result);
// Getting all the questions for this page and add them to a multidimensional array where the first index is the page.
// as long as there is no pagebreak fount we keep adding questions to the page
$questions_displayed = array();
$counter = 0;
$limit=0;
$sql = "SELECT * FROM $table_survey_question
WHERE survey_id = '".Database::escape_string($_GET['survey_id'])."'
ORDER BY sort ASC";
$result = api_sql_query($sql, __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result))
{
// if the type is not a pagebreak we store it in the $questions array
if($row['type'] <> 'pagebreak')
if($row['type'] == 'pagebreak')
{
$questions[$row['sort']]['question_id'] = $row['question_id'];
$questions[$row['sort']]['survey_id'] = $row['survey_id'];
$questions[$row['sort']]['survey_question'] = $row['survey_question'];
$questions[$row['sort']]['display'] = $row['display'];
$questions[$row['sort']]['type'] = $row['type'];
$questions[$row['sort']]['options'][$row['option_sort']] = $row['option_text'];
$questions[$row['sort']]['maximum_score'] = $row['max_value'];
$counter++;
}
// if the type is a pagebreak we are finished loading the questions for this page
else
{
$limit = $counter;
break;
$paged_questions[$counter][] = $row['question_id'];
}
}
if (key_exists($_GET['show'],$paged_questions))
{
$sql = "SELECT 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
FROM $table_survey_question survey_question
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($_GET['survey_id'])."'
AND survey_question.question_id IN (".implode(',',$paged_questions[$_GET['show']]).")
ORDER BY survey_question.sort ASC";
$result = api_sql_query($sql, __FILE__, __LINE__);
$question_counter_max = mysql_num_rows($result);
$counter = 0;
$limit=0;
$questions = array();
while ($row = mysql_fetch_assoc($result))
{
// if the type is not a pagebreak we store it in the $questions array
if($row['type'] <> 'pagebreak')
{
$questions[$row['sort']]['question_id'] = $row['question_id'];
$questions[$row['sort']]['survey_id'] = $row['survey_id'];
$questions[$row['sort']]['survey_question'] = $row['survey_question'];
$questions[$row['sort']]['display'] = $row['display'];
$questions[$row['sort']]['type'] = $row['type'];
$questions[$row['sort']]['options'][$row['option_sort']] = $row['option_text'];
$questions[$row['sort']]['maximum_score'] = $row['max_value'];
}
// if the type is a pagebreak we are finished loading the questions for this page
else
{
break;
}
$counter++;
}
$counter++;
}
}
// selecting the maximum number of pages
$sql = "SELECT * FROM $table_survey_question WHERE type='".Database::escape_string('pagebreak')."' AND survey_id='".Database::escape_string($_GET[survey_id])."'";
$result = api_sql_query($sql, __FILE__, __LINE__);
$numberofpages = mysql_num_rows($result) + 1;
// Displaying the form with the questions
echo '<form id="question" name="question" method="post" action="'.api_get_self().'?survey_id='.$_GET['survey_id'].'&show='.$limit.'">';
if (isset($_GET['show']))
{
$show = (int)$_GET['show'] + 1;
}
else
{
$show = 0;
}
echo '<form id="question" name="question" method="post" action="'.api_get_self().'?survey_id='.$_GET['survey_id'].'&show='.$show.'">';
foreach ($questions as $key=>$question)
{
$display = new $question['type'];
$display->render_question($question);
}
if (($limit AND $limit <> $question_counter_max) OR !$_GET['show'])
if (($show < $numberofpages) OR !$_GET['show'])
{
//echo '<a href="'.api_get_self().'?survey_id='.$_GET['survey_id'].'&amp;show='.$limit.'">NEXT</a>';
echo '<br /><input type="submit" name="next_survey_page" value="'.get_lang('Next').' >> " />';
}
if ($limit==0 AND $_GET['show'])
if ($show >= $numberofpages AND $_GET['show'])
{
echo '<input type="submit" name="finish_survey" value="'.get_lang('FinishSurvey').' >> " />';
}

@ -21,7 +21,7 @@
* @package dokeos.survey
* @author unknown, the initial survey that did not make it in 1.8 because of bad code
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code
* @version $Id: reporting.php 12901 2007-08-28 12:32:02Z pcool $
* @version $Id: reporting.php 12912 2007-08-31 15:52:45Z pcool $
*
* @todo The question has to be more clearly indicated (same style as when filling the survey)
*/
@ -325,7 +325,12 @@ function display_user_report()
$answers[$row['question_id']][] = $row['option_id'];
$all_answers[$row['question_id']][] = $row;
}
/*
echo '<pre>';
print_r($all_answers);
echo '</pre>';
*/
// displaying all the questions
foreach ($questions as $key=>$question)
{
@ -342,10 +347,10 @@ function display_user_report()
$second_parameter = $answers[$question['question_id']];
if ($question['type'] == 'open')
{
$second_parameter = $all_answers[$question['question_id']][0]['value'];
$second_parameter = array();
$second_parameter[] = $all_answers[$question['question_id']][0]['option_id'];
}
}
$display = new $question['type'];
$display->render_question($question, $second_parameter);
// echo '<pre>';
@ -453,7 +458,7 @@ function display_question_report($survey_data)
$result = api_sql_query($sql, __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result))
{
echo $row['value'].'<hr noshade="noshade" size="1" />';
echo $row['option_id'].'<hr noshade="noshade" size="1" />';
}
}
@ -469,6 +474,9 @@ function display_question_report($survey_data)
{
$options[$row['question_option_id']] = $row;
}
//echo '<pre>';
//print_r($options);
//echo '<pre>';
// getting the answers
$sql = "SELECT *, count(answer_id) as total FROM $table_survey_answer
@ -481,6 +489,9 @@ function display_question_report($survey_data)
$number_of_answers += $row['total'];
$data[$row['option_id']] = $row;
}
//echo '<pre>';
//print_r($data);
//echo '<pre>';
// displaying the table: headers
echo '<table>';
@ -501,7 +512,13 @@ function display_question_report($survey_data)
echo ' <td>'.$value['option_text'].'</td>';
echo ' <td><a href="reporting.php?action='.$_GET['action'].'&amp;survey_id='.$_GET['survey_id'].'&amp;question='.$offset.'&amp;viewoption='.$value['question_option_id'].'">'.$absolute_number.'</a></td>';
echo ' <td>'.round($absolute_number/$number_of_answers*100, 2).' %</td>';
echo ' <td><div style="background-color:#0066CC; height:10px; width:'.($absolute_number/$number_of_answers*100*2).'px">&nbsp;</div></td>';
echo ' <td>';
$size = $absolute_number/$number_of_answers*100*2;
if ($size > 0)
{
echo '<div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:'.$size.'px">&nbsp;</div>';
}
echo ' </td>';
echo ' </tr>';
}
@ -593,7 +610,13 @@ function display_question_report_score($survey_data, $question, $offset)
echo ' <td>'.$i.'</td>';
echo ' <td><a href="reporting.php?action='.$_GET['action'].'&amp;survey_id='.$_GET['survey_id'].'&amp;question='.$offset.'&amp;viewoption='.$value['question_option_id'].'&amp;value='.$i.'">'.$absolute_number.'</a></td>';
echo ' <td>'.round($absolute_number/$number_of_answers*100, 2).' %</td>';
echo ' <td><div style="background-color:#0066CC; height:10px; width:'.($absolute_number/$number_of_answers*100*2).'px">&nbsp;</div></td>';
echo ' <td>';
$size = ($absolute_number/$number_of_answers*100*2);
if ($size > 0)
{
echo ' <div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:'.$size.'px">&nbsp;</div>';
}
echo ' </td>';
echo ' </tr>';
}
}
@ -674,6 +697,7 @@ function display_complete_report()
echo '</th>';
}
}
$questions[$row['question_id']] = $row;
}
echo ' </tr>';
@ -716,13 +740,20 @@ function display_complete_report()
{
if ($old_user <> $row['user'] AND $old_user<>'')
{
display_complete_report_row($possible_answers, $answers_of_user, $old_user);
display_complete_report_row($possible_answers, $answers_of_user, $old_user, $questions);
$answers_of_user=array();
}
$answers_of_user[$row['question_id']][$row['option_id']] = $row;
if ($questions[$row['question_id']]['type']<> 'open')
{
$answers_of_user[$row['question_id']][$row['option_id']] = $row;
}
else
{
$answers_of_user[$row['question_id']][0] = $row;
}
$old_user = $row['user'];
}
display_complete_report_row($possible_answers, $answers_of_user, $old_user); // this is to display the last user
display_complete_report_row($possible_answers, $answers_of_user, $old_user, $questions); // this is to display the last user
echo '</table>';
@ -742,31 +773,39 @@ function display_complete_report()
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version February 2007
*/
function display_complete_report_row($possible_answers, $answers_of_user, $user)
function display_complete_report_row($possible_answers, $answers_of_user, $user, $questions)
{
$table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
echo '<tr>';
echo ' <th><a href="'.api_get_self().'?action=userreport&survey_id='.$_GET['survey_id'].'&user='.$user.'">'.$user.'</a></th>'; // the user column
foreach ($possible_answers as $question_id=>$possible_option)
{
foreach ($possible_option as $option_id=>$value)
if ($questions[$question_id]['type'] == 'open')
{
echo '<td align="center">';
if (!empty($answers_of_user[$question_id][$option_id]))
echo $answers_of_user[$question_id]['0']['option_id'];
echo '</td>';
}
else
{
foreach ($possible_option as $option_id=>$value)
{
if ($answers_of_user[$question_id][$option_id]['value']<>0)
{
echo $answers_of_user[$question_id][$option_id]['value'];
}
else
echo '<td align="center">';
if (!empty($answers_of_user[$question_id][$option_id]))
{
echo 'v';
if ($answers_of_user[$question_id][$option_id]['value']<>0)
{
echo $answers_of_user[$question_id][$option_id]['value'];
}
else
{
echo 'v';
}
}
}
echo '</td>';
}
}
echo '</tr>';
}

@ -249,7 +249,7 @@ class survey_manager
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version February 2007
*/
function update_survey_answered($survey_id, $user)
function update_survey_answered($survey_id, $user, $survey_code)
{
global $_course;
@ -266,7 +266,7 @@ class survey_manager
$res = api_sql_query($sql, __FILE__, __LINE__);
// storing that the user has finished the survey.
$sql = "UPDATE $table_survey_invitation SET answered='1' WHERE user='".Database::escape_string($user)."'";
$sql = "UPDATE $table_survey_invitation SET answered='1' WHERE user='".Database::escape_string($user)."' AND survey_code='".Database::escape_string($survey_code)."'";
$res = api_sql_query($sql, __FILE__, __LINE__);
}
@ -879,12 +879,15 @@ class survey_manager
global $_course;
// Database table definition
$table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER, $_course['db_name']);
$table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION, $_course['db_name']);
// variable initialisation
$return = array();
// getting the survey information
$survey_data = survey_manager::get_survey($survey_id);
$sql = "SELECT DISTINCT user FROM $table_survey_answer WHERE survey_id = '".Database::escape_string($survey_id)."'";
$sql = "SELECT DISTINCT user FROM $table_survey_invitation WHERE survey_code= '".Database::escape_string($survey_data['code'])."' AND answered='1'";
$res = api_sql_query($sql, __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($res))
{
@ -1507,7 +1510,15 @@ class open extends question
echo '<div class="survey_question_wrapper">';
echo '<div class="survey_question">'.$form_content['survey_question'].'</div>';
echo '<div class="survey_question_options">';
echo '<label for="question'.$form_content['question_id'].'"></label><textarea name="question'.$form_content['question_id'].'" id="textarea" style="width: 400px; height: 130px;">'.implode($answers).'</textarea>';
if (is_array($answers))
{
$content = implode('',$answers);
}
else
{
$content = $answers;
}
echo '<label for="question'.$form_content['question_id'].'"></label><textarea name="question'.$form_content['question_id'].'" id="textarea" style="width: 400px; height: 130px;">'.$content.'</textarea>';
echo '</div>';
}
}
@ -1680,4 +1691,38 @@ function db_escape_string($value)
{
}
function check_first_last_question($survey_id, $continue=true)
{
// table definitions
$tbl_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
// getting the information of the question
$sql = "SELECT * FROM $tbl_survey_question WHERE survey_id='".Database::escape_string($survey_id)."' ORDER BY sort ASC";
$result = api_sql_query($sql, __FILE__, __LINE__);
$total = mysql_num_rows($result);
$counter=1;
$error = false;
while ($row = mysql_fetch_assoc($result))
{
if ($counter == 1 AND $row['type'] == 'pagebreak')
{
Display::display_error_message(get_lang('PagebreakNotFirst'), false);
$error = true;
}
if ($counter == $total AND $row['type'] == 'pagebreak')
{
Display::display_error_message(get_lang('PagebreakNotLast'), false);
$error = true;
}
$counter++;
}
if (!$continue AND $error)
{
Display::display_footer();
exit;
}
}
?>

@ -21,7 +21,7 @@ Tel. +32 (2) 211 34 56
* @package dokeos.survey
* @author unknown
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code
* @version $Id: survey.php 12901 2007-08-28 12:32:02Z pcool $
* @version $Id: survey.php 12912 2007-08-31 15:52:45Z pcool $
*
* @todo use quickforms for the forms
*/
@ -96,6 +96,8 @@ if (isset($_GET['message']))
}
}
check_first_last_question($_GET['survey_id']);
// Action links
$survey_actions = get_lang('Survey').': ';
$survey_actions .= '<a href="create_new_survey.php?'.api_get_cidreq().'&amp;action=edit&amp;survey_id='.$_GET['survey_id'].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';

@ -63,7 +63,6 @@ if (strlen(strip_tags($survey_data['title'])) > 40)
$urlname .= '...';
}
// breadcrumbs
$interbreadcrumb[] = array ('url' => 'survey_list.php', 'name' => get_lang('SurveyList'));
$interbreadcrumb[] = array ('url' => 'survey.php?survey_id='.$_GET['survey_id'], 'name' => $urlname);
@ -82,7 +81,11 @@ if (!is_numeric($_GET['survey_id']))
// Getting all the people who have filled this survey
$answered_data = survey_manager::get_people_who_filled_survey($_GET['survey_id']);
if ($survey_data['anonymous'] == 1)
{
Display::display_normal_message(get_lang('AnonymousSurveyCannotKnowWhoAnswered').' '.count($answered_data).' '.get_lang('PeopleAnswered'));
$answered_data = array();
}
//
if (!isset($_GET['view']) OR $_GET['view'] == 'invited')

@ -83,6 +83,16 @@ if (mysql_num_rows($result) > 1)
Display::display_warning_message(get_lang('IdenticalSurveycodeWarning'));
}
// invited / answered message
if ($survey_data['invited'] > 0)
{
$message = '<a href="survey_invitation.php?view=answered&amp;survey_id='.$survey_data['survey_id'].'">'.$survey_data['answered'].'</a> ';
$message .= get_lang('HaveAnswered');
$message .= '<a href="survey_invitation.php?view=invited&amp;survey_id='.$survey_data['survey_id'].'">'.$survey_data['invited'].'</a> ';
$message .= get_lang('WereInvited');
Display::display_normal_message($message, false);
}
// building the form for publishing the survey
$form = new FormValidator('publish_form','post', api_get_self().'?survey_id='.$_GET['survey_id']);
// Course users

@ -21,10 +21,8 @@
* @package dokeos.survey
* @author unknown, the initial survey that did not make it in 1.8 because of bad code
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code
* @version $Id: survey_list.php 12901 2007-08-28 12:32:02Z pcool $
* @version $Id: survey_list.php 12912 2007-08-31 15:52:45Z pcool $
*
* @todo The invite column is not done
* @todo try to understand the white, blue, ... template stuff.
* @todo use quickforms for the forms
*/

Loading…
Cancel
Save