[svn r15947] Survey personality test implemented. User's form also added before the introduction.

skala
Julio Montoya 17 years ago
parent c7cd8a0f06
commit 6fdd3d13bd
  1. 4
      main/inc/lib/add_course.lib.inc.php
  2. 2
      main/install/migrate-db-1.8.5-1.8.6-pre.sql
  3. 72
      main/survey/create_new_survey.php
  4. 1167
      main/survey/fillsurvey.php
  5. 324
      main/survey/survey.lib.php
  6. 4
      main/survey/survey_list.php

@ -85,7 +85,7 @@ function generate_course_code($course_title)
{ {
//$wantedCode = strtr($course_title, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "AAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy"); //$wantedCode = strtr($course_title, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "AAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy");
//$wantedCode = substr(str_replace( //$wantedCode = substr(str_replace(
// array('<EFBFBD>?','À','Â','Ä','Ã','Å','Æ' ,'Ç','É','È','Ê','Ë','<EFBFBD>?','Ì','Î','<EFBFBD>?','Ĩ','Ó','Ò','Ô','Ö','Õ','Ø' ,'Œ' ,'Ú','Ù','Û','Ü','Ũ','Ÿ','<EFBFBD>?','<EFBFBD>?','Ñ','ß' ,'à','á','â','ä','ã','å','æ' ,'ç','Š','é','è','ê','ë','ì','í','î','ï','ĩ','ò','ó','ô','ö','õ','ø' ,'œ' ,'ú','ù','û','ü','ũ','ÿ','ý','ñ','š','€'), // array('<EFBFBD>?','À','Â','Ä','Ã','Å','Æ' ,'Ç','É','È','Ê','Ë','<EFBFBD>?','Ì','Î','<EFBFBD>?','Ĩ','Ó','Ò','Ô','Ö','Õ','Ø' ,'Œ' ,'Ú','Ù','Û','Ü','Ũ','Ÿ','<EFBFBD>?','<EFBFBD>?','Ñ','ß' ,'à','á','â','ä','ã','å','æ' ,'ç','Š','é','è','ê','ë','ì','í','î','ï','ĩ','ò','ó','ô','ö','õ','ø' ,'œ' ,'ú','ù','û','ü','ũ','ÿ','ý','ñ','š','€'),
// array('A','A','A','A','A','A','Ae','C','E','E','E','E','I','I','I','I','I','O','O','O','O','O','Oe','Oe','U','U','U','U','U','Y','Y','D','N','SS','a','a','a','a','a','a','ae','c','S','e','e','e','e','i','i','i','i','i','o','o','o','o','o','oe','oe','u','u','u','u','u','y','y','n','š','Euro'), // array('A','A','A','A','A','A','Ae','C','E','E','E','E','I','I','I','I','I','O','O','O','O','O','Oe','Oe','U','U','U','U','U','Y','Y','D','N','SS','a','a','a','a','a','a','ae','c','S','e','e','e','e','i','i','i','i','i','o','o','o','o','o','oe','oe','u','u','u','u','u','y','y','n','š','Euro'),
// $course_title) // $course_title)
// ,0,20); // ,0,20);
@ -1382,6 +1382,8 @@ function update_Db_course($courseDbName)
survey_version varchar(255) NOT NULL default '', survey_version varchar(255) NOT NULL default '',
parent_id int unsigned NOT NULL, parent_id int unsigned NOT NULL,
survey_type int NOT NULL default '0', survey_type int NOT NULL default '0',
show_form_profile int NOT NULL default '0',
form_fields TEXT NOT NULL,
PRIMARY KEY (survey_id) PRIMARY KEY (survey_id)
)"; )";

@ -41,3 +41,5 @@ ALTER TABLE survey_question ADD survey_group_sec2 int unsigned NOT NULL default
CREATE TABLE survey_group ( id int unsigned NOT NULL auto_increment, name varchar(20) NOT NULL, description varchar(255) NOT NULL, survey_id int unsigned NOT NULL, PRIMARY KEY (id) ); CREATE TABLE survey_group ( id int unsigned NOT NULL auto_increment, name varchar(20) NOT NULL, description varchar(255) NOT NULL, survey_id int unsigned NOT NULL, PRIMARY KEY (id) );
ALTER TABLE survey_question_option ADD value int NOT NULL default 0; ALTER TABLE survey_question_option ADD value int NOT NULL default 0;
UPDATE tool SET category = 'interaction' WHERE name = 'forum'; UPDATE tool SET category = 'interaction' WHERE name = 'forum';
ALTER TABLE survey ADD show_form_profile int NOT NULL default 0;
ALTER TABLE survey ADD form_fields TEXT NOT NULL;

@ -24,9 +24,10 @@
* @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 15846 2008-07-24 20:29:41Z dperales $ * @author Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modification and rewriting large parts of the code
* @version $Id: create_new_survey.php 15947 2008-08-07 16:12:49Z juliomontoya $
* *
* @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)
*/ */
// name of the language file that needs to be included // name of the language file that needs to be included
@ -78,7 +79,7 @@ if ($_GET['action'] == 'add')
$interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('SurveyList')); $interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('SurveyList'));
$tool_name = get_lang('CreateNewSurvey'); $tool_name = get_lang('CreateNewSurvey');
} }
if ($_GET['action'] == 'edit' AND is_numeric($_GET['survey_id'])) if ($_GET['action'] == 'edit' && is_numeric($_GET['survey_id']))
{ {
$interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('SurveyList')); $interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('SurveyList'));
$interbreadcrumb[] = array ("url" => "survey.php?survey_id=".$_GET['survey_id'], "name" => $urlname); $interbreadcrumb[] = array ("url" => "survey.php?survey_id=".$_GET['survey_id'], "name" => $urlname);
@ -148,7 +149,7 @@ $form->addElement('datepickerdate', 'end_date', get_lang('EndDate'), array('form
//$group=''; //$group='';
//$group[] =& HTML_QuickForm::createElement('radio', 'survey_share',null, get_lang('Yes'),$form_share_value); //$group[] =& HTML_QuickForm::createElement('radio', 'survey_share',null, get_lang('Yes'),$form_share_value);
/** @todo maybe it is better to change this into false instead see line 95 in survey.lib.php */ /** TODO maybe it is better to change this into false instead see line 95 in survey.lib.php */
//$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';
@ -159,29 +160,80 @@ $form->addElement('html_editor', 'survey_thanks', get_lang('SurveyThanks'));
$surveytypes[0] = get_lang('Normal'); $surveytypes[0] = get_lang('Normal');
$surveytypes[1] = get_lang('Conditional'); $surveytypes[1] = get_lang('Conditional');
if ($_GET['action'] == 'add'){
$form->addElement('select', 'survey_type', get_lang('SelectType'), $surveytypes);
if ($_GET['action'] == 'add')
{
$form->addElement('select', 'survey_type', get_lang('SelectType'), $surveytypes);
$sql = 'SELECT survey_id,title FROM '.$table_survey.' WHERE survey_type = 1 AND author = '.$_SESSION['_user']['user_id']; $sql = 'SELECT survey_id,title FROM '.$table_survey.' WHERE survey_type = 1 AND author = '.$_SESSION['_user']['user_id'];
$rs = api_sql_query($sql,__FILE__,__LINE__); $rs = api_sql_query($sql,__FILE__,__LINE__);
if(Database::num_rows($rs)>0){ if(Database::num_rows($rs)>0)
{
$list_surveys[0] = ''; $list_surveys[0] = '';
while($row = Database::fetch_array($rs,NUM)){ while($row = Database::fetch_array($rs,NUM))
{
$list_surveys[$row[0]] = $row[1]; $list_surveys[$row[0]] = $row[1];
} }
$form->addElement('select', 'parent_id', get_lang('ParentSurvey'), $list_surveys); $form->addElement('select', 'parent_id', get_lang('ParentSurvey'), $list_surveys);
} }
} }
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'));
} }
if ($survey_data['anonymous']==0 )
{
$form->addElement('checkbox', 'show_form_profile', get_lang('ShowFormProfile'));
}
if ($_GET['action'] == 'edit' && is_numeric($_GET['survey_id']) )
{
if ($survey_data['show_form_profile']==1 && $survey_data['anonymous']==0 )
{
$field_list=SurveyUtil::make_field_list();
if (is_array ($field_list))
{
//TODO hide and show the list in a fancy DIV
//$form->addElement('html', '<a href=javascript>'.get_lang('ViewFields').'</a> <div id="fields" style="display: none;" >');
foreach ($field_list as $key=> $field)
{
if ($field['visibility']==1)
{
$form->addElement('checkbox', 'profile_'.$key, ' ','&nbsp;&nbsp;'.$field['name'] );
$input_name_list.= 'profile_'.$key.',';
}
}
// necesary to know the fields
$form->addElement('hidden', 'input_name_list', $input_name_list );
//set defaults form fields
if ($survey_data['form_fields'])
{
$form_fields=explode('@',$survey_data['form_fields']);
foreach($form_fields as $field)
{
$field_value=explode(':',$field);
if ($field_value[0]!='' && $field_value[1]!= '')
{
$defaults[$field_value[0]]=$field_value[1];
}
}
}
//$form->addElement('html', '</div>');
}
}
}
$form->addElement('submit', 'submit_survey', get_lang('Ok')); $form->addElement('submit', 'submit_survey', get_lang('Ok'));
// 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');

