, Ghent University: cleanup, refactoring and rewriting large parts of the code
* @version $Id: survey.php 11350 2007-03-02 16:02:46Z elixir_julian $
*
* @todo The ansTarget column is not done
* @todo try to understand the white, blue, ... template stuff.
* @todo use quickforms for the forms
*/
// 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');
require_once (api_get_path(LIBRARY_PATH)."/course.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())
{
Display :: display_header();
Display :: display_error_message(get_lang('NotAllowedHere'));
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);
$user_info = Database :: get_main_table(TABLE_MAIN_SURVEY_REMINDER);
// breadcrumbs
$interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('SurveyList'));
$tool_name = get_lang('Survey');
// Displaying the header
Display::display_header($tool_name);
// Action handling
if (isset($_GET['action']))
{
if (($_GET['action'] == 'moveup' OR $_GET['action'] == 'movedown') AND isset($_GET['question_id']))
{
survey_manager::move_survey_question($_GET['action'], $_GET['question_id'], $_GET['survey_id']);
Display::display_confirmation_message('SurveyQuestionMoved');
}
}
// Displaying the survey information
$survey_data = survey_manager::get_survey($_GET['survey_id']);
echo ''.$survey_data['title'].'
';
echo $survey_data['subtitle'].'
';
// Action links
$survey_actions = ''.Display::return_icon('edit.gif').'';
$survey_actions .= ''.Display::return_icon('delete.gif').'';
$survey_actions .= ''.Display::return_icon('copy.gif').'';
$survey_actions .= ''.Display::return_icon('preview.gif').'';
$survey_actions .= ''.Display::return_icon('survey_publish.gif').'';
$survey_actions .= ''.Display::return_icon('statistics.gif').'';
echo '
'.get_lang('QuestionNumber').' | '; echo ''.get_lang('Title').' | '; echo ''.get_lang('Type').' | '; echo ''.get_lang('NumberOfOptions').' | '; echo ''.get_lang('Modify').' | '; echo '
---|---|---|---|---|
'.$question_counter.' | '; echo ''.$row['survey_question'].' | '; echo ''.$row['type'].' | '; echo ''.$row['number_of_options'].' | '; echo ''; echo ' '.Display::return_icon('edit.gif').''; echo ' '.Display::return_icon('delete.gif').''; if ($question_counter > 1) { echo ' '.Display::return_icon('up.gif').''; } if ($question_counter < $question_counter_max) { echo ' '.Display::return_icon('down.gif').''; } echo ' | '; $question_counter++; } echo '