Browse Source

Adding UTC support to the messages, fixing the new session view

Julio Montoya 14 years ago
parent
commit
ef4edb599d

+ 1 - 1
main/admin/add_courses_to_usergroup.php

@@ -176,7 +176,7 @@ if ($add_type == 'multiple') {
 }
 
 echo '<div class="actions">';
-echo '<a href="usergroups.php">'.Display::return_icon('back.png',get_lang('Back')).get_lang('Back').'</a>';       
+echo '<a href="usergroups.php">'.Display::return_icon('back.png',get_lang('Back'), array(), 32).'</a>';       
 echo '</div>';
 
 echo '<div class="row"><div class="form_header">'.$tool_name.' '.$data['name'].'</div></div><br/>'; ?>

+ 1 - 1
main/admin/resume_session.php

@@ -310,7 +310,7 @@ else {
 					<td>
 						<a href="../mySpace/myStudents.php?student='.$user['user_id'].''.$orig_param.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a>&nbsp;
 						<a href="session_course_user.php?id_user='.$user['user_id'].'&id_session='.$id_session.'">'.Display::return_icon('course.gif', get_lang('BlockCoursesForThisUser')).'</a>&nbsp;
-						<a href="'.api_get_self().'?id_session='.$id_session.'&action=delete&user='.$user['user_id'].'" onclick="javascript:if(!confirm(\''.get_lang('ConfirmYourChoice').'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>
+						<a href="'.api_get_self().'?id_session='.$id_session.'&action=delete&user='.$user['user_id'].'" onclick="javascript:if(!confirm(\''.get_lang('ConfirmYourChoice').'\')) return false;">'.Display::return_icon('delete.png', get_lang('Delete')).'</a>
 					</td>
 				  </tr>';
 	}

+ 23 - 0
main/auth/my_progress.php

@@ -18,6 +18,29 @@ $nameTools = get_lang('MyProgress');
 
 api_block_anonymous_users();
 
