Browse Source

[svn r17076] changes in logic - I added the sight of student - see(FS#3302)

Isaac Flores 16 years ago
parent
commit
da8cfa8952

+ 4 - 2
main/gradebook/gradebook_flatview.php

@@ -158,8 +158,10 @@ if (isset($_GET['exportpdf'])) {
 } else {
 	Display :: display_header(get_lang('FlatView'));
 }
-DisplayGradebook :: display_header_reduce_flatview($cat[0], $showeval, $showlink, $simple_search_form);
-$flatviewtable->display();
+if ( !isset($_GET['selectcat']) && ($_SESSION['studentview']=='studentview') || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='true') ) {
+	DisplayGradebook :: display_header_reduce_flatview($cat[0], $showeval, $showlink, $simple_search_form);
+	$flatviewtable->display();
+}
 Display :: display_footer();
 
 function get_printable_data($users,$alleval, $alllinks) {

+ 5 - 3
main/gradebook/gradebook_scoring_system.php

@@ -122,9 +122,10 @@ if ($scoreform->validate()) {
 }
 
 Display :: display_header(get_lang('ScoreEdit'));
-if (isset ($_GET['scoringupdated'])) {
-	Display :: display_confirmation_message(get_lang('ScoringUpdated'),false);
-}
+if (!isset($_GET['selectcat']) && ($_SESSION['studentview']=='studentview') || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='true')) {
+	if (isset ($_GET['scoringupdated'])) {
+		Display :: display_confirmation_message(get_lang('ScoringUpdated'),false);
+	}
 
 if (isset ($_GET['nouniqueranges'])) {
 	Display :: display_error_message(get_lang('NoUniqueScoreRanges'),false);
@@ -133,4 +134,5 @@ if (isset ($_GET['nouniqueranges'])) {
 echo '<div class="maincontent">';
 $scoreform->display();
 echo '</div>';
+}
 Display :: display_footer();

+ 27 - 3
main/gradebook/index.php

@@ -59,6 +59,21 @@ $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
 
 $filter_confirm_msg = true;
 $filter_warning_msg = true;
+
+if ( !isset($_GET['selectcat']) && ($_SESSION['studentview']=='studentview') || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='true') ) {
+	Display :: display_header(get_lang('Gradebook'));
+	$cats = Category :: load (0, null, null, null, null, null, false);
+	$allcat= $cats[0]->get_subcategories($stud_id, $course_code, $session_id);
+	$alleval= $cats[0]->get_evaluations($stud_id);
+	$alllink= $cats[0]->get_links($stud_id);
+	$gradebooktable= new GradebookTable($cats[0], $allcat, $alleval,$alllink, $addparams);
+	$gradebooktable->display();
+	Display :: display_footer();
+	exit;
+}	
+
+
+		
 // --------------------------------------------------------------------------------
 // -                                  ACTIONS                                     -
 // --------------------------------------------------------------------------------
@@ -412,6 +427,16 @@ if (!isset($_GET['exportpdf']) and !isset($_GET['export_certificate'])) {
 		Display :: display_header('');
 	} else {
 		Display :: display_header(get_lang('Gradebook'));
+		/*if ( ($_SESSION['studentview']=='studentview') || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='true') ) {
+			$cats = Category :: load (0, null, null, null, null, null, false);
+			$allcat= $cats[0]->get_subcategories($stud_id, $course_code, $session_id);
+			$alleval= $cats[0]->get_evaluations($stud_id);
+			$alllink= $cats[0]->get_links($stud_id);
+			$gradebooktable= new GradebookTable($cats[0], $allcat, $alleval,$alllink, $addparams);
+			$gradebooktable->display();
+			Display :: display_footer();
+			exit;
+		}*/
 	}
 }
 
