diff --git a/main/survey/create_new_survey.php b/main/survey/create_new_survey.php index ac1646fdae..fb324a3279 100644 --- a/main/survey/create_new_survey.php +++ b/main/survey/create_new_survey.php @@ -25,7 +25,7 @@ * @author unknown, the initial survey that did not make it in 1.8 because of bad code * @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: create_new_survey.php 19254 2009-03-24 22:18:53Z cvargas1 $ +* @version $Id: create_new_survey.php 19829 2009-04-17 13:49:47Z pcool $ * * @todo only the available platform languages should be used => need an api get_languages and and api_get_available_languages (or a parameter) */ @@ -138,17 +138,19 @@ else // initiate the object $form = new FormValidator('survey', 'post', api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.$survey_id); +$form->addElement('header', '', $tool_name); + // settting the form elements if ($_GET['action'] == 'edit' AND isset($survey_id) AND is_numeric($survey_id)) { $form->addElement('hidden', 'survey_id'); -} - +} + $survey_code = $form->addElement('text', 'survey_code', get_lang('SurveyCode'), array('size' => '40')); -if ($_GET['action'] == 'edit') { - $survey_code->freeze(); - $form->applyFilter('survey_code', 'strtoupper'); -} +if ($_GET['action'] == 'edit') { + $survey_code->freeze(); + $form->applyFilter('survey_code', 'strtoupper'); +} $fck_attribute['Width'] = '100%'; $fck_attribute['Height'] = '200'; @@ -175,7 +177,7 @@ $fck_attribute['Height'] = '130'; //$form->addGroup($group, 'survey_share', get_lang('ShareSurvey'), ' '); $form->addElement('checkbox', 'anonymous', get_lang('Anonymous')); $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')); /* @@ -205,8 +207,8 @@ if ($_GET['action'] == 'add') } if ($survey_data['survey_type']==1 || $_GET['action'] == 'add' ) -{ - $form->addElement('checkbox', 'one_question_per_page', get_lang('OneQuestionPerPage')); +{ + $form->addElement('checkbox', 'one_question_per_page', get_lang('OneQuestionPerPage')); $form->addElement('checkbox', 'shuffle', get_lang('ActivateShuffle')); } @@ -274,9 +276,9 @@ $form->addElement('style_submit_button', 'submit_survey', $text, 'class="'.$clas // setting the rules if ($_GET['action'] == 'add') -{ - $form->addRule('survey_code', '
'.get_lang('ThisFieldIsRequired'), 'required'); -} +{ + $form->addRule('survey_code', '
'.get_lang('ThisFieldIsRequired'), 'required'); +} $form->addRule('survey_title', '
'.get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('start_date', get_lang('InvalidDate'), 'date'); $form->addRule('end_date', get_lang('InvalidDate'), 'date'); diff --git a/main/survey/question.php b/main/survey/question.php index 968ae854bd..dad494966e 100644 --- a/main/survey/question.php +++ b/main/survey/question.php @@ -23,7 +23,7 @@ * @package dokeos.survey * @author unknown, the initial survey that did not make it in 1.8 because of bad code * @author Patrick Cool , Ghent University: cleanup, refactoring and rewriting large parts of the code -* @version $Id: question.php 19004 2009-03-12 18:04:08Z juliomontoya $ +* @version $Id: question.php 19829 2009-04-17 13:49:47Z pcool $ */ // name of the language file that needs to be included @@ -90,10 +90,15 @@ if ($_GET['action'] == 'edit') { // the possible question types $possible_types = array('personality','yesno', 'multiplechoice', 'multipleresponse', 'open', 'dropdown', 'comment', 'pagebreak', 'percentage', 'score'); +// actions +$actions = ''; // checking if it is a valid type if (!in_array($_GET['type'], $possible_types)) { Display :: display_header($tool_name,'Survey'); + echo $actions; Display :: display_error_message(get_lang('TypeDoesNotExist'), false); Display :: display_footer(); } @@ -103,6 +108,7 @@ if (empty($_POST['save_question']) && in_array($_GET['type'],$possible_types)) { if (!isset($_POST['save_question'])) { // Displaying the header Display::display_header($tool_name,'Survey'); + echo $actions; $error_message=''; // Displys message if exists if (isset($_SESSION['temp_sys_message'])) { @@ -112,9 +118,6 @@ if (empty($_POST['save_question']) && in_array($_GET['type'],$possible_types)) { Display::display_error_message(get_lang($error_message), true); } } - - echo ''.get_lang(ucfirst($_GET['type'])).'
'; - echo get_lang(ucfirst($_GET['type'])); } $form = new $_GET['type']; diff --git a/main/survey/survey.lib.php b/main/survey/survey.lib.php index e1264827ed..99a2c09748 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 19606 2009-04-07 17:53:13Z iflorespaz $ +* @version $Id: survey.lib.php 19829 2009-04-17 13:49:47Z pcool $ * * @todo move this file to inc/lib * @todo use consistent naming for the functions (save vs store for instance) @@ -1329,23 +1329,39 @@ class question { global $fck_attribute; global $survey_data; - $this->html = '
'; + + //$tool_name = ''.get_lang(ucfirst($_GET['type'])).''; + $tool_name = Display::return_icon(survey_manager::icon_question($_GET['type']),get_lang(ucfirst($_GET['type'])),array('align'=>'middle', 'height'=>'22px')).' '; + if ($_GET['action'] == 'add') { + $tool_name .= get_lang('AddQuestion'); + } + if ($_GET['action'] == 'edit') { + $tool_name .= get_lang('EditQuestion'); + } + $tool_name .= ': '.get_lang(ucfirst($_GET['type'])); + + $this->html .= '
'.$tool_name.'
'; + $this->html .= ''; $this->html .= ' '; $this->html .= ' '; $this->html .= ' '; $this->html .= ' '; - $this->html .= ''; - $this->html .= ' '; - $this->html .= ' '; - $this->html .= ' '; - $this->html .= ' '; - //$this->html .= ' '; + + // question field $fck_attribute['Width'] = '100%'; $fck_attribute['Height'] = '100'; $fck_attribute['ToolbarSet'] = 'Survey'; - //$this->html .= ' '; - $this->html .= ' '; - $this->html .= ' '; + $this->html .= '
'; + $this->html .= '
'; + $this->html .= ' * '.get_lang('Question'); + $this->html .= '
'; + $this->html .= '
'; + $this->html .= api_return_html_area('question', html_entity_decode(stripslashes($form_content['question']))); + $this->html .= '
'; + $this->html .= '
'; + + + /* $this->html .= ' '; $this->html .= ' '; @@ -1354,6 +1370,8 @@ class question $this->html .= ' '; */ + $this->html .= '
'.get_lang('Question').'
'.api_return_html_area('question', html_entity_decode(stripslashes($form_content['question']))).'
'; + $this->html .=' '; if($survey_data['survey_type']==1) @@ -1413,12 +1431,16 @@ class question $class="add"; $text=get_lang('CreateQuestionSurvey'); } - $this->html .= ' '; - $this->html .= ' '; - $this->html .= ' '; - $this->html .= ' '; - $this->html .= ' '; - $this->html .= '
 
  
'; + + $this->html .= '
'; + $this->html .= '
'; + $this->html .= '
'; + $this->html .= '
'; + $this->html .= ' '; + $this->html .= '
'; + $this->html .= '
'; + + $this->html .= '
'; echo $this->html; } @@ -1579,13 +1601,12 @@ class yesno extends question { $this->html = parent::create_form($form_content); // Horizontal or vertical - $this->html .= ' '; - $this->html .= ' '.get_lang('DisplayAnswersHorVert').''; - $this->html .= ' '; - $this->html .= ' '; - $this->html .= '  '; - $this->html .= ' '; - $this->html .= ' html .= '
'; + $this->html .= '
'; + $this->html .= get_lang('DisplayAnswersHorVert'); + $this->html .= '
'; + $this->html .= '
'; + $this->html .= ' html .= 'checked="checked"'; @@ -1597,17 +1618,17 @@ class yesno extends question $this->html .= 'checked="checked"'; } $this->html .= ' />'.get_lang('Vertical').''; - $this->html .= ' '; - $this->html .= '  '; - $this->html .= ' '; - $this->html .=' -   - '; + $this->html .= '
'; + $this->html .= '
'; + // The options - $this->html .= ' '; - $this->html .= ' '.get_lang('AnswerOptions').''; - $this->html .= ' '; + $this->html .= '
'; + $this->html .= '
'; + $this->html .= get_lang('AnswerOptions'); + $this->html .= '
'; + $this->html .= '
'; + $this->html .= ' '; $this->html .= ' '; $this->html .= ' '; //$this->html .= ' '; @@ -1620,6 +1641,11 @@ class yesno extends question $this->html .= ' '; $this->html .= ' '; $this->html .= ' '; + $this->html .= '
'.api_return_html_area('answers[1]', stripslashes($form_content['answers'][1])).'
'; + $this->html .= '
'; + $this->html .= '
'; + + } /** @@ -1672,14 +1698,13 @@ class multiplechoice extends question function create_form($form_content) { $this->html = parent::create_form($form_content); - $this->html .= ' '; - $this->html .= ' '.get_lang('DisplayAnswersHorVert').''; - $this->html .= ' '; // Horizontal or vertical - $this->html .= ' '; - $this->html .= '  '; - $this->html .= ' '; - $this->html .= ' html .= '
'; + $this->html .= '
'; + $this->html .= get_lang('DisplayAnswersHorVert'); + $this->html .= '
'; + $this->html .= '
'; + $this->html .= ' html .= 'checked="checked"'; @@ -1690,18 +1715,18 @@ class multiplechoice extends question { $this->html .= 'checked="checked"'; } - $this->html .= ' />'.get_lang('Vertical').''; $this->html .= ' '; - $this->html .= '  '; - $this->html .= ' '; - $this->html .=' -   - '; + $this->html .= ' />'.get_lang('Vertical').''; + $this->html .= '
'; + $this->html .= '
'; // The Options - $this->html .= ' '; - $this->html .= ' '.get_lang('AnswerOptions').''; - $this->html .= ' '; + $this->html .= '
'; + $this->html .= '
'; + $this->html .= get_lang('AnswerOptions'); + $this->html .= '
'; + $this->html .= '
'; $total_number_of_answers = count($form_content['answers']); + $this->html .= ' '; foreach ($form_content['answers'] as $key=>$value) { $this->html .= ' '; @@ -1726,6 +1751,10 @@ class multiplechoice extends question } // The buttons for adding or removing $this->html .= parent :: add_remove_buttons($form_content); + $this->html .= '
'; + $this->html .= '
'; + $this->html .= '
'; + } /** @@ -1764,7 +1793,7 @@ class personality extends question $this->html .= ' '; $this->html .= '  '; $this->html .= ' '; - $this->html .= ' html .= ' html = parent::create_form($form_content); - $this->html .= ' '; - $this->html .= ' '.get_lang('DisplayAnswersHorVert').''; - $this->html .= ' '; // Horizontal or vertical - $this->html .= ' '; - $this->html .= '  '; - $this->html .= ' '; - $this->html .= ' html .= '
'; + $this->html .= '
'; + $this->html .= get_lang('DisplayAnswersHorVert'); + $this->html .= '
'; + $this->html .= '
'; + $this->html .= ' html .= 'checked="checked"'; @@ -1883,19 +1911,19 @@ class multipleresponse extends question { $this->html .= 'checked="checked"'; } - $this->html .= ' />'.get_lang('Vertical').''; $this->html .= ' '; - $this->html .= '  '; - $this->html .= ' '; - $this->html .=' -   - '; + $this->html .= ' />'.get_lang('Vertical').''; + $this->html .= '
'; + $this->html .= '
'; // The options - $this->html .= ' '; - $this->html .= ' '.get_lang('AnswerOptions').''; - $this->html .= ' '; + $this->html .= '
'; + $this->html .= '
'; + $this->html .= get_lang('AnswerOptions'); + $this->html .= '
'; + $this->html .= '
'; $total_number_of_answers = count($form_content['answers']); + $this->html .= ' '; foreach ($form_content['answers'] as $key=>$value) { $this->html .= ' '; @@ -1920,6 +1948,9 @@ class multipleresponse extends question } // The buttons for adding or removing $this->html .= parent :: add_remove_buttons($form_content); + $this->html .= '
'; + $this->html .= '
'; + $this->html .= '
'; } /** @@ -1972,10 +2003,13 @@ class dropdown extends question { $this->html = parent::create_form($form_content); // The answers - $this->html .= ' '; - $this->html .= ' '.get_lang('AnswerOptions').''; - $this->html .= ' '; + $this->html .= '
'; + $this->html .= '
'; + $this->html .= get_lang('AnswerOptions'); + $this->html .= '
'; + $this->html .= '
'; $total_number_of_answers = count($form_content['answers']); + $this->html .= ' '; foreach ($form_content['answers'] as $key=>$value) { $this->html .= ' '; @@ -1999,6 +2033,9 @@ class dropdown extends question } // The buttons for adding or removing $this->html .= parent :: add_remove_buttons($form_content); + $this->html .= '
'; + $this->html .= '
'; + $this->html .= '
'; } /** @@ -2174,17 +2211,24 @@ class score extends question { $this->html = parent::create_form($form_content); // the maximum score that can be given - $this->html .= ' '; - $this->html .= ' '.get_lang('MaximumScore').''; - $this->html .= ' '; - $this->html .= ' - - '; + $this->html .= '
'; + $this->html .= '
'; + $this->html .= ' *'.get_lang('MaximumScore'); + $this->html .= '
'; + $this->html .= '
'; + $this->html .= ' '; + $this->html .= '
'; + $this->html .= '
'; + + // The answers - $this->html .= ' '; - $this->html .= ' '.get_lang('AnswerOptions').''; - $this->html .= ' '; + $this->html .= '
'; + $this->html .= '
'; + $this->html .= get_lang('AnswerOptions'); + $this->html .= '
'; + $this->html .= '
'; $total_number_of_answers = count($form_content['answers']); + $this->html .= ' '; foreach ($form_content['answers'] as $key=>$value) { $this->html .= ' '; @@ -2209,6 +2253,9 @@ class score extends question } // The buttons for adding or removing $this->html .= parent :: add_remove_buttons($form_content); + $this->html .= '
'; + $this->html .= '
'; + $this->html .= '
'; } function render_question($form_content, $answers=array()) @@ -4265,33 +4312,47 @@ class SurveyUtil { function display_survey_search_form() { echo '
'; - echo ' - - - - - - - - - - - - - - - - -
'.get_lang('Title').'
'.get_lang('Code').'
'.get_lang('Language').' - + + '; + echo '
+
+ '.get_lang('Code').' +
+
+ +
+
'; + echo '
+
+ '.get_lang('Language').' +
+
'; + echo ' -
 
