diff --git a/public/main/gradebook/index.php b/public/main/gradebook/index.php index 8ea08d3a92..f6b7593528 100644 --- a/public/main/gradebook/index.php +++ b/public/main/gradebook/index.php @@ -458,9 +458,9 @@ if (isset($_GET['deletelink'])) { thread_qualify_max = 0, thread_weight = 0, thread_title_qualify = "" - WHERE c_id = '.$course_id.' AND iid = ( + WHERE iid = ( SELECT ref_id FROM '.$tbl_grade_links.' - WHERE id='.$get_delete_link.' AND type = '.LINK_FORUM_THREAD.' + WHERE id = '.$get_delete_link.' AND type = '.LINK_FORUM_THREAD.' )'; Database::query($sql); // clean attendance @@ -469,7 +469,7 @@ if (isset($_GET['deletelink'])) { attendance_qualify_title = "" WHERE iid = ( SELECT ref_id FROM '.$tbl_grade_links.' - WHERE id='.$get_delete_link.' AND type = '.LINK_ATTENDANCE.' + WHERE id = '.$get_delete_link.' AND type = '.LINK_ATTENDANCE.' )'; Database::query($sql); $link[0]->delete(); diff --git a/public/main/gradebook/lib/be/attendancelink.class.php b/public/main/gradebook/lib/be/attendancelink.class.php index 2fe7a76af6..1767cc498b 100644 --- a/public/main/gradebook/lib/be/attendancelink.class.php +++ b/public/main/gradebook/lib/be/attendancelink.class.php @@ -85,8 +85,7 @@ class AttendanceLink extends AbstractLink $sql = 'SELECT count(*) AS number FROM '.$tbl_attendance_result." WHERE session_id = $sessionId AND - c_id = '.$this->course_id.' AND - attendance_id = '".$this->get_ref_id()."'"; + attendance_id = ".$this->get_ref_id(); $result = Database::query($sql); $number = Database::fetch_row($result); @@ -114,7 +113,7 @@ class AttendanceLink extends AbstractLink // Get results $sql = 'SELECT * FROM '.$tbl_attendance_result.' - WHERE c_id = '.$this->course_id.' AND attendance_id = '.$this->get_ref_id(); + WHERE attendance_id = '.$this->get_ref_id(); if (isset($studentId)) { $sql .= ' AND user_id = '.intval($studentId); } diff --git a/public/main/gradebook/lib/be/learnpathlink.class.php b/public/main/gradebook/lib/be/learnpathlink.class.php index 965b7bedcd..4f3dfa51b9 100644 --- a/public/main/gradebook/lib/be/learnpathlink.class.php +++ b/public/main/gradebook/lib/be/learnpathlink.class.php @@ -50,24 +50,6 @@ class LearnpathLink extends AbstractLink } return $list; - - /*$session_id = $this->get_session_id(); - if (empty($session_id)) { - $session_condition = api_get_session_condition(0, true); - } else { - $session_condition = api_get_session_condition($session_id, true, true); - } - - $sql = 'SELECT iid, name FROM '.$this->get_learnpath_table().' - WHERE c_id = '.$this->course_id.' '.$session_condition.' '; - $result = Database::query($sql); - - $cats = []; - while ($data = Database::fetch_array($result)) { - $cats[] = [$data['iid'], $data['name']]; - } - - return $cats;*/ } /** @@ -77,7 +59,7 @@ class LearnpathLink extends AbstractLink { $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); $sql = "SELECT count(id) AS number FROM $tbl_stats - WHERE c_id = ".$this->course_id." AND lp_id = ".$this->get_ref_id(); + WHERE lp_id = ".$this->get_ref_id(); $result = Database::query($sql); $number = Database::fetch_array($result, 'NUM'); @@ -104,7 +86,6 @@ class LearnpathLink extends AbstractLink $sql = "SELECT * FROM $tbl_stats WHERE - c_id = ".$this->course_id." AND lp_id = ".$this->get_ref_id()." AND session_id = $session_id "; @@ -211,7 +192,7 @@ class LearnpathLink extends AbstractLink public function is_valid_link() { $sql = 'SELECT count(iid) FROM '.$this->get_learnpath_table().' - WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; + WHERE iid = '.$this->get_ref_id().' '; $result = Database::query($sql); $number = Database::fetch_row($result, 'NUM'); @@ -265,7 +246,7 @@ class LearnpathLink extends AbstractLink { if (!isset($this->learnpath_data)) { $sql = 'SELECT * FROM '.$this->get_learnpath_table().' - WHERE c_id = '.$this->course_id.' AND iid = '.$this->get_ref_id().' '; + WHERE iid = '.$this->get_ref_id().' '; $result = Database::query($sql); $this->learnpath_data = Database::fetch_array($result); } diff --git a/public/main/survey/survey_question.php b/public/main/survey/survey_question.php index 7e6c7a7b5f..699ed50457 100644 --- a/public/main/survey/survey_question.php +++ b/public/main/survey/survey_question.php @@ -19,7 +19,7 @@ class survey_question */ public function addParentMenu($formData, FormValidator $form, $surveyData) { - $surveyId = $surveyData['survey_id']; + $surveyId = $surveyData['iid']; $questionId = isset($formData['question_id']) ? $formData['question_id'] : 0; $parentId = isset($formData['parent_id']) ? $formData['parent_id'] : 0; $optionId = isset($formData['parent_option_id']) ? $formData['parent_option_id'] : 0;