diff --git a/main/gradebook/lib/be/abstractlink.class.php b/main/gradebook/lib/be/abstractlink.class.php index 5a7087e147..8453ea0fbc 100755 --- a/main/gradebook/lib/be/abstractlink.class.php +++ b/main/gradebook/lib/be/abstractlink.class.php @@ -557,12 +557,6 @@ abstract class AbstractLink implements GradebookItem return 'link'; } - /* Seems to be not used anywhere */ - public function get_not_created_links() - { - return null; - } - public function get_all_links() { return null; diff --git a/main/gradebook/lib/be/attendancelink.class.php b/main/gradebook/lib/be/attendancelink.class.php index cb7ffa1b6e..c9615a32db 100755 --- a/main/gradebook/lib/be/attendancelink.class.php +++ b/main/gradebook/lib/be/attendancelink.class.php @@ -38,46 +38,6 @@ class AttendanceLink extends AbstractLink return false; } - /** - * Generate an array of attendances that a teacher hasn't created a link for. - * - * @return array 2-dimensional array - every element contains 2 subelements (id, name) - * - * @todo seems to be depracated - */ - public function get_not_created_links() - { - return false; - if (empty($this->course_code)) { - die('Error in get_not_created_links() : course code not set'); - } - $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); - - $sql = 'SELECT att.id, att.name, att.attendance_qualify_title - FROM '.$this->get_attendance_table().' att - WHERE - att.c_id = '.$this->course_id.' AND - att.id NOT IN ( - SELECT ref_id FROM '.$tbl_grade_links.' - WHERE - type = '.LINK_ATTENDANCE.' AND - course_code = "'.Database::escape_string($this->get_course_code()).'" - ) - AND att.session_id='.api_get_session_id().''; - $result = Database::query($sql); - - $cats = []; - while ($data = Database::fetch_array($result)) { - if (isset($data['attendance_qualify_title']) && $data['attendance_qualify_title'] != '') { - $cats[] = [$data['id'], $data['attendance_qualify_title']]; - } else { - $cats[] = [$data['id'], $data['name']]; - } - } - - return $cats; - } - /** * Generate an array of all attendances available. * @@ -86,7 +46,7 @@ class AttendanceLink extends AbstractLink public function get_all_links() { if (empty($this->course_code)) { - die('Error in get_not_created_links() : course code not set'); + return []; } $tbl_attendance = $this->get_attendance_table(); $session_id = api_get_session_id(); diff --git a/main/gradebook/lib/be/category.class.php b/main/gradebook/lib/be/category.class.php index 76f2eb9623..e81491c487 100755 --- a/main/gradebook/lib/be/category.class.php +++ b/main/gradebook/lib/be/category.class.php @@ -1588,6 +1588,7 @@ class Category implements GradebookItem $this->id, api_is_allowed_to_edit() ? null : 1 ); + /** @var Category $cat */ foreach ($cats as $cat) { if ($cat->hasEvaluationsWithStudentResults($studentId)) { @@ -1775,7 +1776,6 @@ class Category implements GradebookItem $this->id, api_is_allowed_to_edit() ? null : 1 ); - } } else { // All students diff --git a/main/gradebook/lib/be/dropboxlink.class.php b/main/gradebook/lib/be/dropboxlink.class.php index 37190b087c..5767cccdd1 100755 --- a/main/gradebook/lib/be/dropboxlink.class.php +++ b/main/gradebook/lib/be/dropboxlink.class.php @@ -31,9 +31,11 @@ class DropboxLink extends EvalLink // with the same title as the evaluation name $eval = $this->get_evaluation(); - $sql = 'SELECT filename FROM '.$this->get_dropbox_table() - .' WHERE c_id = '.$this->course_id.' AND uploader_id = '.intval($stud_id) - ." AND title = '".Database::escape_string($eval->get_name())."'"; + $sql = 'SELECT filename FROM '.$this->get_dropbox_table().' + WHERE + c_id = '.$this->course_id.' AND + uploader_id = '.intval($stud_id)." AND + title = '".Database::escape_string($eval->get_name())."'"; $result = Database::query($sql); if ($fileurl = Database::fetch_row($result)) { diff --git a/main/gradebook/lib/be/forumthreadlink.class.php b/main/gradebook/lib/be/forumthreadlink.class.php index 5a72fe6a27..1a2fba1605 100755 --- a/main/gradebook/lib/be/forumthreadlink.class.php +++ b/main/gradebook/lib/be/forumthreadlink.class.php @@ -152,9 +152,7 @@ class ForumThreadLink extends AbstractLink { require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php'; $threadInfo = get_thread_information('', $this->get_ref_id()); - $thread_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY); - $sessionId = $this->get_session_id(); $sessionCondition = api_get_session_condition( $sessionId, diff --git a/main/gradebook/lib/be/learnpathlink.class.php b/main/gradebook/lib/be/learnpathlink.class.php index 51588846fa..24ef7872ae 100755 --- a/main/gradebook/lib/be/learnpathlink.class.php +++ b/main/gradebook/lib/be/learnpathlink.class.php @@ -24,37 +24,6 @@ class LearnpathLink extends AbstractLink $this->set_type(LINK_LEARNPATH); } - /** - * Generate an array of learnpaths that a teacher hasn't created a link for. - * - * @return array 2-dimensional array - every element contains 2 subelements (id, name) - */ - public function get_not_created_links() - { - return false; - if (empty($this->course_code)) { - die('Error in get_not_created_links() : course code not set'); - } - - $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); - - $sql = 'SELECT id, name FROM '.$this->get_learnpath_table().' lp - WHERE c_id = '.$this->course_id.' AND id NOT IN ' - .' (SELECT ref_id FROM '.$tbl_grade_links - .' WHERE type = '.LINK_LEARNPATH - ." AND course_code = '".$this->get_course_code()."'" - .') AND lp.session_id='.api_get_session_id().''; - - $result = Database::query($sql); - - $cats = []; - while ($data = Database::fetch_array($result)) { - $cats[] = [$data['id'], $data['name']]; - } - - return $cats; - } - /** * Generate an array of all learnpaths available. * @@ -63,7 +32,7 @@ class LearnpathLink extends AbstractLink public function get_all_links() { if (empty($this->course_code)) { - die('Error in get_not_created_links() : course code not set'); + return []; } $session_id = api_get_session_id(); diff --git a/main/gradebook/lib/be/studentpublicationlink.class.php b/main/gradebook/lib/be/studentpublicationlink.class.php index 597fa04840..e519a4e998 100755 --- a/main/gradebook/lib/be/studentpublicationlink.class.php +++ b/main/gradebook/lib/be/studentpublicationlink.class.php @@ -71,36 +71,6 @@ class StudentPublicationLink extends AbstractLink return false; } - /** - * Generate an array of exercises that a teacher hasn't created a link for. - * - * @return array 2-dimensional array - every element contains 2 subelements (id, name) - */ - public function get_not_created_links() - { - return false; - if (empty($this->course_code)) { - die('Error in get_not_created_links() : course code not set'); - } - $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); - - $sql = 'SELECT id, url from '.$this->get_studpub_table() - .' pup WHERE c_id = '.$this->course_id.' AND has_properties != '."''".' AND id NOT IN' - .' (SELECT ref_id FROM '.$tbl_grade_links - .' WHERE type = '.LINK_STUDENTPUBLICATION - ." AND course_code = '".Database::escape_string($this->get_course_code())."'" - .') AND pub.session_id='.api_get_session_id().''; - - $result = Database::query($sql); - - $cats = []; - while ($data = Database::fetch_array($result)) { - $cats[] = [$data['id'], $data['url']]; - } - - return $cats; - } - /** * Generate an array of all exercises available. * @@ -109,7 +79,7 @@ class StudentPublicationLink extends AbstractLink public function get_all_links() { if (empty($this->course_code)) { - die('Error in get_not_created_links() : course code not set'); + return []; } $em = Database::getManager(); $session = $em->find('ChamiloCoreBundle:Session', api_get_session_id()); diff --git a/main/gradebook/lib/be/surveylink.class.php b/main/gradebook/lib/be/surveylink.class.php index 12d4153771..737314b8f5 100755 --- a/main/gradebook/lib/be/surveylink.class.php +++ b/main/gradebook/lib/be/surveylink.class.php @@ -93,42 +93,6 @@ class SurveyLink extends AbstractLink return isset($links) ? $links : null; } - /** - * Generates an array of surveys that a teacher hasn't created a link for. - * - * @return array 2-dimensional array - every element contains 2 subelements (id, name) - */ - public function get_not_created_links() - { - if (empty($this->course_code)) { - die('Error in get_not_created_links() : course code not set'); - } - $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); - - $sql = 'SELECT survey_id, title, code - FROM '.$this->get_survey_table().' AS srv - WHERE survey_id NOT IN - ( - SELECT ref_id FROM '.$tbl_grade_links.' - WHERE - type = '.LINK_SURVEY.' AND - course_code = "'.$this->get_course_code().'" - ) - AND srv.session_id = '.api_get_session_id(); - - $result = Database::query($sql); - - $links = []; - while ($data = Database::fetch_array($result)) { - $links[] = [ - $data['survey_id'], - api_trunc_str($data['code'].': '.self::html_to_text($data['title']), 80), - ]; - } - - return $links; - } - /** * Has anyone done this survey yet? * Implementation of the AbstractLink class, mainly used dynamically in gradebook/lib/fe.