[svn r19829] form consistency

actions
skala
Patrick Cool 17 years ago
parent 5282726f42
commit 66336e4b8b
  1. 28
      main/survey/create_new_survey.php
  2. 11
      main/survey/question.php
  3. 269
      main/survey/survey.lib.php
  4. 7
      main/survey/survey.php
  5. 3
      main/survey/survey_invite.php

@ -25,7 +25,7 @@
* @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
* @author Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modification and rewriting large parts of the code * @author Julio Montoya Armas <gugli100@gmail.com>, 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) * @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 // initiate the object
$form = new FormValidator('survey', 'post', api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.$survey_id); $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 // settting the form elements
if ($_GET['action'] == 'edit' AND isset($survey_id) AND is_numeric($survey_id)) if ($_GET['action'] == 'edit' AND isset($survey_id) AND is_numeric($survey_id))
{ {
$form->addElement('hidden', 'survey_id'); $form->addElement('hidden', 'survey_id');
} }
$survey_code = $form->addElement('text', 'survey_code', get_lang('SurveyCode'), array('size' => '40')); $survey_code = $form->addElement('text', 'survey_code', get_lang('SurveyCode'), array('size' => '40'));
if ($_GET['action'] == 'edit') { if ($_GET['action'] == 'edit') {
$survey_code->freeze(); $survey_code->freeze();
$form->applyFilter('survey_code', 'strtoupper'); $form->applyFilter('survey_code', 'strtoupper');
} }
$fck_attribute['Width'] = '100%'; $fck_attribute['Width'] = '100%';
$fck_attribute['Height'] = '200'; $fck_attribute['Height'] = '200';
@ -175,7 +177,7 @@ $fck_attribute['Height'] = '130';
//$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('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'));
/* /*
@ -205,8 +207,8 @@ if ($_GET['action'] == 'add')
} }
if ($survey_data['survey_type']==1 || $_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')); $form->addElement('checkbox', 'shuffle', get_lang('ActivateShuffle'));
} }
@ -274,9 +276,9 @@ $form->addElement('style_submit_button', 'submit_survey', $text, 'class="'.$clas
// setting the rules // setting the rules
if ($_GET['action'] == 'add') if ($_GET['action'] == 'add')
{ {
$form->addRule('survey_code', '<div class="required">'.get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('survey_code', '<div class="required">'.get_lang('ThisFieldIsRequired'), 'required');
} }
$form->addRule('survey_title', '<div class="required">'.get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('survey_title', '<div class="required">'.get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('start_date', get_lang('InvalidDate'), 'date'); $form->addRule('start_date', get_lang('InvalidDate'), 'date');
$form->addRule('end_date', get_lang('InvalidDate'), 'date'); $form->addRule('end_date', get_lang('InvalidDate'), 'date');

@ -23,7 +23,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: 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 // name of the language file that needs to be included
@ -90,10 +90,15 @@ if ($_GET['action'] == 'edit') {
// the possible question types // the possible question types
$possible_types = array('personality','yesno', 'multiplechoice', 'multipleresponse', 'open', 'dropdown', 'comment', 'pagebreak', 'percentage', 'score'); $possible_types = array('personality','yesno', 'multiplechoice', 'multipleresponse', 'open', 'dropdown', 'comment', 'pagebreak', 'percentage', 'score');
// actions
$actions = '<div class="actions">';
$actions .= '<a href="survey.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'">'.Display::return_icon('back.png').get_lang('BackToSurvey').'</a>';
$actions .= '</div>';
// checking if it is a valid type // checking if it is a valid type
if (!in_array($_GET['type'], $possible_types)) if (!in_array($_GET['type'], $possible_types))
{ {
Display :: display_header($tool_name,'Survey'); Display :: display_header($tool_name,'Survey');
echo $actions;
Display :: display_error_message(get_lang('TypeDoesNotExist'), false); Display :: display_error_message(get_lang('TypeDoesNotExist'), false);
Display :: display_footer(); Display :: display_footer();
} }
@ -103,6 +108,7 @@ if (empty($_POST['save_question']) && in_array($_GET['type'],$possible_types)) {
if (!isset($_POST['save_question'])) { if (!isset($_POST['save_question'])) {
// Displaying the header // Displaying the header
Display::display_header($tool_name,'Survey'); Display::display_header($tool_name,'Survey');
echo $actions;
$error_message=''; $error_message='';
// Displys message if exists // Displys message if exists
if (isset($_SESSION['temp_sys_message'])) { 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); Display::display_error_message(get_lang($error_message), true);
} }
} }
echo '<img src="../img/'.survey_manager::icon_question($_GET['type']).'" alt="'.get_lang(ucfirst($_GET['type'])).'" title="'.get_lang(ucfirst($_GET['type'])).'" /><br />';
echo get_lang(ucfirst($_GET['type']));
} }
$form = new $_GET['type']; $form = new $_GET['type'];

@ -24,7 +24,7 @@
* @package dokeos.survey * @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 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 @author Julio Montoya Armas <gugli100@gmail.com>, 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 move this file to inc/lib
* @todo use consistent naming for the functions (save vs store for instance) * @todo use consistent naming for the functions (save vs store for instance)
@ -1329,23 +1329,39 @@ class question
{ {
global $fck_attribute; global $fck_attribute;
global $survey_data; global $survey_data;
$this->html = '<form id="question_form" name="question_form" method="post" action="'.api_get_self().'?action='.$_GET['action'].'&type='.$_GET['type'].'&survey_id='.$_GET['survey_id'].'&question_id='.$_GET['question_id'].'">';
//$tool_name = '<img src="../img/'.survey_manager::icon_question($_GET['type']).'" alt="'.get_lang(ucfirst($_GET['type'])).'" title="'.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 .= '<div class="row"><div class="form_header">'.$tool_name.'</div></div>';
$this->html .= '<form id="question_form" name="question_form" method="post" action="'.api_get_self().'?action='.$_GET['action'].'&type='.$_GET['type'].'&survey_id='.$_GET['survey_id'].'&question_id='.$_GET['question_id'].'">';
$this->html .= ' <input type="hidden" name="survey_id" id="survey_id" value="'.$_GET['survey_id'].'"/>'; $this->html .= ' <input type="hidden" name="survey_id" id="survey_id" value="'.$_GET['survey_id'].'"/>';
$this->html .= ' <input type="hidden" name="question_id" id="question_id" value="'.$_GET['question_id'].'"/>'; $this->html .= ' <input type="hidden" name="question_id" id="question_id" value="'.$_GET['question_id'].'"/>';
$this->html .= ' <input type="hidden" name="shared_question_id" id="shared_question_id" value="'.$form_content['shared_question_id'].'"/>'; $this->html .= ' <input type="hidden" name="shared_question_id" id="shared_question_id" value="'.$form_content['shared_question_id'].'"/>';
$this->html .= ' <input type="hidden" name="type" id="type" value="'.$_GET['type'].'"/>'; $this->html .= ' <input type="hidden" name="type" id="type" value="'.$_GET['type'].'"/>';
$this->html .= '<table>';
$this->html .= ' <tr>'; // question field
$this->html .= ' <td colspan="3"><strong>'.get_lang('Question').'</strong></td>';
$this->html .= ' </tr>';
$this->html .= ' <tr>';
//$this->html .= ' <td><label for="question">'.get_lang('Question').'</label></td>';
$fck_attribute['Width'] = '100%'; $fck_attribute['Width'] = '100%';
$fck_attribute['Height'] = '100'; $fck_attribute['Height'] = '100';
$fck_attribute['ToolbarSet'] = 'Survey'; $fck_attribute['ToolbarSet'] = 'Survey';
//$this->html .= ' <td><input type="text" name="question" id="question" value="'.$form_content['question'].'"/></td>'; $this->html .= ' <div class="row">';
$this->html .= ' <td colspan="3" width="550">'.api_return_html_area('question', html_entity_decode(stripslashes($form_content['question']))).'</td>'; $this->html .= ' <div class="label">';
$this->html .= ' </tr>'; $this->html .= ' <span class="form_required">*</span> '.get_lang('Question');
$this->html .= ' </div>';
$this->html .= ' <div class="formw">';
$this->html .= api_return_html_area('question', html_entity_decode(stripslashes($form_content['question'])));
$this->html .= ' </div>';
$this->html .= ' </div>';
/* /*
$this->html .= ' <tr>'; $this->html .= ' <tr>';
$this->html .= ' <td><label for="question_comment">'.get_lang('QuestionComment').'</label></td>'; $this->html .= ' <td><label for="question_comment">'.get_lang('QuestionComment').'</label></td>';
@ -1354,6 +1370,8 @@ class question
$this->html .= ' </tr>'; $this->html .= ' </tr>';
*/ */
$this->html .= '<table>';
$this->html .=' <tr><td colspan="">&nbsp;</td></tr>'; $this->html .=' <tr><td colspan="">&nbsp;</td></tr>';
if($survey_data['survey_type']==1) if($survey_data['survey_type']==1)
@ -1413,12 +1431,16 @@ class question
$class="add"; $class="add";
$text=get_lang('CreateQuestionSurvey'); $text=get_lang('CreateQuestionSurvey');
} }
$this->html .= ' <tr>';
$this->html .= ' <td>&nbsp;</td>'; $this->html .= ' <div class="row">';
$this->html .= ' <td><button class="'.$class.'"type="submit" name="save_question">'.$text.'</button></td>'; $this->html .= ' <div class="label">';
$this->html .= ' <td>&nbsp;</td>'; $this->html .= ' </div>';
$this->html .= ' </tr>'; $this->html .= ' <div class="formw">';
$this->html .= '</table>'; $this->html .= ' <button class="'.$class.'"type="submit" name="save_question">'.$text.'</button>';
$this->html .= ' </div>';
$this->html .= ' </div>';
$this->html .= '</form>'; $this->html .= '</form>';
echo $this->html; echo $this->html;
} }
@ -1579,13 +1601,12 @@ class yesno extends question
{ {
$this->html = parent::create_form($form_content); $this->html = parent::create_form($form_content);
// Horizontal or vertical // Horizontal or vertical
$this->html .= ' <tr>'; $this->html .= ' <div class="row">';
$this->html .= ' <td colspan="2"><strong>'.get_lang('DisplayAnswersHorVert').'</strong></td>'; $this->html .= ' <div class="label">';
$this->html .= ' </tr>'; $this->html .= get_lang('DisplayAnswersHorVert');
$this->html .= ' <tr>'; $this->html .= ' </div>';
$this->html .= ' <td align="right" valign="top">&nbsp;</td>'; $this->html .= ' <div class="formw">';
$this->html .= ' <td>'; $this->html .= ' <input name="horizontalvertical" type="radio" value="horizontal" ';
$this->html .= ' <input name="horizontalvertical" type="radio" value="horizontal" checked="cheked" ';
if ($form_content['horizontalvertical'] == 'horizontal') if ($form_content['horizontalvertical'] == 'horizontal')
{ {
$this->html .= 'checked="checked"'; $this->html .= 'checked="checked"';
@ -1597,17 +1618,17 @@ class yesno extends question
$this->html .= 'checked="checked"'; $this->html .= 'checked="checked"';
} }
$this->html .= ' />'.get_lang('Vertical').'</label>'; $this->html .= ' />'.get_lang('Vertical').'</label>';
$this->html .= ' </td>'; $this->html .= ' </div>';
$this->html .= ' <td>&nbsp;</td>'; $this->html .= ' </div>';
$this->html .= ' </tr>';
$this->html .=' <tr>
<td colspan="">&nbsp;</td>
</tr>';
// The options // The options
$this->html .= ' <tr>'; $this->html .= ' <div class="row">';
$this->html .= ' <td colspan="3"><strong>'.get_lang('AnswerOptions').'</strong></td>'; $this->html .= ' <div class="label">';
$this->html .= ' </tr>'; $this->html .= get_lang('AnswerOptions');
$this->html .= ' </div>';
$this->html .= ' <div class="formw">';
$this->html .= ' <table style="margin-left: 185px;">';
$this->html .= ' <tr>'; $this->html .= ' <tr>';
$this->html .= ' <td align="right"><label for="answers[0]">1</label></td>'; $this->html .= ' <td align="right"><label for="answers[0]">1</label></td>';
//$this->html .= ' <td><input type="text" name="answers[0]" id="answers[0]" value="'.$form_content['answers'][0].'" /></td>'; //$this->html .= ' <td><input type="text" name="answers[0]" id="answers[0]" value="'.$form_content['answers'][0].'" /></td>';
@ -1620,6 +1641,11 @@ class yesno extends question
$this->html .= ' <td width="550">'.api_return_html_area('answers[1]', stripslashes($form_content['answers'][1])).'</td>'; $this->html .= ' <td width="550">'.api_return_html_area('answers[1]', stripslashes($form_content['answers'][1])).'</td>';
$this->html .= ' <td><input type="image" src="../img/up.gif" value="move_up[1]" name="move_up[1]" /></td>'; $this->html .= ' <td><input type="image" src="../img/up.gif" value="move_up[1]" name="move_up[1]" /></td>';
$this->html .= ' </tr>'; $this->html .= ' </tr>';
$this->html .= ' </table>';
$this->html .= ' </div>';
$this->html .= ' </div>';
} }
/** /**
@ -1672,14 +1698,13 @@ class multiplechoice extends question
function create_form($form_content) function create_form($form_content)
{ {
$this->html = parent::create_form($form_content); $this->html = parent::create_form($form_content);
$this->html .= ' <tr>';
$this->html .= ' <td colspan="2"><strong>'.get_lang('DisplayAnswersHorVert').'</strong></td>';
$this->html .= ' </tr>';
// Horizontal or vertical // Horizontal or vertical
$this->html .= ' <tr>'; $this->html .= ' <div class="row">';
$this->html .= ' <td align="right" valign="top">&nbsp;</td>'; $this->html .= ' <div class="label">';
$this->html .= ' <td>'; $this->html .= get_lang('DisplayAnswersHorVert');
$this->html .= ' <input name="horizontalvertical" type="radio" value="horizontal" checked="cheked" '; $this->html .= ' </div>';
$this->html .= ' <div class="formw">';
$this->html .= ' <input name="horizontalvertical" type="radio" value="horizontal" ';
if ($form_content['horizontalvertical'] == 'horizontal') if ($form_content['horizontalvertical'] == 'horizontal')
{ {
$this->html .= 'checked="checked"'; $this->html .= 'checked="checked"';
@ -1690,18 +1715,18 @@ class multiplechoice extends question
{ {
$this->html .= 'checked="checked"'; $this->html .= 'checked="checked"';
} }
$this->html .= ' />'.get_lang('Vertical').'</label>'; $this->html .= ' </td>'; $this->html .= ' />'.get_lang('Vertical').'</label>';
$this->html .= ' <td>&nbsp;</td>'; $this->html .= ' </div>';
$this->html .= ' </tr>'; $this->html .= ' </div>';
$this->html .=' <tr>
<td colspan="">&nbsp;</td>
</tr>';
// The Options // The Options
$this->html .= ' <tr>'; $this->html .= ' <div class="row">';
$this->html .= ' <td colspan="3"><strong>'.get_lang('AnswerOptions').'</strong></td>'; $this->html .= ' <div class="label">';
$this->html .= ' </tr>'; $this->html .= get_lang('AnswerOptions');
$this->html .= ' </div>';
$this->html .= ' <div class="formw">';
$total_number_of_answers = count($form_content['answers']); $total_number_of_answers = count($form_content['answers']);
$this->html .= ' <table style="margin-left: 185px;">';
foreach ($form_content['answers'] as $key=>$value) foreach ($form_content['answers'] as $key=>$value)
{ {
$this->html .= ' <tr>'; $this->html .= ' <tr>';
@ -1726,6 +1751,10 @@ class multiplechoice extends question
} }
// The buttons for adding or removing // The buttons for adding or removing
$this->html .= parent :: add_remove_buttons($form_content); $this->html .= parent :: add_remove_buttons($form_content);
$this->html .= ' </table>';
$this->html .= ' </div>';
$this->html .= ' </div>';
} }
/** /**
@ -1764,7 +1793,7 @@ class personality extends question
$this->html .= ' <tr>'; $this->html .= ' <tr>';
$this->html .= ' <td align="right" valign="top">&nbsp;</td>'; $this->html .= ' <td align="right" valign="top">&nbsp;</td>';
$this->html .= ' <td>'; $this->html .= ' <td>';
$this->html .= ' <input name="horizontalvertical" type="radio" value="horizontal" checked="cheked" '; $this->html .= ' <input name="horizontalvertical" type="radio" value="horizontal" ';
if ($form_content['horizontalvertical'] == 'horizontal') if ($form_content['horizontalvertical'] == 'horizontal')
{ {
@ -1865,14 +1894,13 @@ class multipleresponse extends question
function create_form($form_content) function create_form($form_content)
{ {
$this->html = parent::create_form($form_content); $this->html = parent::create_form($form_content);
$this->html .= ' <tr>';
$this->html .= ' <td colspan="2"><strong>'.get_lang('DisplayAnswersHorVert').'</strong></td>';
$this->html .= ' </tr>';
// Horizontal or vertical // Horizontal or vertical
$this->html .= ' <tr>'; $this->html .= ' <div class="row">';
$this->html .= ' <td align="right" valign="top">&nbsp;</td>'; $this->html .= ' <div class="label">';
$this->html .= ' <td>'; $this->html .= get_lang('DisplayAnswersHorVert');
$this->html .= ' <input name="horizontalvertical" type="radio" value="horizontal" checked="cheked" '; $this->html .= ' </div>';
$this->html .= ' <div class="formw">';
$this->html .= ' <input name="horizontalvertical" type="radio" value="horizontal" ';
if ($form_content['horizontalvertical'] == 'horizontal') if ($form_content['horizontalvertical'] == 'horizontal')
{ {
$this->html .= 'checked="checked"'; $this->html .= 'checked="checked"';
@ -1883,19 +1911,19 @@ class multipleresponse extends question
{ {
$this->html .= 'checked="checked"'; $this->html .= 'checked="checked"';
} }
$this->html .= ' />'.get_lang('Vertical').'</label>'; $this->html .= ' </td>'; $this->html .= ' />'.get_lang('Vertical').'</label>';
$this->html .= ' <td>&nbsp;</td>'; $this->html .= ' </div>';
$this->html .= ' </tr>'; $this->html .= ' </div>';
$this->html .=' <tr>
<td colspan="">&nbsp;</td>
</tr>';
// The options // The options
$this->html .= ' <tr>'; $this->html .= ' <div class="row">';
$this->html .= ' <td colspan="3"><strong>'.get_lang('AnswerOptions').'</strong></td>'; $this->html .= ' <div class="label">';
$this->html .= ' </tr>'; $this->html .= get_lang('AnswerOptions');
$this->html .= ' </div>';
$this->html .= ' <div class="formw">';
$total_number_of_answers = count($form_content['answers']); $total_number_of_answers = count($form_content['answers']);
$this->html .= ' <table style="margin-left: 185px;">';
foreach ($form_content['answers'] as $key=>$value) foreach ($form_content['answers'] as $key=>$value)
{ {
$this->html .= ' <tr>'; $this->html .= ' <tr>';
@ -1920,6 +1948,9 @@ class multipleresponse extends question
} }
// The buttons for adding or removing // The buttons for adding or removing
$this->html .= parent :: add_remove_buttons($form_content); $this->html .= parent :: add_remove_buttons($form_content);
$this->html .= ' </table>';
$this->html .= ' </div>';
$this->html .= ' </div>';
} }
/** /**
@ -1972,10 +2003,13 @@ class dropdown extends question
{ {
$this->html = parent::create_form($form_content); $this->html = parent::create_form($form_content);
// The answers // The answers
$this->html .= ' <tr>'; $this->html .= ' <div class="row">';
$this->html .= ' <td colspan="3"><strong>'.get_lang('AnswerOptions').'</strong></td>'; $this->html .= ' <div class="label">';
$this->html .= ' </tr>'; $this->html .= get_lang('AnswerOptions');
$this->html .= ' </div>';
$this->html .= ' <div class="formw">';
$total_number_of_answers = count($form_content['answers']); $total_number_of_answers = count($form_content['answers']);
$this->html .= ' <table style="margin-left: 185px;">';
foreach ($form_content['answers'] as $key=>$value) foreach ($form_content['answers'] as $key=>$value)
{ {
$this->html .= ' <tr>'; $this->html .= ' <tr>';
@ -1999,6 +2033,9 @@ class dropdown extends question
} }
// The buttons for adding or removing // The buttons for adding or removing
$this->html .= parent :: add_remove_buttons($form_content); $this->html .= parent :: add_remove_buttons($form_content);
$this->html .= ' </table>';
$this->html .= ' </div>';
$this->html .= ' </div>';
} }
/** /**
@ -2174,17 +2211,24 @@ class score extends question
{ {
$this->html = parent::create_form($form_content); $this->html = parent::create_form($form_content);
// the maximum score that can be given // the maximum score that can be given
$this->html .= ' <tr>'; $this->html .= ' <div class="row">';
$this->html .= ' <td colspan="3"><strong>'.get_lang('MaximumScore').'</strong></td>'; $this->html .= ' <div class="label">';
$this->html .= ' </tr>'; $this->html .= ' <span class="form_required">*</span>'.get_lang('MaximumScore');
$this->html .= ' <tr> $this->html .= ' </div>';
<td colspan="3"><input type="text" name="maximum_score" value="'.$form_content['maximum_score'].'"></td> $this->html .= ' <div class="formw">';
</tr>'; $this->html .= ' <input type="text" name="maximum_score" value="'.$form_content['maximum_score'].'">';
$this->html .= ' </div>';
$this->html .= ' </div>';
// The answers // The answers
$this->html .= ' <tr>'; $this->html .= ' <div class="row">';
$this->html .= ' <td colspan="3"><strong>'.get_lang('AnswerOptions').'</strong></td>'; $this->html .= ' <div class="label">';
$this->html .= ' </tr>'; $this->html .= get_lang('AnswerOptions');
$this->html .= ' </div>';
$this->html .= ' <div class="formw">';
$total_number_of_answers = count($form_content['answers']); $total_number_of_answers = count($form_content['answers']);
$this->html .= ' <table style="margin-left: 185px;">';
foreach ($form_content['answers'] as $key=>$value) foreach ($form_content['answers'] as $key=>$value)
{ {
$this->html .= ' <tr>'; $this->html .= ' <tr>';
@ -2209,6 +2253,9 @@ class score extends question
} }
// The buttons for adding or removing // The buttons for adding or removing
$this->html .= parent :: add_remove_buttons($form_content); $this->html .= parent :: add_remove_buttons($form_content);
$this->html .= ' </table>';
$this->html .= ' </div>';
$this->html .= ' </div>';
} }
function render_question($form_content, $answers=array()) function render_question($form_content, $answers=array())
@ -4265,33 +4312,47 @@ class SurveyUtil {
function display_survey_search_form() function display_survey_search_form()
{ {
echo '<form method="get" action="survey_list.php?search=advanced">'; echo '<form method="get" action="survey_list.php?search=advanced">';
echo '<table> echo '<div class="row"><div class="form_header">'.get_lang('SearchASurvey').'</div></div>';
<tr> echo ' <div class="row">
<td>'.get_lang('Title').'</td> <div class="label">
<td><input type="text" name="keyword_title"/></td> '.get_lang('Title').'
</tr> </div>
<tr> <div class="formw">
<td>'.get_lang('Code').'</td> <input type="text" name="keyword_title"/>
<td><input type="text" name="keyword_code"/></td> </div>
</tr> </div>';
<tr> echo ' <div class="row">
<td>'.get_lang('Language').'</td> <div class="label">
<td> '.get_lang('Code').'
<select name="keyword_language"><option value="%">'.get_lang('All').'</option>'; </div>
<div class="formw">
<input type="text" name="keyword_code"/>
</div>
</div>';
echo ' <div class="row">
<div class="label">
'.get_lang('Language').'
</div>
<div class="formw">';
echo ' <select name="keyword_language"><option value="%">'.get_lang('All').'</option>';
$languages = api_get_languages(); $languages = api_get_languages();
foreach ($languages['name'] as $index => $name) foreach ($languages['name'] as $index => $name)
{ {
echo '<option value="'.$languages['folder'][$index].'">'.$name.'</option>'; echo ' <option value="'.$languages['folder'][$index].'">'.$name.'</option>';
} }
echo ' </select> echo ' </select>';
</td> echo ' </div>
</tr> </div>';
<tr> echo '<input type="hidden" name="cidReq" value="'.api_get_course_id().'"/>';
<td>&nbsp;<input type="hidden" name="cidReq" value="'.api_get_course_id().'"/></td> echo ' <div class="row">
<td><button class="search" type="submit" name="do_search">'.get_lang('Search').'</button></td> <div class="label">
</tr> </div>
</table> <div class="formw">
</form>'; <button class="search" type="submit" name="do_search">'.get_lang('Search').'</button>
</div>
</div>';
echo '</form>';
echo '<div style="clear: both;margin-bottom: 10px;"></div>';
} }
/** /**
@ -4388,7 +4449,7 @@ class SurveyUtil {
{ {
$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="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().'&amp;action=delete&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("DeleteSurvey").'?',ENT_QUOTES,$charset)).'\')) 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").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
$return .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=empty&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("EmptySurvey").'?')).'\')) return false;">'.Display::return_icon('empty.gif', get_lang('EmptySurvey')).'</a>'; $return .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=empty&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("EmptySurvey").'?')).'\')) return false;">'.Display::return_icon('clean_group.gif', get_lang('EmptySurvey')).'</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>';
@ -4409,7 +4470,7 @@ class SurveyUtil {
//$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().'&amp;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().'&amp;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="survey_list.php?'.api_get_cidreq().'&amp;action=empty&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("EmptySurvey").'?')).'\')) return false;">'.Display::return_icon('empty.gif', get_lang('EmptySurvey')).'</a>'; $return .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=empty&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("EmptySurvey").'?')).'\')) return false;">'.Display::return_icon('clean_group.gif', get_lang('EmptySurvey')).'</a>';
//$return .= '<a href="reporting.php?'.api_get_cidreq().'&amp;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;
} }

@ -1,4 +1,4 @@
<?php // $Id: survey.php 19606 2009-04-07 17:53:13Z iflorespaz $ <?php // $Id: survey.php 19829 2009-04-17 13:49:47Z pcool $
/* /*
============================================================================== ==============================================================================
Dokeos - elearning and course management software Dokeos - elearning and course management software
@ -23,7 +23,7 @@
* @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 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 * @todo use quickforms for the forms
*/ */
@ -141,8 +141,7 @@ if(!empty($survey_data['survey_version'])) echo '<b>'.get_lang('Version').': '.$
SurveyUtil::check_first_last_question($_GET['survey_id']); SurveyUtil::check_first_last_question($_GET['survey_id']);
// Action links // 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')).' '.get_lang('EditSurvey').'</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')).' '.get_lang('EditSurvey').'</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").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).' '.get_lang('DeleteSurvey').'</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").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).' '.get_lang('DeleteSurvey').'</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().'&amp;survey_id='.$_GET['survey_id'].'">'.Display::return_icon('preview.gif', get_lang('Preview')).' '.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')).' '.get_lang('Preview').'</a>';

@ -111,6 +111,9 @@ if ($survey_data['invited'] > 0)
// building the form for publishing the survey // building the form for publishing the survey
$form = new FormValidator('publish_form','post', api_get_self().'?survey_id='.$survey_id); $form = new FormValidator('publish_form','post', api_get_self().'?survey_id='.$survey_id);
$form->addElement('header', '', $tool_name);
// Course users // Course users
$complete_user_list = CourseManager :: get_user_list_from_course_code($_course['id'], true, $_SESSION['id_session'], '', 'ORDER BY lastname'); $complete_user_list = CourseManager :: get_user_list_from_course_code($_course['id'], true, $_SESSION['id_session'], '', 'ORDER BY lastname');
$possible_users = array (); $possible_users = array ();

Loading…
Cancel
Save