Yannick Warnier 14 years ago
parent
commit
b6c54b428f
48 changed files with 462 additions and 170 deletions
  1. 1 0
      documentation/changelog.html
  2. 26 2
      main/admin/statistics/statistics.lib.php
  3. 23 16
      main/admin/user_list.php
  4. 9 1
      main/css/academica/default.css
  5. 9 1
      main/css/baby_orange/default.css
  6. 9 1
      main/css/blue_lagoon/default.css
  7. 9 1
      main/css/chamilo/default.css
  8. 11 3
      main/css/chamilo_electric_blue/default.css
  9. 10 2
      main/css/chamilo_green/default.css
  10. 10 2
      main/css/chamilo_orange/default.css
  11. 10 2
      main/css/chamilo_red/default.css
  12. 10 1
      main/css/cool_blue/default.css
  13. 9 1
      main/css/corporate/default.css
  14. 9 1
      main/css/cosmic_campus/default.css
  15. 9 1
      main/css/delicious_bordeaux/default.css
  16. 12 1
      main/css/dokeos_blue/default.css
  17. 18 1
      main/css/dokeos_classic/default.css
  18. 10 1
      main/css/dokeos_classic_2D/default.css
  19. 9 1
      main/css/empire_green/default.css
  20. 11 1
      main/css/fruity_orange/default.css
  21. 9 1
      main/css/medical/default.css
  22. 9 1
      main/css/public_admin/default.css
  23. 9 1
      main/css/royal_purple/default.css
  24. 9 1
      main/css/silver_line/default.css
  25. 9 1
      main/css/sober_brown/default.css
  26. 9 1
      main/css/steel_grey/default.css
  27. 9 0
      main/css/tasty_olive/default.css
  28. 4 1
      main/exercice/answer_admin.inc.php
  29. 11 5
      main/exercice/exercice.php
  30. 12 5
      main/exercice/exercice_submit.php
  31. 12 7
      main/exercice/exercise.lib.php
  32. 5 5
      main/exercice/exercise_result.class.php
  33. 10 5
      main/exercice/exercise_result.php
  34. 10 2
      main/exercice/exercise_show.php
  35. 7 7
      main/exercice/export/scorm/scorm_classes.php
  36. 19 19
      main/exercice/question.class.php
  37. 0 1
      main/forum/forumfunction.inc.php
  38. 14 18
      main/inc/banner.inc.php
  39. 3 1
      main/inc/footer.inc.php
  40. 3 3
      main/inc/lib/exercise_show_functions.lib.php
  41. 1 1
      main/inc/lib/main_api.lib.php
  42. 5 13
      main/inc/lib/system_announcements.lib.php
  43. 4 0
      main/inc/lib/usermanager.lib.php
  44. 3 0
      main/install/configuration.dist.php
  45. 5 5
      main/newscorm/learnpath_functions.inc.php
  46. 5 0
      main/newscorm/scorm_api.php
  47. 31 16
      main/work/work.lib.php
  48. 11 10
      main/work/work.php

+ 1 - 0
documentation/changelog.html

@@ -37,6 +37,7 @@
   <li>Multiple URL feature: System Announcements and Global agenda now are filtered by URL see BT#1441</li>
   <li>Fixed bug when editing a "Student publication" see BT#1377</li>
   <li>Fixed bug when deleting a "Student publication" see BT#1556</li>
+  <li>Exercises: Now we show the firstname and lastname of the students in different columns see BT#1263</li>  
   <li>Deleting production user's file fixed see #1682</li>
 </ul>
 <h3>Security</h3>

+ 26 - 2
main/admin/statistics/statistics.lib.php

@@ -263,26 +263,50 @@ class Statistics {
 		if ($_configuration['multiple_access_urls']) {
 			$table_url = ", $access_url_rel_user_table";
 			$where_url = " WHERE login_user_id=user_id AND access_url_id='".$current_url_id."'";
+			$where_url_last = ' AND login_date > DATE_SUB(NOW(),INTERVAL 1 %s)';
 		} else {
 			$table_url = '';
-			$where_url='';
+			$where_url = '';
+			$where_url_last = ' WHERE login_date > DATE_SUB(NOW(),INTERVAL 1 %s)';
 		}
 		switch ($type) {
 			case 'month':
 				$months = api_get_months_long();
 				$period = get_lang('PeriodMonth');
 				$sql = "SELECT DATE_FORMAT( login_date, '%Y-%m' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY login_date ";
+				$sql_last_x = "SELECT DATE_FORMAT( login_date, '%Y-%m' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'YEAR')." GROUP BY stat_date ORDER BY login_date ";
 				break;
 			case 'hour':
 				$period = get_lang('PeriodHour');
 				$sql = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY stat_date ";
+				$sql_last_x = "SELECT DATE_FORMAT( login_date, '%H' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'DAY')." GROUP BY stat_date ORDER BY stat_date ";
 				break;
 			case 'day':
 				$week_days = api_get_week_days_long();
 				$period = get_lang('PeriodDay');
 				$sql = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
+				$sql_last_x = "SELECT DATE_FORMAT( login_date, '%w' ) AS stat_date , count( login_id ) AS number_of_logins FROM ".$table.$table_url.$where_url.sprintf($where_url_last,'WEEK')." GROUP BY stat_date ORDER BY DATE_FORMAT( login_date, '%w' ) ";
 				break;
 		}
+		$res_last_x = Database::query($sql_last_x);
+		$result_last_x = array();
+		while ($obj = Database::fetch_object($res_last_x)) {
+			$stat_date = $obj->stat_date;
+			switch ($type) {
+				case 'month':
+					$stat_date = explode('-', $stat_date);
+					$stat_date[1] = $months[$stat_date[1] - 1];
+					$stat_date = implode(' ', $stat_date);
+					break;
+				case 'day':
+					$stat_date = $week_days[$stat_date];
+					break;
+			}
+			$result_last_x[$stat_date] = $obj->number_of_logins;
+		}
+		Statistics::print_stats(get_lang('LastLogins').' ('.$period.')', $result_last_x, true);
+		flush(); //flush web request at this point to see something already while the full data set is loading
+		echo '<br />';
 		$res = Database::query($sql);
 		$result = array();
 		while ($obj = Database::fetch_object($res)) {
@@ -299,7 +323,7 @@ class Statistics {
 			}
 			$result[$stat_date] = $obj->number_of_logins;
 		}
-		Statistics::print_stats(get_lang('Logins').' ('.$period.')', $result, true);
+		Statistics::print_stats(get_lang('AllLogins').' ('.$period.')', $result, true);
 	}
 	/**
 	 * Print the number of recent logins

+ 23 - 16
main/admin/user_list.php

@@ -15,6 +15,13 @@ require_once api_get_path(LIBRARY_PATH).'security.lib.php';
 require_once api_get_path(LIBRARY_PATH).'xajax/xajax.inc.php';
 require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
 
+global $_configuration;
+// Blocks the possibility to delete a user
+$delete_user_available = true;
+if (isset($_configuration['deny_delete_users']) &&  $_configuration['deny_delete_users']) {
+	$delete_user_available = false;
+}
+
 $htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>';
 $htmlHeadXtra[] = '<script type="text/javascript">
 function load_course_list (div_course,my_user_id) {
@@ -550,11 +557,8 @@ function user_filter($name, $params, $row) {
  * @param   array   Row of elements to alter
  * @return string Some HTML-code with modify-buttons
  */
