Browse Source

Fixing My reports UI

Julio Montoya 14 years ago
parent
commit
9467f183a0
5 changed files with 117 additions and 99 deletions
  1. 83 80
      main/auth/my_progress.php
  2. 15 11
      main/mySpace/index.php
  3. 2 0
      main/mySpace/myStudents.php
  4. 6 3
      main/tracking/courseLog.php
  5. 11 5
      main/tracking/exams.php

+ 83 - 80
main/auth/my_progress.php

@@ -69,6 +69,8 @@ while($row = Database :: fetch_array($rs)) {
 echo '<div class="actions-title" >';
 echo $nameTools;
 echo '</div>';
+
+if (!empty($courses)) {
 ?>
 <table class="data_table" width="100%">
 <tr class="tableName">
@@ -85,49 +87,52 @@ echo '</div>';
   <th><?php echo get_lang('Details'); ?></th>
 </tr>
 <?php
-$i = 0;
-foreach ($courses as $enreg) {
-	$weighting = 0;
-	$last_connection       = Tracking :: get_last_connection_date_on_the_course($_user['user_id'], $enreg['code']);
-	$progress              = Tracking :: get_avg_student_progress($_user['user_id'], $enreg['code']);
-	$total_time_login      = Tracking :: get_time_spent_on_the_course($_user['user_id'], $enreg['code']);
-	$time                  = api_time_to_hms($total_time_login);
-	$percentage_score      = Tracking :: get_average_test_scorm_and_lp ($_user['user_id'], $enreg['code']);
 
-    echo '<tr class='.($i?'row_odd':'row_even').'>';
-  	echo '<td>'.$enreg['title'].'</td>';
-    
-  	echo '<td align="center">'.$time.'</td>';
-    echo '<td align="center">'.$progress.'%</td>';
-  	
-  	echo '<td align="center">';
-    	if (!is_null($percentage_score)) {
-			echo $percentage_score.'%';
-		} else {
-			echo '0%';
-		}	
-  	echo '</td>';
+    $i = 0;
+    foreach ($courses as $enreg) {
+    	$weighting = 0;
+    	$last_connection       = Tracking :: get_last_connection_date_on_the_course($_user['user_id'], $enreg['code']);
+    	$progress              = Tracking :: get_avg_student_progress($_user['user_id'], $enreg['code']);
+    	$total_time_login      = Tracking :: get_time_spent_on_the_course($_user['user_id'], $enreg['code']);
+    	$time                  = api_time_to_hms($total_time_login);
+    	$percentage_score      = Tracking :: get_average_test_scorm_and_lp ($_user['user_id'], $enreg['code']);
     
-  	echo '<td align="center">'.$last_connection.'</td>';
-	
-  	echo '<td align="center">';		
-	if ($enreg['code'] == $_GET['course'] && empty($_GET['session_id'])) {
-		echo '<a href="#">';
-		Display::display_icon('2rightarrow_na.gif', get_lang('Details'));
-	} else {
-		echo '<a href="'.api_get_self().'?course='.$enreg['code'].'">';
-		Display::display_icon('2rightarrow.gif', get_lang('Details'));
-	}
-	echo '</a>';
-    echo '</td></tr>';
-	$i = $i ? 0 : 1;
+        echo '<tr class='.($i?'row_odd':'row_even').'>';
+      	echo '<td>'.$enreg['title'].'</td>';
+        
+      	echo '<td align="center">'.$time.'</td>';
+        echo '<td align="center">'.$progress.'%</td>';
+      	
+      	echo '<td align="center">';
+    	if (is_numeric($percentage_score)) {
+    		echo $percentage_score.'%';
+    	} else {
+    		echo '0%';
+    	}	
+      	echo '</td>';        
+      	echo '<td align="center">'.$last_connection.'</td>';    	
+      	echo '<td align="center">';		
+    	if ($enreg['code'] == $_GET['course'] && empty($_GET['session_id'])) {
+    		echo '<a href="#">';
+    		Display::display_icon('2rightarrow_na.gif', get_lang('Details'));
+    	} else {
+    		echo '<a href="'.api_get_self().'?course='.$enreg['code'].'">';
+    		Display::display_icon('2rightarrow.gif', get_lang('Details'));
+    	}
+    	echo '</a>';
+        echo '</td></tr>';
+    	$i = $i ? 0 : 1;
+    }    
+    echo '</table>';
 }
+
+if (!empty($course_in_session)) {
 ?>
-</table>
+
 <br />
 <table class="data_table" width="100%">
 <tr class="tableName">
-    <td colspan="6">
+    <td colspan="7">
         <strong><?php echo get_lang('Sessions'); ?></strong>
     </td>
 </tr>
@@ -141,54 +146,54 @@ foreach ($courses as $enreg) {
   <th><?php echo get_lang('Details'); ?></th>
 </tr>
 <?php
-
-foreach ($course_in_session as $key=>$session) {
-    
-    echo '<tr  class='.($i?'row_odd':'row_even').'>';
     
-    echo '<td rowspan="'.count($session).'" > '.api_get_session_name($key).' </td>';
-    
-    foreach ($session as $enreg) {
-        
-        
-        $weighting = 0;
-        $last_connection       = Tracking :: get_last_connection_date_on_the_course($_user['user_id'], $enreg['code'], $enreg['session_id']);
-        $progress              = Tracking :: get_avg_student_progress($_user['user_id'], $enreg['code'],array(), $enreg['session_id']);
-        $total_time_login      = Tracking :: get_time_spent_on_the_course($_user['user_id'], $enreg['code'], $enreg['session_id']);
-        $time                  = api_time_to_hms($total_time_login);
-        $percentage_score      = Tracking :: get_avg_student_score ($_user['user_id'], $enreg['code'], array(), $enreg['session_id']);
-        
-        echo '<td>'.$enreg['title'].' </td>';
-        
-        echo '<td align="center">'.$time.'</td>';
-        echo '<td align="center">'.$progress.'%</td>';
-        
-        echo '<td align="center">';
-            if (!is_null($percentage_score)) {
+    foreach ($course_in_session as $key=>$session) {    
+        echo '<tr  class='.($i?'row_odd':'row_even').'>';    
+        echo '<td rowspan="'.count($session).'" > '.api_get_session_name($key).' </td>';    
+        foreach ($session as $enreg) {               
+            $weighting = 0;
+            $last_connection       = Tracking :: get_last_connection_date_on_the_course($_user['user_id'], $enreg['code'], $key);
+            $progress              = Tracking :: get_avg_student_progress($_user['user_id'], $enreg['code'],array(), $key);
+            
+            $total_time_login      = Tracking :: get_time_spent_on_the_course($_user['user_id'], $enreg['code'], $key);
+            $time                  = api_time_to_hms($total_time_login);
+            $percentage_score      = Tracking :: get_avg_student_score ($_user['user_id'], $enreg['code'], array(), $key);
+            
+            echo '<td>'.$enreg['title'].' </td>';        
+            echo '<td align="center">'.$time.'</td>';
+            
+            if (is_numeric($progress)) {
+                $progress = $progress.'%';
+            } else {
+                $progress = '0%';
+            }
+            
+            echo '<td align="center">'.$progress.'</td>';
+            echo '<td align="center">';
+            if (is_numeric($percentage_score)) {
                 echo $percentage_score.'%';
             } else {
                 echo '0%';
             }   
-        echo '</td>';
-        
-        echo '<td align="center">'.$last_connection.'</td>';
-        
-        echo '<td align="center">';     
-        if ($enreg['code'] == $_GET['course'] && $_GET['session_id'] == $key) {
-            echo '<a href="#">';
-            Display::display_icon('2rightarrow_na.gif', get_lang('Details'));
-        } else {
-            echo '<a href="'.api_get_self().'?course='.$enreg['code'].'&session_id='.$key.'">';
-            Display::display_icon('2rightarrow.gif', get_lang('Details'));
-        }
-        echo '</a>';
-        echo '</td>';
-        $i = $i ? 0 : 1;
-          echo '</tr>';
-    }  
+            echo '</td>';        
+            echo '<td align="center">'.$last_connection.'</td>';        
+            echo '<td align="center">';     
+            if ($enreg['code'] == $_GET['course'] && $_GET['session_id'] == $key) {
+                echo '<a href="#">';
+                Display::display_icon('2rightarrow_na.gif', get_lang('Details'));
+            } else {
+                echo '<a href="'.api_get_self().'?course='.$enreg['code'].'&session_id='.$key.'">';
+                Display::display_icon('2rightarrow.gif', get_lang('Details'));
+            }
+            echo '</a>';
+            echo '</td>';
+            $i = $i ? 0 : 1;
+            echo '</tr>';
+        }  
+    }
+    echo '</table>';
 }
 ?>
-</table>
 <br /><br />
 <?php
 /*	Details for one course  */
@@ -201,8 +206,6 @@ foreach ($course_in_session as $key=>$session) {
         $tbl_session                = Database :: get_main_table(TABLE_MAIN_SESSION);
         $tbl_session_course         = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
         $tbl_session_course_user    = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
-        
-        
         $tbl_course_lp_view         = Database :: get_course_table(TABLE_LP_VIEW, $course_info['db_name']);
         $tbl_course_lp_view_item    = Database :: get_course_table(TABLE_LP_ITEM_VIEW, $course_info['db_name']);
         $tbl_course_lp              = Database :: get_course_table(TABLE_LP_MAIN, $course_info['db_name']);
@@ -313,7 +316,7 @@ foreach ($course_in_session as $key=>$session) {
 								<td align='center' width=180px >";
 						                        
 						if (!empty($last_connection_in_lp)) {
-							echo api_get_utc_datetime($last_connection_in_lp);
+							echo $last_connection_in_lp;
 						} else {
 							echo '-';
 						}

+ 15 - 11
main/mySpace/index.php

@@ -211,15 +211,20 @@ if ($is_drh || $_GET['display'] == 'yourstudents') {
 $nb_menu_items = count($menu_items);
 
 if ($nb_teacher_courses > 0 ) {
-	echo '<div class="actions-title" style ="font-size:10pt;">';
-	if ($nb_menu_items > 1) {
-		foreach ($menu_items as $key => $item) {
-			echo $item;
-			if ($key != $nb_menu_items - 1) {
-				echo '&nbsp;|&nbsp;';
-			}
-		}
-	}
+    
+	echo '<div class="actions" style ="font-size:10pt;">';    
+    if (empty($session_id)) {
+    	if ($nb_menu_items > 1) {
+    		foreach ($menu_items as $key => $item) {
+    			echo $item;
+    			if ($key != $nb_menu_items - 1) {
+    				echo '&nbsp;|&nbsp;';
+    			}
+    		}
+    	}
+    } else {
+    	echo '&nbsp;<a href="javascript: window.back();" ">'.Display::return_icon('back.png', get_lang('Back')).get_lang('Back').'</a>';
+    }
 	echo '&nbsp;&nbsp;<a href="javascript: void(0);" onclick="javascript: window.print()"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a> ';
 	if (isset($_GET['display']) && ($_GET['display'] == 'useroverview' || $_GET['display'] == 'sessionoverview' || $_GET['display'] == 'courseoverview')) {
 		echo '<a href="'.api_get_self().'?display='.$_GET['display'].'&export=csv&view='.$view.'"><img align="absbottom" src="../img/csv.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>';
@@ -229,13 +234,12 @@ if ($nb_teacher_courses > 0 ) {
 } else {
 	echo '<div class="actions-title" style ="font-size:10pt;">';
 	echo '<a href="'.api_get_path(WEB_CODE_PATH).'auth/my_progress.php"><img align="absbottom" src="../img/statistics.gif">&nbsp;'.get_lang('MyStats').'</a> ';
-
 	echo '</div>';
 	//Display::display_warning_message(get_lang('HaveNoCourse'));
 }
 
 
-echo '<h2>'.$title.'</h2>';
+echo '<h2>'.get_lang('Session').' '.$title.'</h2>';
 
 if (($is_drh && $view == 'drh') || $_GET['display'] == 'yourstudents') {
 	// get data for human resources manager

+ 2 - 0
main/mySpace/myStudents.php

@@ -257,6 +257,8 @@ if (!empty ($_GET['student'])) {
 
 	// Actions bar
 	echo '<div class="actions">';
+    echo '&nbsp;<a href="javascript: window.back();" ">'.Display::return_icon('back.png', get_lang('Back')).get_lang('Back').'</a>';
+    
 	echo '<a href="javascript: void(0);" onclick="javascript: window.print();"><img src="../img/printmgr.gif">&nbsp;' . get_lang('Print') . '</a>';
 	echo '<a href="' . api_get_self() . '?' . Security :: remove_XSS($_SERVER['QUERY_STRING']) . '&export=csv"><img src="../img/csv.gif">&nbsp;' . get_lang('ExportAsCSV') . '</a>';
 	if (!empty ($info_user['email'])) {

+ 6 - 3
main/tracking/courseLog.php

@@ -139,7 +139,7 @@ if (isset($_GET['additional_profile_field']) && is_numeric($_GET['additional_pro
 
 /* MAIN CODE */
 
-echo '<div class="actions-title"  style ="font-size:10pt;">';
+echo '<div class="actions"  style ="font-size:10pt;">';
 if ($_GET['studentlist'] == 'false') {
     echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=true">'.get_lang('StudentsTracking').'</a> | ';
     echo get_lang('CourseTracking').' | ';
@@ -156,11 +156,14 @@ if ($_GET['studentlist'] == 'false') {
         echo ' | <a href="exams.php?'.api_get_cidreq().'">'.get_lang('ExamTracking').'</a>&nbsp;';
 
 } elseif($_GET['studentlist'] == '' || $_GET['studentlist'] == 'true') {
+    echo '&nbsp;<a href="javascript: window.back();" ">'.Display::return_icon('back.png', get_lang('Back')).get_lang('Back').'</a>';
+    
+    /*
     echo get_lang('StudentsTracking').' | ';
     echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=false">'.get_lang('CourseTracking').'</a> | ';
     echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=resources">'.get_lang('ResourcesTracking').'</a>';
     if (empty($session_id))
-        echo ' | <a href="exams.php?'.api_get_cidreq().'">'.get_lang('ExamTracking').'</a>&nbsp;';
+        echo ' | <a href="exams.php?'.api_get_cidreq().'">'.get_lang('ExamTracking').'</a>&nbsp;';*/
 }
 
 echo '&nbsp;<a href="javascript: void(0);" onclick="javascript: window.print();">'.Display::return_icon('printmgr.gif', get_lang('Print')).get_lang('Print').'</a>';
@@ -483,7 +486,7 @@ if ($_GET['studentlist'] == 'false') {
         $course_code = $_course['id'];
 
         $user_ids = array_keys($a_students);
-
+        
         $table = new SortableTable('users_tracking', array('TrackingCourseLog', 'get_number_of_users'), array('TrackingCourseLog', 'get_user_data'), (api_is_western_name_order() xor api_sort_by_first_name()) ? 3 : 2);
 
         $parameters['cidReq'] 		= Security::remove_XSS($_GET['cidReq']);

+ 11 - 5
main/tracking/exams.php

@@ -70,11 +70,17 @@ $form->setDefaults(array('score'=>$filter_score));
 
 if (!$export_to_xls) {
 	Display :: display_header(get_lang('Reporting'));
-	echo '<div class="actions-title" style ="font-size:10pt;">';
+	echo '<div class="actions" style ="font-size:10pt;">';
 	if ($global) {		
 		$menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher">'.get_lang('TeacherInterface').'</a>';
-		$menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=coach">'.get_lang('AdminInterface').'</a>';
+        if (api_is_platform_admin()) {
+		  $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=admin">'.get_lang('AdminInterface').'</a>';
+        } else {
+            $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=coach">'.get_lang('AdminInterface').'</a>';	
+        }
 		$menu_items[] = get_lang('ExamTracking');
+        $menu_items[] = '<a href="javascript: void(0);" onclick="javascript: window.print();"><img src="../img/printmgr.gif">&nbsp;' . get_lang('Print') . '</a>';
+        $menu_items[] = '<a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsXLS').'</a>';
 		
 		$nb_menu_items = count($menu_items);
 		if($nb_menu_items>1) {
@@ -90,14 +96,14 @@ if (!$export_to_xls) {
 	   echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=true">'.get_lang('StudentsTracking').'</a>&nbsp;| 
 		     <a href="courseLog.php?'.api_get_cidreq().'&studentlist=false">'.get_lang('CourseTracking').'</a>&nbsp;|&nbsp';
        echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=resources">'.get_lang('ResourcesTracking').'</a>';
-		echo ' | '.get_lang('ExamTracking').'';		
+		echo ' | '.get_lang('ExamTracking').'';
+         echo '<a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsXLS').'</a><br /><br />';		
 			
 	}	
     echo '</div>';  
 	echo '<br /><br />';
 	$form->display();		
-	echo '<h3>'.sprintf(get_lang('FilteringWithScoreX'), $filter_score).'%</h3>';	
-	echo '<a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsXLS').'</a><br /><br />';
+	echo '<h3>'.sprintf(get_lang('FilteringWithScoreX'), $filter_score).'%</h3>';
 }
 
 if ($global) {