[svn r12901] anonymous survey

skala
Patrick Cool 17 years ago
parent f9f82017d8
commit 502e39c92e
  1. 1
      main/inc/lib/add_course.lib.inc.php
  2. 1
      main/install/migrate-db-1.8.3-1.8.4-pre.sql
  3. 5
      main/survey/create_new_survey.php
  4. 35
      main/survey/fillsurvey.php
  5. 17
      main/survey/reporting.php
  6. 17
      main/survey/survey.lib.php
  7. 40
      main/survey/survey.php
  8. 3
      main/survey/survey_invite.php
  9. 37
      main/survey/survey_list.php

@ -1273,6 +1273,7 @@ function update_Db_course($courseDbName)
answered int NOT NULL, answered int NOT NULL,
invite_mail text NOT NULL, invite_mail text NOT NULL,
reminder_mail text NOT NULL, reminder_mail text NOT NULL,
anonymous enum('0','1') NOT NULL default '0',
PRIMARY KEY (survey_id) PRIMARY KEY (survey_id)
)"; )";

@ -28,3 +28,4 @@ INSERT INTO settings_options(variable,value,display_text) VALUES ('default_forum
-- xxUSERxx -- xxUSERxx
-- xxCOURSExx -- xxCOURSExx
ALTER TABLE survey ADD anonymous ENUM( '0', '1' ) NOT NULL DEFAULT '0';

@ -21,7 +21,7 @@
* @package dokeos.survey * @package dokeos.survey
* @author unknown, the initial survey that did not make it in 1.8 because of bad code * @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 (if not all) of the code * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts (if not all) of the code
* @version $Id: create_new_survey.php 12272 2007-05-03 14:40:45Z elixir_julian $ * @version $Id: create_new_survey.php 12901 2007-08-28 12:32:02Z pcool $
* *
* @todo only the available platform languages should be used => need an api get_languages and and api_get_available_languages (or a parameter) * @todo only the available platform languages should be used => need an api get_languages and and api_get_available_languages (or a parameter)
*/ */
@ -96,6 +96,7 @@ if ($_GET['action'] == 'edit' AND isset($_GET['survey_id']) AND is_numeric($_GET
{ {
$form_share_value = $defaults['survey_share']['survey_share']; $form_share_value = $defaults['survey_share']['survey_share'];
} }
$defaults['anonymous'] = $survey_data['anonymous'];
} }
else else
{ {
@ -105,6 +106,7 @@ else
$defaults['end_date'] = date('d-F-Y H:i', $startdateandxdays); $defaults['end_date'] = date('d-F-Y H:i', $startdateandxdays);
$defaults['survey_share']['survey_share'] = 0; $defaults['survey_share']['survey_share'] = 0;
$form_share_value = 1; $form_share_value = 1;
$defaults['anonymous'] = 0;
} }
// initiate the object // initiate the object
@ -135,6 +137,7 @@ $group[] =& HTML_QuickForm::createElement('radio', 'survey_share',null, get_lang
$group[] =& HTML_QuickForm::createElement('radio', 'survey_share',null, get_lang('No'),0); $group[] =& HTML_QuickForm::createElement('radio', 'survey_share',null, get_lang('No'),0);
$fck_attribute['Height'] = '200'; $fck_attribute['Height'] = '200';
$form->addGroup($group, 'survey_share', get_lang('ShareSurvey'), '&nbsp;'); $form->addGroup($group, 'survey_share', get_lang('ShareSurvey'), '&nbsp;');
$form->addElement('checkbox', 'anonymous', get_lang('Anonymous'));
$form->addElement('html_editor', 'survey_introduction', get_lang('SurveyIntroduction')); $form->addElement('html_editor', 'survey_introduction', get_lang('SurveyIntroduction'));
$form->addElement('html_editor', 'survey_thanks', get_lang('SurveyThanks')); $form->addElement('html_editor', 'survey_thanks', get_lang('SurveyThanks'));
$form->addElement('submit', 'submit_survey', get_lang('Ok')); $form->addElement('submit', 'submit_survey', get_lang('Ok'));

@ -118,6 +118,10 @@ else
$survey_invitation['survey_id'] = $row['survey_id']; $survey_invitation['survey_id'] = $row['survey_id'];
} }
// getting the survey information
$survey_data = survey_manager::get_survey($survey_invitation['survey_id']);
$survey_data['survey_id'] = $survey_invitation['survey_id'];
// storing the answers // storing the answers
if ($_POST) if ($_POST)
{ {
@ -163,7 +167,7 @@ if ($_POST)
$option_id = $answer_value; $option_id = $answer_value;
$option_value = ''; $option_value = '';
} }
store_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id, $option_id, $option_value); store_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id, $option_id, $option_value, $survey_data);
} }
} }
// all the other question types (open question, multiple choice, percentage, ...) // all the other question types (open question, multiple choice, percentage, ...)
@ -179,21 +183,24 @@ if ($_POST)
else else
{ {
$option_value = 0; $option_value = 0;
if($types[$survey_question_id] == 'open')
{
$option_value = $value;
$value = 0;
}
} }
$survey_question_answer = $value; $survey_question_answer = $value;
remove_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id); remove_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id);
store_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id, $value, $option_value); store_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id, $value, $option_value, $survey_data);
//store_answer($user,$survey_id,$question_id, $option_id, $option_value, $survey_data);
} }
} }
} }
} }
// getting the survey information
$survey_data = survey_manager::get_survey($survey_invitation['survey_id']);
$survey_data['survey_id'] = $survey_invitation['survey_id'];
// displaying the survey title and subtitle (appears on every page) // displaying the survey title and subtitle (appears on every page)
echo '<div id="survey_title">'.$survey_data['survey_title'].'</div>'; echo '<div id="survey_title">'.$survey_data['survey_title'].'</div>';
echo '<div id="survey_subtitle">'.$survey_data['survey_subtitle'].'</div>'; echo '<div id="survey_subtitle">'.$survey_data['survey_subtitle'].'</div>';
@ -293,7 +300,7 @@ Display :: display_footer();
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version January 2007 * @version January 2007
*/ */
function store_answer($user, $survey_id, $question_id, $option_id, $option_value) function store_answer($user, $survey_id, $question_id, $option_id, $option_value, $survey_data)
{ {
global $_course; global $_course;
global $types; global $types;
@ -303,6 +310,20 @@ function store_answer($user, $survey_id, $question_id, $option_id, $option_value
// table definition // table definition
$table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER, $_course['db_name']); $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER, $_course['db_name']);
// make the survey anonymous
if ($survey_data['anonymous'] == 1)
{
if (!$_SESSION['surveyuser'])
{
$user = md5($user.time());
$_SESSION['surveyuser'] = $user;
}
else
{
$user = $_SESSION['surveyuser'];
}
}
$sql = "INSERT INTO $table_survey_answer (user, survey_id, question_id, option_id, value) VALUES ( $sql = "INSERT INTO $table_survey_answer (user, survey_id, question_id, option_id, value) VALUES (
'".Database::escape_string($user)."', '".Database::escape_string($user)."',
'".Database::escape_string($survey_id)."', '".Database::escape_string($survey_id)."',

@ -21,7 +21,7 @@
* @package dokeos.survey * @package dokeos.survey
* @author unknown, the initial survey that did not make it in 1.8 because of bad code * @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 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code
* @version $Id: reporting.php 12586 2007-06-12 13:39:57Z elixir_julian $ * @version $Id: reporting.php 12901 2007-08-28 12:32:02Z pcool $
* *
* @todo The question has to be more clearly indicated (same style as when filling the survey) * @todo The question has to be more clearly indicated (same style as when filling the survey)
*/ */
@ -340,6 +340,10 @@ function display_user_report()
else else
{ {
$second_parameter = $answers[$question['question_id']]; $second_parameter = $answers[$question['question_id']];
if ($question['type'] == 'open')
{
$second_parameter = $all_answers[$question['question_id']][0]['value'];
}
} }
$display = new $question['type']; $display = new $question['type'];
@ -449,7 +453,7 @@ function display_question_report($survey_data)
$result = api_sql_query($sql, __FILE__, __LINE__); $result = api_sql_query($sql, __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result)) while ($row = mysql_fetch_assoc($result))
{ {
echo $row['option_id'].'<hr noshade="noshade" size="1" />'; echo $row['value'].'<hr noshade="noshade" size="1" />';
} }
} }
@ -747,11 +751,6 @@ function display_complete_report_row($possible_answers, $answers_of_user, $user)
foreach ($possible_answers as $question_id=>$possible_option) foreach ($possible_answers as $question_id=>$possible_option)
{ {
$sql='SELECT type FROM '.$table_survey_question.' WHERE question_id="'.$question_id.'"';
$result=api_sql_query($sql);
$question_type=mysql_result($result,0,0);
foreach ($possible_option as $option_id=>$value) foreach ($possible_option as $option_id=>$value)
{ {
echo '<td align="center">'; echo '<td align="center">';
@ -766,10 +765,6 @@ function display_complete_report_row($possible_answers, $answers_of_user, $user)
echo 'v'; echo 'v';
} }
} }
elseif($question_type=='open'){
$a_answer = $answers_of_user[$question_id];
echo key($a_answer);
}
echo '</td>'; echo '</td>';
} }
} }

