From 551c600bdc986c2e1df7d7213b5e1a00255e3847 Mon Sep 17 00:00:00 2001 From: Patrick Cool Date: Mon, 29 Jan 2007 21:40:13 +0100 Subject: [PATCH] [svn r10974] bugfix: correct survey link in mail, filling survey as non course member --- main/survey/fillsurvey.php | 16 +++++++++++----- main/survey/survey.lib.php | 11 ++++++++--- main/survey/survey_invite.php | 3 ++- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/main/survey/fillsurvey.php b/main/survey/fillsurvey.php index ad25f9b0ce..1ebb7a1cc0 100644 --- a/main/survey/fillsurvey.php +++ b/main/survey/fillsurvey.php @@ -37,14 +37,18 @@ 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"); + +// getting all the course information +$_course = CourseManager::get_course_information($_GET['course']); // 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_survey = Database :: get_course_table(TABLE_SURVEY, $_course['db_name']); +$table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION, $_course['db_name']); +$table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION, $_course['db_name']); $table_course = Database :: get_main_table(TABLE_MAIN_COURSE); $table_user = Database :: get_main_table(TABLE_MAIN_USER); -$table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); +$table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION, $_course['db_name']); // breadcrumbs // $interbreadcrumb[] = array ("url" => 'survey_list.php', 'name' => get_lang('SurveyList')); @@ -205,8 +209,10 @@ Display :: display_footer(); */ function store_answer($user, $survey_id, $question_id, $option_id) { + global $_course; + // table definition - $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); + $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER, $_course['db_name']); $sql = "INSERT INTO $table_survey_answer (user, survey_id, question_id, option_id) VALUES ( '".mysql_real_escape_string($user)."', diff --git a/main/survey/survey.lib.php b/main/survey/survey.lib.php index 35e8fd017a..c830becc1d 100644 --- a/main/survey/survey.lib.php +++ b/main/survey/survey.lib.php @@ -47,7 +47,10 @@ class survey_manager */ function get_survey($survey_id) { - $tbl_survey = Database :: get_course_table(TABLE_SURVEY); + global $_course; + + // table definition + $tbl_survey = Database :: get_course_table(TABLE_SURVEY, $_course['db_name']); $sql = "SELECT * FROM $tbl_survey WHERE survey_id='".mysql_real_escape_string($survey_id)."'"; $result = api_sql_query($sql, __FILE__, __LINE__); @@ -219,9 +222,11 @@ class survey_manager */ function save_question($form_content) { + global $_course; + // table definitions - $table_survey = Database :: get_course_table(TABLE_SURVEY); - $tbl_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); + $table_survey = Database :: get_course_table(TABLE_SURVEY, $_course['db_name']); + $tbl_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION, $_course['db_name']); // storing a new question if ($form_content['question_id'] == '' OR !is_numeric($form_content['question_id'])) diff --git a/main/survey/survey_invite.php b/main/survey/survey_invite.php index 5bca41bc6a..637f2ef5c4 100644 --- a/main/survey/survey_invite.php +++ b/main/survey/survey_invite.php @@ -168,6 +168,7 @@ function save_invitations($users_array, $invitation_title, $invitation_text) { global $_user; global $_course; + global $_configuration; // Database table definition $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); @@ -193,7 +194,7 @@ function save_invitations($users_array, $invitation_title, $invitation_text) $result = api_sql_query($sql, __FILE__, __LINE__); // replacing the **link** part with a valid link for the user - $survey_link = 'http://fillsurvey.php?course='.$_course['code'].'&invitationcode='.$invitation_code; + $survey_link = $_configuration['root_web'].$_configuration['code_append'].'survey/'.'fillsurvey.php?course='.$_course['sysCode'].'&invitationcode='.$invitation_code; $invitation_text = str_ireplace('**link**', $survey_link ,$invitation_text, $replace_count); if ($replace_count < 1) {