Adding c_id in queries changes due the new single database changes see #3910

skala
Julio Montoya 13 years ago
parent 25d84ebf05
commit 323d554233
  1. 3
      main/exercice/admin.php
  2. 4
      main/exercice/exercise.lib.php
  3. 3
      main/exercice/exercise_admin.php
  4. 9
      main/exercice/qti2.php
  5. 19
      main/exercice/question.class.php
  6. 2
      main/survey/survey_invite.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'));

@ -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']) ) {

@ -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();

@ -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();

@ -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;

@ -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;

Loading…
Cancel
Save