File diff suppressed because it is too large Load Diff

@ -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 15884 2008-08-01 08:02:10Z yannoo $ * @version $Id: survey.lib.php 15947 2008-08-07 16:12:49Z juliomontoya $
* *
* @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)
@ -80,6 +80,10 @@ class survey_manager
$return['survey_thanks'] = $return['surveythanks']; $return['survey_thanks'] = $return['surveythanks'];
$return['survey_type'] = $return['survey_type']; $return['survey_type'] = $return['survey_type'];
$return['one_question_per_page']= $return['one_question_per_page']; $return['one_question_per_page']= $return['one_question_per_page'];
$return['show_form_profile'] = $return['show_form_profile'];
$return['input_name_list'] = $return['input_name_list'];
$return['shuffle'] = $return['shuffle']; $return['shuffle'] = $return['shuffle'];
$return['parent_id'] = $return['parent_id']; $return['parent_id'] = $return['parent_id'];
$return['survey_version'] = $return['survey_version']; $return['survey_version'] = $return['survey_version'];
@ -110,7 +114,6 @@ class survey_manager
if (!$values['survey_id'] OR !is_numeric($values['survey_id'])) if (!$values['survey_id'] OR !is_numeric($values['survey_id']))
{ {
// check if the code doesn't soon exists in this language // check if the code doesn't soon exists in this language
$sql = 'SELECT 1 FROM '.$table_survey.' WHERE code="'.Database::escape_string($values['survey_code']).'" AND lang="'.Database::escape_string($values['survey_language']).'"'; $sql = 'SELECT 1 FROM '.$table_survey.' WHERE code="'.Database::escape_string($values['survey_code']).'" AND lang="'.Database::escape_string($values['survey_language']).'"';
$rs = api_sql_query($sql, __FILE__, __LINE__); $rs = api_sql_query($sql, __FILE__, __LINE__);
@ -130,6 +133,45 @@ class survey_manager
$additional['columns'] = ''; $additional['columns'] = '';
$additional['values'] = ''; $additional['values'] = '';
if ($values['anonymous']==0)
{
// input_name_list
$additional['columns'] .= ', show_form_profile';
$additional['values'] .= ",'".Database::escape_string($values['show_form_profile'])."'";
if ($values['show_form_profile']==1)
{
// input_name_list
$fields=explode(',',$values['input_name_list']);
$field_values='';
foreach ($fields as $field )
{
if ($field!='')
{
if ($values[$field]=='')
$values[$field]=0;
$field_values.= $field.':'.$values[$field].'@';
}
}
$additional['columns'] .= ', form_fields';
$additional['values'] .= ",'".Database::escape_string($field_values)."'";
}
else
{
$additional['columns'] .= ', form_fields';
$additional['values'] .= ",''";
}
}
else
{
// input_name_list
$additional['columns'] .= ', show_form_profile';
$additional['values'] .= ",'0'";
$additional['columns'] .= ', form_fields';
$additional['values'] .= ",''";
}
if($values['survey_type']==1) if($values['survey_type']==1)
{ {
$additional['columns'] = ', survey_type'; $additional['columns'] = ', survey_type';
@ -162,7 +204,9 @@ class survey_manager
{ {
$additional['values'] .= ",'".$getversion['survey_version'].".1'"; $additional['values'] .= ",'".$getversion['survey_version'].".1'";
} }
} else { }
else
{
if(strpos($row['survey_version'], '.')===false){ if(strpos($row['survey_version'], '.')===false){
$row['survey_version'] = $row['survey_version'] + 1; $row['survey_version'] = $row['survey_version'] + 1;
$additional['values'] .= ",'".$row['survey_version']."'"; $additional['values'] .= ",'".$row['survey_version']."'";
@ -215,6 +259,37 @@ class survey_manager
$additionalsets = ", shuffle = '".Database::escape_string($values['shuffle'])."'"; $additionalsets = ", shuffle = '".Database::escape_string($values['shuffle'])."'";
$additionalsets .= ", one_question_per_page = '".Database::escape_string($values['one_question_per_page'])."'"; $additionalsets .= ", one_question_per_page = '".Database::escape_string($values['one_question_per_page'])."'";
if ($values['anonymous']==0)
{
$additionalsets .= ", show_form_profile = '".Database::escape_string($values['show_form_profile'])."'";
if ($values['show_form_profile']==1)
{
$fields=explode(',',$values['input_name_list']);
$field_values='';
foreach ($fields as $field )
{
if ($field!='')
{
if ($values[$field]=='')
$values[$field]=0;
$field_values.= $field.':'.$values[$field].'@';
}
}
$additionalsets .= ", form_fields = '".Database::escape_string($field_values)."'";
}
else
{
$additionalsets .= ", form_fields = '' ";
}
}
else
{
$additionalsets .= ", show_form_profile = '0'";
$additionalsets .= ", form_fields = '' ";
}
$sql = "UPDATE $table_survey SET $sql = "UPDATE $table_survey SET
title = '".Database::escape_string($values['survey_title'])."', title = '".Database::escape_string($values['survey_title'])."',
subtitle = '".Database::escape_string($values['survey_subtitle'])."', subtitle = '".Database::escape_string($values['survey_subtitle'])."',
@ -997,7 +1072,6 @@ class survey_manager
$counter=1; $counter=1;
if(is_array($form_content['answers'])) if(is_array($form_content['answers']))
{ {
//foreach ($form_content['answers'] as $key=>$answer) { //foreach ($form_content['answers'] as $key=>$answer) {
for ($i=0;$i<count($form_content['answers']);$i++) for ($i=0;$i<count($form_content['answers']);$i++)
{ {
@ -4362,5 +4436,247 @@ class SurveyUtil {
} }
echo '</table>'; echo '</table>';
} }
/**
* Creates a multi array with the user fields that we can show. We look the visibility with the api_get_setting function
* The username is always NOT able to change it.
* @author Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modification
* @return array[value_name][name]
* array[value_name][visibilty]
*
*/
function make_field_list()
{
// LAST NAME and FIRST NAME
$field_list_array=array();
$field_list_array['lastname']['name']=get_lang('Lastname');
$field_list_array['firstname']['name']=get_lang('Firstname');
if (api_get_setting('profile', 'name') !== 'true')
{
$field_list_array['firstname']['visibility']=0;
$field_list_array['lastname']['visibility']=0;
}
else
{
$field_list_array['firstname']['visibility']=1;
$field_list_array['lastname']['visibility']=1;
}
$field_list_array['username']['name']=get_lang('Username');
$field_list_array['username']['visibility']=0;
// OFFICIAL CODE
$field_list_array['official_code']['name']=get_lang('OfficialCode');
if (api_get_setting('profile', 'officialcode') !== 'true')
{
$field_list_array['official_code']['visibility']=1;
}
else
{
$field_list_array['official_code']['visibility']=0;
}
// EMAIL
$field_list_array['email']['name']=get_lang('Email');
if (api_get_setting('profile', 'email') !== 'true')
{
$field_list_array['email']['visibility']=1;
}
else
{
$field_list_array['email']['visibility']=0;
}
// OPENID URL
//$field_list_array[]='openid_authentication';
/*
if(is_profile_editable() && api_get_setting('openid_authentication')=='true')
{
$form->addElement('text', 'openid', get_lang('OpenIDURL'), array('size' => 40));
if (api_get_setting('profile', 'openid') !== 'true')
$form->freeze('openid');
$form->applyFilter('openid', 'trim');
//if (api_get_setting('registration', 'openid') == 'true')
// $form->addRule('openid', get_lang('ThisFieldIsRequired'), 'required');
}*/
// PHONE
$field_list_array['phone']['name']=get_lang('Phone');
if (api_get_setting('profile', 'phone') !== 'true')
{
$field_list_array['phone']['visibility']=0;
}
else
{
$field_list_array['phone']['visibility']=1;
}
// LANGUAGE
$field_list_array['language']['name']=get_lang('Language');
if (api_get_setting('profile', 'language') !== 'true')
{
$field_list_array['language']['visibility']=0;
}
else
{
$field_list_array['language']['visibility']=1;
}
// EXTRA FIELDS
$extra = UserManager::get_extra_fields(0,50,5,'ASC');
$extra_data = UserManager::get_extra_user_data(api_get_user_id(),true);
foreach($extra as $id => $field_details)
{
if($field_details[6] == 0)
{
continue;
}
switch($field_details[2])
{
case USER_FIELD_TYPE_TEXT:
$field_list_array['extra_'.$field_details[1]]['name']=$field_details[3];
if ($field_details[7] == 0)
{
$field_list_array['extra_'.$field_details[1]]['visibility']=0;
}
else
{
$field_list_array['extra_'.$field_details[1]]['visibility']=1;
}
break;
case USER_FIELD_TYPE_TEXTAREA:
$field_list_array['extra_'.$field_details[1]]['name']=$field_details[3];
if ($field_details[7] == 0)
{
$field_list_array['extra_'.$field_details[1]]['visibility']=0;
}
else
{
$field_list_array['extra_'.$field_details[1]]['visibility']=1;
}
break;
case USER_FIELD_TYPE_RADIO:
$field_list_array['extra_'.$field_details[1]]['name']=$field_details[3];
if ($field_details[7] == 0)
{
$field_list_array['extra_'.$field_details[1]]['visibility']=0;
}
else
{
$field_list_array['extra_'.$field_details[1]]['visibility']=1;
}
break;
case USER_FIELD_TYPE_SELECT:
$field_list_array['extra_'.$field_details[1]]['name']=$field_details[3];
if ($field_details[7] == 0)
{
$field_list_array['extra_'.$field_details[1]]['visibility']=0;
}
else
{
$field_list_array['extra_'.$field_details[1]]['visibility']=1;
}
break;
case USER_FIELD_TYPE_SELECT_MULTIPLE:
$field_list_array['extra_'.$field_details[1]]['name']=$field_details[3];
if ($field_details[7] == 0)
{
$field_list_array['extra_'.$field_details[1]]['visibility']=0;
}
else
{
$field_list_array['extra_'.$field_details[1]]['visibility']=1;
}
break;
case USER_FIELD_TYPE_DATE:
$field_list_array['extra_'.$field_details[1]]['name']=$field_details[3];
if ($field_details[7] == 0)
{
$field_list_array['extra_'.$field_details[1]]['visibility']=0;
}
else
{
$field_list_array['extra_'.$field_details[1]]['visibility']=1;
}
break;
case USER_FIELD_TYPE_DATETIME:
$field_list_array['extra_'.$field_details[1]]['name']=$field_details[3];
if ($field_details[7] == 0)
{
$field_list_array['extra_'.$field_details[1]]['visibility']=0;
}
else
{
$field_list_array['extra_'.$field_details[1]]['visibility']=1;
}
break;
case USER_FIELD_TYPE_DOUBLE_SELECT:
$field_list_array['extra_'.$field_details[1]]['name']=$field_details[3];
if ($field_details[7] == 0)
{
$field_list_array['extra_'.$field_details[1]]['visibility']=0;
}
else
{
$field_list_array['extra_'.$field_details[1]]['visibility']=1;
}
/*
foreach ($field_details[8] as $key=>$element)
{
if ($element[2][0] == '*')
{
$values['*'][$element[0]] = str_replace('*','',$element[2]);
}
else
{
$values[0][$element[0]] = $element[2];
}
}
$group='';
$group[] =& HTML_QuickForm::createElement('select', 'extra_'.$field_details[1],'',$values[0],'');
$group[] =& HTML_QuickForm::createElement('select', 'extra_'.$field_details[1].'*','',$values['*'],'');
$form->addGroup($group, 'extra_'.$field_details[1], $field_details[3], '&nbsp;');
if ($field_details[7] == 0) $form->freeze('extra_'.$field_details[1]);
// recoding the selected values for double : if the user has selected certain values, we have to assign them to the correct select form
if (key_exists('extra_'.$field_details[1], $extra_data))
{
// exploding all the selected values (of both select forms)
$selected_values = explode(';',$extra_data['extra_'.$field_details[1]]);
$extra_data['extra_'.$field_details[1]] =array();
// looping through the selected values and assigning the selected values to either the first or second select form
foreach ($selected_values as $key=>$selected_value)
{
if (key_exists($selected_value,$values[0]))
{
$extra_data['extra_'.$field_details[1]]['extra_'.$field_details[1]] = $selected_value;
}
else
{
$extra_data['extra_'.$field_details[1]]['extra_'.$field_details[1].'*'] = $selected_value;
}
}
}*/
break;
case USER_FIELD_TYPE_DIVIDER:
//$form->addElement('static',$field_details[1], '<br /><strong>'.$field_details[3].'</strong>');
break;
}
}
return $field_list_array;
}
} }
?> ?>

@ -25,7 +25,8 @@
* @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 15555 2008-06-11 20:39:15Z juliomontoya $ * @author Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modification and rewriting large parts of the code
* @version $Id: survey_list.php 15947 2008-08-07 16:12:49Z juliomontoya $
* *
* @todo use quickforms for the forms * @todo use quickforms for the forms
*/ */
@ -67,6 +68,7 @@ else
$tool_name = get_lang('SurveyList'); $tool_name = get_lang('SurveyList');
} }
// Header // Header
Display :: display_header($tool_name,'Survey'); Display :: display_header($tool_name,'Survey');
//api_display_tool_title($tool_name); //api_display_tool_title($tool_name);

Loading…
Cancel
Save