+$htmlHeadXtra[] = api_get_jquery_ui_js();
+$htmlHeadXtra[] = '
+<script language="javascript">
+$(function() {
+    $(".dialog").dialog("destroy");        
+    $(".dialog").dialog({
+            autoOpen: false,
+            show: "blind",                
+            resizable: false,
+            height:300,
+            width:550,
+            modal: true
+     });     
+
+    $(".opener").click(function() {
+        var my_id = $(this).attr(\'id\'); 
+        var big_image = \'#main_graph_\' + my_id;
+        $( big_image ).dialog("open");
+        return false;
+    });
+});
+</script>';
+
 Display :: display_header($nameTools);
 
 // Database table definitions

+ 23 - 18
main/calendar/agenda.inc.php

@@ -1225,8 +1225,8 @@ function sent_to($tool, $id) {
 */
 function sent_to_form($sent_to_array) {
 	// we find all the names of the groups
-	$group_names=get_course_groups();
-	count($sent_to_array);
+	$group_names = get_course_groups();	
+	
 	// we count the number of users and the number of groups
 	if (isset($sent_to_array['users'])) {
 		$number_users=count($sent_to_array['users']);
@@ -1238,15 +1238,17 @@ function sent_to_form($sent_to_array) {
 	} else {
 		$number_groups=0;
 	}
-	$total_numbers=$number_users+$number_groups;
-
+	$total_numbers = $number_users + $number_groups;
+	
 	// starting the form if there is more than one user/group
-	if ($total_numbers >1) {    	
+	if ($total_numbers > 1 ) {    	
     	//$output.="<option>".get_lang("SentTo")."</option>";
     	// outputting the name of the groups
     	if (is_array($sent_to_array['groups'])) {
     		foreach ($sent_to_array['groups'] as $group_id) {
-    			$output.="G: ".$group_names[$group_id]['name']."<br />";
+    		    if (isset($group_names[$group_id]['name'])) {
+                    $output.= $group_names[$group_id]['name']."<br />";
+    		    }
             }
         }
     	if (isset($sent_to_array['users'])) {
@@ -2014,15 +2016,16 @@ function display_agenda_items($select_month, $select_year) {
         $th .= Display::tag('th', get_lang('Content'));
         $th .= Display::tag('th', get_lang('SentTo'));
         $th .= Display::tag('th', get_lang('StartTimeWindow'));
-        $th .= Display::tag('th', get_lang('EndTimeWindow'));
-        
+        $th .= Display::tag('th', get_lang('EndTimeWindow'));        
         
         //if (!$is_repeated && (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) && $myrow['calendar_type'] == 'course' ) {
         if ((api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()))) {
-            if( ! (api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $myrow['id'] ) ) ) {
+            if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $myrow['id']))) {
                 // a coach can only delete an element belonging to his session
                 $th .= Display::tag('th', get_lang('Modify'));
             }
+        } else {
+            $th .= Display::tag('th', get_lang('Detail'));
         }
         
         echo Display::tag('tr', $th); 
@@ -2135,14 +2138,16 @@ function display_agenda_items($select_month, $select_year) {
         	echo '</td>';
     
         	// attachment list
-    	    $attachment_list=get_attachment($myrow['id']);
-    
+    	    $attachment_list = get_attachment($myrow['id']);
+    	    
+            echo '<td align="center">';
+            
             /*Display: edit delete button (course admin only) */
     		if (!$is_repeated && (api_is_allowed_to_edit(false,true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) && $myrow['calendar_type'] == 'course') {
-        		if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $myrow['id'] ) ) ) {
+        		if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $myrow['id']))) {
         			// a coach can only delete an element belonging to his session
     				$mylink = api_get_self().'?'.api_get_cidreq().'&amp;origin='.Security::remove_XSS($_GET['origin']).'&amp;id='.$myrow['id'].'&amp;';
-    	    		echo '<td align="center">';
+    	    	
     	    		// edit
         			echo '<a href="'.$mylink.api_get_cidreq()."&amp;sort=asc&amp;toolgroup=".Security::remove_XSS($_GET['toolgroup']).'&amp;action=edit&amp;id_attach='.$attachment_list['id'].'" title="'.get_lang("ModifyCalendarItem").'">';
     	    		echo Display::return_icon('edit.png', get_lang('ModifyCalendarItem'),'',22)."</a>";
@@ -2169,28 +2174,28 @@ function display_agenda_items($select_month, $select_year) {
     	    	//echo '<a class="ical_export" href="'.$mylink.'&amp;class=private" title="'.get_lang('ExportiCalPrivate').'">'.Display::return_icon($export_icon_low, get_lang('ExportiCalPrivate')).'</a> ';
     	    	//echo '<a class="ical_export" href="'.$mylink.'&amp;class=public" title="'.get_lang('ExportiCalPublic').'">'.Display::return_icon($export_icon, get_lang('ExportiCalPublic')).'</a> ';
     		    echo '<a href="#" onclick="javascript:win_print=window.open(\'print.php?id='.$myrow['id'].'\',\'popup\',\'left=100,top=100,width=700,height=500,scrollbars=1,resizable=0\'); win_print.focus(); return false;">'.Display::return_icon('printer.png', get_lang('Print'),'',22).'</a>&nbsp;';
-    	    	echo '</td>';
+    	    
     		}
     
             //Display: the added resources
         	if (check_added_resources("Agenda", $myrow["id"])) {
-        		echo '<tr>';
-        		echo '<td colspan="3">';
         		echo "<i>".get_lang("AddedResources")."</i><br/>";
         		if ($myrow['visibility']==0) {
         			$addedresource_style="invisible";
         		}
         		display_added_resources("Agenda", $myrow["id"], $addedresource_style);
-        		echo "</td></tr>";
     	   	}
         	$event_list.=$myrow['id'].',';
         	$counter++;
             
-            echo '<td colspan="3">';
+            
             if ($is_repeated) {
             	echo get_lang('RepeatedEvent'),' <a href="',api_get_self(),'?',api_get_cidreq(),'&amp;agenda_id=',$myrow['parent_event_id'],'" alt="',get_lang('RepeatedEventViewOriginalEvent'),'">',get_lang('RepeatedEventViewOriginalEvent'),'</a>';
             }
+            
             echo '</td>';
+            
+            
         	echo "</tr>";
         	
         } // end while ($myrow=Database::fetch_array($result))

+ 34 - 58
main/inc/lib/message.lib.php

@@ -166,12 +166,11 @@ class MessageManager
 				} else {
 					$message[1] = Display::return_icon('mail.png',get_lang('UnReadMessage'));//Message without reading
 				}*/
-
 				$message[1] = '<a onclick="get_action_url_and_show_messages(1,'.$result[0].')" href="javascript:void(0)">'.GetFullUserName($result[1]).'</a>';
 				$message[2] = '<a onclick="get_action_url_and_show_messages(1,'.$result[0].')" href="javascript:void(0)">'.str_replace("\\","",$result[3]).'</a>';
 				$message[3] = '<a onclick="reply_to_messages(\'show\','.$result[0].',\'\')" href="javascript:void(0)">'.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).'</a>'.
 						  '&nbsp;&nbsp;<a onclick="delete_one_message('.$result[0].')" href="javascript:void(0)"  >'.Display::return_icon('delete.png',get_lang('DeleteMessage')).'</a>';
