diff --git a/main/exercice/admin.php b/main/exercice/admin.php index 513dc084b1..7a0bf48911 100644 --- a/main/exercice/admin.php +++ b/main/exercice/admin.php @@ -436,12 +436,13 @@ function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) Display::display_header($nameTools,'Exercise'); +$course_id = api_get_course_int_id(); $show_quiz_edition = true; if (isset($exerciseId) && !empty($exerciseId)) { $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM); $sql="SELECT max_score FROM $TBL_LP_ITEM - WHERE item_type = '".TOOL_QUIZ."' AND path ='".Database::escape_string($exerciseId)."'"; + WHERE c_id = $course_id AND item_type = '".TOOL_QUIZ."' AND path ='".Database::escape_string($exerciseId)."'"; $result = Database::query($sql); if (Database::num_rows($result) > 0) { Display::display_warning_message(get_lang('EditingExerciseCauseProblemsInLP')); diff --git a/main/exercice/exercise.lib.php b/main/exercice/exercise.lib.php index af12026692..a52bcbdde8 100644 --- a/main/exercice/exercise.lib.php +++ b/main/exercice/exercise.lib.php @@ -689,10 +689,10 @@ function get_exercise_track_exercise_info($exe_id) { * Validates the time control key */ function exercise_time_control_is_valid($exercise_id) { - //Fast check + $course_id = api_get_course_int_id(); $exercise_id = intval($exercise_id); $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); - $sql = "SELECT expired_time FROM $TBL_EXERCICES WHERE id = $exercise_id"; + $sql = "SELECT expired_time FROM $TBL_EXERCICES WHERE c_id = $course_id AND id = $exercise_id"; $result = Database::query($sql); $row = Database::fetch_array($result, 'ASSOC'); if (!empty($row['expired_time']) ) { diff --git a/main/exercice/exercise_admin.php b/main/exercice/exercise_admin.php index fe4ef7eef3..560faacfe8 100644 --- a/main/exercice/exercise_admin.php +++ b/main/exercice/exercise_admin.php @@ -143,6 +143,7 @@ $(document).ready(function () { // INIT EXERCISE $objExercise = new Exercise(); +$course_id = api_get_course_int_id(); //INIT FORM if (isset($_GET['exerciseId'])) { @@ -218,7 +219,7 @@ if ($form->validate()) { if (isset($objExercise) && !empty($objExercise->id)) { $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM); $sql="SELECT max_score FROM $TBL_LP_ITEM - WHERE item_type = '".TOOL_QUIZ."' AND path ='".Database::escape_string($objExercise->id)."'"; + WHERE c_id = $course_id AND item_type = '".TOOL_QUIZ."' AND path ='".Database::escape_string($objExercise->id)."'"; $result = Database::query($sql); if (Database::num_rows($result) > 0) { $form->freeze(); diff --git a/main/exercice/qti2.php b/main/exercice/qti2.php old mode 100755 new mode 100644 index bdff74deb7..1dbe10da81 --- a/main/exercice/qti2.php +++ b/main/exercice/qti2.php @@ -85,6 +85,9 @@ function ch_qti2_import_file($array_file) { } } +// display header +Display::display_header(get_lang('ImportQtiQuiz'), 'Exercises'); + // import file if ((api_is_allowed_to_edit(null, true))) { if (isset($_POST['submit'])) { @@ -92,12 +95,8 @@ if ((api_is_allowed_to_edit(null, true))) { } } -// display header -Display::display_header(get_lang('ImportQtiQuiz'), 'Exercises'); - // display qti form ch_qti2_display_form(); // display the footer -Display::display_footer(); -?> +Display::display_footer(); \ No newline at end of file diff --git a/main/exercice/question.class.php b/main/exercice/question.class.php index 8d80a31ce3..b142c5b98e 100644 --- a/main/exercice/question.class.php +++ b/main/exercice/question.class.php @@ -651,9 +651,8 @@ abstract class Question * @param - integer $exerciseId - exercise ID if saving in an exercise */ function save($exerciseId=0) { - - $TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION, $this->course['db_name']); - $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION, $this->course['db_name']); + $TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION); + $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION); $id = $this->id; $question = $this->question; @@ -663,9 +662,9 @@ abstract class Question $type = $this->type; $picture = $this->picture; $level = $this->level; - $extra = $this->extra; - $c_id = $this->course['real_id']; - $category = $this->category; // hub 12-10-2011 + $extra = $this->extra; + $c_id = $this->course['real_id']; + $category = $this->category; // hub 12-10-2011 // question already exists @@ -677,9 +676,9 @@ abstract class Question position ='".Database::escape_string($position)."', type ='".Database::escape_string($type)."', picture ='".Database::escape_string($picture)."', - extra ='".Database::escape_string($extra)."', + extra ='".Database::escape_string($extra)."', level ='".Database::escape_string($level)."' - WHERE id='".Database::escape_string($id)."'"; + WHERE c_id = $c_id AND id='".Database::escape_string($id)."'"; Database::query($sql); $this->saveCategory($category); // hub 12-10-2011 if (!empty($exerciseId)) { @@ -1275,6 +1274,8 @@ abstract class Question */ static function display_type_menu ($feedbacktype = 0) { global $exerciseId; + $course_id = api_get_course_int_id(); + // 1. by default we show all the question types $question_type_custom_list = self::$questionTypes; @@ -1293,7 +1294,7 @@ abstract class Question if (isset($exerciseId) && !empty($exerciseId)) { $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM); $sql="SELECT max_score FROM $TBL_LP_ITEM - WHERE item_type = '".TOOL_QUIZ."' AND path ='".Database::escape_string($exerciseId)."'"; + WHERE c_id = $course_id AND item_type = '".TOOL_QUIZ."' AND path ='".Database::escape_string($exerciseId)."'"; $result = Database::query($sql); if (Database::num_rows($result) > 0) { $show_quiz_edition = false; diff --git a/main/survey/survey_invite.php b/main/survey/survey_invite.php old mode 100755 new mode 100644 index 9eb283bdb8..6753b6fc1f --- a/main/survey/survey_invite.php +++ b/main/survey/survey_invite.php @@ -21,8 +21,6 @@ require '../inc/global.inc.php'; // Including additional libraries require_once 'survey.lib.php'; -require_once api_get_path(LIBRARY_PATH).'course.lib.php'; -require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'; require_once api_get_path(LIBRARY_PATH).'mail.lib.inc.php'; $this_section = SECTION_COURSES;