-
'; + echo ' '; + } + echo ' '; + echo '
+
'; + echo ''; + echo '
+
+
+
+ +
+
'; + echo ''; + echo '
'; } /** @@ -4388,7 +4449,7 @@ class SurveyUtil { { $return .= ''.Display::return_icon('edit.gif', get_lang('Edit')).''; $return .= ''.Display::return_icon('delete.gif', get_lang('Delete')).''; - $return .= ''.Display::return_icon('empty.gif', get_lang('EmptySurvey')).''; + $return .= ''.Display::return_icon('clean_group.gif', get_lang('EmptySurvey')).''; } //$return .= ''.Display::return_icon('copy.gif', get_lang('Copy')).''; //$return .= ''.Display::return_icon('add.gif', get_lang('Add')).''; @@ -4409,7 +4470,7 @@ class SurveyUtil { //$return .= ''.Display::return_icon('add.gif', get_lang('Add')).''; $return .= ''.Display::return_icon('preview.gif', get_lang('Preview')).''; $return .= ''.Display::return_icon('survey_publish.gif', get_lang('Publish')).''; - $return .= ''.Display::return_icon('empty.gif', get_lang('EmptySurvey')).''; + $return .= ''.Display::return_icon('clean_group.gif', get_lang('EmptySurvey')).''; //$return .= ''.Display::return_icon('statistics.gif', get_lang('Reporting')).''; return $return; } diff --git a/main/survey/survey.php b/main/survey/survey.php index 822a877065..970f18e5e8 100644 --- a/main/survey/survey.php +++ b/main/survey/survey.php @@ -1,4 +1,4 @@ -, Ghent University: cleanup, refactoring and rewriting large parts of the code -* @version $Id: survey.php 19606 2009-04-07 17:53:13Z iflorespaz $ +* @version $Id: survey.php 19829 2009-04-17 13:49:47Z pcool $ * * @todo use quickforms for the forms */ @@ -141,8 +141,7 @@ if(!empty($survey_data['survey_version'])) echo ''.get_lang('Version').': '.$ SurveyUtil::check_first_last_question($_GET['survey_id']); // Action links -$survey_actions = get_lang('Survey').': '; -$survey_actions .= ''.Display::return_icon('edit.gif', get_lang('Edit')).' '.get_lang('EditSurvey').''; +$survey_actions = ''.Display::return_icon('edit.gif', get_lang('Edit')).' '.get_lang('EditSurvey').''; $survey_actions .= ''.Display::return_icon('delete.gif', get_lang('Delete')).' '.get_lang('DeleteSurvey').''; //$survey_actions .= ''.Display::return_icon('copy.gif', get_lang('Copy')).''; $survey_actions .= ''.Display::return_icon('preview.gif', get_lang('Preview')).' '.get_lang('Preview').''; diff --git a/main/survey/survey_invite.php b/main/survey/survey_invite.php index d8d23eb978..153ed08c7f 100644 --- a/main/survey/survey_invite.php +++ b/main/survey/survey_invite.php @@ -111,6 +111,9 @@ if ($survey_data['invited'] > 0) // building the form for publishing the survey $form = new FormValidator('publish_form','post', api_get_self().'?survey_id='.$survey_id); + +$form->addElement('header', '', $tool_name); + // Course users $complete_user_list = CourseManager :: get_user_list_from_course_code($_course['id'], true, $_SESSION['id_session'], '', 'ORDER BY lastname'); $possible_users = array ();