-			} else {			    
+			} else {		    
 				if($result[4]==1) {
 					$class = 'class = "unread"';
 				} else {
@@ -186,7 +185,7 @@ class MessageManager
 				$message[3] = '<a href="new_message.php?re_id='.$result[0].'&f='.Security::remove_XSS($_GET['f']).'">'.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).'</a>'.
 						  '&nbsp;&nbsp;<a delete_one_message('.$result[0].') href="inbox.php?action=deleteone&id='.$result[0].'&f='.Security::remove_XSS($_GET['f']).'">'.Display::return_icon('delete.png',get_lang('DeleteMessage')).'</a>';
 			}
-			$message[2] = $result[3]; //date stays the same
+			$message[2] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same
 			foreach($message as $key => $value) {
 				$message[$key] = api_xml_http_response_encode($value);
 			}
@@ -621,7 +620,8 @@ class MessageManager
 			if ($request===true) {
 				$message[1] = '<a onclick="show_sent_message('.$result[0].')" href="javascript:void(0)">'.GetFullUserName($result[4]).'</a>';
 				$message[2] = '<a onclick="show_sent_message('.$result[0].')" href="javascript:void(0)">'.str_replace("\\","",$result[2]).'</a>';
-					$message[3] = $result[3]; //date stays the same
+				$message[3] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same
+				
 				$message[4] = '&nbsp;&nbsp;<a onclick="delete_one_message_outbox('.$result[0].')" href="javascript:void(0)"  >'.Display::return_icon('delete.png',get_lang('DeleteMessage')).'</a>';
 			} else {
 				$link = '';
@@ -630,7 +630,7 @@ class MessageManager
 				}
 				$message[1] = '<a '.$class.' onclick="show_sent_message ('.$result[0].')" href="../messages/view_message.php?id_send='.$result[0].$link.'">'.$result[2].'</a><br />'.GetFullUserName($result[4]);
 				//$message[2] = '<a '.$class.' onclick="show_sent_message ('.$result[0].')" href="../messages/view_message.php?id_send='.$result[0].$link.'">'.$result[2].'</a>';
-			    $message[2] = $result[3]; //date stays the same
+			    $message[2] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same
 				$message[3] = '<a href="outbox.php?action=deleteone&id='.$result[0].'&f='.Security::remove_XSS($_GET['f']).'"  onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage')))."'".')) return false;">'.Display::return_icon('delete.png',get_lang('DeleteMessage')).'</a>';
 			}
 
