[svn r20345] Logic changes - Debugging and polishing survey - partial FS#4002 (by jhp1411)

skala
Cristian Fasanando 16 years ago
parent dce91b1bfb
commit b5101c561d
  1. 7
      main/survey/create_new_survey.php
  2. 17
      main/survey/fillsurvey.php
  3. 2
      main/survey/preview.php
  4. 4
      main/survey/survey.lib.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 <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
* @version $Id: create_new_survey.php 20156 2009-04-28 20:18:02Z juliomontoya $
* @version $Id: create_new_survey.php 20345 2009-05-05 21:06:43Z cfasanando $
*
* @todo only the available platform languages should be used => need an api get_languages and and api_get_available_languages (or a parameter)
*/
@ -161,12 +161,13 @@ $form->addElement('html_editor', 'survey_title', get_lang('SurveyTitle'));
$fck_attribute['Config']['ToolbarStartExpanded']='false';
$fck_attribute['Height'] = '100';
$form->addElement('html_editor', 'survey_subtitle', get_lang('SurveySubTitle'));
/*
$lang_array = api_get_languages();
foreach ($lang_array['name'] as $key=>$value)
{
foreach ($lang_array['name'] as $key=>$value) {
$languages[$lang_array['folder'][$key]] = $value;
}
$form->addElement('select', 'survey_language', get_lang('Language'), $languages);
*/
$form->addElement('datepickerdate', 'start_date', get_lang('StartDate'), array('form_name'=>'survey'));
$form->addElement('datepickerdate', 'end_date', get_lang('EndDate'), array('form_name'=>'survey'));

@ -532,20 +532,16 @@ if ($survey_data['form_fields']!='' && $survey_data['anonymous'] == 0 && is_arra
$form->setDefaults($user_data);
}
if ($survey_data['form_fields'] && $survey_data['anonymous'] == 0 && is_array($user_data) && !isset ($_GET['show']))
{
if ($form->validate())
{
if ($survey_data['form_fields'] && $survey_data['anonymous'] == 0 && is_array($user_data) && !isset ($_GET['show'])) {
if ($form->validate()) {
$user_data = $form->exportValues();
if (is_array($user_data)) {
if (count($user_data)>0) {
$extras = array ();
// build SQL query
$sql = "UPDATE $table_user SET";
foreach ($user_data as $key => $value)
{
if (substr($key, 0, 6) == 'extra_') //an extra field
{
foreach ($user_data as $key => $value) {
if (substr($key, 0, 6) == 'extra_') { //an extra field
$extras[substr($key, 6)] = $value;
} else {
$sql .= " $key = '" . Database :: escape_string($value) . "',";
@ -575,8 +571,7 @@ if ($survey_data['form_fields'] && $survey_data['anonymous'] == 0 && is_array($u
}
//elseif ($_GET['show_form']==1) // // displaying the field
else
{
else {
echo '<div id="survey_content" class="survey_content">' . get_lang('UpdateInformation') . '</div>';
//we unset the sessions
unset($_SESSION['paged_questions']);
@ -1204,7 +1199,7 @@ if ($survey_data['survey_type'] === '0')
if (($show < $numberofpages) || !$_GET['show']) //$show = $_GET['show']+1
{
//echo '<input type="submit" name="next_survey_page" value="' . get_lang('Next') . ' " class="next" />';
echo '<button type="submit" name="next_survey_page" class="next">'.get_lang('Next').'</button>';
echo '<button type="submit" name="next_survey_page" class="next">'.get_lang('NextQuestion').'</button>';
}
if ($show >= $numberofpages && $_GET['show']) {

@ -193,7 +193,7 @@ else
if (($show < $numberofpages) OR !$_GET['show'])
{
//echo '<a href="'.api_get_self().'?survey_id='.$survey_id.'&amp;show='.$limit.'">NEXT</a>';
echo '<br /><button type="submit" name="next_survey_page" class="next">'.get_lang('Next').' </button>';
echo '<br /><button type="submit" name="next_survey_page" class="next">'.get_lang('NextQuestion').' </button>';
}
if ($show >= $numberofpages AND $_GET['show'])
{

@ -24,7 +24,7 @@
* @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 Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modification and rewriting large parts of the code
* @version $Id: survey.lib.php 20327 2009-05-05 14:13:56Z juliomontoya $
* @version $Id: survey.lib.php 20345 2009-05-05 21:06:43Z cfasanando $
*
* @todo move this file to inc/lib
* @todo use consistent naming for the functions (save vs store for instance)
@ -2998,7 +2998,7 @@ class SurveyUtil {
echo '<input type="hidden" name="export_format" value="xls">';
echo '</form>';
echo '<form id="form2" name="form2" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'">';
echo '<a class="survey_export_link" href="#" onclick="document.form1a.submit();"><img align="absbottom" src="'.api_get_path(WEB_IMG_PATH).'excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>';
//echo '<a class="survey_export_link" href="#" onclick="document.form1a.submit();"><img align="absbottom" src="'.api_get_path(WEB_IMG_PATH).'excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>';
echo '<a class="survey_export_link" href="#" onclick="document.form1b.submit();"><img align="absbottom" src="'.api_get_path(WEB_IMG_PATH).'excel.gif">&nbsp;'.get_lang('ExportAsXLS').'</a>';
// the table
echo '<br /><table class="data_table" border="1">';

Loading…
Cancel
Save