, Ghent University: cleanup, refactoring and rewriting large parts of the code * @version $Id: question.php 19829 2009-04-17 13:49:47Z pcool $ */ // name of the language file that needs to be included $language_file = 'survey'; // including the global dokeos file require ('../inc/global.inc.php'); // including additional libraries //require_once (api_get_path(LIBRARY_PATH)."/survey.lib.php"); require_once('survey.lib.php'); /** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/ if (!api_is_allowed_to_edit(false,true)) { Display :: display_header(); Display :: display_error_message(get_lang('NotAllowed'), false); Display :: display_footer(); exit; } // Database table definitions $table_survey = Database :: get_course_table(TABLE_SURVEY); $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); $table_course = Database :: get_main_table(TABLE_MAIN_COURSE); $table_user = Database :: get_main_table(TABLE_MAIN_USER); // getting the survey information $survey_data = survey_manager::get_survey($_GET['survey_id']); if (empty($survey_data)) { Display :: display_header(get_lang('Survey')); Display :: display_error_message(get_lang('InvallidSurvey'), false); Display :: display_footer(); exit; } $urlname = substr(html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40); if (strlen(strip_tags($survey_data['title'])) > 40) { $urlname .= '...'; } if($survey_data['survey_type']==1) { $sql = 'SELECT id FROM '.Database :: get_course_table(TABLE_SURVEY_QUESTION_GROUP).' WHERE survey_id = '.(int)$_GET['survey_id'].' LIMIT 1'; $rs = api_sql_query($sql,__FILE__,__LINE__); if(Database::num_rows($rs)===0) { header('Location: survey.php?survey_id='.(int)$_GET['survey_id'].'&message='.'YouNeedToCreateGroups'); exit; } } // breadcrumbs $interbreadcrumb[] = array ("url" => 'survey_list.php', 'name' => get_lang('SurveyList')); $interbreadcrumb[] = array ("url" => 'survey.php?survey_id='.Security::remove_XSS($_GET['survey_id']), 'name' => strip_tags($urlname)); // Tool name if ($_GET['action'] == 'add') { $tool_name = get_lang('AddQuestion'); } if ($_GET['action'] == 'edit') { $tool_name = get_lang('EditQuestion'); } // the possible question types $possible_types = array('personality','yesno', 'multiplechoice', 'multipleresponse', 'open', 'dropdown', 'comment', 'pagebreak', 'percentage', 'score'); // actions $actions = '