@@ -1178,7 +1178,7 @@ function inbox_display() {
 	global $charset;
 //	$charset = api_get_system_encoding();
 	$table_message = Database::get_main_table(TABLE_MESSAGE);
-	$request=api_is_xml_http_request();
+	//$request=api_is_xml_http_request();
 	if ($_SESSION['social_exist']===true) {
 		if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') {
 			$success= get_lang('SelectedMessagesDeleted');
@@ -1207,40 +1207,26 @@ function inbox_display() {
 	// display sortable table with messages of the current user
 	//$table = new SortableTable('messages', 'get_number_of_messages_mask', 'get_message_data_mask', 3, get_number_of_messages_mask(),'DESC');
 	$table = new SortableTable('message_inbox', array('MessageManager','get_number_of_messages'), array('MessageManager','get_message_data'),3,20,'DESC');
-	$table->set_header(0, '', false,array ('style' => 'width:20px;'));
+	$table->set_header(0, '', false,array ('style' => 'width:15px;'));
 	$title=api_xml_http_response_encode(get_lang('Title'));
-	$action=api_xml_http_response_encode(get_lang('Actions'));
+	$action=api_xml_http_response_encode(get_lang('Modify'));
 	$table->set_header(1,api_xml_http_response_encode(get_lang('Messages')),false);
 	//$table->set_header(2,$title,true);
-	$table->set_header(2,api_xml_http_response_encode(get_lang('Date')),true, array('style' => 'width:150px;'));
+	$table->set_header(2,api_xml_http_response_encode(get_lang('Date')),true, array('style' => 'width:160px;'));
 	$table->set_header(3,$action,false,array ('style' => 'width:70px;'));
 
 	if ($_REQUEST['f']=='social') {
 		$parameters['f'] = 'social';
 		$table->set_additional_parameters($parameters);
-	}
-
-    echo '<div id="div_content_table_data">';
-	if ($request===true) {
-		echo '<form name="form_send" id="form_send" action="" method="post">';
-		echo '<input type="hidden" name="action" value="delete" />';
-		$table->display();
-		echo '</form>';
-		if (get_number_of_messages_mask() > 0) {
-			echo '<a href="javascript:void(0)" onclick="selectall_cheks()">'.api_xml_http_response_encode(get_lang('SelectAll')).'</a>&nbsp;&nbsp;&nbsp;';
-			echo '<a href="javascript:void(0)" onclick="unselectall_cheks()">'.api_xml_http_response_encode(get_lang('UnSelectAll')).'</a>&nbsp;&nbsp;&nbsp;';
-			echo '<button class="save" name="delete" type="button" value="'.api_xml_http_response_encode(get_lang('DeleteSelectedMessages')).'" onclick="submit_form(\'inbox\')">'.api_xml_http_response_encode(get_lang('DeleteSelectedMessages')).'</button>';
-
-		}
-	} else {
-		$table->set_form_actions(array ('delete' => get_lang('DeleteSelectedMessages')));
-		$table->display();
-	}
-    echo '</div>';
+	}    
+	$table->set_form_actions(array ('delete' => get_lang('DeleteSelectedMessages')));
+	$table->display();	
 }
+
 function get_number_of_messages_mask() {
 	return MessageManager::get_number_of_messages();
 }
+
 function get_message_data_mask($from, $number_of_items, $column, $direction) {
 	$column='3';
 	$direction='DESC';
@@ -1248,6 +1234,7 @@ function get_message_data_mask($from, $number_of_items, $column, $direction) {
 	$number_of_items=get_number_of_messages_mask();
 	return MessageManager::get_message_data($from, $number_of_items, $column, $direction);
 }
+
 function outbox_display() {
 	$table_message = Database::get_main_table(TABLE_MESSAGE);
 	$request=api_is_xml_http_request();
@@ -1291,41 +1278,31 @@ function outbox_display() {
 
 	$parameters['f'] = Security::remove_XSS($_GET['f']);
 	$table->set_additional_parameters($parameters);
-	$table->set_header(0, '', false,array ('style' => 'width:20px;'));
+	$table->set_header(0, '', false,array ('style' => 'width:15px;'));
 	$title = api_xml_http_response_encode(get_lang('Title'));
-	$action= api_xml_http_response_encode(get_lang('Actions'));
+	$action= api_xml_http_response_encode(get_lang('Modify'));
 
 	$table->set_header(1, api_xml_http_response_encode(get_lang('Messages')),false);
 	//$table->set_header(2, $title,true);
-	$table->set_header(2, api_xml_http_response_encode(get_lang('Date')),true,array ('style' => 'width:150px;'));
+	$table->set_header(2, api_xml_http_response_encode(get_lang('Date')),true,array ('style' => 'width:160px;'));
 	$table->set_header(3,$action, false,array ('style' => 'width:70px;'));
 
-	/*
-	if ($_REQUEST['f']=='social') {
-		$parameters['f'] = 'social';
-		$table->set_additional_parameters($parameters);
-	}
-	*/
-
-	echo '<div id="div_content_table_data_sent">';
-
-		if ($request===true) {
-			echo '<form name="form_send_out" id="form_send_out" action="" method="post">';
-
-			echo '<input type="hidden" name="action" value="delete" />';
-
-			$table->display();
-			echo '</form>';
-			if (get_number_of_messages_send_mask() > 0) {
-				echo '<a href="javascript:void(0)" onclick="selectall_cheks()">'.api_xml_http_response_encode(get_lang('SelectAll')).'</a>&nbsp;&nbsp;&nbsp;';
-				echo '<a href="javascript:void(0)" onclick="unselectall_cheks()">'.api_xml_http_response_encode(get_lang('UnSelectAll')).'</a>&nbsp;&nbsp;&nbsp;';
-				echo '<button class="save" name="delete" type="button" value="'.api_xml_http_response_encode(get_lang('DeleteSelectedMessages')).'" onclick="submit_form(\'outbox\')">'.api_xml_http_response_encode(get_lang('DeleteSelectedMessages')).'</button>';
-			}
-		} else {
-			$table->set_form_actions(array ('delete' => get_lang('DeleteSelectedMessages')));
-			$table->display();
+	
+	if ($request===true) {
+		echo '<form name="form_send_out" id="form_send_out" action="" method="post">';
+		echo '<input type="hidden" name="action" value="delete" />';
+		$table->display();
+		echo '</form>';
+		if (get_number_of_messages_send_mask() > 0) {
+			echo '<a href="javascript:void(0)" onclick="selectall_cheks()">'.api_xml_http_response_encode(get_lang('SelectAll')).'</a>&nbsp;&nbsp;&nbsp;';
+			echo '<a href="javascript:void(0)" onclick="unselectall_cheks()">'.api_xml_http_response_encode(get_lang('UnSelectAll')).'</a>&nbsp;&nbsp;&nbsp;';
+			echo '<button class="save" name="delete" type="button" value="'.api_xml_http_response_encode(get_lang('DeleteSelectedMessages')).'" onclick="submit_form(\'outbox\')">'.api_xml_http_response_encode(get_lang('DeleteSelectedMessages')).'</button>';
 		}
-	echo '</div>';
+	} else {
+		$table->set_form_actions(array ('delete' => get_lang('DeleteSelectedMessages')));
+		$table->display();
+	}
+	
 }
 function get_number_of_messages_send_mask() {
 	return MessageManager::get_number_of_messages_sent();
@@ -1336,5 +1313,4 @@ function get_message_data_send_mask($from, $number_of_items, $column, $direction
 	//non set by SortableTable ?
 	$number_of_items=get_number_of_messages_send_mask();
 	return MessageManager::get_message_data_sent($from, $number_of_items, $column, $direction);
-}
-?>
+}

+ 78 - 48
main/inc/lib/tracking.lib.php

@@ -867,8 +867,7 @@ class Tracking {
          * @param     int         Learning path id
          * @return     int         Total time
          */
-        public static function get_last_connection_time_in_lp($student_id, $course_code, $lp_id, $session_id=0) {
-
+        public static function get_last_connection_time_in_lp($student_id, $course_code, $lp_id, $session_id = 0) {
             $course = CourseManager :: get_course_information($course_code);
             $student_id = intval($student_id);
             $lp_id = intval($lp_id);
@@ -1944,11 +1943,12 @@ class Tracking {
             }
 
             $rs = Database::query($sql);
-            while($row = Database :: fetch_array($rs)) {
+            while ($row = Database :: fetch_array($rs)) {
                 $course_in_session[$row['session_id']][$row['course_code']] = CourseManager::get_course_information($row['course_code']);
             }
 
             $html  = '';
+            //Courses list
             if ($show_courses) {
                 if (!empty($courses)) {
                     $html .= '<table class="data_table" width="100%">';
@@ -2046,20 +2046,23 @@ class Tracking {
                         $session_graph[$my_session_id] = self::generate_session_exercise_graph($exercise_graph_name_list, $user_results, $exercise_graph_list);
                     }
                 }
-
+                
+                $html .= '<table class="data_table" width="100%">';
+                $html .= '<tr>
+                      '.Display::tag('th', get_lang('Session'),                  array('width'=>'300px')).'
+                      '.Display::tag('th', get_lang('PublishedExercises'),       array('width'=>'300px')).'
+                      '.Display::tag('th', get_lang('DoneExercises'),            array('class'=>'head')).'
+                      '.Display::tag('th', get_lang('AverageExerciseResult'),    array('class'=>'head')).'
+                      '.Display::tag('th', get_lang('Details'),                  array('class'=>'head')).'                        
+                      </tr>';
+                
                 foreach ($course_in_session as $key => $course_list) {
                     if (isset($session_id) && !empty($session_id)) {
                         if ($session_id != $key) {
                             continue;
                         }
-                    }
-                    $html .= Display::tag('h2',api_get_session_name($key));
-                    $html .= '<table class="data_table" width="100%">';
-                    $html .= '<tr>
-                          '.Display::tag('th', get_lang('PublishedExercises'),       array('width'=>'300px')).'
-                          '.Display::tag('th', get_lang('DoneExercises'),            array('class'=>'head')).'
-                          '.Display::tag('th', get_lang('AverageExerciseResult'),    array('class'=>'head')).'                  
-                	      </tr>';
+                    }                   
+       
                     $all_exercises = 0;
                     $all_done_exercise = 0;
                     $all_average = 0;
@@ -2080,18 +2083,39 @@ class Tracking {
                         $all_average       += $average;
                         $stats_array[$enreg['code']] = array('exercises'=>$exercises, 'done_exercises'=>$done_exercises, 'average'=>$average);
                     }
+                    
                     $all_average = $all_average /  count($course_list);
+                    
+                    if (isset($_GET['session_id']) && $key == $_GET['session_id']) {
+                        $html .= '<tr style="background-color:#FBF09D">';
+                    } else {
+                        $html .= '<tr>';
+                    }
+                    
+                    $html .= Display::tag('td', api_get_session_name($key));
                     $html .= Display::tag('td', $all_exercises);
                     $html .= Display::tag('td', $all_done_exercise);
                     $html .= Display::tag('td', convert_to_percentage($all_average));
-                    $html .='</table><br />';
                     
-                    if (!empty($session_graph[$key])) {
-                        $html .= Display::div($session_graph[$my_session_id], array('id'=>'session_graph_'.$key,'class'=>'chart-session', 'style'=>'position:relative; text-align: center;') );
+                                     
+                    if (isset($_GET['session_id']) && $key == $_GET['session_id']) {
+                        $icon = Display::url(Display::return_icon('2rightarrow_na.gif', get_lang('Details')), '?session_id='.$key);
+                    } else {
+                        $icon = Display::url(Display::return_icon('2rightarrow.gif', get_lang('Details')), '?session_id='.$key);
                     }
-
-                    $html .= Display::tag('h2',get_lang('CourseList'));
-
+                    $html .= Display::tag('td', $icon);                    
+                    $html .= '</tr>';                                   
+                }                
+                $html .='</table><br />';                
+                
+                //Checking selected session
+                
+                if (isset($_GET['session_id'])) {
+                    $key = intval($_GET['session_id']);
+                    $html .= Display::tag('h2',api_get_session_name($key).' - '.get_lang('CourseList'));
+                    
+                    $course_list = $course_in_session[$key];
+    
                     $html .= '<table class="data_table" width="100%">';
                     $html .= '
                         <tr>
@@ -2101,40 +2125,45 @@ class Tracking {
                           '.Display::tag('th', get_lang('AverageExerciseResult'), array('class'=>'head')).'
                           '.Display::tag('th', get_lang('Time')         ,         array('class'=>'head')).'
                           '.Display::tag('th', get_lang('LPProgress')     ,       array('class'=>'head')).'
-                          '.Display::tag('th', get_lang('Score').Display :: return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).'
+                          '.Display::tag('th', get_lang('Score').Display::return_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')), array('class'=>'head')).'
                           '.Display::tag('th', get_lang('LastConnexion'),         array('class'=>'head')).'      
                           '.Display::tag('th', get_lang('Details'),               array('class'=>'head')).'
                         </tr>';
+                    
                     foreach ($course_list as $enreg) {
+                        
+                        //All exercises in the course @todo change for a real count
+                        $exercises          = count(get_all_exercises($enreg, $key));
+                        //Count of user results
+                        //$done_exercises     = get_best_exercise_results_by_course($enreg['code'], $key);
+                        $done_exercises     = get_count_exercises_attempted_by_course($enreg['code'], $key);
+                        //Average
+                        $average            = get_average_score_by_course($enreg['code'], $key);
+           
+                        $stats_array[$enreg['code']] = array('exercises'=>$exercises, 'done_exercises'=>$done_exercises, 'average'=>$average);
+                        
                         $weighting = 0;
                         $last_connection       = Tracking :: get_last_connection_date_on_the_course($user_id, $enreg['code'], $key);
                         $progress              = Tracking :: get_avg_student_progress($user_id, $enreg['code'],array(), $key);
                         $total_time_login      = Tracking :: get_time_spent_on_the_course($user_id, $enreg['code'], $key);
                         $time                  = api_time_to_hms($total_time_login);
                         $percentage_score      = Tracking :: get_avg_student_score($user_id, $enreg['code'], array(), $key);
-
+    
                         if ($enreg['code'] == $_GET['course'] && $_GET['session_id'] == $key) {
                             $html .= '<tr class="row_odd" style="background-color:#FBF09D" >';
                         } else {
                             $html .= '<tr class="row_even">';
                         }
-
+    
                         $url        = api_get_course_url($enreg['code'], $key);
                         $course_url = Display::url($enreg['title'], $url, array('target'=>'_blank'));
-
-                        $html .= Display::tag('td', $course_url);/*
-                        //All exercises in the course
-                        $exercises = get_all_exercises($enreg, $key);
-                        //Count of user results
-                        $done_exercises = get_all_exercise_results_by_course($enreg['code'], $key);
-                        //Average
-                        $average = get_average_score_by_course($enreg['code'], $key);*/
-
+    
+                        $html .= Display::tag('td', $course_url);
                         $html .= Display::tag('td', $stats_array[$enreg['code']]['exercises']);
                         $html .= Display::tag('td', $stats_array[$enreg['code']]['done_exercises']);
                         $html .= Display::tag('td', convert_to_percentage($stats_array[$enreg['code']]['average']));
                         $html .= Display::tag('td', $time, array('align'=>'center'));
-
+    
                         if (is_numeric($progress)) {
                             $progress = $progress.'%';
                         } else {
@@ -2148,7 +2177,7 @@ class Tracking {
                         }
                         $html .= Display::tag('td', $percentage_score, array('align'=>'center'));
                         $html .= Display::tag('td', $last_connection,  array('align'=>'center'));
-
+    
                         if ($enreg['code'] == $_GET['course'] && $_GET['session_id'] == $key) {
                             $details = '<a href="#">';
                             $details .=Display::return_icon('2rightarrow_na.gif', get_lang('Details'));
@@ -2160,9 +2189,15 @@ class Tracking {
                         $html .= Display::tag('td', $details, array('align'=>'center'));
                         $html .= '</tr>';
                     }
-                    $html .= '</table>';
+                    $html .= '</table>'; 
+                    
+                    if (!empty($session_graph[$key])) {
+                        $html .= Display::div($session_graph[$my_session_id], array('id'=>'session_graph_'.$key,'class'=>'chart-session', 'style'=>'position:relative; text-align: center;') );
+                    }     
+                    
+                    
                 }
-            }
+            }            
             return $html;
         }
 
@@ -2196,15 +2231,11 @@ class Tracking {
 
                 $session_name = api_get_session_name($session_id);
 
-                $html .='
-            <table class="data_table" width="100%">
-                <tr class="tableName">
-                    <td colspan="4">
-                        '.Display::tag('h3', $course_info['title']).'
-                    </td>
-                </tr><tr>';                
-
-                $html .= Display::tag('th', get_lang('Learnpath'),     array('class'=>'head', 'style'=>'color:#000'));
+                $html .='<table class="data_table" width="100%">
+                         <tr class="tableName">
+                            <td colspan="4">'.Display::tag('h3', $course_info['title']).'</td>
+                         </tr><tr>';
+                $html .= Display::tag('th', get_lang('Learnpaths'),     array('class'=>'head', 'style'=>'color:#000'));
                 $html .= Display::tag('th', get_lang('Time'),          array('class'=>'head', 'style'=>'color:#000'));
                 $html .= Display::tag('th', get_lang('Progress'),      array('class'=>'head', 'style'=>'color:#000'));
                 $html .= Display::tag('th', get_lang('LastConnexion'), array('class'=>'head', 'style'=>'color:#000'));
@@ -2233,7 +2264,7 @@ class Tracking {
                         $html .= Display::tag('td', $progress, array('align'=>'center'));
                         $last_connection = '-';
                         if (!empty($last_connection_in_lp)) {
-                            $last_connection = api_get_utc_datetime($last_connection_in_lp);
+                            $last_connection = api_convert_and_format_date($last_connection_in_lp, DATE_TIME_FORMAT_LONG);
                         }
                         $html .= Display::tag('td', $last_connection, array('align'=>'center','width'=>'180px'));
                         $html .= "</tr>";
@@ -2247,7 +2278,7 @@ class Tracking {
                 }
 
                 $html .='</table><br />
-            <table class="data_table" width="100%">';
+                         <table class="data_table" width="100%">';
 
                 // This code was commented on purpose see BT#924
 
@@ -2321,13 +2352,13 @@ class Tracking {
                                     $normal_graph  = self::generate_exercise_result_graph($to_graph_exercise_result[$exercices['id']]);
                                 }
                             }
-
+                                                        
                             echo Display::div($normal_graph, array('id'=>'main_graph_'.$exercices['id'],'class'=>'dialog', 'style'=>'display:none') );
 
                             if (empty($graph)) {
                                 $graph = '-';
                             } else {
-                                $graph = Display::url($graph, '#', array('id'=>$exercices['id'],'class'=>'opener'));
+                                $graph = Display::url($graph, '#', array('id'=>$exercices['id'], 'class'=>'opener'));
                             }
 
                             $html .= Display::tag('td', $attempts,                 array('align'=>'center'));
@@ -2335,7 +2366,6 @@ class Tracking {
                             $html .= Display::tag('td', $position,                 array('align'=>'center'));
                             $html .= Display::tag('td', $best_score,               array('align'=>'center'));
                             $html .= Display::tag('td', $graph,                    array('align'=>'center'));
-
                             //$html .= Display::tag('td', $latest_attempt_url,       array('align'=>'center', 'width'=>'25'));
 
                         } else {

+ 29 - 33
main/messages/inbox.php

@@ -161,40 +161,36 @@ echo '<div id="social-content">';
 	}
 
 	echo '<div id="'.$id_content_right.'">';
-	
-			if (api_get_setting('allow_social_tool') == 'true') {
-			    
-				echo '<div class="social-box-container2">';				
-				echo '<div class="actions">';				
-    				echo '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php?f=social">'.Display::return_icon('compose_message.png', get_lang('ComposeMessage'), array(), 32).'</a>';
-                    echo '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php?f=social">'.Display::return_icon('outbox.png', get_lang('Outbox'), array(), 32).'</a>';                        
-				echo '</div>';
-								
-				//echo '<div>'.Display::return_icon('content-post-group1.jpg',get_lang('Inbox')).'</div>';
-				//echo '<div id="div_content_table" class="social-box-content2">';
-			}	
-			//MAIN CONTENT
-			if (!isset($_GET['del_msg'])) {	
-				inbox_display();
-			} else {
-				$num_msg = intval($_POST['total']);
-				for ($i=0;$i<$num_msg;$i++) {
-					if($_POST[$i]) {
-						//the user_id was necesarry to delete a message??
-						MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_POST['_'.$i]);
-					}
-				}
-				inbox_display();
-			}
-			if (api_get_setting('allow_social_tool') == 'true'){
-				echo '</div>';				
-				//echo '</div>';
-			}			
+    
+    if (api_get_setting('allow_social_tool') == 'true') {
+        
+    	echo '<div class="social-box-container2">';				
+    	echo '<div class="actions">';				
+    		echo '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php?f=social">'.Display::return_icon('compose_message.png', get_lang('ComposeMessage'), array(), 32).'</a>';
+            echo '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php?f=social">'.Display::return_icon('outbox.png', get_lang('Outbox'), array(), 32).'</a>';                        
+    	echo '</div>';
+    					
+    	//echo '<div>'.Display::return_icon('content-post-group1.jpg',get_lang('Inbox')).'</div>';
+    	//echo '<div id="div_content_table" class="social-box-content2">';
+    }	
+    //MAIN CONTENT
+    if (!isset($_GET['del_msg'])) {
+    	inbox_display();
+    } else {
+    	$num_msg = intval($_POST['total']);
+    	for ($i=0;$i<$num_msg;$i++) {
+    		if($_POST[$i]) {
+    			//the user_id was necesarry to delete a message??
+    			MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_POST['_'.$i]);
+    		}
+    	}
+    	inbox_display();
+    }
+    if (api_get_setting('allow_social_tool') == 'true'){
+    	echo '</div>';				
+    	//echo '</div>';
+    }			
 	echo '</div>';	
 echo '</div>';
 
-/*
-		FOOTER
-*/
-
 Display::display_footer();

+ 1 - 1
main/mySpace/myStudents.php

@@ -634,7 +634,7 @@ if ($timezone !== null) {
 				$start_time = Tracking::get_last_connection_time_in_lp($student_id, $course_code, $lp_id, $session_id);
                 
                 if (!empty($start_time)) {
-                    $start_time = api_get_utc_datetime($start_time );
+                    $start_time = api_convert_and_format_date($start_time, DATE_TIME_FORMAT_LONG);
                 } else {
                     $start_time =  '-';
                 }

+ 1 - 1
main/session/index.php

@@ -348,7 +348,7 @@ $(function() {
 </script>
 
 <?php 
-$my_reporting   = Tracking::show_user_progress(api_get_user_id(), $session_id, '&session_id='.$session_id.'#tabs-3', false);
+$my_reporting   = Tracking::show_user_progress(api_get_user_id(), $session_id, '&session_id='.$session_id.'#tabs-4', false);
 $my_reporting   .= '<br />'.Tracking::show_course_detail(api_get_user_id(), $_GET['course'], $_GET['session_id']);
 
 //Main headers

+ 6 - 15
main/social/friends.php

@@ -133,12 +133,7 @@ if (count($friends) == 0 ) {
 	      <tr>
 			<td height="153" valign="top">
 				<?php
-				
-				
-				
-				
-		
-					
+							
 					$friend_html = '';
 					$number_of_images = 8;
 					
@@ -158,18 +153,15 @@ if (count($friends) == 0 ) {
 								$friends_profile = SocialManager::get_picture_user($friend['friend_user_id'], $friend['image'], 92);
 								$friend_html.='<div onMouseover="show_icon_delete(this)" onMouseout="hide_icon_delete(this)" class="image-social-content" id=div_'.$friends[$j]['friend_user_id'].'>';
 								$friend_html.='<span><a href="profile.php?u='.$friend['friend_user_id'].'"><center><img src="'.$friends_profile['file'].'" style="height:60px;border:3pt solid #eee" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$user_name.'" /></center></a></span>';
-								$friend_html.='<img onclick="delete_friend (this)" id=img_'.$friend['friend_user_id'].' src="../img/blank.gif" alt="" title=""  class="image-delete" /> <center class="friend">'.$user_name.'</center></div>';				
+								$friend_html.='<img onclick="delete_friend(this)" id=img_'.$friend['friend_user_id'].' src="../img/blank.gif" alt="" title=""  class="image-delete" /> <center class="friend">'.$user_name.'</center></div>';				
 							}
 							$j++;
 						}
 						$friend_html.='</td></tr>';
 					}
 					$friend_html.='<br/></table>';
-					
-					
-					echo $friend_html;
-				
-				echo '</div>';
+					echo $friend_html;				
+				    echo '</div>';
 				?>
 			</td>
 	        </tr>
@@ -177,9 +169,8 @@ if (count($friends) == 0 ) {
 	  </tr>
 	</table>
 	</div>
-	<?php
-		
+	<?php		
 	}	
-		echo '</div>';
+	echo '</div>';
 	echo '</div>';	
 Display :: display_footer();