Jelajahi Sumber

[svn r12899] set the coach rights to api_isCourseTeacher = false, allow him to correct exercises

Eric Marguin 17 tahun lalu
induk
melakukan
16db1f85a2
3 mengubah file dengan 9 tambahan dan 9 penghapusan
  1. 6 6
      main/exercice/exercice.php
  2. 2 2
      main/exercice/exercise_show.php
  3. 1 1
      main/inc/local.inc.php

+ 6 - 6
main/exercice/exercice.php

@@ -139,7 +139,7 @@ a.invisible:hover
 -->
 </style>';
 
-if ($show=='result' && $_REQUEST['comments']=='update' && $is_allowedToEdit)
+if ($show=='result' && $_REQUEST['comments']=='update' && ($is_allowedToEdit || $is_courseTutor))
 {
 	$id  = $_GET['exeid'];
 	$emailid = $_GET['emailid'];
@@ -809,18 +809,18 @@ if($_configuration['tracking_enabled'])
 
 		<table class="data_table">
 		 <tr class="row_odd">
-		  <?php if($is_allowedToEdit): ?>
+		  <?php if($is_allowedToEdit || $is_courseTutor): ?>
 			<th><?php echo get_lang("User"); ?></th><?php endif; ?>
 		  <th><?php echo get_lang("Exercice"); ?></th>
 		  <th><?php echo get_lang("Date"); ?></th>
 		  <th><?php echo get_lang("Result"); ?></th>
-		  <th><?php echo $is_allowedToEdit?get_lang("CorrectTest"):get_lang("ViewTest"); ?></th>
+		  <th><?php echo $is_allowedToEdit || $is_courseTutor?get_lang("CorrectTest"):get_lang("ViewTest"); ?></th>
 
 
 		 </tr>
 
 		<?php
-		if($is_allowedToEdit)
+		if($is_allowedToEdit || $is_courseTutor)
 		{
 			//get all results (ourself and the others) as an admin should see them
 			//AND exe_user_id <> $_user['user_id']  clause has been removed
@@ -870,7 +870,7 @@ if($_configuration['tracking_enabled'])
 				echo '<tr';
 				if($i%2==0) echo 'class="row_odd"'; else echo 'class="row_even"';
 				echo '>';
-				if($is_allowedToEdit)
+				if($is_allowedToEdit || $is_courseTutor)
 				{
 					$user = $results[$i][0];
 					echo '<td>'.$user.'</td>';
@@ -878,7 +878,7 @@ if($_configuration['tracking_enabled'])
 				echo '<td>'.$test.'</td>';
 				echo '<td>'.format_locale_date(get_lang('dateTimeFormatLong'),$results[$i][4]).'</td>';
 		  		echo '<td>'.$res.' / '.$results[$i][3].'</td>';
-				echo '<td>'.($is_allowedToEdit?"<a href='exercise_show.php?user=$user&dt=$dt&res=$res&id=$id&email=$mailid'>".get_lang("Edit")."</a>":"<a href='exercise_show.php?dt=$dt&res=$res&id=$id'>".get_lang('Show')."</a>").'</td>';
+				echo '<td>'.($is_allowedToEdit || $is_courseTutor?"<a href='exercise_show.php?user=$user&dt=$dt&res=$res&id=$id&email=$mailid'>".get_lang("Edit")."</a>":"<a href='exercise_show.php?dt=$dt&res=$res&id=$id'>".get_lang('Show')."</a>").'</td>';
 				echo '</tr>';
 			}
 		}

+ 2 - 2
main/exercice/exercise_show.php

@@ -102,7 +102,7 @@ if ( empty ( $questionList ) ) {
 if ( empty ( $objExercise ) ) {
     $objExercise = $_SESSION['objExercise'];
 }
-$is_allowedToEdit=api_is_allowed_to_edit();
+$is_allowedToEdit=api_is_allowed_to_edit() || $is_courseTutor;
 $nameTools=get_lang('CorrectTest');
 
 if($origin=='user_course')
@@ -306,7 +306,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
 		$exerciseTitle=api_parse_tex($test);
 		$exerciseDexcription=mysql_result($result,0,1);
 
-$user_restriction = api_is_allowed_to_edit() ? '' :  "AND user_id=".intval($_user['user_id'])." ";
+$user_restriction = $is_allowedToEdit ? '' :  "AND user_id=".intval($_user['user_id'])." ";
 $query = "select * from ".$TBL_TRACK_ATTEMPT." as attempts  
 						INNER JOIN ".$TBL_TRACK_EXERCICES." as stats_exercices ON stats_exercices.exe_id=attempts.exe_id 
 						INNER JOIN ".$TBL_EXERCICE_QUESTION." as quizz_rel_questions ON quizz_rel_questions.exercice_id=stats_exercices.exe_exo_id AND quizz_rel_questions.question_id = attempts.question_id

+ 1 - 1
main/inc/local.inc.php

@@ -667,7 +667,7 @@ if ((isset($uidReset) && $uidReset) || (isset($cidReset) && $cidReset)) // sessi
 		        	$_courseUser['role'] = 'Professor';
 		            $is_courseMember     = true;
 		            $is_courseTutor      = true;
-		            $is_courseAdmin      = true;
+		            $is_courseAdmin      = false;
 		            $is_courseCoach      = true;
 	
 		            api_session_register('_courseUser');