Kaynağa Gözat

[svn r10728] update of the reporting :
- link with admin (courses list, sessions list, user list)
- Some menus are now hidden because we are not in the session mode

Julian Prud'homme 18 yıl önce
ebeveyn
işleme
509298f8f9

+ 8 - 1
main/mySpace/index.php

@@ -313,7 +313,7 @@ if(api_is_platform_admin())
 	 </div>';
 }
  
-if(api_is_platform_admin() || $is_allowedCreateCourse)
+if((api_is_platform_admin() || $is_allowedCreateCourse) && api_get_setting('use_session_mode')=='true')
 {
 	 echo '<div class="admin_section">
 		<h4>
@@ -339,11 +339,18 @@ if(api_is_platform_admin() || $is_allowedCreateCourse)
 		<?php echo "<a href='cours.php'><img src='".api_get_path(WEB_IMG_PATH)."courses.gif'>&nbsp;".get_lang('Course').' ('.$nbCours.')'."</a>"; ?>
 	</h4>
  </div>
+ 
+ <?php
+ if(api_get_setting('use_session_mode')=='true'){
+ ?>
  <div class="admin_section">
 	<h4>
 		<?php echo "<a href='session.php'><img src='".api_get_path(WEB_IMG_PATH)."sessions.gif'>&nbsp;".get_lang('Sessions').' ('.$nbSessions.')'."</a>"; ?>
 	</h4>
  </div>
+ <?php
+ }
+ ?>
 
  <div class="admin_section">
 	<h4>

+ 21 - 3
main/mySpace/myStudents.php

@@ -12,13 +12,13 @@ $language_file = array ('registration', 'index','trad4all', 'tracking');
  
  $nameTools=get_lang("MyStudents");
  
+ $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
+ 
  if(isset($_GET["user_id"]) && $_GET["user_id"]!="" && !isset($_GET["type"])){
- 	$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
  	$interbreadcrumb[] = array ("url" => "teachers.php", "name" => get_lang('Teachers'));
  }
  
  if(isset($_GET["user_id"]) && $_GET["user_id"]!="" && isset($_GET["type"]) && $_GET["type"]=="coach"){
- 	$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
  	$interbreadcrumb[] = array ("url" => "coaches.php", "name" => get_lang('Tutors'));
  }
  
@@ -205,7 +205,9 @@ if(!empty($_GET['student']))
 					;
 	$resultInfosUser = api_sql_query($sqlInfosUser);
 	$a_infosUser = mysql_fetch_array($resultInfosUser);
-
+	
+	if(api_get_setting('use_session_mode')=='true'){
+		//REFAIRE LA REQUETE AFIN QU'ELLE MARCHE EN MODE NO-SESSION
 	$sqlCours = " 	SELECT DISTINCT course.title,
 									course.code,
 									course.db_name,
@@ -220,6 +222,22 @@ if(!empty($_GET['student']))
 					AND sessionCourse.id_coach = user.user_id
 					ORDER BY course.title ASC
 				";
+	}
+	else{
+		$sqlCours = " 	SELECT DISTINCT course.title,
+									course.code,
+									course.db_name,
+									CONCAT(user.firstname,' ',user.lastname) as tutor_name,
+									sessionCourse.id_coach
+					FROM $tbl_user as user,$tbl_course AS course
+					INNER JOIN $tbl_session_course_user AS course_user
+						ON course_user.course_code = course.code
+					INNER JOIN $tbl_session_course as sessionCourse
+							ON sessionCourse.course_code = course.code
+					WHERE course_user.id_user = ".$_GET['student']."
+					AND sessionCourse.id_coach = user.user_id
+					ORDER BY course.title ASC";
+	}
 		$resultCours = api_sql_query($sqlCours);
 		
 ?>

+ 25 - 3
main/mySpace/student.php

@@ -290,6 +290,26 @@ $tbl_session_rel_user 		= Database :: get_main_table(TABLE_MAIN_SESSION_USER);
 		}
 	}
 	