@ -100,7 +100,11 @@ class survey_manager
if (!$values['survey_id'] OR !is_numeric($values['survey_id'])) if (!$values['survey_id'] OR !is_numeric($values['survey_id']))
{ {
$sql = "INSERT INTO $table_survey (code, title, subtitle, author, lang, avail_from, avail_till, is_shared, template, intro, surveythanks, creation_date) VALUES ( if ($values['anonymous']=='')
{
$values['anonymous']=0;
}
$sql = "INSERT INTO $table_survey (code, title, subtitle, author, lang, avail_from, avail_till, is_shared, template, intro, surveythanks, creation_date, anonymous) VALUES (
'".Database::escape_string($values['survey_code'])."', '".Database::escape_string($values['survey_code'])."',
'".Database::escape_string($values['survey_title'])."', '".Database::escape_string($values['survey_title'])."',
'".Database::escape_string($values['survey_subtitle'])."', '".Database::escape_string($values['survey_subtitle'])."',
@ -112,7 +116,9 @@ class survey_manager
'".Database::escape_string('template')."', '".Database::escape_string('template')."',
'".Database::escape_string($values['survey_introduction'])."', '".Database::escape_string($values['survey_introduction'])."',
'".Database::escape_string($values['survey_thanks'])."', '".Database::escape_string($values['survey_thanks'])."',
'".date()."')"; '".date()."',
'".Database::escape_string($values['anonymous'])."'
)";
$result = api_sql_query($sql, __FILE__, __LINE__); $result = api_sql_query($sql, __FILE__, __LINE__);
$survey_id = mysql_insert_id(); $survey_id = mysql_insert_id();
@ -124,6 +130,10 @@ class survey_manager
} }
else else
{ {
if ($values['anonymous']=='')
{
$values['anonymous']=0;
}
$sql = "UPDATE $table_survey SET $sql = "UPDATE $table_survey SET
code = '".Database::escape_string($values['survey_code'])."', code = '".Database::escape_string($values['survey_code'])."',
title = '".Database::escape_string($values['survey_title'])."', title = '".Database::escape_string($values['survey_title'])."',
@ -135,7 +145,8 @@ class survey_manager
is_shared = '".Database::escape_string($shared_survey_id)."', is_shared = '".Database::escape_string($shared_survey_id)."',
template = '".Database::escape_string('template')."', template = '".Database::escape_string('template')."',
intro = '".Database::escape_string($values['survey_introduction'])."', intro = '".Database::escape_string($values['survey_introduction'])."',
surveythanks = '".Database::escape_string($values['survey_thanks'])."' surveythanks = '".Database::escape_string($values['survey_thanks'])."',
anonymous = '".Database::escape_string($values['anonymous'])."'
WHERE survey_id = '".Database::escape_string($values['survey_id'])."'"; WHERE survey_id = '".Database::escape_string($values['survey_id'])."'";
$result = api_sql_query($sql, __FILE__, __LINE__); $result = api_sql_query($sql, __FILE__, __LINE__);

@ -21,7 +21,7 @@ Tel. +32 (2) 211 34 56
* @package dokeos.survey * @package dokeos.survey
* @author unknown * @author unknown
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code
* @version $Id: survey.php 12221 2007-05-01 23:23:49Z yannoo $ * @version $Id: survey.php 12901 2007-08-28 12:32:02Z pcool $
* *
* @todo use quickforms for the forms * @todo use quickforms for the forms
*/ */
@ -98,24 +98,24 @@ if (isset($_GET['message']))
// Action links // Action links
$survey_actions = get_lang('Survey').': '; $survey_actions = get_lang('Survey').': ';
$survey_actions .= '<a href="create_new_survey.php?'.api_get_cidreq().'&action=edit&amp;survey_id='.$_GET['survey_id'].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>'; $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>';
$survey_actions .= '<a href="survey_list.php?'.api_get_cidreq().'&action=delete&amp;survey_id='.$_GET['survey_id'].'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("DeleteSurvey").'?')).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>'; $survey_actions .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$_GET['survey_id'].'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("DeleteSurvey").'?')).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
//$survey_actions .= '<a href="create_survey_in_another_language.php?id_survey='.$_GET['survey_id'].'">'.Display::return_icon('copy.gif', get_lang('Copy')).'</a>'; //$survey_actions .= '<a href="create_survey_in_another_language.php?id_survey='.$_GET['survey_id'].'">'.Display::return_icon('copy.gif', get_lang('Copy')).'</a>';
$survey_actions .= '<a href="preview.php?'.api_get_cidreq().'&survey_id='.$_GET['survey_id'].'">'.Display::return_icon('preview.gif', get_lang('Preview')).'</a>'; $survey_actions .= '<a href="preview.php?'.api_get_cidreq().'&amp;survey_id='.$_GET['survey_id'].'">'.Display::return_icon('preview.gif', get_lang('Preview')).'</a>';
$survey_actions .= '<a href="survey_invite.php?'.api_get_cidreq().'&survey_id='.$_GET['survey_id'].'">'.Display::return_icon('survey_publish.gif', get_lang('Publish')).'</a>'; $survey_actions .= '<a href="survey_invite.php?'.api_get_cidreq().'&amp;survey_id='.$_GET['survey_id'].'">'.Display::return_icon('survey_publish.gif', get_lang('Publish')).'</a>';
$survey_actions .= '<a href="reporting.php?'.api_get_cidreq().'&survey_id='.$_GET['survey_id'].'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a>'; $survey_actions .= '<a href="reporting.php?'.api_get_cidreq().'&amp;survey_id='.$_GET['survey_id'].'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a>';
echo '<div style="float:right;">'.$survey_actions.'</div>'; echo '<div style="float:right;">'.$survey_actions.'</div>';
echo '<div>'; echo '<div>';
echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&action=add&type=yesno&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/yesno.gif" /><br />'.get_lang('YesNo').'</a></div>'; echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&amp;action=add&type=yesno&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/yesno.gif" /><br />'.get_lang('YesNo').'</a></div>';
echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&action=add&type=multiplechoice&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/mcua.gif" /><br />'.get_lang('MultipleChoice').'</a></div>'; echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&amp;action=add&type=multiplechoice&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/mcua.gif" /><br />'.get_lang('MultipleChoice').'</a></div>';
echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&action=add&type=multipleresponse&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/mcma.gif" /><br />'.get_lang('MultipleResponse').'</a></div>'; echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&amp;action=add&type=multipleresponse&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/mcma.gif" /><br />'.get_lang('MultipleResponse').'</a></div>';
echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&action=add&type=open&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/open_answer.gif" /><br />'.get_lang('Open').'</a></div>'; echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&amp;action=add&type=open&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/open_answer.gif" /><br />'.get_lang('Open').'</a></div>';
echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&action=add&type=dropdown&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/dropdown.gif" /><br />'.get_lang('Dropdown').'</a></div>'; echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&amp;action=add&type=dropdown&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/dropdown.gif" /><br />'.get_lang('Dropdown').'</a></div>';
echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&action=add&type=percentage&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/percentagequestion.gif" /><br />'.get_lang('Percentage').'</a></div>'; echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&amp;action=add&type=percentage&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/percentagequestion.gif" /><br />'.get_lang('Percentage').'</a></div>';
echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&action=add&type=score&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/scorequestion.gif" /><br />'.get_lang('Score').'</a></div>'; echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&amp;action=add&type=score&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/scorequestion.gif" /><br />'.get_lang('Score').'</a></div>';
echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&action=add&type=comment&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/commentquestion.gif" /><br />'.get_lang('Comment').'</a></div>'; echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&amp;action=add&type=comment&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/commentquestion.gif" /><br />'.get_lang('Comment').'</a></div>';
echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&action=add&type=pagebreak&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/page_end.gif" /><br />'.get_lang('Pagebreak').'</a></div>'; echo '<div style="float:left; text-align:center; margin:5px;"><a href="question.php?'.api_get_cidreq().'&amp;action=add&type=pagebreak&amp;survey_id='.$_GET['survey_id'].'"><img src="../img/page_end.gif" /><br />'.get_lang('Pagebreak').'</a></div>';
echo '</div>'; echo '</div>';
echo '<div style="clear:both;"></div>'; echo '<div style="clear:both;"></div>';
@ -146,7 +146,7 @@ while ($row = mysql_fetch_assoc($result))
echo ' <td>'; echo ' <td>';
if (strlen($row['survey_question']) > 100) if (strlen($row['survey_question']) > 100)
{ {
echo substr($row['survey_question'],0, 100).' ... '; echo substr(strip_tags($row['survey_question']),0, 100).' ... ';
} }
else else
{ {
@ -156,15 +156,15 @@ while ($row = mysql_fetch_assoc($result))
echo ' <td>'.get_lang(ucfirst($row['type'])).'</td>'; echo ' <td>'.get_lang(ucfirst($row['type'])).'</td>';
echo ' <td>'.$row['number_of_options'].'</td>'; echo ' <td>'.$row['number_of_options'].'</td>';
echo ' <td>'; echo ' <td>';
echo ' <a href="question.php?'.api_get_cidreq().'&action=edit&amp;type='.$row['type'].'&amp;survey_id='.$_GET['survey_id'].'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>'; echo ' <a href="question.php?'.api_get_cidreq().'&amp;action=edit&amp;type='.$row['type'].'&amp;survey_id='.$_GET['survey_id'].'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
echo ' <a href="survey.php?'.api_get_cidreq().'&action=delete&amp;survey_id='.$_GET['survey_id'].'&amp;question_id='.$row['question_id'].'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("DeleteSurveyQuestion").'?')).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>'; echo ' <a href="survey.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$_GET['survey_id'].'&amp;question_id='.$row['question_id'].'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("DeleteSurveyQuestion").'?')).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
if ($question_counter > 1) if ($question_counter > 1)
{ {
echo ' <a href="survey.php?'.api_get_cidreq().'&action=moveup&amp;survey_id='.$_GET['survey_id'].'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('up.gif', get_lang('MoveUp')).'</a>'; echo ' <a href="survey.php?'.api_get_cidreq().'&amp;action=moveup&amp;survey_id='.$_GET['survey_id'].'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('up.gif', get_lang('MoveUp')).'</a>';
} }
if ($question_counter < $question_counter_max) if ($question_counter < $question_counter_max)
{ {
echo ' <a href="survey.php?'.api_get_cidreq().'&action=movedown&amp;survey_id='.$_GET['survey_id'].'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('down.gif', get_lang('MoveDown')).'</a>'; echo ' <a href="survey.php?'.api_get_cidreq().'&amp;action=movedown&amp;survey_id='.$_GET['survey_id'].'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('down.gif', get_lang('MoveDown')).'</a>';
} }
echo ' </td>'; echo ' </td>';
$question_counter++; $question_counter++;

@ -136,7 +136,8 @@ if ($form->validate())
$values['additional_users'] = $values['additional_users'].';'; // this is for the case when you enter only one email $values['additional_users'] = $values['additional_users'].';'; // this is for the case when you enter only one email
$temp = str_replace(',',';',$values['additional_users']); // this is to allow , and ; as email separators $temp = str_replace(',',';',$values['additional_users']); // this is to allow , and ; as email separators
$additional_users = explode(';',$temp); $additional_users = explode(';',$temp);
for($i=0; $i<count($additional_users); $i++){ for($i=0; $i<count($additional_users); $i++)
{
$additional_users[$i] = trim($additional_users[$i]); $additional_users[$i] = trim($additional_users[$i]);
} }
$counter_additional_users = save_invitations($additional_users, $values['mail_title'], $values['mail_text'], $values['resend_to_all']); $counter_additional_users = save_invitations($additional_users, $values['mail_title'], $values['mail_text'], $values['resend_to_all']);

@ -21,7 +21,7 @@
* @package dokeos.survey * @package dokeos.survey
* @author unknown, the initial survey that did not make it in 1.8 because of bad code * @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 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code
* @version $Id: survey_list.php 12221 2007-05-01 23:23:49Z yannoo $ * @version $Id: survey_list.php 12901 2007-08-28 12:32:02Z pcool $
* *
* @todo The invite column is not done * @todo The invite column is not done
* @todo try to understand the white, blue, ... template stuff. * @todo try to understand the white, blue, ... template stuff.
@ -122,9 +122,9 @@ if ($_POST['action'])
// Action links // Action links
echo '<a href="create_new_survey.php?'.api_get_cidreq().'&action=add">'.get_lang('CreateNewSurvey').'</a> | '; echo '<a href="create_new_survey.php?'.api_get_cidreq().'&amp;action=add">'.get_lang('CreateNewSurvey').'</a> | ';
//echo '<a href="survey_all_courses.php">'.get_lang('CreateExistingSurvey').'</a> | '; //echo '<a href="survey_all_courses.php">'.get_lang('CreateExistingSurvey').'</a> | ';
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&search=advanced">'.get_lang('Search').'</a>'; echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;search=advanced">'.get_lang('Search').'</a>';
// Main content // Main content
display_survey_list(); display_survey_list();
@ -207,8 +207,10 @@ function display_survey_list()
$table->set_header(7, get_lang('AvailableFrom')); $table->set_header(7, get_lang('AvailableFrom'));
$table->set_header(8, get_lang('AvailableUntill')); $table->set_header(8, get_lang('AvailableUntill'));
$table->set_header(9, get_lang('Invite')); $table->set_header(9, get_lang('Invite'));
$table->set_header(10, get_lang('Modify'), false); $table->set_header(10, get_lang('Anonymous'));
$table->set_column_filter(10, 'modify_filter'); $table->set_header(11, get_lang('Modify'), false);
$table->set_column_filter(10, 'anonymous_filter');
$table->set_column_filter(11, 'modify_filter');
$table->set_form_actions(array ('delete' => get_lang('DeleteSurvey'))); $table->set_form_actions(array ('delete' => get_lang('DeleteSurvey')));
$table->display(); $table->display();
@ -274,7 +276,8 @@ function get_survey_data($from, $number_of_items, $column, $direction)
survey.avail_from AS col7, survey.avail_from AS col7,
survey.avail_till AS col8, survey.avail_till AS col8,
CONCAT('<a href=\"survey_invitation.php?view=answered&amp;survey_id=',survey.survey_id,'\">',survey.answered,'</a> / <a href=\"survey_invitation.php?view=invited&amp;survey_id=',survey.survey_id,'\">',survey.invited, '</a>') AS col9, CONCAT('<a href=\"survey_invitation.php?view=answered&amp;survey_id=',survey.survey_id,'\">',survey.answered,'</a> / <a href=\"survey_invitation.php?view=invited&amp;survey_id=',survey.survey_id,'\">',survey.invited, '</a>') AS col9,
survey.survey_id AS col10 survey.anonymous AS col10,
survey.survey_id AS col11
FROM $table_survey survey FROM $table_survey survey
LEFT JOIN $table_survey_question survey_question ON survey.survey_id = survey_question.survey_id LEFT JOIN $table_survey_question survey_question ON survey.survey_id = survey_question.survey_id
, $table_user user , $table_user user
@ -305,16 +308,28 @@ function get_survey_data($from, $number_of_items, $column, $direction)
*/ */
function modify_filter($survey_id) function modify_filter($survey_id)
{ {
$return = '<a href="create_new_survey.php?'.api_get_cidreq().'&action=edit&amp;survey_id='.$survey_id.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>'; $return = '<a href="create_new_survey.php?'.api_get_cidreq().'&amp;action=edit&amp;survey_id='.$survey_id.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
$return .= '<a href="survey_list.php?'.api_get_cidreq().'&action=delete&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("DeleteSurvey").'?')).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>'; $return .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("DeleteSurvey").'?')).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
//$return .= '<a href="create_survey_in_another_language.php?id_survey='.$survey_id.'">'.Display::return_icon('copy.gif', get_lang('Copy')).'</a>'; //$return .= '<a href="create_survey_in_another_language.php?id_survey='.$survey_id.'">'.Display::return_icon('copy.gif', get_lang('Copy')).'</a>';
//$return .= '<a href="survey.php?survey_id='.$survey_id.'">'.Display::return_icon('add.gif', get_lang('Add')).'</a>'; //$return .= '<a href="survey.php?survey_id='.$survey_id.'">'.Display::return_icon('add.gif', get_lang('Add')).'</a>';
$return .= '<a href="preview.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('preview.gif', get_lang('Preview')).'</a>'; $return .= '<a href="preview.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('preview.gif', get_lang('Preview')).'</a>';
$return .= '<a href="survey_invite.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('survey_publish.gif', get_lang('Publish')).'</a>'; $return .= '<a href="survey_invite.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('survey_publish.gif', get_lang('Publish')).'</a>';
$return .= '<a href="reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a>'; $return .= '<a href="reporting.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a>';
return $return; return $return;
} }
function anonymous_filter($anonymous)
{
if ($anonymous == 1)
{
return get_lang('Yes');
}
else
{
return get_lang('No');
}
}
/** /**
* this function handles the search restriction for the SQL statements * this function handles the search restriction for the SQL statements

Loading…
Cancel
Save