-function modify_filter($user_id,$url_params,$row)
-{
-	global $charset;
-	global $_user;
-	global $_admins_list;
+function modify_filter($user_id,$url_params,$row) {
+	global $charset, $_user, $_admins_list, $delete_user_available;
 	$is_admin = in_array($user_id,$_admins_list);
 	$statusname = api_get_status_langvars();
 	$user_is_anonymous = false;
@@ -600,14 +604,13 @@ function modify_filter($user_id,$url_params,$row)
 		} else {
 				$result .= Display::return_icon('edit_na.gif', get_lang('Edit')).'</a>&nbsp;&nbsp;';
 		}
-
-		if ($row[0] != $_user['user_id'] && !$user_is_anonymous) {
-
-			// you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
-			$result .= '<a href="user_list.php?action=delete_user&amp;user_id='.$user_id.'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'"  onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
-
-		} else {
-			$result .= Display::return_icon('delete_na.gif', get_lang('Delete'));
+		if ($delete_user_available) {
+			if ($row[0] != $_user['user_id'] && !$user_is_anonymous) {			
+				// you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
+				$result .= '<a href="user_list.php?action=delete_user&amp;user_id='.$user_id.'&amp;'.$url_params.'&amp;sec_token='.$_SESSION['sec_token'].'"  onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset))."'".')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';			
+			} else {
+				$result .= Display::return_icon('delete_na.gif', get_lang('Delete'));
+			}
 		}
 	}
 	if ($is_admin) {
@@ -772,10 +775,14 @@ if ($_GET['action'] == "login_as" && isset ($login_as_user_id))
 					break;
 				case 'delete_user' :
 					if (api_is_platform_admin()) {
-						if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id'])) {
-							Display :: display_confirmation_message(get_lang('UserDeleted'));
+						if ($delete_user_available) {
+							if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id'])) {
+								Display :: display_confirmation_message(get_lang('UserDeleted'));
+							} else {
+								Display :: display_error_message(get_lang('CannotDeleteUserBecauseOwnsCourse'));
+							}
 						} else {
-							Display :: display_error_message(get_lang('CannotDeleteUserBecauseOwnsCourse'));
+							Display :: display_error_message(get_lang('CannotDeleteUser'));
 						}
 					}
 					break;

+ 9 - 1
main/css/academica/default.css

@@ -3315,4 +3315,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 9 - 1
main/css/baby_orange/default.css

@@ -3249,4 +3249,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 9 - 1
main/css/blue_lagoon/default.css

@@ -3925,4 +3925,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 9 - 1
main/css/chamilo/default.css

@@ -1752,7 +1752,7 @@ div.system_announcement {
 	background: transparent url('images/systemenouvelles.jpg') no-repeat top  left;
 	padding-top: 10px;
 	padding-bottom: 10px;
-	width: 90%;
+	margin-left:8px;
 }
 .system_announcements h3 {
 	padding-left:70px;
@@ -4324,3 +4324,11 @@ span.form_required  {
 	padding:0px;
 }
 
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 11 - 3
main/css/chamilo_electric_blue/default.css

@@ -1656,8 +1656,8 @@ div.system_announcement {
 .system_announcements {
 	background: transparent url('images/systemenouvelles.jpg') no-repeat top  left;
 	padding-top: 10px;
-	padding-bottom: 10px;
-	width: 90%;
+	padding-bottom: 10px;	
+	margin-left:8px;
 }
 .system_announcements h3 {
 	padding-left:70px;
@@ -4296,4 +4296,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 10 - 2
main/css/chamilo_green/default.css

@@ -1669,7 +1669,7 @@ div.system_announcement {
 	background: transparent url('images/systemenouvelles.jpg') no-repeat top  left;
 	padding-top: 10px;
 	padding-bottom: 10px;
-	width: 90%;
+	margin-left:8px;
 }
 .system_announcements h3 {
 	padding-left:70px;
@@ -4312,4 +4312,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 10 - 2
main/css/chamilo_orange/default.css

@@ -1655,7 +1655,7 @@ div.system_announcement {
 	background: transparent url('images/systemenouvelles.jpg') no-repeat top  left;
 	padding-top: 10px;
 	padding-bottom: 10px;
-	width: 90%;
+	margin-left:8px;
 }
 .system_announcements h3 {
 	padding-left:70px;
@@ -4290,4 +4290,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 10 - 2
main/css/chamilo_red/default.css

@@ -1666,7 +1666,7 @@ div.system_announcement {
 	background: transparent url('images/systemenouvelles.jpg') no-repeat top  left;
 	padding-top: 10px;
 	padding-bottom: 10px;
-	width: 90%;
+	margin-left:8px;
 }
 .system_announcements h3 {
 	padding-left:70px;
@@ -4300,4 +4300,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 10 - 1
main/css/cool_blue/default.css

@@ -1139,6 +1139,7 @@ span.form_error {
 .data_table tr.total {
 	padding: 5px;
 	border: 1px solid gray;
+
 	background-color: #ffffcc;
 	text-align:left;
 }
@@ -3799,4 +3800,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 9 - 1
main/css/corporate/default.css

@@ -3268,4 +3268,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 9 - 1
main/css/cosmic_campus/default.css

@@ -3328,4 +3328,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 9 - 1
main/css/delicious_bordeaux/default.css

@@ -3787,4 +3787,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 12 - 1
main/css/dokeos_blue/default.css

@@ -1139,6 +1139,7 @@ span.form_error {
 .data_table tr.tableName {
 	padding: 5px;
 	border: 1px solid gray;
+
 	background-color: #e6e6ff;
 	text-align:left;
 }
@@ -1951,6 +1952,7 @@ div.comments {
 	padding: 0.5em 0.5em 2em 0;
 	-moz-border-radius: 0.5em;
 }
+
 .glossary-term-edit-desc {
 	font-weight: bold;
 	font-size: 120%;
@@ -3545,6 +3547,7 @@ div.attendance-calendar-add div.row div.formw,div.attendance-calendar-edit div.r
 .attendance-calendar-edit div.row {
 	display:inline;
 }
+
 .attendance-calendar-row {
 	padding:5px;
 }
@@ -3832,4 +3835,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 18 - 1
main/css/dokeos_classic/default.css

@@ -4047,4 +4047,21 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}
+
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 10 - 1
main/css/dokeos_classic_2D/default.css

@@ -4062,4 +4062,13 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 9 - 1
main/css/empire_green/default.css

@@ -3775,4 +3775,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 11 - 1
main/css/fruity_orange/default.css

@@ -3548,6 +3548,7 @@ div.attendance-calendar-add div.row div.formw,div.attendance-calendar-edit div.r
 	overflow:hidden;
 	margin-right:2px;
 	margin-top:5px;
+
 }
 .attendance-calendar-add div.row {
 	display:inline;
@@ -3776,4 +3777,13 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 9 - 1
main/css/medical/default.css

@@ -4232,4 +4232,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 9 - 1
main/css/public_admin/default.css

@@ -3980,4 +3980,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 9 - 1
main/css/royal_purple/default.css

@@ -3772,4 +3772,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 9 - 1
main/css/silver_line/default.css

@@ -3719,4 +3719,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 9 - 1
main/css/sober_brown/default.css

@@ -3928,4 +3928,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 9 - 1
main/css/steel_grey/default.css

@@ -3776,4 +3776,12 @@ span.form_required  {
     border:1pt solid #ccc;
     margin-top:5px;
     height: 40px;
-}
+}
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 9 - 0
main/css/tasty_olive/default.css

@@ -3550,6 +3550,7 @@ div.attendance-calendar-add div.row div.formw,div.attendance-calendar-edit div.r
 	margin-right:2px;
 	margin-top:5px;
 }
+
 .attendance-calendar-add div.row {
 	display:inline;
 }
@@ -3778,3 +3779,11 @@ span.form_required  {
     margin-top:5px;
     height: 40px;
 }
+
+.attendance-users-table td {
+	height:66px;
+}
+
+.attendance-calendar-table td {
+	height:66px;
+}

+ 4 - 1
main/exercice/answer_admin.inc.php

@@ -281,8 +281,10 @@ if($submitAnswers || $buttonBack)
                 $reponse=str_replace('::','',$reponse);
 
                 // we save the answer because it will be modified
-                $temp=$reponse;
+                //$temp=$reponse;
+                $temp = text_filter($reponse);
 
+                /* // Deprecated code.
                 // 1. find everything between the [tex] and [/tex] tags
                 $startlocations=api_strpos($temp,'[tex]');
                 $endlocations=api_strpos($temp,'[/tex]');
@@ -294,6 +296,7 @@ if($submitAnswers || $buttonBack)
                     // 2. replace this by {texcode}
                     $temp=str_replace($texstring,"{texcode}",$temp);
                 }
+                */
 
                 // blanks will be put into an array
                 $blanks=Array();

+ 11 - 5
main/exercice/exercice.php

@@ -869,7 +869,7 @@ if ($show == 'test') {
 					echo '<td width="15" valign="left">'.($i+($page*$limitExPage)).'.'.'</td>';
 
 					//Showing exercise title
-					$row['title']=api_parse_tex($row['title']);
+					$row['title']=text_filter($row['title']);
 
 					echo '<td>';
 					$class_invisible = '';
@@ -928,7 +928,7 @@ if ($show == 'test') {
 					?>
 					<tr>
 					  <td><?php echo ($i+($page*$limitExPage)).'.'; ?></td>
-					  <?php $row['title']=api_parse_tex($row['title']);?>
+					  <?php $row['title']=text_filter($row['title']);?>
 					  <td>
 
 					<?php
@@ -1131,7 +1131,7 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
 							"te.exe_weighting as exweight, te.exe_date as exdate, te.exe_id as exid, email as exemail, " .
 							"te.start_date as exstart, steps_counter as exstep, cuser.user_id as excruid, te.exe_duration as exduration, ce.results_disabled as exdisabled
 							FROM $TBL_EXERCICES AS ce , $TBL_TRACK_EXERCICES AS te, $TBL_USER AS user,$tbl_course_rel_user AS cuser
-					WHERE  user.user_id=cuser.user_id AND te.exe_exo_id = ce.id AND te.status != 'incomplete' AND cuser.user_id=te.exe_user_id 
+					WHERE  user.user_id=cuser.user_id AND te.exe_exo_id = ce.id AND te.status != 'incomplete' AND cuser.user_id=te.exe_user_id
                     AND te.exe_cours_id='" . Database :: escape_string($_cid) . "'
 					AND cuser.relation_type<>".COURSE_RELATION_TYPE_RRHH." $user_id_and $session_id_and AND ce.active <>-1 AND" .
 					" orig_lp_id = 0 AND orig_lp_item_id = 0 AND cuser.course_code=te.exe_cours_id ORDER BY userpart2, te.exe_cours_id ASC, ce.title ASC," .
@@ -1166,7 +1166,7 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
 			$from_gradebook = true;
 		}
 		$sizeof = sizeof($results);
-		
+
 		$user_list_id = array ();
 		$user_last_name = '';
 		$user_first_name = '';
@@ -1225,7 +1225,13 @@ if ($_configuration['tracking_enabled'] && ($show == 'result')) {
 					//echo ceil((($results[$i][4] - $results[$i][7]) / 60)) . ' ' . get_lang('MinMinutes');
 					$exe_date_timestamp = api_strtotime($results[$i]['exdate'], date_default_timezone_get());
 					$start_date_timestamp = api_strtotime($results[$i]['exstart'], date_default_timezone_get());
-					$duration_list = ceil((($exe_date_timestamp - $start_date_timestamp) / 60)) . ' ' . get_lang('MinMinutes');
+
+					$my_duration = ceil((($exe_date_timestamp - $start_date_timestamp) / 60));
+					if ($my_duration == 1 ) {
+						$duration_list = $my_duration . ' ' . get_lang('MinMinute');
+					} else {
+						$duration_list =  $my_duration. ' ' . get_lang('MinMinutes');
+					}
 					if ($results[$i]['exstep'] > 1) {
 						//echo ' ( ' . $results[$i][8] . ' ' . get_lang('Steps') . ' )';
 						$duration_list = ' ( ' . $results[$i]['exstep'] . ' ' . get_lang('Steps') . ' )';

+ 12 - 5
main/exercice/exercice_submit.php

@@ -519,8 +519,10 @@ if ($formSent) {
                                     $answerWeighting = explode(',', $is_set_switchable[0]);
 
                                     // we save the answer because it will be modified
-                                    $temp = $answer;
+                                    //$temp = $answer;
+                                    $temp = text_filter($answer);
 
+                                    /* // Deprecated code
                                     // TeX parsing
                                     // 1. find everything between the [tex] and [/tex] tags
                                     $startlocations = api_strpos($temp, '[tex]');
@@ -531,6 +533,7 @@ if ($formSent) {
                                         // 2. replace this by {texcode}
                                         $temp = str_replace($texstring, '{texcode}', $temp);
                                     }
+                                    */
 
                                     $answer = '';
                                     $j = 0;
@@ -545,9 +548,11 @@ if ($formSent) {
                                         if (($pos = api_strpos($temp, '[')) === false) {
                                             // adds the end of the text
                                             $answer = $temp;
+                                            /* // Deprecated code
                                             // TeX parsing - replacement of texcode tags
                                             $texstring = api_parse_tex($texstring);
                                             $answer = str_replace("{texcode}", $texstring, $answer);
+                                            */
                                             $real_text[] = $answer;
                                             break; //no more "blanks", quit the loop
                                         }
@@ -779,7 +784,9 @@ if ($formSent) {
                     //Verify if the current test is fraudulent
                     $current_time = time();
 
-                    if (isset($_SESSION['expired_time'][$current_expired_time_key]) && $exercise_row['expired_time'][$exerciseId] != 0) {
+					//The $exercise_row['expired_time'][$exerciseId] is never set. It means nothing.
+                    //if (isset($_SESSION['expired_time'][$current_expired_time_key]) && $exercise_row['expired_time'][$exerciseId] != 0) {
+                    if (isset($_SESSION['expired_time'][$current_expired_time_key])) {
                         $expired_date = $_SESSION['expired_time'][$current_expired_time_key];
                         $expired_time = strtotime($expired_date);
 
@@ -838,7 +845,7 @@ if (!isset ($_SESSION['objExercise']) || $_SESSION['objExercise']->id != $_REQUE
     }
 }
 
-if (!isset ($objExcercise) && isset ($_SESSION['objExercise'])) {
+if (!isset ($objExercise) && isset ($_SESSION['objExercise'])) {
     $objExercise = $_SESSION['objExercise'];
 }
 if (!is_object($objExercise)) {
@@ -890,7 +897,7 @@ if (!isset ($_SESSION['questionList'])) {
         echo str_repeat('&nbsp;', 0) . '$_SESSION[questionList] was unset - set now - end' . "<br />\n";
     }
 }
-if (!isset ($objExcercise) && isset ($_SESSION['objExercise'])) {
+if (!isset ($objExercise) && isset ($_SESSION['objExercise'])) {
     $questionList = $_SESSION['questionList'];
 }
 
@@ -1084,7 +1091,7 @@ if (api_is_course_admin() && $origin != 'learnpath') {
     echo '</div>';
 }
 
-$exerciseTitle = api_parse_tex($exerciseTitle);
+$exerciseTitle = text_filter($exerciseTitle);
 echo "<h3>" . $exerciseTitle . "</h3>";
 $show_clock = true;
 

+ 12 - 7
main/exercice/exercise.lib.php

@@ -47,7 +47,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 			$questionName=$objQuestionTmp->selectTitle();
 			$questionDescription=$objQuestionTmp->selectDescription();
 
-			$questionName=api_parse_tex($questionName);
+			$questionName=text_filter($questionName);
 
 			$s="<div id=\"question_title\" class=\"sectiontitle\">
 				".get_lang('Question').' ';
@@ -63,7 +63,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 			$s='';
 			$s.="<table class='exercise_questions' style='margin:4px;padding:2px;'>
 				<tr><td valign='top' colspan='2'>";
-			$questionDescription=api_parse_tex($questionDescription);
+			$questionDescription=text_filter($questionDescription);
 			$s.=$questionDescription;
 			$s.="</td></tr></table>";
 
@@ -150,6 +150,8 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 				list($answer) = explode('::',$answer);
 
 				// because [] is parsed here we follow this procedure:
+				$answer = text_filter($answer);
+				/* // Deprecated code
 				// 1. find everything between the [tex] and [/tex] tags
 				$startlocations = api_strpos($answer,'[tex]');
 				$endlocations = api_strpos($answer,'[/tex]');
@@ -159,6 +161,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 					// 2. replace this by {texcode}
 					$answer = str_replace($texstring,'{texcode}',$answer);
 				}
+				*/
 
 				// 3. do the normal matching parsing
 				// replaces [blank] by an input field
@@ -207,9 +210,11 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 
 				*/
 
+				/* // Deprecated code
 				// 5. replace the {texcode by the api_pare_tex parsed code}
 				$texstring = api_parse_tex($texstring);
 				$answer=str_replace("{texcode}",$texstring,$answer);
+				*/
 
 			}
 
@@ -224,7 +229,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 						$selected = 'checked="checked"';
 					}
 				}
-				$answer = api_parse_tex($answer);
+				$answer = text_filter($answer);
 				$answer = Security::remove_XSS($answer, STUDENT);
 				$s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'.
 					'<tr><td colspan="3"><div class="u-m-answer"><p style="float: '.($is_ltr_text_direction ? 'left' : 'right').'; padding-'.($is_ltr_text_direction ? 'right' : 'left').': 4px;">'.
@@ -244,7 +249,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 						$selected = 'checked="checked"';
 					}
 				}
-				$answer = api_parse_tex($answer);
+				$answer = text_filter($answer);
 				$answer = Security::remove_XSS($answer, STUDENT);
 				$s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'.
 					'<tr><td colspan="3"><div class="u-m-answer"><p style="float: '.($is_ltr_text_direction ? 'left' : 'right').'; padding-'.($is_ltr_text_direction ? 'right' : 'left').': 4px;">'.
@@ -264,7 +269,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 						$selected = 'checked="checked"';
 					}
 				}
-				$answer = api_parse_tex($answer);
+				$answer = text_filter($answer);
 				$answer = Security::remove_XSS($answer, STUDENT);
 				$s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'.
 					'<tr><td colspan="3"><div class="u-m-answer"><p style="float: '.($is_ltr_text_direction ? 'left' : 'right').'; padding-'.($is_ltr_text_direction ? 'right' : 'left').': 4px;">'.
@@ -284,7 +289,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 					// only show elements to be answered (not the contents of
 					// the select boxes, who are corrrect = 0)
 					$s .= '<tr><td width="45%" valign="top" >';
-					$parsed_answer = api_parse_tex($answer);
+					$parsed_answer = text_filter($answer);
 					//left part questions
 					$s .= ' <span style="float:left; width:8%;"><b>'.$lines_count.'</b>.&nbsp;</span>
 						 	<span style="float:left; width:92%;">'.$parsed_answer.'</span></td>';
@@ -390,7 +395,7 @@ function showQuestion($questionId, $onlyAnswers = false, $origin = false, $curre
 			echo '<table class="exercise_questions" >
 				  <tr>
 			  		<td valign="top" colspan="2">';
-			echo $questionDescription=api_parse_tex($questionDescription);
+			echo $questionDescription=text_filter($questionDescription);
 			echo '</td></tr>';
 		}
 

+ 5 - 5
main/exercice/exercise_result.class.php

@@ -109,7 +109,7 @@ class ExerciseResult
     	$session_id_and = ' AND ce.session_id = ' . api_get_session_id() . ' ';
 		if (empty($user_id)) {
 			
-			$sql="SELECT ".(api_is_western_name_order() ? "firstname as userpart1, lastname as userpart1" : "lastname as userpart1, firstname as userpart2").", ce.title as extitle, te.exe_result as exresult ,
+			$sql="SELECT ".(api_is_western_name_order() ? "firstname as userpart2, lastname as userpart1" : "lastname as userpart2, firstname as userpart2").", ce.title as extitle, te.exe_result as exresult ,
 								 te.exe_weighting as exweight, te.exe_date as exdate, te.exe_id as exid, user.email as exemail, user.user_id as userid
 				  FROM $TBL_EXERCISES AS ce , $TBL_TRACK_EXERCISES AS te, $TBL_USER AS user,$TBL_COURSE_REL_USER AS cuser
 				  WHERE  user.user_id=cuser.user_id AND cuser.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND te.exe_exo_id = ce.id AND te.status != 'incomplete' AND cuser.user_id=te.exe_user_id AND te.exe_cours_id='" . Database :: escape_string($cid) . "'
@@ -245,11 +245,11 @@ class ExerciseResult
 		//titles
 		if(!empty($this->results[0]['last_name']))
 		{
-			$data .= get_lang('last_name').';';
+			$data .= get_lang('LastName').';';
 		}
 		if(!empty($this->results[0]['first_name']))
 		{
-			$data .= get_lang('first_name').';';
+			$data .= get_lang('FirstName').';';
 		}
 		if($export_user_fields)
 		{
@@ -352,9 +352,9 @@ class ExerciseResult
 		}
 
 		if($with_column_user) {
-		   	$worksheet->write($line,$column,get_lang('last_name'));
+		   	$worksheet->write($line,$column,get_lang('LastName'));
 				$column++;
-			$worksheet->write($line,$column,get_lang('first_name'));
+			$worksheet->write($line,$column,get_lang('FirstName'));
 				$column++;
 		}
 		$export_user_fields = true;

+ 10 - 5
main/exercice/exercise_result.php

@@ -314,14 +314,14 @@ function display_unique_or_multiple_answer($answerType, $studentChoice, $answer,
 	</td>
 	<td width="45%" style="border-bottom: 1px solid #4171B5;">
 		<?php
-		$answer=api_parse_tex($answer);
+		$answer=text_filter($answer);
 		echo $answer;
 		?>
 	</td>
 	<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
 	<td width="45%" style="border-bottom: 1px solid #4171B5;">
 		<?php
-		$answerComment=api_parse_tex($answerComment);
+		$answerComment=text_filter($answerComment);
 		if($studentChoice)
 		{
 			if(!$answerCorrect)
@@ -440,7 +440,7 @@ if (api_is_course_admin() && $origin != 'learnpath') {
 	echo '</div>';
 }
 
-$exerciseTitle=api_parse_tex($exerciseTitle);
+$exerciseTitle=text_filter($exerciseTitle);
 
 //show exercise title
 ?>
@@ -685,8 +685,10 @@ foreach ($questionList as $questionId) {
 					$answerWeighting = explode(',',$is_set_switchable[0]);
 
 					// we save the answer because it will be modified
-					$temp=$answer;
+					//$temp=$answer;
+					$temp = text_filter($answer);
 
+					/* // Deprecated code.
 					// TeX parsing
 					// 1. find everything between the [tex] and [/tex] tags
 					$startlocations=api_strpos($temp,'[tex]');
@@ -698,6 +700,7 @@ foreach ($questionList as $questionId) {
 						// 2. replace this by {texcode}
 						$temp=str_replace($texstring,'{texcode}',$temp);
 					}
+					*/
 
 					$answer='';
 					$j=0;
@@ -714,9 +717,11 @@ foreach ($questionList as $questionId) {
 						{
 							// adds the end of the textsolution
 							$answer=$temp;
+							/* // Deprecated code.
 							// TeX parsing - replacement of texcode tags
 							$texstring = api_parse_tex($texstring);
 							$answer=str_replace("{texcode}",$texstring,$answer);
+							*/
                             $real_text[] = $answer;
 							break; //no more "blanks", quit the loop
 						}
@@ -890,7 +895,7 @@ foreach ($questionList as $questionId) {
 			{
 				if ($origin != 'learnpath') {
 					echo '<tr>';
-					echo '<td>'.api_parse_tex($answer_matching[$answerId]).'</td><td>'.api_parse_tex($user_answer).' / <b><span style="color: #008000;">'.api_parse_tex($answer_matching[$answerCorrect]).'</span></b></td>';
+					echo '<td>'.text_filter($answer_matching[$answerId]).'</td><td>'.text_filter($user_answer).' / <b><span style="color: #008000;">'.text_filter($answer_matching[$answerCorrect]).'</span></b></td>';
 					echo '</tr>';
 				}
 			}

+ 10 - 2
main/exercice/exercise_show.php

@@ -269,7 +269,7 @@ $show_results = true;
 // Avoiding the "Score 0/0" message  when the exe_id is not set
 if (Database::num_rows($result)>0 && isset($id)) {
 	$test=Database::result($result,0,0);
-	$exerciseTitle=api_parse_tex($test);
+	$exerciseTitle=text_filter($test);
 	$exerciseDescription=Database::result($result,0,1);
 
 	// if the results_disabled of the Quiz is 1 when block the script
@@ -634,8 +634,10 @@ if ($show_results) {
 
 				//$answerWeighting=explode(',',$answerWeighting);
 				// we save the answer because it will be modified
-			    $temp=$answer;
+			    //$temp=$answer;
+			    $temp = text_filter($answer);
 
+			    /* // Deprecated code
 				// TeX parsing
 				// 1. find everything between the [tex] and [/tex] tags
 				$startlocations=api_strpos($temp,'[tex]');
@@ -645,6 +647,8 @@ if ($show_results) {
 					// 2. replace this by {texcode}
 					$temp=str_replace($texstring,'{texcode}',$temp);
 				}
+				*/
+
 				$j=0;
 				// the loop will stop at the end of the text
 				$i=0;
@@ -655,8 +659,10 @@ if ($show_results) {
 						if (($pos = api_strpos($temp,'[')) === false) {
 							// adds the end of the text
 							$answer.=$temp;
+							/* // Deprecated code
 							// TeX parsing
 							$texstring = api_parse_tex($texstring);
+							*/
 							break;
 						}
 					    $temp=api_substr($temp,$pos+1);
@@ -703,9 +709,11 @@ if ($show_results) {
 						if (($pos = api_strpos($temp,'[')) === false) {
 							// adds the end of the text
 							$answer.=$temp;
+							/* // Deprecated code
 							// TeX parsing
 							$texstring = api_parse_tex($texstring);
 							//$answer=str_replace("{texcode}",$texstring,$answer);
+							*/
 							break;
 						}
 						// adds the piece of text that is before the blank and ended by [

+ 7 - 7
main/exercice/export/scorm/scorm_classes.php

@@ -129,12 +129,12 @@ class ScormQuestion extends Question
 		$cols = 2;
 		$s='<tr>' .
 			'<td colspan="'.$cols.'" id="question_'.$this->id.'_title" valign="middle" style="background-color:#d6d6d6;">' . "\n" .
-		   	api_parse_tex($title).
+		   	text_filter($title).
 		   	'</td>' . "\n" .
 		   	'</tr>' . "\n" .
 		   	'<tr>' . "\n" .
 		   	'<td valign="top" colspan="'.$cols.'">' . "\n" .
-		   	'<i>'.api_parse_tex($description).'</i>' . "\n" .
+		   	'<i>'.text_filter($description).'</i>' . "\n" .
 		   	'</td>' . "\n" .
 		   	'</tr>' . "\n";
 		return $s;
@@ -174,7 +174,7 @@ class ScormAnswerMultipleChoice extends Answer
 		$type = $this->getQuestionType();
 		$jstmpw = 'questions_answers_ponderation['.$this->questionJSId.'] = new Array();'."\n";
 		$jstmpw .= 'questions_answers_ponderation['.$this->questionJSId.'][0] = 0;'."\n";
-		
+
 		//not sure if we are going to export also the MULTIPLE_ANSWER_COMBINATION to SCORM
         //if ($type == MCMA  || $type == MULTIPLE_ANSWER_COMBINATION ) {
 		if ($type == MCMA ) {
@@ -208,7 +208,7 @@ class ScormAnswerMultipleChoice extends Answer
 	    		$js .= 'questions_types['.$this->questionJSId.'] = \'mcma\';'."\n";
 	    	} else {
 	    		$js .= 'questions_types['.$this->questionJSId.'] = \'exact\';'."\n";
-	    	}	    	
+	    	}
 	    	$js .= $jstmpw;
         } elseif ($type == MULTIPLE_ANSWER_COMBINATION) {
         		//To this items we show the ThisItemIsNotExportable
@@ -443,7 +443,7 @@ class ScormAnswerMatching extends Answer
 				// options (A, B, C, ...) that will be put into the list-box
 				$Select[$answerId]['Lettre']=$cpt1;
 				// answers that will be shown at the right side
-				$answer = api_parse_tex($answer);
+				$answer = text_filter($answer);
 				$Select[$answerId]['Reponse']=$answer;
 				$cpt1++;
 			}
@@ -722,14 +722,14 @@ class ScormAnswerHotspot extends Answer
 		{
 			$s="<tr>
 			  <td valign='top' colspan='2'>&nbsp;";
-			$questionName=api_parse_tex($questionName);
+			$questionName=text_filter($questionName);
 			$s.=$questionName;
 			$s.="</td>
 			</tr>
 			<tr>
 			  <td valign='top' colspan='2'>
 				<i>";
-			$questionDescription=api_parse_tex($questionDescription);
+			$questionDescription=text_filter($questionDescription);
 			$s.=$questionDescription;
 			$s.="</i>
 			  </td>

+ 19 - 19
main/exercice/question.class.php

@@ -42,7 +42,7 @@ abstract class Question
 	public $picture;
 	public $exerciseList;  // array with the list of exercises which this question is in
 	private $isContent;
-	
+
 	static $typePicture = 'new_question.png';
 	static $explanationLangVar = '';
 	static $questionTypes = array(
@@ -70,7 +70,7 @@ abstract class Question
 		$this->level = 1;
 		$this->exerciseList=array();
 	}
-	
+
 	public function getIsContent() {
 		$isContent = intval($_REQUEST['isContent']);
 		return $this->isContent = $isContent;
@@ -142,7 +142,7 @@ abstract class Question
 	 */
 	function selectTitle()
 	{
-		$this->question=api_parse_tex($this->question);
+		$this->question=text_filter($this->question);
 		return $this->question;
 	}
 
@@ -154,7 +154,7 @@ abstract class Question
 	 */
 	function selectDescription()
 	{
-		$this->description=api_parse_tex($this->description);
+		$this->description=text_filter($this->description);
 		return $this->description;
 	}
 
@@ -516,15 +516,15 @@ abstract class Question
 		// saves the picture into a temporary file
 		@move_uploaded_file($Picture,$picturePath.'/tmp.'.$Extension);
 	}
-	
+
 	/**
-		Sets the title 
+		Sets the title
 	*/
 	public function setTitle($title)
 	{
-		$this->question = $title; 	
+		$this->question = $title;
 	}
-	
+
 
 	/**
 	 * Moves the temporary question "tmp" to "quiz-$questionId"
@@ -1002,10 +1002,10 @@ abstract class Question
 		$renderer->setElementTemplate('<div class="row"><div class="label">{label}</div><div class="formw" >{element}</div></div>','questionName');
 		$renderer->setElementTemplate('<div class="row"><div class="label">{label}</div><div class="formw">{element}</div></div>','questionLevel');
 		$form->addRule('questionName', get_lang('GiveQuestion'), 'required');
-		
+
 		// default content
 		$isContent = intval($_REQUEST['isContent']);
-		
+
 		// question type
 		$answerType= intval($_REQUEST['answerType']);
 		$form->addElement('hidden','answerType',$_REQUEST['answerType']);
@@ -1101,26 +1101,26 @@ abstract class Question
 			//2. but if it is a feedback DIRECT we only show the UNIQUE_ANSWER type that is currently available
 			$question_type_custom_list = array ( UNIQUE_ANSWER => self::$questionTypes[UNIQUE_ANSWER]);
 		}
-		
+
 		//blocking edition
-		
+
 		$show_quiz_edition = true;
 		if (isset($exerciseId) && !empty($exerciseId)) {
 			$TBL_LP_ITEM	= Database::get_course_table(TABLE_LP_ITEM);
 			$sql="SELECT max_score FROM $TBL_LP_ITEM
 				  WHERE item_type = '".TOOL_QUIZ."' AND path ='".Database::escape_string($exerciseId)."'";
 			$result = Database::query($sql);
-			if (Database::num_rows($result) > 0) {				
+			if (Database::num_rows($result) > 0) {
 				$show_quiz_edition = false;
 			}
 		}
-		
+
 		echo '<ul class="question_menu">';
 
 		foreach ($question_type_custom_list as $i=>$a_type) {
 			// include the class of the type
-			require_once($a_type[0]);			
- 		    // get the picture of the type and the langvar which describes it			 
+			require_once($a_type[0]);
+ 		    // get the picture of the type and the langvar which describes it
 			eval('$img = '.$a_type[1].'::$typePicture;');
 			eval('$explanation = get_lang('.$a_type[1].'::$explanationLangVar);');
 			echo '<li>';
@@ -1139,7 +1139,7 @@ abstract class Question
 			echo '</div>';
 			echo '</li>';
 		}
-		
+
 		echo '<li>';
 		echo '<div class="icon_image_content">';
 		if ($show_quiz_edition) {
@@ -1164,11 +1164,11 @@ abstract class Question
 	{
 		return self::$questionTypes;
 	}
-	
+
 	static function updateId()
 	{
 		return self::$questionTypes;
-	}	
+	}
 }
 endif;
 ?>

+ 0 - 1
main/forum/forumfunction.inc.php

@@ -3725,7 +3725,6 @@ function send_notifications($forum_id=0, $thread_id=0, $post_id=0) {
 				$email_body .= get_lang('NewForumPost')."\n";
 				$email_body .= get_lang('YouWantedToStayInformed')."<br /><br />\n";
 				$email_body .= get_lang('ThreadCanBeFoundHere')." : <a href=\"".$thread_link."\">".$thread_link."</a>\n";
-
 				@api_mail_html(api_get_person_name($value['firstname'], $value['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $value['email'], $email_subject, $email_body, api_get_person_name($_SESSION['_user']['firstName'], $_SESSION['_user']['lastName'], null, PERSON_NAME_EMAIL_ADDRESS), $_SESSION['_user']['mail']);
 			}
 		}

+ 14 - 18
main/inc/banner.inc.php

@@ -26,10 +26,22 @@ $session_name   = api_get_session_name($my_session_id);
 			if (!empty($iname)) {
 	           echo '-&nbsp;<a href="'.$iurl.'" target="_top">'.$iname.'</a>';
 			}
-			?>
+			
+			/*	External link section a.k.a Department - Department URL */
+			
+			if (isset($_course['extLink']) && $_course['extLink']['name'] != '') {
+				echo '<span class="extLinkSeparator"> - </span>';
+				if ($_course['extLink']['url'] != '') {
+					echo '<a class="extLink" href="'.$_course['extLink']['url'].'" target="_top">';
+					echo $_course['extLink']['name'];
+					echo '</a>';
+				} else {
+					echo $_course['extLink']['name'];
+				}
+			}
+?>
 		</div>
 <?php
-
 /*	Course title section */
 
 if (!empty($_cid) and $_cid != -1 and isset($_course)) {
@@ -79,23 +91,7 @@ echo '</div>';
 echo '<div class="clear">&nbsp;</div>';
 
 /*	Plugins for banner section */
-
-
-
 $web_course_path = api_get_path(WEB_COURSE_PATH);
-
-/*	External link section */
-
-if (isset($_course['extLink']) && $_course['extLink']['name'] != '') {
-	echo '<span class="extLinkSeparator"> / </span>';
-	if ($_course['extLink']['url'] != '') {
-		echo '<a class="extLink" href="'.$_course['extLink']['url'].'" target="_top">';
-		echo $_course['extLink']['name'];
-		echo '</a>';
-	} else {
-		echo $_course['extLink']['name'];
-	}
-}
 ?>
 	</div>
 	<div id="header2">

+ 3 - 1
main/inc/footer.inc.php

@@ -68,6 +68,7 @@ if (api_get_setting('show_tutor_data') == 'true') {
 				$bar = '<br />';
 				echo get_lang('Coachs').' : <ul>';
 				echo '<li>'.implode("<li>", $email_link);
+				echo '</ul>';
 			} elseif (count($coachs_email) == 1) {
 				echo get_lang('Coach').' : ';
 				echo implode("&nbps;", $email_link);
@@ -75,11 +76,12 @@ if (api_get_setting('show_tutor_data') == 'true') {
 				echo '';
 			}
 		}
-		echo '</ul></div>';
+		echo '</div>';
 	}
 	echo '<br>';
 }
 
+echo '<div style="clear:both"></div>';
 $class = '';
 
 if (api_get_setting('show_teacher_data') == 'true') {

+ 3 - 3
main/inc/lib/exercise_show_functions.lib.php

@@ -124,7 +124,7 @@ class ExerciseShowFunctions {
 			<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
 			<td valign="top" align="left" >
 				<?php
-				$answerComment=api_parse_tex($answerComment);
+				$answerComment=text_filter($answerComment);
 				if($studentChoice) {
 					echo '<span style="font-weight: bold; color: #008000;">'.nl2br(make_clickable($answerComment)).'</span>';
 				} else {
@@ -169,7 +169,7 @@ class ExerciseShowFunctions {
 		</td>
 		<td width="40%" style="border-bottom: 1px solid #4171B5;">
 			<?php
-			$answer=api_parse_tex($answer);
+			$answer=text_filter($answer);
 			echo $answer;
 			?>
 		</td>
@@ -177,7 +177,7 @@ class ExerciseShowFunctions {
 		<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
 		<td width="20%" style="border-bottom: 1px solid #4171B5;">
 			<?php
-			$answerComment=api_parse_tex($answerComment);
+			$answerComment=text_filter($answerComment);
 			if($studentChoice)
 			{
 				if(!$answerCorrect)

+ 1 - 1
main/inc/lib/main_api.lib.php

@@ -141,7 +141,7 @@ define('LOG_CONFIGURATION_SETTINGS_CATEGORY', 'settings_category');
 define('LOG_CONFIGURATION_SETTINGS_VARIABLE', 'settings_variable');
 
 // Specification for usernames:
-// 1. ASCII-letters, digits, "." (dot), "_" (underscore) are acceptable, 20 characters maximal length.
+// 1. ASCII-letters, digits, "." (dot), "_" (underscore) are acceptable, 40 characters maximum length.
 // 2. Empty username is formally valid, but it is reserved for the anonymous user.
 define('USERNAME_MAX_LENGTH', 40);
 define('USERNAME_PURIFIER', '/[^0-9A-Za-z_\.]/');

+ 5 - 13
main/inc/lib/system_announcements.lib.php

@@ -50,25 +50,23 @@ class SystemAnnouncementManager
 			$query_string = ereg_replace('&$', '', $query_string);
 			$url = api_get_self();
 			echo '<div class="system_announcements">';
+			
 			echo '<h3>'.get_lang('SystemAnnouncements').'</h3>';
-			echo '<table border="0">';
+			
+			echo '<div style="margin:10px;text-align:right;"><a href="news_list.php">'.get_lang('More').'</a></div>';		
 			
 			while ($announcement = Database::fetch_object($announcements)) {
-
 				if ($id != $announcement->id) {
 					if (strlen($query_string) > 0) {
 						$show_url = 'news_list.php#'.$announcement->id;
-						//$show_url = $url.'?'.$query_string.'&announcement='.$announcement->id;
 					} else {
 						$show_url = 'news_list.php#'.$announcement->id;
-						//$show_url = $url.'?announcement='.$announcement->id;
 					}
 					$display_date = api_convert_and_format_date($announcement->display_date, DATE_FORMAT_LONG, date_default_timezone_get());					
 					echo '<a name="'.$announcement->id.'"></a>
 						<div class="system_announcement">
 							<div class="system_announcement_title"><a name="ann'.$announcement->id.'" href="'.$show_url.'">'.$announcement->title.'</a></div><div class="system_announcement_date">'.$display_date.'</div>
-					  	</div>
-						<br />';				
+					  	</div>';				
 				} else {
 					echo '<div class="system_announcement">
 							<div class="system_announcement_title">'
@@ -76,14 +74,8 @@ class SystemAnnouncementManager
 								<a name="ann'.$announcement->id.'" href="'.$url.'?'.$query_string.'#ann'.$announcement->id.'">'.$announcement->title.'</a>
 							</div>';
 				}
-
+				echo '<br />';
 			}
-
-			/*echo '<tr><td height="15px"></td></tr>';*/
-			echo '<tr><td colspan="2">';
-			echo '<a href="news_list.php">'.get_lang('More').'</a>';
-			echo '</td></tr>';
-			echo '</table>';
 			echo '</div>';
 		}
 		return;

+ 4 - 0
main/inc/lib/usermanager.lib.php

@@ -173,6 +173,10 @@ class UserManager
 	 * @return boolean true if user can be deleted
 	 */
 	public static function can_delete_user($user_id) {
+		global $_configuration;
+		if (isset($_configuration['delete_users']) && $_configuration['delete_users'] == false) {
+			return false;
+		} 
 		$table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
 		if ($user_id != strval(intval($user_id))) return false;
 		if ($user_id === false) return false;

+ 3 - 0
main/install/configuration.dist.php

@@ -124,6 +124,9 @@ $_configuration['session_lifetime']						= SESSION_LIFETIME;
 $_configuration['software_name']						= 'Chamilo';
 $_configuration['software_url']							= 'http://www.chamilo.org/';
 
+//Deny the elimination of users
+$_configuration['deny_delete_users']					= false;
+
 // Version settings
 $_configuration['system_version']						= '{NEW_VERSION}';
 $_configuration['system_stable']						= NEW_VERSION_STABLE;

+ 5 - 5
main/newscorm/learnpath_functions.inc.php

@@ -1473,7 +1473,7 @@ function export_exercise($item_id)
 		}
 	}
 
-	$exerciseTitle = api_parse_tex($exerciseTitle);
+	$exerciseTitle = text_filter($exerciseTitle);
 
 	$test .= "<h3>".$exerciseTitle."</h3>";
 
@@ -1482,7 +1482,7 @@ function export_exercise($item_id)
 		$test .= "<a href=\"../document/download.php?doc_url=%2Faudio%2F".$exerciseSound."\"&SQMSESSID=36812c2dea7d8d6e708d5e6a2f09b0b9 target=\"_blank\"><img src=\"../img/sound.gif\" border=\"0\" align=\"absmiddle\" alt=".get_lang("Sound")."\" /></a>";
 	}
 
-	$exerciseDescription = api_parse_tex($exerciseDescription);
+	$exerciseDescription = text_filter($exerciseDescription);
 
 	// --------- writing the .js file with to check the correct answers begin -----------------------
 	$scriptfilename = "Exercice".$item_id.".js";
@@ -1716,7 +1716,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
 				$content = $myrow["content"];
 				//3.2.7 Make clickable???
 				$content = make_clickable($content);
-				$content = api_parse_tex($content);
+				$content = text_filter($content);
 				//3.2.8 Write the prepared content to the export string
 				$expcontent .= "<tr><td class=\"text\" colspan='2'>";
 				$expcontent .= $content;
@@ -1755,7 +1755,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
 				//$content = nl2br($content);
 				//3.2 Prepare the data for export
 				$content = make_clickable($content);
-				$content = api_parse_tex($content);
+				$content = text_filter($content);
 
 				//3.3 Get a UNIX(?<-mktime) Timestamp of the end_date for this announcement
 				$last_post_datetime = $myrow['end_date']; // post time format  datetime de mysql
@@ -1801,7 +1801,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
 					$expcontent .= "<h4>".$row['title']."</h4>";
 					//2.a.1.2 Prepare content
 					$content = make_clickable(nl2br($row['content']));
-					$content = api_parse_tex($content);
+					$content = text_filter($content);
 					//2.a.1.3 Write content to the export string
 					$expcontent .= $content;
 				}

+ 5 - 0
main/newscorm/scorm_api.php

@@ -1705,6 +1705,11 @@ if(olms.lms_lp_type==1 || olms.lms_item_type=='asset'){
 function attach_glossary_into_scorm(type) {
 
     var f = $('#content_id')[0];
+    //Prevents "f is undefined" javascript error
+    if (f == null) {
+    	logit_lms('attach_glossary_into_scorm failed', 0);
+    	return false;
+    }
 	//logit_lms('attach_glossary_into_scorm', 0);
     var doc = f.contentWindow ? f.contentWindow.document :
     f.contentDocument ? f.contentDocument : f.document;

+ 31 - 16
main/work/work.lib.php

@@ -376,17 +376,18 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
 	$row = Database::fetch_array($sql_result_num);
 	$count_files = $row[0];
 
-	$table_header[] = array(get_lang('Type'), true, 'style="width:40px"');
+	$table_header[] = array(get_lang('Type'), false, 'style="width:40px"');
 	$table_header[] = array(get_lang('Title'), true);
 
 	if ($count_files != 0) {
 		$table_header[] = array(get_lang('Authors'), true);
+		$table_header[] = array(get_lang('Qualification'), true);
 	}
 
 	$table_header[] = array(get_lang('Date'), true);
 
 	if ($origin != 'learnpath') {
-		$table_header[] = array(get_lang('Modify'), true);
+		$table_header[] = array(get_lang('Modify'), false);
 		$table_header[] = array('RealDate', true);
 	}
 
@@ -396,6 +397,7 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
 
 	if ($count_files != 0) {
 		$column_show[] = 1;	 // authors
+		$column_show[] = 1;	 // qualification
 	}
 
 	$column_show[] = 1; //date
@@ -406,18 +408,27 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
 	// in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate
 	// because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48"
 
+	$column_order = array();
+	$i=0;
+	foreach($table_header as $item) {
+		$column_order[$i] = $i;
+		$i++;
+	}
+	
 	if ($count_files != 0) {
-		$column_order[3] = 5;
+		$column_order[2] = 5;
 	} else {
-		$column_order[2] = 4;
+		$column_order[1] = 4;
 	}
-
+	
 	$table_data = array();
 	$dirs_list = get_subdirs_list($work_dir);
 
 	$my_sub_dir = str_replace('work/', '', $sub_course_dir);
-
-	// List of all folders
+	
+	// @todo Since "works" cant have sub works this foreach is useless when selecting the list of works 
+	
+	// List of all folders	
 	if (is_array($dirs_list)) {
 		foreach ($dirs_list as $dir) {
 			if ($my_sub_dir == '') {
@@ -432,7 +443,7 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
 			} else {
 				$sql_select_directory .= " work.post_group_id = '0' ";
 			}
-			$sql_select_directory .= " AND work.url LIKE BINARY '".$mydir_temp."' AND work.filetype = 'folder' AND prop.tool='work' $condition_session";
+			$sql_select_directory .= " AND work.url LIKE BINARY '".$mydir_temp."' AND work.filetype = 'folder' AND prop.tool='work' $condition_session";			
 			$result = Database::query($sql_select_directory);
 			$row = Database::fetch_array($result);
 
@@ -746,6 +757,11 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
 			$table_data[] = $row;
 		}
 	}
+	
+	//Redefining $my_sub_dir
+	if (substr($my_sub_dir,strlen($my_sub_dir)-1, strlen($my_sub_dir)) == '/') {
+		$my_sub_dir = substr($my_sub_dir, 0,strlen($my_sub_dir)-1);
+	}
 
 	if (Database::num_rows($sql_result) > 0) {
 		while ($work = Database::fetch_object($sql_result)) {
@@ -754,8 +770,7 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
 			$author_sql = "SELECT * FROM $iprop_table WHERE tool = 'work' AND ref=".$work->id;
 			$author_qry = Database::query($author_sql);
 			$row2 = Database::fetch_array($author_qry);
-
-
+			
 			if (Database::num_rows($author_qry) == 1) {
 				$is_author = true;
 			}
@@ -773,9 +788,11 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
 				$add_string = '';
 				if (defined('IS_ASSIGNMENT')) {
 					if($work->qualification == '') {
-						$qualification_string = ' / <b style="color:orange">'.get_lang('NotRevised').'</b>';
+						//$qualification_string = '<b style="color:orange">'.get_lang('NotRevised').'</b>';
+						$qualification_string = '<b style="color:orange"> - </b>';
 					} else {
-						$qualification_string = ' / <b style="color:blue">'.get_lang('Qualification').': '.$work->qualification.'</b>';
+						//$qualification_string = '<b style="color:blue">'.get_lang('Qualification').': '.$work->qualification.'</b>';
+						$qualification_string = '<b style="color:blue">'.$work->qualification.'</b>';
 					}
 					if (defined('ASSIGNMENT_EXPIRES') && (ASSIGNMENT_EXPIRES < convert_date_to_number($work->sent_date))) {
 						$add_string = ' <b style="color:red">'.get_lang('Expired').'</b>';
@@ -786,13 +803,13 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
 
 				$row[] = '<a href="download.php?file='.$url.'">'.build_document_icon_tag('file', substr(basename($work->url), 13)).'</a>';
 				$row[] = '<a href="download.php?file='.$url.'"'.$class.'><img src="../img/filesave.gif" style="float:right;" alt="'.get_lang('Save').'" title="'.get_lang('Save').'" />'.$work->title.'</a><br />'.$work->description;
-				$row[] = display_user_link_work($row2['insert_user_id'], $work->author).$qualification_string; // $work->author;
+				$row[] = display_user_link_work($row2['insert_user_id'], $work->author); // $work->author;
+				$row[] = $qualification_string;
 			
 				$work_sent_date_local = api_get_local_time($work->sent_date);				
 				$row[] = date_to_str_ago($work_sent_date_local).$add_string.'<br /><span class="dropbox_date">'.api_format_date($work_sent_date_local).'</span>';
 
 				if ($is_allowed_to_edit) {
-
 					$action = '';
 					$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;edit='.$work->id.'&gradebook='.Security::remove_XSS($_GET['gradebook']).'&amp;parent_id='.$work->parent_id.'" title="'.get_lang('Modify').'"  ><img src="../img/edit.gif" alt="'.get_lang('Modify').'" title="'.get_lang('Modify').'"></a>';
 					$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;delete='.$work->id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('WorkDelete').'" >'.Display::return_icon('delete.gif', get_lang('WorkDelete')).'</a>';
@@ -802,7 +819,6 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
 					} else {
 						$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;make_visible='.$work->id.'&amp;'.$sort_params.'" title="'.get_lang('Visible').'" ><img src="../img/invisible.gif" alt="'.get_lang('Visible').'"  title="'.get_lang('Visible').'"></a>';
 					}
-
 					$row[] = $action;
 				// the user that is not course admin can only edit/delete own document
 				} elseif ($row2['insert_user_id'] == $_user['user_id']) {
@@ -811,7 +827,6 @@ function display_student_publications_list($work_dir, $sub_course_dir, $currentC
 					if (api_get_course_setting('student_delete_own_publication') == 1) {
 						$action .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&curdirpath='.urlencode($my_sub_dir).'&amp;origin='.$origin.'&gradebook='.$gradebook.'&amp;delete='.$work->id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('WorkDelete').'"  >'.Display::return_icon('delete.gif',get_lang('WorkDelete')).'</a>';
 					}
-
 					$row[] = $action;
 				} else {
 					$row[] = ' ';

+ 11 - 10
main/work/work.php

@@ -1126,18 +1126,19 @@ if ($is_special > 0) {
 
 	if ($homework['expires_on'] != '0000-00-00 00:00:00' || $homework['ends_on'] != '0000-00-00 00:00:00') {
 		$time_now		= convert_date_to_number(api_get_local_time());
-		$time_expires 	= convert_date_to_number(api_get_local_time($homework['expires_on']));
-		$time_ends 		= convert_date_to_number(api_get_local_time($homework['ends_on']));
-				
-		$difference 	= $time_expires - $time_now;		
 		
-		$difference2 	= $time_ends - $time_now;
-		if ($homework['expires_on'] != '0000-00-00 00:00:00' && $difference < 0) {			
-			$has_expired = true;
+		if ($homework['expires_on'] != '0000-00-00 00:00:00') {
+			$time_expires 	= convert_date_to_number(api_get_local_time($homework['expires_on']));
+			$difference 	= $time_expires - $time_now;					
+			if ($difference < 0)			
+				$has_expired = true;
 		}
-		if ($homework['ends_on'] != '0000-00-00 00:00:00' && $difference2 < 0) {
-			
-			$has_ended = true;
+		if ($homework['ends_on'] != '0000-00-00 00:00:00') {
+			$time_ends 		= convert_date_to_number(api_get_local_time($homework['ends_on']));
+			$difference2 	= $time_ends - $time_now;				
+			if ($difference2 < 0) {
+				$has_ended = true;
+			}
 		}
 		if ($homework['expires_on'] == '0000-00-00 00:00:00') {
 			$has_expiry_date = false;