From 3b3bcfa15ec7638d2d95bf386ef837cba6cc9e8f Mon Sep 17 00:00:00 2001 From: Isaac Flores Date: Sun, 8 Feb 2009 21:51:20 +0100 Subject: [PATCH] [svn r18342] logic changes - allow show results, when the teacher is student in the gradebook tool and allow show exercise, when the teacher is student in the exercise tool - (partial FS#3542) --- main/gradebook/lib/be/exerciselink.class.php | 8 ++++++-- main/gradebook/lib/fe/gradebooktable.class.php | 12 +++++++++--- .../gradebook/lib/gradebook_data_generator.class.php | 6 +++++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/main/gradebook/lib/be/exerciselink.class.php b/main/gradebook/lib/be/exerciselink.class.php index 63f0dd0066..6c29379690 100644 --- a/main/gradebook/lib/be/exerciselink.class.php +++ b/main/gradebook/lib/be/exerciselink.class.php @@ -165,10 +165,14 @@ class ExerciseLink extends AbstractLink * Check this php file for more info. */ public function get_link() { + //status student + $user_id=api_get_user_id(); + $course_code=$this->get_course_code(); + $status_user=api_get_status_of_user_in_course ($user_id,$course_code); $url = api_get_path(WEB_PATH) .'main/gradebook/exercise_jump.php?cidReq='.$this->get_course_code().'&gradebook=view&exerciseId='.$this->get_ref_id(); - if (!api_is_allowed_to_create_course() - && $this->calc_score(api_get_user_id()) == null) { + if ((!api_is_allowed_to_create_course() + && $this->calc_score(api_get_user_id()) == null) || $status_user!=1) { $url .= '&doexercise='.$this->get_ref_id(); } return $url; diff --git a/main/gradebook/lib/fe/gradebooktable.class.php b/main/gradebook/lib/fe/gradebooktable.class.php index 59d21bcf8d..eb6860654d 100644 --- a/main/gradebook/lib/fe/gradebooktable.class.php +++ b/main/gradebook/lib/fe/gradebooktable.class.php @@ -51,10 +51,11 @@ class GradebookTable extends SortableTable $column= 0; if (api_is_course_tutor() && api_is_allowed_to_create_course() && ($_SESSION['studentview']<>'studentview') || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) { $this->set_header($column++,'','','width="25px"'); - } + } $this->set_header($column++, get_lang('Type'),'','width="35px"'); $this->set_header($column++, get_lang('Name')); $this->set_header($column++, get_lang('Description')); + if (api_is_course_tutor() && api_is_allowed_to_create_course() && $_SESSION['studentview']<>'studentview' || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) { $this->set_header($column++, get_lang('Weight'),'','width="50px"'); } else { @@ -127,7 +128,12 @@ class GradebookTable extends SortableTable } else { $sorting |= GradebookDataGenerator :: GDG_SORT_ASC; } - $data_array = $this->datagen->get_data($sorting, $from, $this->per_page); + //status de user in course + $user_id=api_get_user_id(); + $course_code=api_get_course_id(); + $status_user=api_get_status_of_user_in_course ($user_id,$course_code); + + $data_array = $this->datagen->get_data($sorting, $from, $this->per_page); // generate the data to display $sortable_data = array(); foreach ($data_array as $data) { @@ -191,7 +197,7 @@ class GradebookTable extends SortableTable } else { //students get the results and certificates columns - if (count($this->evals_links)>0) { + if (count($this->evals_links)>0 || $status_user!=1) { $value_data=isset($data[5]) ? $data[5] : null; $row[] = $value_data; } diff --git a/main/gradebook/lib/gradebook_data_generator.class.php b/main/gradebook/lib/gradebook_data_generator.class.php index 5c332da76b..9ddcdc3183 100644 --- a/main/gradebook/lib/gradebook_data_generator.class.php +++ b/main/gradebook/lib/gradebook_data_generator.class.php @@ -100,6 +100,10 @@ class GradebookDataGenerator } // get selected items $visibleitems = array_slice($allitems, $start, $count); + //status de user in course + $user_id=api_get_user_id(); + $course_code=api_get_course_id(); + $status_user=api_get_status_of_user_in_course ($user_id,$course_code); // generate the data to display $data = array(); foreach ($visibleitems as $item) { @@ -111,7 +115,7 @@ class GradebookDataGenerator $row[] = $this->build_date_column ($item); if(count($this->evals_links)>0) - if (!api_is_allowed_to_create_course()) + 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;