+	elseif(api_is_platform_admin() && isset($_GET["user_id"])){
+		
+		$sqlStudent = "	SELECT user_id,lastname,firstname,email
+						FROM $tbl_user
+						WHERE user_id='".$_GET["user_id"]."'
+						ORDER BY lastname ASC
+					  ";
+
+		$resultStudent = api_sql_query($sqlStudent);
+		
+		$a_current_student[]=mysql_result($resultStudent,0,"user_id");
+		$a_current_student[]=mysql_result($resultStudent,0,"lastname");
+		$a_current_student[]=mysql_result($resultStudent,0,"firstname");
+		$a_current_student[]=mysql_result($resultStudent,0,"email");
+		
+		$a_students[$_GET["user_id"]]=$a_current_student;
+		$a_students[$_GET["user_id"]]["teacher"]=true;
+
+	}
+	
 	else{
 
 		if(isset($_GET["user_id"])){
@@ -423,9 +443,11 @@ $tbl_session_rel_user 		= Database :: get_main_table(TABLE_MAIN_SESSION_USER);
 			
 			
 			if($a_current_student["teacher"]==true){
-							
-				echo '<td align="center"><a href="coaches.php?id_student='.$a_current_student[0].'"><img src="'.api_get_path(WEB_IMG_PATH).'coachs.gif" alt="'.get_lang("StudentTutors").'" title="'.get_lang("StudentTutors").'"></a>&nbsp;<a href="cours.php?type=student&user_id='.$a_current_student[0].'"><img src="'.api_get_path(WEB_IMG_PATH).'course.gif" alt="'.get_lang("StudentCourses").'" title="'.get_lang("StudentCourses").'"></a>&nbsp;<a href="'.$_SERVER['PHP_SELF'].'?student='.$a_current_student[0].'#sessionSuivie"><img src="'.api_get_path(WEB_IMG_PATH).'agenda.gif" alt="'.get_lang("StudentSessions").'" title="'.get_lang("StudentSessions").'"></a>';
-				
+				echo '<td align="center">';
+				if(api_get_setting('use_session_mode')=='true'){
+					echo '<a href="coaches.php?id_student='.$a_current_student[0].'"><img src="'.api_get_path(WEB_IMG_PATH).'coachs.gif" alt="'.get_lang("StudentTutors").'" title="'.get_lang("StudentTutors").'"></a>&nbsp;<a href="'.$_SERVER['PHP_SELF'].'?student='.$a_current_student[0].'#sessionSuivie"><img src="'.api_get_path(WEB_IMG_PATH).'agenda.gif" alt="'.get_lang("StudentSessions").'" title="'.get_lang("StudentSessions").'"></a>&nbsp;';
+				}		
+				echo '<a href="cours.php?type=student&user_id='.$a_current_student[0].'"><img src="'.api_get_path(WEB_IMG_PATH).'course.gif" alt="'.get_lang("StudentCourses").'" title="'.get_lang("StudentCourses").'"></a>';				
 			}
 			else{
 				echo '<td></td>';

+ 16 - 12
main/mySpace/teachers.php

@@ -6,7 +6,7 @@
  
 ob_start(); 
 
-// name of the language file that needs to be included 
+// names of the language file that needs to be included 
 $language_file = array ('registration', 'index','trad4all', 'tracking', 'admin');
 $cidReset=true;
 require ('../inc/global.inc.php');
@@ -83,17 +83,21 @@ function exportCsv($a_header,$a_data)
  */
 
 
-/*
- * liste nominative avec coordonnées et lien vers les cours et
-les stagiaires dont il est le
-responsable. 
-*/
-
-$sqlFormateurs = "	SELECT user_id,lastname,firstname,email
-					FROM $tbl_user
-					WHERE status = 1
-					ORDER BY lastname ASC
-				  ";
+if(isset($_GET["teacher_id"]) && $_GET["teacher_id"]!=0){
+	$i_teacher_id=$_GET["teacher_id"];
+	$sqlFormateurs = "	SELECT user_id,lastname,firstname,email
+						FROM $tbl_user
+						WHERE user_id='$i_teacher_id' 
+						ORDER BY lastname ASC
+					  ";
+}
+else{
+	$sqlFormateurs = "	SELECT user_id,lastname,firstname,email
+						FROM $tbl_user
+						WHERE status = 1
+						ORDER BY lastname ASC
+					  ";
+}
 
 $resultFormateurs = api_sql_query($sqlFormateurs);