From 5eff922bd60923572c92cd9e21f4fa7639821e20 Mon Sep 17 00:00:00 2001 From: Isaac Flores Date: Thu, 26 Mar 2009 18:36:44 +0100 Subject: [PATCH] [svn r19356] logic changes -hiden date when user is student - (partial FS#3914) --- main/gradebook/lib/be/exerciselink.class.php | 4 +++- main/gradebook/lib/be/learnpathlink.class.php | 4 ++-- main/gradebook/lib/be/studentpublicationlink.class.php | 4 ++-- main/gradebook/lib/gradebook_data_generator.class.php | 9 ++++++--- main/gradebook/lib/user_data_generator.class.php | 1 - 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/main/gradebook/lib/be/exerciselink.class.php b/main/gradebook/lib/be/exerciselink.class.php index 4d993d04e9..4178fd07de 100644 --- a/main/gradebook/lib/be/exerciselink.class.php +++ b/main/gradebook/lib/be/exerciselink.class.php @@ -118,7 +118,9 @@ class ExerciseLink extends AbstractLink $sql = 'SELECT * FROM '.$tbl_stats.' WHERE exe_exo_id = '.$this->get_ref_id().' AND orig_lp_id = 0 AND orig_lp_item_id = 0'; if (isset($stud_id)){ - $sql .= ' AND exe_cours_id="'.api_get_course_id().'" AND exe_user_id = '."'".$stud_id."'"; + $currect_course=api_get_course_id(); + $course_code_exe=(strlen($currect_course)===0) ? $this->get_course_code() : api_get_course_id(); + $sql .= ' AND exe_cours_id="'.$course_code_exe.'" AND exe_user_id = '."'".$stud_id."'"; } $sql .= ' ORDER BY exe_id DESC'; diff --git a/main/gradebook/lib/be/learnpathlink.class.php b/main/gradebook/lib/be/learnpathlink.class.php index 3d3901f3c4..a681475c11 100644 --- a/main/gradebook/lib/be/learnpathlink.class.php +++ b/main/gradebook/lib/be/learnpathlink.class.php @@ -103,6 +103,7 @@ class LearnpathLink extends AbstractLink */ public function has_results() { + error_log('demo'); $course_info = api_get_course_info($this->get_course_code()); $tbl_stats = Database::get_course_table(TABLE_LP_VIEW,$course_info['dbName']); $sql = 'SELECT count(id) AS number FROM '.$tbl_stats @@ -123,7 +124,7 @@ class LearnpathLink extends AbstractLink { $course_info = api_get_course_info($this->get_course_code()); $tbl_stats = Database::get_course_table(TABLE_LP_VIEW,$course_info['dbName']); - if (is_null($course_info['db_name'])) { + if (is_null($course_info['dbName'])===true) { return false; } $sql = 'SELECT * FROM '.$tbl_stats @@ -135,7 +136,6 @@ class LearnpathLink extends AbstractLink // order by id, that way the student's first attempt is accessed first $sql .= ' ORDER BY view_count DESC'; $scores = api_sql_query($sql, __FILE__, __LINE__); - // for 1 student if (isset($stud_id)) { diff --git a/main/gradebook/lib/be/studentpublicationlink.class.php b/main/gradebook/lib/be/studentpublicationlink.class.php index 6f0aa00f89..75eb462af4 100644 --- a/main/gradebook/lib/be/studentpublicationlink.class.php +++ b/main/gradebook/lib/be/studentpublicationlink.class.php @@ -24,7 +24,7 @@ */ /** * Gradebook link to student publication item - * @author Bert Stepp� + * @author Bert Steppé * @package dokeos.gradebook */ class StudentPublicationLink extends AbstractLink @@ -150,7 +150,7 @@ class StudentPublicationLink extends AbstractLink $course_info = Database :: get_course_info($this->get_course_code()); $database_name = (empty($course_info['db_name']))?$course_info['dbName']:$course_info['db_name']; $tbl_stats = Database :: get_course_table(TABLE_STUDENT_PUBLICATION, $database_name); - if (is_null($course_info['db_name'])) { + if (is_null($database_name)===true) { return false; } $sql = 'SELECT * FROM '.$tbl_stats." WHERE id = '".$this->get_ref_id()."'"; diff --git a/main/gradebook/lib/gradebook_data_generator.class.php b/main/gradebook/lib/gradebook_data_generator.class.php index 9ddcdc3183..1e74baf29e 100644 --- a/main/gradebook/lib/gradebook_data_generator.class.php +++ b/main/gradebook/lib/gradebook_data_generator.class.php @@ -74,7 +74,8 @@ class GradebookDataGenerator * 4: date * 5: student's score (if student logged in) */ - public function get_data ($sorting = 0, $start = 0, $count = null, $ignore_score_color = false) { + public function get_data ($sorting = 0, $start = 0, $count = null, $ignore_score_color = false) { + $status=CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id()); // do some checks on count, redefine if invalid value if (!isset($count)) { $count = count ($this->items) - $start; @@ -112,10 +113,12 @@ class GradebookDataGenerator $row[] = $item->get_name(); $row[] = $item->get_description(); $row[] = $item->get_weight(); - $row[] = $this->build_date_column ($item); - + if (($status==1 || is_null($status)) && api_is_allowed_to_create_course()) { + $row[] = $this->build_date_column ($item); + } if(count($this->evals_links)>0) if (!api_is_allowed_to_create_course() || $status_user!=1) + $row[] = $this->build_result_column ($item, $ignore_score_color); //$row[] = $this->get_certificate_link ($item); $data[] = $row; diff --git a/main/gradebook/lib/user_data_generator.class.php b/main/gradebook/lib/user_data_generator.class.php index 569d3e6786..0c7313cdf0 100644 --- a/main/gradebook/lib/user_data_generator.class.php +++ b/main/gradebook/lib/user_data_generator.class.php @@ -84,7 +84,6 @@ class UserDataGenerator * 6: student's score as custom display (only if custom scoring enabled) */ public function get_data ($sorting = 0, $start = 0, $count = null, $ignore_score_color = false) { - // do some checks on count, redefine if invalid value if (!isset($count)) { $count = count ($this->items) - $start;