diff --git a/main/survey/survey.lib.php b/main/survey/survey.lib.php index 0ca5970cfd..0aed06466b 100644 --- a/main/survey/survey.lib.php +++ b/main/survey/survey.lib.php @@ -24,7 +24,7 @@ * @package dokeos.survey * @author Patrick Cool , Ghent University: cleanup, refactoring and rewriting large parts (if not all) of the code @author Julio Montoya Armas , Dokeos: Personality Test modification and rewriting large parts of the code -* @version $Id: survey.lib.php 20483 2009-05-11 14:54:18Z juliomontoya $ +* @version $Id: survey.lib.php 20486 2009-05-11 15:32:32Z juliomontoya $ * * @todo move this file to inc/lib * @todo use consistent naming for the functions (save vs store for instance) @@ -1435,12 +1435,14 @@ class question } else { $class="add"; $text=get_lang('CreateQuestionSurvey'); - } - - $this->html .= '
'; - $this->html .= '
'; - $this->html .= '
'; - $this->html .= '
'; + } + + if ($_GET['type']=='yesno' || $_GET['type']=='open'|| $_GET['type']=='percentage' || $_GET['type']=='comment' || $_GET['type']=='pagebreak') { + $this->html .= '
'; + $this->html .= '
'; + $this->html .= '
'; + $this->html .= '
'; + } $this->html .= ' '; $this->html .= '
'; $this->html .= '
'; @@ -1514,7 +1516,7 @@ class question if ($config['survey']['debug']) { Display :: display_header(); - Display :: display_confirmation_message($message.'
'.get_lang('ReturnTo').' '.get_lang('Survey').'', false); + Display :: display_confirmation_message($message.'
'.get_lang('ReturnTo').' '.get_lang('Survey').'', false); } else { header('Location:survey.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'&message='.$message); exit(); @@ -1570,13 +1572,21 @@ class question $remove_answer_attribute = 'disabled="disabled"'; } + $return .= '
'; + $return .= '
'; + $return .= '
'; + $return .= '
'; + $return .= ' '; + $return .= ' '; + + /* $return .= ' '; $return .= '  '; $return .= ' '; $return .= ' '; $return .= ' '; $return .= ' '; - $return .= ' '; + $return .= ' ';*/ return $return; } @@ -1591,7 +1601,7 @@ class question */ function render_question($form_content) { - $this->html = '
'; + $this->html = ''; echo $this->html; } } @@ -1627,17 +1637,18 @@ class yesno extends question $this->html .= '
'; $this->html .= '
'; - + // The options $this->html .= '
'; $this->html .= '
'; $this->html .= get_lang('AnswerOptions'); $this->html .= '
'; $this->html .= '
'; - $this->html .= ' '; + $this->html .= '
'; $this->html .= ' '; $this->html .= ' '; //$this->html .= ' '; + $this->html .= ' '; $this->html .= ' '; $this->html .= ' '; @@ -1733,34 +1744,32 @@ class multiplechoice extends question $this->html .= ' '; $this->html .= '
'; $total_number_of_answers = count($form_content['answers']); - $this->html .= '
'.api_return_html_area('answers[0]', stripslashes($form_content['answers'][0])).'
'; - foreach ($form_content['answers'] as $key=>$value) - { + $this->html .= '
'; + foreach ($form_content['answers'] as $key=>$value) { $this->html .= ' '; $this->html .= ' '; //$this->html .= ' '; $this->html .= ' '; $this->html .= ' '; $this->html .= ' '; } - // The buttons for adding or removing - $this->html .= parent :: add_remove_buttons($form_content); + // The buttons for adding or removing $this->html .= '
'.api_return_html_area('answers['.$key.']', api_html_entity_decode(stripslashes($form_content['answers'][$key]), ENT_QUOTES, $charset)).''; - if ($key<$total_number_of_answers-1) - { + if ($key<$total_number_of_answers-1) { $this->html .= ' '; } - if ($key>0) - { + if ($key>0) { $this->html .= ' '; } - if ($total_number_of_answers> 2) - { + if ($total_number_of_answers> 2) { $this->html .= ' '; } $this->html .= '
'; $this->html .= '
'; $this->html .= '
'; + + $this->html .= parent :: add_remove_buttons($form_content); + } @@ -1928,34 +1937,32 @@ class multipleresponse extends question $this->html .= '
'; $this->html .= '
'; $total_number_of_answers = count($form_content['answers']); - $this->html .= ' '; - foreach ($form_content['answers'] as $key=>$value) - { + $this->html .= '
'; + foreach ($form_content['answers'] as $key=>$value) { $this->html .= ' '; $this->html .= ' '; //$this->html .= ' '; $this->html .= ' '; $this->html .= ' '; $this->html .= ' '; } - // The buttons for adding or removing - $this->html .= parent :: add_remove_buttons($form_content); + // The buttons for adding or removing $this->html .= '
'.api_return_html_area('answers['.$key.']', api_html_entity_decode(stripslashes($form_content['answers'][$key]), ENT_QUOTES, $charset)).''; - if ($key<$total_number_of_answers-1) - { + if ($key<$total_number_of_answers-1) { $this->html .= ' '; } - if ($key>0) - { + + if ($key>0) { $this->html .= ' '; } - if ($total_number_of_answers> 2) - { + + if ($total_number_of_answers> 2) { $this->html .= ' '; } $this->html .= '
'; $this->html .= '
'; - $this->html .= '
'; + $this->html .= ' '; + $this->html .= parent :: add_remove_buttons($form_content); } /** @@ -2016,7 +2023,7 @@ class dropdown extends question $this->html .= ' '; $this->html .= '
'; $total_number_of_answers = count($form_content['answers']); - $this->html .= ' '; + $this->html .= '
'; foreach ($form_content['answers'] as $key=>$value) { $this->html .= ' '; @@ -2038,11 +2045,11 @@ class dropdown extends question $this->html .= ' '; $this->html .= ' '; } - // The buttons for adding or removing - $this->html .= parent :: add_remove_buttons($form_content); + // The buttons for adding or removing $this->html .= '
'; $this->html .= '
'; $this->html .= ' '; + $this->html .= parent :: add_remove_buttons($form_content); } /** @@ -2235,7 +2242,7 @@ class score extends question $this->html .= ' '; $this->html .= '
'; $total_number_of_answers = count($form_content['answers']); - $this->html .= ' '; + $this->html .= '
'; foreach ($form_content['answers'] as $key=>$value) { $this->html .= ' '; @@ -2259,10 +2266,10 @@ class score extends question $this->html .= ' '; } // The buttons for adding or removing - $this->html .= parent :: add_remove_buttons($form_content); $this->html .= '
'; $this->html .= '
'; - $this->html .= ' '; + $this->html .= ' '; + $this->html .= parent :: add_remove_buttons($form_content); } function render_question($form_content, $answers=array()) @@ -2752,7 +2759,7 @@ class SurveyUtil { { if ($offset <> $i-1) { - echo ''.$i.''; + echo ''.$i.''; } else { @@ -2782,7 +2789,7 @@ class SurveyUtil { echo ' | '; if ($_GET['question'] < ($survey_data['number_of_questions']-1)) { - echo ''.get_lang('NextQuestion').'>> '; + echo ''.get_lang('NextQuestion').'>> '; } else { @@ -2887,7 +2894,7 @@ class SurveyUtil { if (isset($_GET['viewoption'])) { - echo get_lang('PeopleWhoAnswered').': '.$options[$_GET['viewoption']]['option_text'].'
'; + echo get_lang('PeopleWhoAnswered').': '.$options[Security::remove_XSS($_GET['viewoption'])]['option_text'].'
'; if (is_numeric($_GET['value'])) { @@ -3745,7 +3752,7 @@ class SurveyUtil { echo ''; // survey_id echo ''; - echo ''; + echo ''; // X axis echo get_lang('SelectXAxis').': '; echo '