@@ -524,6 +549,7 @@ if (isset ($_GET['studentoverview'])) {
 	if (!api_is_allowed_to_edit(true,true)) {
 		$user_id = api_get_user_id();
 	}
+
 	$category = Category :: load ($_GET['cat']);
 	if ($category[0]->is_certificate_available($user_id)) {
 		$user= get_user_info_from_id($user_id);
@@ -570,7 +596,6 @@ if (isset ($_GET['studentoverview'])) {
     // we have to show the root category and show its subcategories that
     // are inside this course. This is done at the time of calling
     // $cats[0]->get_subcategories(), not at the time of doing Category::load() 
-    
     // $category comes from GET['selectcat']
     $course_code = api_get_course_id();
     $session_id = api_get_session_id();
@@ -582,7 +607,6 @@ if (isset ($_GET['studentoverview'])) {
         // When *inside* a course, we want to make sure there is one (and only
         // one) category for this course or for this session.
 	    $cats = Category :: load(null, null, $course_code, null, null, $session_id, false);
-
         if (empty($cats)) {
             // There is no category for this course+session, so create one
             $cat= new Category();
@@ -663,7 +687,7 @@ if (api_is_platform_admin() || api_is_allowed_to_create_course()) {
 	if ( (isset ($_GET['selectcat']) && $_GET['selectcat']<>0) ) {
 	//
 	} else {
-			if ( ((isset ($_GET['selectcat']) && $_GET['selectcat']==0) || ((isset($_GET['cidReq']) && $_GET['cidReq']!==''))) ) {
+			if ( ((isset ($_GET['selectcat']) && $_GET['selectcat']==0) || ((isset($_GET['cidReq']) && $_GET['cidReq']!==''))) || isset($_GET['isStudentView']) && $_GET['isStudentView']=='false') {
 			$cats = Category :: load(null, null, $course_code, null, null, $session_id, false);
 			DisplayGradebook :: display_reduce_header_gradebook($cats[0],$is_course_admin, $is_platform_admin, $simple_search_form, false, false);	
 		} 

+ 13 - 12
main/gradebook/lib/fe/gradebooktable.class.php

@@ -49,27 +49,28 @@ class GradebookTable extends SortableTable
 			$this->set_additional_parameters($addparams);
 		}
 		$column= 0;
-		if (api_is_allowed_to_create_course()) {
+		if (api_is_allowed_to_create_course() && ($_SESSION['studentview']<>'studentview') || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) {
 			$this->set_header($column++, '', false);
 		}	
 		$this->set_header($column++, get_lang('Type'));
 		$this->set_header($column++, get_lang('Name'));
 		$this->set_header($column++, get_lang('Description'));
-		if (api_is_allowed_to_create_course()) {
-		$this->set_header($column++, get_lang('Weight'));	
+		if (api_is_allowed_to_create_course() && $_SESSION['studentview']<>'studentview' || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) {
+			$this->set_header($column++, get_lang('Weight'));	
 		} else {
-			if (!isset($_GET['selectcat'])) {	
-			$this->set_header($column++, get_lang('Evaluation'));
+			if (!isset($_GET['selectcat']) || ($_SESSION['studentview']=='studentview' || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='true')) || !api_is_allowed_to_create_course()) {	
+				$this->set_header($column++, get_lang('Evaluation'));
 			}
 			else {
 			$this->set_header($column++, get_lang('Weight'));	
+			
 			}	
 		}		 
 							
 		$this->set_header($column++, get_lang('Date'),true, 'width="100"');				
 		
 		//admins get an edit column
-		if (api_is_allowed_to_create_course()) {
+		if (api_is_allowed_to_create_course() && $_SESSION['studentview']<>'studentview' || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) {
 			$this->set_header($column++, get_lang('Modify'), false, 'width="100"');
 			//actions on multiple selected documents
 			$this->set_form_actions(array (
@@ -81,8 +82,8 @@ class GradebookTable extends SortableTable
  	             if(count($evals_links)>0) {
  	             	$this->set_header($column++, get_lang('Results'), false);
  	             }
-		 	    if (!isset($_GET['selectcat'])) {         
-				$this->set_header($column++, get_lang('Certificates'),false);
+		 	    if (!isset($_GET['selectcat']) ||(isset($_GET['isStudentView']) && $_GET['isStudentView']=='true') || !api_is_allowed_to_create_course()) {         
+					$this->set_header($column++, get_lang('Certificates'),false);
 		 	    }	
 		}
     }
@@ -141,7 +142,7 @@ class GradebookTable extends SortableTable
 			$invisibility_span_close = (api_is_allowed_to_create_course() && $item->is_visible() == '0') ? '</span>' : '';
 			
 			
-			if (api_is_allowed_to_create_course()) {
+			if (api_is_allowed_to_create_course() && ($_SESSION['studentview']<>'studentview') || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false')) {
 				$row[] = $this->build_id_column ($item);
 			}
 			$row[] = $this->build_type_column ($item);
@@ -152,7 +153,7 @@ class GradebookTable extends SortableTable
 			$row[] = $invisibility_span_open . $data[3] . $invisibility_span_close;	
 			} else {
 					
-				if (!isset($_GET['selectcat'])) {					
+				if (!isset($_GET['selectcat']) && isset($certificate_min_score)) {					
 					// generating the total score for a course
 				    $stud_id= api_get_user_id();
 				      
@@ -180,14 +181,14 @@ class GradebookTable extends SortableTable
 			$row[] = $invisibility_span_open . str_replace(' ','&nbsp;',$data[4]) . $invisibility_span_close;
 			
 			//admins get an edit column
-			if (api_is_allowed_to_create_course()) {
+			if (api_is_allowed_to_create_course() && ($_SESSION['studentview']<>'studentview' || (isset($_GET['isStudentView']) && $_GET['isStudentView']=='false'))) {
 				$row[] = $this->build_edit_column ($item);
 			} else {
 			//students get the results and certificates columns
 				if (count($this->evals_links)>0) {
 					$row[] = $data[5];
 				}
-				if (!isset($_GET['selectcat'])) {
+				if (!isset($_GET['selectcat']) && isset($certificate_min_score) && !api_is_allowed_to_create_course) {
 					if ((int)$item_value >= (int)$certificate_min_score) {
 						$certificates = '<a href="'.api_get_path(WEB_CODE_PATH) .'gradebook/index.php?export_certificate=yes"><img src="'.api_get_path(WEB_CODE_PATH) . 'img/dokeos.gif" /></a>&nbsp;'.$scoretotal_display; 	
 					} else {