Julio Montoya 15 years ago
parent
commit
00732c964f
59 changed files with 1386 additions and 1212 deletions
  1. 5 0
      documentation/changelog.html
  2. 5 3
      main/attendance/attendance_add.php
  3. 59 39
      main/attendance/attendance_controller.php
  4. 7 3
      main/attendance/attendance_edit.php
  5. 0 1
      main/attendance/attendance_list.php
  6. 17 191
      main/attendance/index.php
  7. 2 6
      main/auth/courses.php
  8. 0 2
      main/auth/lostPassword.php
  9. 1 1
      main/auth/lost_password.lib.php
  10. 1 1
      main/auth/my_progress.php
  11. 3 5
      main/auth/profile.php
  12. 59 59
      main/calendar/myagenda.inc.php
  13. 32 61
      main/course_info/delete_course.php
  14. 25 24
      main/course_info/download.lib.php
  15. 4 6
      main/course_info/download.php
  16. 123 129
      main/course_info/infocours.php
  17. 17 17
      main/course_info/maintenance.php
  18. 40 64
      main/course_info/postpone.php
  19. 217 0
      main/course_progress/index.php
  20. 29 0
      main/course_progress/layout.php
  21. 36 42
      main/course_progress/thematic.php
  22. 25 28
      main/course_progress/thematic_advance.php
  23. 32 27
      main/course_progress/thematic_controller.php
  24. 9 11
      main/course_progress/thematic_plan.php
  25. 2 1
      main/gradebook/lib/fe/displaygradebook.php
  26. 5 5
      main/gradebook/lib/fe/exportgradebook.php
  27. 30 51
      main/help/allowed_html_tags.php
  28. 39 68
      main/help/faq.php
  29. 42 74
      main/help/help.php
  30. 11 7
      main/inc/introductionSection.inc.php
  31. 2 0
      main/inc/lib/add_course.lib.inc.php
  32. 4 3
      main/inc/lib/attendance.lib.php
  33. 38 30
      main/inc/lib/course_home.lib.php
  34. 2 11
      main/inc/lib/fckeditor/fckeditor.php
  35. 101 81
      main/inc/lib/internationalization.lib.php
  36. 0 26
      main/inc/lib/internationalization_internal.lib.php
  37. 10 9
      main/inc/lib/main_api.lib.php
  38. 33 3
      main/inc/lib/text.lib.php
  39. 33 14
      main/inc/lib/thematic.lib.php
  40. 4 14
      main/inc/tool_navigation_menu.inc.php
  41. 5 3
      main/install/db_main.sql
  42. 6 3
      main/install/migrate-db-1.8.6.2-1.8.7-pre.sql
  43. 3 0
      main/lang/bulgarian/course_info.inc.php
  44. 15 0
      main/lang/bulgarian/exercice.inc.php
  45. 78 2
      main/lang/bulgarian/trad4all.inc.php
  46. 10 0
      main/lang/english/trad4all.inc.php
  47. 0 1
      main/lang/french/tracking.inc.php
  48. 12 0
      main/lang/galician/admin.inc.php
  49. 11 11
      main/lang/slovenian/tracking.inc.php
  50. 54 54
      main/lang/slovenian/trad4all.inc.php
  51. 1 1
      main/lang/spanish/announcements.inc.php
  52. 1 0
      main/lang/spanish/course_info.inc.php
  53. 1 0
      main/lang/spanish/learnpath.inc.php
  54. 38 1
      main/lang/spanish/trad4all.inc.php
  55. 1 1
      main/mySpace/myStudents.php
  56. 4 3
      main/newscorm/content_makers.inc.php
  57. 8 4
      main/newscorm/learnpath.class.php
  58. 12 11
      tests/main/inc/lib/internationalization.lib.test.php
  59. 22 0
      tests/main/inc/lib/text.lib.test.php

+ 5 - 0
documentation/changelog.html

@@ -24,6 +24,11 @@
 <p>Chamilo 1.8.7 is a intermediate&nbsp;release including a lot of new features, mostly focused on social network, the handling of sessions (which will help many educational institutions, public or private, to manage their contents in a more flexible way) and visual style, and a few important bugfixes. It lays the first stable stone in the Chamilo software project.</p>
 <h3>New Features</h3>
 <ul>
+  <li>Full UTF-8 support has been implemented (Feature #272). UTF-8 becomes recommended system encoding to be used. It is recommended too that html-documents created with external tools to be UTF-8 encoded.
+  <br />For newly installed systems: UTF-8 is the default value of the administrator's setting "Character set". Database tables are created for storing UTF-8 encoded texts.
+  <br />For upgraded systems: Upgrade procedure does not change to UTF-8 the administrator's setting "Character set". This may be done later, on administrator's decision. During upgrade database tables are converted to UTF-8. Conversion to UTF-8 of stored in the file system html-documents is not performed, this is not mandatory.
+  <br />Note about integration with external systems: Keep in maind that since version 1.8.7 texts kept in database are UTF-8 encoded. If an external system accesses database records directly, some corrections mignt be necessary about encoding used by the external database.
+  </li>
   <li>New tool: Class attendance (usable in Gradebook)</li>
   <li>New Tool: Student certificate </li>
   <li>Thematic advance option added in course description (shown on course homepage)</li>

+ 5 - 3
main/attendance/attendance_add.php

@@ -11,7 +11,7 @@
 api_protect_course_script(true);
 
 // error messages
-if (isset($error) && intval($error) == 1) {	
+if ($error) {	
 	Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);	
 }
 
@@ -20,11 +20,13 @@ if (isset($_SESSION['gradebook'])) {
 	$param_gradebook = '&gradebook='.Security::remove_XSS($_SESSION['gradebook']);
 }
 
-$token = Security::get_token();
+if (!$error) {
+	$token = Security::get_token();
+}
 // display form
 $form = new FormValidator('attendance_add','POST','index.php?action=attendance_add&'.api_get_cidreq().$param_gradebook,'','style="width: 100%;"');
 $form->addElement('header', '', get_lang('CreateANewAttendance'));
-$form->addElement('hidden', 'sec_token',$token);
+$form->addElement('hidden', 'sec_token', $token);
 
 $form->add_textfield('title', get_lang('Title'), true, array('size'=>'50'));
 $form->applyFilter('title','html_filter');

+ 59 - 39
main/attendance/attendance_controller.php

@@ -53,33 +53,38 @@
 		
 		$attendance = new Attendance();        
 		$data = array();
-				
-		if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
 
-			$check = Security::check_token();        		
-    		if ($check) {
-    			$attendance->set_name($_POST['title']);
-    			$attendance->set_description($_POST['description']);
-    			$attendance->set_attendance_qualify_title($_POST['attendance_qualify_title']);
-    			$attendance->set_attendance_weight($_POST['attendance_weight']);
-    			$link_to_gradebook = false;    			    			
-				if ( isset($_POST['attendance_qualify_gradebook']) && $_POST['attendance_qualify_gradebook'] == 1 ) {
-					$link_to_gradebook = true;	
-				}    			    			
-    			$last_id = $attendance->attendance_add($link_to_gradebook);    			   			
-	        	Security::clear_token();	        		
-    		}
-    		 
-    		if ($last_id) {        			
-				$this->attendance_sheet('calendar_list',$last_id);     			
+		if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
+			
+			if (!empty($_POST['title'])) {
+				$check = Security::check_token();        		
+	    		if ($check) {
+	    			$attendance->set_name($_POST['title']);
+	    			$attendance->set_description($_POST['description']);
+	    			$attendance->set_attendance_qualify_title($_POST['attendance_qualify_title']);
+	    			$attendance->set_attendance_weight($_POST['attendance_weight']);
+	    			$link_to_gradebook = false;    			    			
+					if ( isset($_POST['attendance_qualify_gradebook']) && $_POST['attendance_qualify_gradebook'] == 1 ) {
+						$link_to_gradebook = true;	
+					}    			    			
+	    			$last_id = $attendance->attendance_add($link_to_gradebook);    			   			
+		        	Security::clear_token();	        		
+	    		}
+    			$param_gradebook = '';
+				if (isset($_SESSION['gradebook'])) {
+					$param_gradebook = '&gradebook='.Security::remove_XSS($_SESSION['gradebook']);
+				}
+    			header('location:index.php?action=attendance_sheet_list&attendance_id='.$last_id.'&'.api_get_cidreq().$param_gradebook);
+    			exit;    			    							     							 
 			} else {
-				$data['error_attendance_add'] = true;
+				$data['error'] = true;
 				$this->view->set_data($data);
 				$this->view->set_layout('layout'); 
 				$this->view->set_template('attendance_add');		       
 				$this->view->render();
 			}
 
+
 		} else {
 			$this->view->set_data($data);
 			$this->view->set_layout('layout'); 
@@ -97,30 +102,44 @@
 	public function attendance_edit($attendance_id) {		
 		$attendance = new Attendance();        
 		$data = array();
-		$attendance_id = intval($attendance_id);				
+		$attendance_id = intval($attendance_id);	
+					
 		if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
-			$check = Security::check_token();        		
-    		if ($check) {
-    			$attendance->set_name($_POST['title']);
-    			$attendance->set_description($_POST['description']);
-    			$attendance->set_attendance_qualify_title($_POST['attendance_qualify_title']);
-    			$attendance->set_attendance_weight($_POST['attendance_weight']);
-    			
-    			$link_to_gradebook = false;    			    			
-				if ( isset($_POST['attendance_qualify_gradebook']) && $_POST['attendance_qualify_gradebook'] == 1 ) {
-					$link_to_gradebook = true;	
-				}    			    			
-				$affected_rows = $attendance->attendance_edit($attendance_id,$link_to_gradebook);				    			
-	        	Security::clear_token();	        		
-    		}
-    		
+			
+			if (!empty($_POST['title'])) {
+				$check = Security::check_token();        		
+	    		if ($check) {
+	    			$attendance->set_name($_POST['title']);
+	    			$attendance->set_description($_POST['description']);
+	    			$attendance->set_attendance_qualify_title($_POST['attendance_qualify_title']);
+	    			$attendance->set_attendance_weight($_POST['attendance_weight']);
+	    			
+	    			$link_to_gradebook = false;    			    			
+					if ( isset($_POST['attendance_qualify_gradebook']) && $_POST['attendance_qualify_gradebook'] == 1 ) {
+						$link_to_gradebook = true;	
+					}    			    			
+					$last_id = $attendance->attendance_edit($attendance_id,$link_to_gradebook);				    			
+		        	Security::clear_token();
+		        	
+		        	$param_gradebook = '';
+					if (isset($_SESSION['gradebook'])) {
+						$param_gradebook = '&gradebook='.Security::remove_XSS($_SESSION['gradebook']);
+					}
+	    			header('location:index.php?action=attendance_list&'.api_get_cidreq().$param_gradebook);
+	    			exit;  	        		
+	    		}
+			} else {
+				$data['attendance_id'] = $_POST['attendance_id'];
+				$data['error'] = true;
+				$this->view->set_data($data);
+				$this->view->set_layout('layout'); 
+				$this->view->set_template('attendance_edit');		       
+				$this->view->render();				
+			}
     		
     		
-    		if ($affected_rows) {
-    			$data['message_edit'] = true;
-    		}
-    		$this->attendance_list();
 		} else {
+			
 			// default values
 			$attendance_data = $attendance->get_attendance_by_id($attendance_id);
 			$data['attendance_id'] = $attendance_data['id'];
@@ -133,6 +152,7 @@
 			$this->view->set_layout('layout'); 
 			$this->view->set_template('attendance_edit');		       
 			$this->view->render();
+			
 		}
 	} 
 	

+ 7 - 3
main/attendance/attendance_edit.php

@@ -12,7 +12,7 @@
 api_protect_course_script(true);
 
 // error messages
-if (isset($error) && intval($error) == 1) {	
+if ($error) {	
 	Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);	
 }
 
@@ -20,13 +20,17 @@ $param_gradebook = '';
 if (isset($_SESSION['gradebook'])) {
 	$param_gradebook = '&gradebook='.Security::remove_XSS($_SESSION['gradebook']);
 }
-$token = Security::get_token();
-$attendance_weight = floatval($attendance_weight);
 
+if (!$error) {
+	$token = Security::get_token();
+}
+
+$attendance_weight = floatval($attendance_weight);
 // display form
 $form = new FormValidator('attendance_edit','POST','index.php?action=attendance_edit&'.api_get_cidreq().'&attendance_id='.$attendance_id.$param_gradebook,'','style="width: 100%;"');
 $form->addElement('header', '', get_lang('Edit'));
 $form->addElement('hidden', 'sec_token',$token);
+$form->addElement('hidden', 'attendance_id', $attendance_id);
 
 $form->add_textfield('title', get_lang('Title'), true, array('size'=>'50'));
 $form->applyFilter('title','html_filter');

+ 0 - 1
main/attendance/attendance_list.php

@@ -17,7 +17,6 @@ if (api_is_allowed_to_edit(null, true)) {
 	}
 	echo '<div class="actions" style="margin-bottom:30px">';
 	echo '<a href="index.php?'.api_get_cidreq().$param_gradebook.'&action=attendance_add">'.Display::return_icon('adherir.png',get_lang('CreateANewAttendance')).' '.get_lang('CreateANewAttendance').'</a>';	
-	echo '<a href="index.php?'.api_get_cidreq().$param_gradebook.'&action=thematic_details">'.Display::return_icon('defaut.gif',get_lang('ThematicControl')).' '.get_lang('ThematicControl').'</a>';
 	echo '</div>';
 }
 $table = new SortableTable('attendance_list', array('Attendance', 'get_number_of_attendances'), array('Attendance', 'get_attendance_data'), $default_column);

+ 17 - 191
main/attendance/index.php

@@ -14,10 +14,8 @@ $language_file = array ('course_description', 'pedaSuggest', 'userInfo', 'admin'
 // including files 
 require_once '../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
-require_once api_get_path(LIBRARY_PATH).'thematic.lib.php';
 require_once api_get_path(LIBRARY_PATH).'app_view.php';
 require_once 'attendance_controller.php';
-require_once 'thematic_controller.php';
 require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
 require_once api_get_path(LIBRARY_PATH).'course.lib.php';
 require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php';
@@ -30,85 +28,52 @@ $this_section = SECTION_COURSES;
 // protect a course script
 api_protect_course_script(true);
 
-
-// defining constants
-define('ADD_THEMATIC_PLAN', 6);
-
-$calendar_id = '';
-if (isset($_GET['calendar_id'])) {
-	$calendar_id = intval($_GET['calendar_id']);
-}
-
 // get actions
 $actions = array('attendance_list', 'attendance_sheet_list', 'attendance_sheet_add', 'attendance_add', 'attendance_edit', 'attendance_delete', 'attendance_delete_select');
 $actions_calendar = array('calendar_list', 'calendar_add', 'calendar_edit', 'calendar_delete', 'calendar_all_delete');
-$actions_thematic = array('thematic_details', 'thematic_list', 'thematic_add', 'thematic_edit', 'thematic_delete', 'moveup', 'movedown', 
-						  'thematic_plan_list', 'thematic_plan_add', 'thematic_plan_edit', 'thematic_plan_delete', 
-						  'thematic_advance_list', 'thematic_advance_add', 'thematic_advance_edit', 'thematic_advance_delete');
-
 $action  = 'attendance_list';
-if (isset($_GET['action']) && (in_array($_GET['action'],$actions) || in_array($_GET['action'],$actions_calendar) || in_array($_GET['action'],$actions_thematic))) {
+if (isset($_GET['action']) && (in_array($_GET['action'],$actions) || in_array($_GET['action'],$actions_calendar))) {
 	$action = $_GET['action'];
 }
-
-if (isset($_POST['action']) && $_POST['action'] == 'thematic_delete_select') {
-	$action = 'thematic_delete_select';
+if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true') {
+	$action = 'attendance_list';
 }
 
 // get attendance id
-$attendance_id = 0;
+$attendance_id = 0; 
 if (isset($_GET['attendance_id'])) {
 	$attendance_id = intval($_GET['attendance_id']);
 }
 
-// get thematic id
-if (isset($_GET['thematic_id'])) {
-	$thematic_id = intval($_GET['thematic_id']);
-}
-
-// get thematic plan description type
-if (isset($_GET['description_type'])) {
-	$description_type = intval($_GET['description_type']);
+// get calendar id
+$calendar_id = '';
+if (isset($_GET['calendar_id'])) {
+	$calendar_id = intval($_GET['calendar_id']);
 }
 
 // instance attendance object for using like library here
 $attendance = new Attendance();
 
-// instance thematic object for using like library here
-$thematic = new Thematic();
-
 // attendance controller object
 $attendance_controller = new AttendanceController();
 
-// thematic controller object
-$thematic_controller = new ThematicController();
-
+// get attendance data
 if (!empty($attendance_id)) {
 	// attendance data by id
 	$attendance_data = $attendance->get_attendance_by_id($attendance_id);
 }
-if (!empty($thematic_id)) {
-	// thematic data by id
-	$thematic_data = $thematic->get_thematic_list($thematic_id);
-}
-
-// get default thematic plan title
-$default_thematic_plan_title = $thematic->get_default_thematic_plan_title();
 
 $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.js" type="text/javascript" language="javascript"></script>';
 $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.js" type="text/javascript" language="javascript"></script>';
 $htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.css" type="text/css" media="projection, screen">';
 $htmlHeadXtra[] = '<script language="javascript">
 		
-			$(function() {	
-									
-				$("table th img").click(function() {
-					
+			$(function() {										
+				$("table th img").click(function() {					
 					var col_id = this.id;
 					var col_split = col_id.split("_");							
 					var calendar_id = col_split[2];
-					var class_img = $(this).attr("class");
-					
+					var class_img = $(this).attr("class");					
 					if (class_img == "img_unlock") {
 						$("#checkbox_head_"+calendar_id).attr("disabled",true);
 						$(".row_odd td.checkboxes_col_"+calendar_id).css({"background-color":"#F2F2F2"});
@@ -128,10 +93,8 @@ $htmlHeadXtra[] = '<script language="javascript">
 						$("#hidden_input_"+calendar_id).attr("disabled",false);
 						$("#hidden_input_"+calendar_id).attr("value",calendar_id);						
 						return false;
-					}	
-					
-				});	
-				
+					}						
+				});					
 				$("table th input:checkbox").click(function() {
 					var col_id = this.id;
 					var col_split = col_id.split("_");							
@@ -141,8 +104,7 @@ $htmlHeadXtra[] = '<script language="javascript">
 					} else {						
 						$(".checkboxes_col_"+calendar_id+" input:checkbox").attr("checked",false);
 					}
-				});
-					
+				});					
 				$(".attendance-sheet-content .row_odd, .attendance-sheet-content .row_even").mouseover(function() {
 					$(".row_odd").css({"background-color":"#F2F2F2"});
 					$(".row_even").css({"background-color":"#FFF"});
@@ -150,8 +112,7 @@ $htmlHeadXtra[] = '<script language="javascript">
 				$(".attendance-sheet-content .row_odd, .attendance-sheet-content .row_even").mouseout(function() {
 					$(".row_odd").css({"background-color":"#F2F2F2"});
 					$(".row_even").css({"background-color":"#FFF"});
-				});
-											
+				});											
 				$(".advanced_parameters").click(function() {				
 					if ($("#id_qualify").css("display") == "none") {
 						$("#id_qualify").css("display","block");
@@ -163,73 +124,8 @@ $htmlHeadXtra[] = '<script language="javascript">
 				});																							
 			});		
 
-
-		function datetime_by_attendance(selected_value) {
-			$.ajax({
-				contentType: "application/x-www-form-urlencoded",
-				beforeSend: function(objeto) {},
-				type: "POST",
-				url: "'.api_get_path(WEB_AJAX_PATH).'thematic.ajax.php?a=get_datetime_by_attendance",
-				data: "attendance_id="+selected_value,
-				success: function(datos) {
-				 $("#div_datetime_attendance").html(datos);
-				}
-			});
-		}
-		
-		function update_done_thematic_advance(selected_value) {
-			$.ajax({
-				contentType: "application/x-www-form-urlencoded",
-				beforeSend: function(objeto) {},
-				type: "GET",
-				url: "'.api_get_path(WEB_AJAX_PATH).'thematic.ajax.php?a=update_done_thematic_advance&thematic_advance_id="+selected_value,
-				data: "thematic_advance_id="+selected_value,
-				success: function(datos) {
-				 $("#div_result").html(datos);
-				}
-			});
-			
-			// clean all radios
-			for (var i=0; i<$("input[@name=\'done_thematic\']").length;i++) {
-				var id_radio_thematic = $("input[@name=\'done_thematic\']").get(i).id;								
-				$("#td_"+id_radio_thematic).css({"background-color":"#FFF"});				
-			}
-			
-			// set background to previous radios 
-			for (var i=0; i<$("input[@name=\'done_thematic\']").length;i++) {
-				var id_radio_thematic = $("input[@name=\'done_thematic\']").get(i).id;								
-				$("#td_"+id_radio_thematic).css({"background-color":"#E5EDF9"});
-				if ($("input[@name=\'done_thematic\']").get(i).value == selected_value) {
-					break;
-				}
-			}		
-
-		}
-		
-		
-		function check_per_attendance(obj) {	
-			if (obj.checked == true) {
-				document.getElementById(\'div_datetime_by_attendance\').style.display=\'block\';
-				document.getElementById(\'div_custom_datetime\').style.display=\'none\';
-			} else {
-				document.getElementById(\'div_datetime_by_attendance\').style.display=\'none\';
-				document.getElementById(\'div_custom_datetime\').style.display=\'block\';
-			}			
-		}
-
-		function check_per_custom_date(obj) {
-			if (obj.checked == true) {
-				document.getElementById(\'div_custom_datetime\').style.display=\'block\';
-				document.getElementById(\'div_datetime_by_attendance\').style.display=\'none\';
-			} else {
-				document.getElementById(\'div_custom_datetime\').style.display=\'none\';
-				document.getElementById(\'div_datetime_by_attendance\').style.display=\'block\';
-			}			
-		}
-
 		</script>';
 
-
 // interbreadcrumbs
 if (!empty($_GET['gradebook']) && $_GET['gradebook']=='view' ) {
 	$_SESSION['gradebook']=Security::remove_XSS($_GET['gradebook']);
@@ -238,12 +134,10 @@ if (!empty($_GET['gradebook']) && $_GET['gradebook']=='view' ) {
 	unset($_SESSION['gradebook']);
 	$gradebook=	'';
 }
-
 $param_gradebook = '';
 if (isset($_SESSION['gradebook'])) {
 	$param_gradebook = '&gradebook='.$gradebook;
 }
-
 $student_param = '';
 if (api_is_drh() && isset($_GET['student_id'])) {			
 	$student_id = intval($_GET['student_id']);
@@ -252,60 +146,13 @@ if (api_is_drh() && isset($_GET['student_id'])) {
 	$student_name  =  api_get_person_name($student_info['firstname'],$student_info['lastname']);
 	$interbreadcrumb[] = array ('url' => '/main/mySpace/myStudents.php?student='.$student_id, 'name' => $student_name);	
 }
-
 if (!empty($gradebook)) {
 	$interbreadcrumb[] = array ('url' => '/main/gradebook/index.php', 'name' => get_lang('ToolGradebook'));	
 }
-$interbreadcrumb[] = array ('url' => 'index.php?action=attendance_list'.$param_gradebook.$student_param, 'name' => get_lang('ToolAttendance'));
+$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=attendance_list'.$param_gradebook.$student_param, 'name' => get_lang('ToolAttendance'));
 if ($action == 'attendance_add') {
 	$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('CreateANewAttendance'));
 }
-if ($action == 'thematic_list') {
-	$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl'));
-}
-if ($action == 'thematic_add') {
-	$interbreadcrumb[] = array ('url' => 'index.php?action=thematic_list', 'name' => get_lang('ThematicControl'));
-	$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicSection'));	
-}
-if ($action == 'thematic_edit') {
-	$interbreadcrumb[] = array ('url' => 'index.php?action=thematic_list', 'name' => get_lang('ThematicControl'));
-	$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('EditThematicSection'));	
-}
-if ($action == 'thematic_details') {
-	//$interbreadcrumb[] = array ('url' => 'index.php?action=thematic_list', 'name' => get_lang('ThematicControl'));
-	$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl'));	
-} 
-if ($action == 'thematic_plan_list' || $action == 'thematic_plan_delete') {
-	if (isset($_GET['origin']) && $_GET['origin'] == 'thematic_details') {
-		$interbreadcrumb[] = array ('url' => 'index.php?action=thematic_details', 'name' => get_lang('ThematicControl'));
-	} else {
-		$interbreadcrumb[] = array ('url' => 'index.php?action=thematic_list', 'name' => get_lang('ThematicControl'));
-	}
-	$interbreadcrumb[] = array ('url' => '#', 'name' => $thematic_data['title'].':'.get_lang('ThematicPlan'));	
-}
-if ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') {
-	$interbreadcrumb[] = array ('url' => 'index.php?action=thematic_list', 'name' => get_lang('ThematicControl'));
-	$interbreadcrumb[] = array ('url' => 'index.php?action=thematic_plan_list&thematic_id='.$thematic_id, 'name' => $thematic_data['title'].':'.get_lang('ThematicPlan'));
-	
-	if ($description_type >= ADD_THEMATIC_PLAN) {
-		$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewBloc'));
-	} else {
-		$interbreadcrumb[] = array ('url' => '#', 'name' => $default_thematic_plan_title[$description_type]);	
-	}
-}
-if ($action == 'thematic_advance_list') {
-	if (isset($_GET['origin']) && $_GET['origin'] == 'thematic_details') {
-		$interbreadcrumb[] = array ('url' => 'index.php?action=thematic_details', 'name' => get_lang('ThematicControl'));
-	} else {
-		$interbreadcrumb[] = array ('url' => 'index.php?action=thematic_list', 'name' => get_lang('ThematicControl'));
-	}
-	$interbreadcrumb[] = array ('url' => '#', 'name' => $thematic_data['title'].':'.get_lang('ThematicAdvance'));
-}
-if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
-	$interbreadcrumb[] = array ('url' => 'index.php?action=thematic_list', 'name' => get_lang('ThematicControl'));
-	$interbreadcrumb[] = array ('url' => 'index.php?action=thematic_advance_list&thematic_id='.$thematic_id, 'name' => $thematic_data['title'].':'.get_lang('ThematicAdvance'));
-	$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicAdvance'));
-}
 if ($action == 'attendance_edit') {
 	$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('Edit'));
 }
@@ -346,27 +193,6 @@ switch ($action) {
 	case 'calendar_all_delete' 		:
 	case 'calendar_delete' 			:	$attendance_controller->attendance_calendar($action, $attendance_id, $calendar_id);
 										break;
-	
-	case 'thematic_add'				:
-	case 'thematic_edit'			:
-	case 'thematic_delete'			:	
-	case 'thematic_delete_select'	:
-	case 'thematic_details'			:
-	case 'moveup'					:
-	case 'movedown'					:
-	case 'thematic_list'			:	$thematic_controller->thematic($action);
-										break;
-	case 'thematic_plan_list'		:
-	case 'thematic_plan_add'		:
-	case 'thematic_plan_edit'		:	
-	case 'thematic_plan_delete'		:	$thematic_controller->thematic_plan($action);
-										break;
-	case 'thematic_advance_list'	:
-	case 'thematic_advance_add'		:
-	case 'thematic_advance_edit'	:
-	case 'thematic_advance_delete'	:	$thematic_controller->thematic_advance($action);
-										break;
-	
 	default		  					:	$attendance_controller->attendance_list();
 }
 

+ 2 - 6
main/auth/courses.php

@@ -1,17 +1,13 @@
 <?php
-/* For licensing terms, see /dokeos_license.txt */
+/* For licensing terms, see /license.txt */
 /**
-==============================================================================
-*	@package dokeos.auth
+*	@package chamilo.auth
 *	@todo check if unsubscribing from a course WITH group memberships works as it should
 *	@todo constants are in uppercase, variables aren't
-==============================================================================
 */
 
 /*
-==============================================================================
 		INIT SECTION
-==============================================================================
 */
 
 // Names of the language file that needs to be included.

+ 0 - 2
main/auth/lostPassword.php

@@ -1,7 +1,6 @@
 <?php
 /* For licensing terms, see /license.txt */
 /**
-==============================================================================
  * SCRIPT PURPOSE :
  *
  * This script allows users to retrieve the password of their profile(s)
@@ -14,7 +13,6 @@
 *	@todo refactor, move relevant functions to code libraries
 *
 *	@package chamilo.auth
-==============================================================================
 */
 // name of the language file that needs to be included
 $language_file = 'registration';

+ 1 - 1
main/auth/lost_password.lib.php

@@ -1,5 +1,5 @@
 <?php
-/* For licensing terms, see /dokeos_license.txt */
+/* For licensing terms, see /license.txt */
 
 /**
  * @deprecated by Ivan Tcholakov, 09-OCT-2009.

+ 1 - 1
main/auth/my_progress.php

@@ -1,5 +1,5 @@
 <?php
-/* For licensing terms, see /dokeos_license.txt */
+/* For licensing terms, see /license.txt */
 // name of the language file that needs to be included
 $language_file = array('registration', 'tracking', 'exercice', 'admin');
 

+ 3 - 5
main/auth/profile.php

@@ -1,14 +1,12 @@
-<?php // $Id: profile.php 22233 2009-07-20 09:54:05Z ivantcholakov $
-/* For licensing terms, see /dokeos_license.txt */
+<?php
+/* For licensing terms, see /license.txt */
 /**
-==============================================================================
 * This file displays the user's profile,
 * optionally it allows users to modify their profile as well.
 *
 * See inc/conf/profile.conf.php to modify settings
 *
-* @package dokeos.auth
-==============================================================================
+* @package chamilo.auth
 */
 
 /**

+ 59 - 59
main/calendar/myagenda.inc.php

@@ -46,13 +46,11 @@ $setting_agenda_link = 'coursecode'; // valid values are coursecode and icon
 /**
  *	This function retrieves all the agenda items of all the courses the user is subscribed to
  */
-function get_myagendaitems($courses_dbs, $month, $year)
-{
+function get_myagendaitems($courses_dbs, $month, $year) {
 	global $_user;
 	global $_configuration;
 	global $setting_agenda_link;
 
-
 	$items = array ();
 	// get agenda-items for every course
 	foreach ($courses_dbs as $key => $array_course_info) {
@@ -62,8 +60,7 @@ function get_myagendaitems($courses_dbs, $month, $year)
 
 		$group_memberships = GroupManager :: get_group_ids($array_course_info["db"], $_user['user_id']);
 		// if the user is administrator of that course we show all the agenda items
-		if ($array_course_info['status'] == '1')
-		{
+		if ($array_course_info['status'] == '1') {
 			//echo "course admin";
 			$sqlquery = "SELECT DISTINCT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
 							FROM ".$TABLEAGENDA." agenda,
@@ -77,11 +74,9 @@ function get_myagendaitems($courses_dbs, $month, $year)
 							ORDER BY start_date ";
 		}
 		// if the user is not an administrator of that course
-		else
-		{
+		else {
 			//echo "GEEN course admin";
-			if (is_array($group_memberships) && count($group_memberships)>0)
-			{
+			if (is_array($group_memberships) && count($group_memberships)>0) {
 				$sqlquery = "SELECT	agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
 								FROM ".$TABLEAGENDA." agenda,
 									".$TABLE_ITEMPROPERTY." ip
@@ -92,9 +87,7 @@ function get_myagendaitems($courses_dbs, $month, $year)
 								AND	( ip.to_user_id='".$_user['user_id']."' OR ip.to_group_id IN (0, ".implode(", ", $group_memberships).") )
 								AND ip.visibility='1'
 								ORDER BY start_date ";
-			}
-			else
-			{
+			} else {
 				$sqlquery = "SELECT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
 								FROM ".$TABLEAGENDA." agenda,
 									".$TABLE_ITEMPROPERTY." ip
@@ -105,24 +98,24 @@ function get_myagendaitems($courses_dbs, $month, $year)
 								AND ( ip.to_user_id='".$_user['user_id']."' OR ip.to_group_id='0')
 								AND ip.visibility='1'
 								ORDER BY start_date ";
-			}
+				}
 		}
 
 		$result = Database::query($sqlquery);
 		while ($item = Database::fetch_array($result)) {
 			$agendaday = date("j",strtotime($item['start_date']));
-			if(!isset($items[$agendaday])){$items[$agendaday]=array();}
-
+			if(!isset($items[$agendaday])) {
+				$items[$agendaday]=array();
+			}
 			$time = api_convert_and_format_date($item['start_date'], TIME_NO_SEC_FORMAT, date_default_timezone_get());
 			$end_time = api_convert_and_format_date($item['end_date'], TIME_NO_SEC_FORMAT, date_default_timezone_get());
 			$URL = api_get_path(WEB_PATH)."main/calendar/agenda.php?cidReq=".urlencode($array_course_info["code"])."&amp;day=$agendaday&amp;month=$month&amp;year=$year#$agendaday"; // RH  //Patrick Cool: to highlight the relevant agenda item
 			if ($setting_agenda_link == 'coursecode') {
 				$title=$array_course_info['title'];
 				$agenda_link = api_substr($title, 0, 14);
-			}
-			else {
+			} else {
 				$agenda_link = Display::return_icon('course_home.gif');
-			}
+				}
 			if(!isset($items[$agendaday][$item['start_date']])) {
 				$items[$agendaday][$item['start_date']] = '';
 			}
@@ -155,8 +148,7 @@ function get_myagendaitems($courses_dbs, $month, $year)
  * @param	string	The month name
  * @return	void	Direct output
  */
-function display_mymonthcalendar($agendaitems, $month, $year, $weekdaynames=array(), $monthName)
-{
+function display_mymonthcalendar($agendaitems, $month, $year, $weekdaynames=array(), $monthName) {
 	global $DaysShort,$course_path;
 	//Handle leap year
 	$numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
@@ -210,8 +202,7 @@ function display_mymonthcalendar($agendaitems, $month, $year, $weekdaynames=arra
 /**
  * Show the mini calender of the given month
  */
-function display_myminimonthcalendar($agendaitems, $month, $year, $monthName)
-{
+function display_myminimonthcalendar($agendaitems, $month, $year, $monthName) {
 	global $DaysShort,$course_path;
 	//Handle leap year
 	$numberofdays = array (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
@@ -238,8 +229,7 @@ function display_myminimonthcalendar($agendaitems, $month, $year, $monthName)
 	while ($curday <= $numberofdays[$month])
 	{
 		echo "<tr>\n";
-		for ($ii = 0; $ii < 7; $ii ++)
-		{
+		for ($ii = 0; $ii < 7; $ii ++) {
 			if (($curday == -1) && ($ii == $startdayofweek))
 			{
 				$curday = 1;
@@ -282,11 +272,12 @@ function display_myminimonthcalendar($agendaitems, $month, $year, $monthName)
  * we are editing
  * attention: we have to check that the student is editing an item that belongs to him/her
  */
-function show_new_personal_item_form($id = "")
-{
+function show_new_personal_item_form($id = "") {
 	global $year, $MonthsLong;
-	global $tbl_personal_agenda;
 	global $_user;
+	
+	$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
+	
 	// we construct the default time and date data (used if we are not editing a personal agenda item)
 	$today = getdate();
 	$day = $today['mday'];
@@ -304,12 +295,12 @@ function show_new_personal_item_form($id = "")
 		return false; //potential SQL injection
 	}
 
-	if ($id <> "")
+	if ($id != "")
 	{
 		$sql = "SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$_user['user_id']."' AND id='".$id."'";
 		$result = Database::query($sql);
 		$aantal = Database::num_rows($result);
-		if ($aantal <> 0)
+		if ($aantal != 0)
 		{
 			$row = Database::fetch_array($result);
 			$year = substr($row['date'], 0, 4);
@@ -318,7 +309,7 @@ function show_new_personal_item_form($id = "")
 			$hours = substr($row['date'], 11, 2);
 			$minutes = substr($row['date'], 14, 2);
 			$title = $row['title'];
-			$text = $row['text'];
+			$content = $row['text'];
 		}
 		else
 		{
@@ -326,7 +317,7 @@ function show_new_personal_item_form($id = "")
 		}
 	}
 
-	echo '<form method="post" action="myagenda.php?action=add_personal_agenda_item&amp;id=$id" name="newedit_form">';
+	echo '<form method="post" action="myagenda.php?action=add_personal_agenda_item&amp;id='.$id.'" name="newedit_form">';
 	echo '<div id="newedit_form">';
 	echo '<div class="title">';
 	echo ($_GET['action'] == 'edit_personal_agenda_item') ? get_lang("ModifyPersonalCalendarItem") : get_lang("AddPersonalCalendarItem");
@@ -474,12 +465,21 @@ function show_new_personal_item_form($id = "")
 
 }
 /**
- * This function shows all the forms that are needed form adding a new personal agenda item
+ * This function shows all the forms that are needed form adding/editing a new personal agenda item
+ * @param date is the time in day
+ * @param date is the time in month
+ * @param date is the time in year
+ * @param date is the time in hour
+ * @param date is the time in minute
+ * @param string is the agenda title
+ * @param string is the content
+ * @param int is the id this param is optional, but is necessary if the item require be edited 
  */
-function store_personal_item($day, $month, $year, $hour, $minute, $title, $content, $id = "")
-{
-	global $tbl_personal_agenda;
+function store_personal_item($day, $month, $year, $hour, $minute, $title, $content, $id = "") {
 	global $_user;
+	
+	$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
+	
 	//constructing the date
 	$date = $year."-".$month."-".$day." ".$hour.":".$minute.":00";
 
@@ -491,7 +491,7 @@ function store_personal_item($day, $month, $year, $hour, $minute, $title, $conte
 	}
 
 
-	if ($id <> "")
+	if ($id != "")
 	{ // we are updating
 		$sql = "UPDATE ".$tbl_personal_agenda." SET user='".$_user['user_id']."', title='".$title."', text='".$content."', date='".$date."' WHERE id='".$id."'";
 	}
@@ -507,11 +507,11 @@ function store_personal_item($day, $month, $year, $hour, $minute, $title, $conte
  * Xritten by Noel Dieschburg <noel.dieschburg@dokeos.com>
  */
 
-function get_all_courses_of_user()
-{
-        global $TABLECOURS;
-        global $TABLECOURSUSER;
+function get_all_courses_of_user() {
         global $_user;
+        
+        $TABLECOURS = Database :: get_main_table(TABLE_MAIN_COURSE);
+        $TABLECOURSUSER = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
         $tbl_session_course     = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
         $tbl_session_course_user= Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
         $tbl_session                    = Database :: get_main_table(TABLE_MAIN_SESSION);
@@ -542,11 +542,11 @@ function get_all_courses_of_user()
  * This function finds all the courses of the user and returns an array containing the
  * database name of the courses.
  */
-function get_courses_of_user()
-{
-	global $TABLECOURS;
-	global $TABLECOURSUSER;
+function get_courses_of_user() {
 	global $_user;
+	
+	$TABLECOURS = Database :: get_main_table(TABLE_MAIN_COURSE);
+	$TABLECOURSUSER = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
 	$sql_select_courses = "SELECT course.code k, course.visual_code  vc,
 									course.title i, course.tutor_name t, course.db_name db, course.directory dir, course_rel_user.status status
 			                        FROM    $TABLECOURS       course,
@@ -564,11 +564,11 @@ function get_courses_of_user()
 /**
  * This function retrieves all the personal agenda items and add them to the agenda items found by the other functions.
  */
-function get_personal_agenda_items($agendaitems, $day = "", $month = "", $year = "", $week = "", $type)
-{
-	global $tbl_personal_agenda;
+function get_personal_agenda_items($agendaitems, $day = "", $month = "", $year = "", $week = "", $type) {
 	global $_user;
 	global $_configuration;
+	
+	$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
 	// 1. creating the SQL statement for getting the personal agenda items in MONTH view
 	if ($type == "month_view" or $type == "") // we are in month view
 	{
@@ -668,8 +668,7 @@ function get_personal_agenda_items($agendaitems, $day = "", $month = "", $year =
  * @param	int	The agenda item ID
  * @return 	array	The results of the database query, or null if not found
  */
-function get_personal_agenda_item($id)
-{
+function get_personal_agenda_item($id) {
 	$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
 	$id = Database::escape_string($id);
 	// make sure events of the personal agenda can only be seen by the user himself
@@ -690,11 +689,12 @@ function get_personal_agenda_item($id)
  * This function retrieves all the personal agenda items of the user and shows
  * these items in one list (ordered by date and grouped by month (the month_bar)
  */
-function show_personal_agenda()
-{
-	global $tbl_personal_agenda;
+function show_personal_agenda() {
 	global $MonthsLong, $charset;
 	global $_user;
+	
+	$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
+	
 	// The SQL statement that retrieves all the personal agenda items of this user
 	$sql = "SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$_user['user_id']."' ORDER BY date DESC";
 	$result = Database::query($sql);
@@ -794,10 +794,10 @@ function show_personal_agenda()
  * these items in one list (ordered by date and grouped by month (the month_bar)
  * @param int user id
  */
-function show_simple_personal_agenda($user_id)
-{
-	$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
+function show_simple_personal_agenda($user_id) {
 	global $MonthsLong, $charset;
+	
+	$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
 
 	// The SQL statement that retrieves all the personal agenda items of this user
 	$sql = "SELECT * FROM ".$tbl_personal_agenda." WHERE user='".$user_id."' ORDER BY date DESC";
@@ -868,10 +868,10 @@ function show_simple_personal_agenda($user_id)
  * There is an additional check to make sure that one cannot delete an item that
  * does not belong to him/her
  */
-function delete_personal_agenda($id)
-{
-	global $tbl_personal_agenda;
+function delete_personal_agenda($id) {
 	global $_user;
+	
+	$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
 
 	if ($id != strval(intval($id))) {
 		return false; //potential SQL injection
@@ -981,4 +981,4 @@ function get_personal_agenda_items_between_dates($user_id, $date_start='', $date
 	}
 	return $items;
 }
-?>
+

+ 32 - 61
main/course_info/delete_course.php

@@ -1,82 +1,53 @@
 <?php
-// $Id: delete_course.php 17195 2008-12-09 23:47:07Z iflorespaz $
-/*
-==============================================================================
-	Dokeos - elearning and course management software
+/* For licensing terms, see /license.txt */
 
-	Copyright (c) 2004 Dokeos S.A.
-	Copyright (c) 2003 Ghent University (UGent)
-	Copyright (c) 2001 Universite catholique de Louvain (UCL)
-	Copyright (c) Olivier brouckaert
-	Copyright (c) Roan Embrechts
-	Copyright (c) Bart Mollet, Hogeschool Gent
-
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
-
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
-
-	See the GNU General Public License for more details.
-
-	Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
-==============================================================================
-*/
 /**
-==============================================================================
-*	This script is about deleting a course.
-*	It displays a message box ('are you sure you wish to delete this course')
-*	and deletes the course if the user answers affirmatively
-*
-*	@package dokeos.course_info
-==============================================================================
-*/
-// name of the language file that needs to be included
-$language_file = array ('admin','course_info');
-
-require_once ('../inc/global.inc.php');
-require_once (api_get_path(LIBRARY_PATH).'course.lib.php');
+ *	This script is about deleting a course.
+ *	It displays a message box ('are you sure you wish to delete this course')
+ *	and deletes the course if the user answers affirmatively
+ *
+ *	@package chamilo.course_info
+ */
+
+// Language files that need to be included
+$language_file = array('admin', 'course_info');
+
+require_once '../inc/global.inc.php';
+require_once api_get_path(LIBRARY_PATH).'course.lib.php';
 require_once '../gradebook/lib/be/gradebookitem.class.php';
 require_once '../gradebook/lib/be/category.class.php';
 $this_section = SECTION_COURSES;
 
-$currentCourseCode = $_course['official_code'];
-$currentCourseName = $_course['name'];
+$current_course_code = $_course['official_code'];
+$current_course_name = $_course['name'];
 
-if (!api_is_allowed_to_edit())
-{
+if (!api_is_allowed_to_edit()) {
 	api_not_allowed(true);
 }
 $tool_name = get_lang('DelCourse');
-if (isset($_GET['delete']) && $_GET['delete'] == 'yes')
-{
+
+if (isset($_GET['delete']) && $_GET['delete'] == 'yes') {
+
 	CourseManager :: delete_course($_course['sysCode']);
 
-	$obj_cat=new Category();
+	$obj_cat = new Category();
 	$obj_cat->update_category_delete($_course['sysCode']);
 
 	// DELETE CONFIRMATION MESSAGE
-	unset ($_course);
-	unset ($_cid);
+	unset($_course);
+	unset($_cid);
 	$noPHP_SELF = true;
-	$message = get_lang('Course')." &quot;".$currentCourseName."&quot; "."(".$currentCourseCode.") ".get_lang('HasDel');
-	$message .=  "<br /><br /><a href=\"../../index.php\">".get_lang('BackHome')." ".api_get_setting('siteName')."</a>";
+	$message = get_lang('Course').' &quot;'.$current_course_name.'&quot; ('.$current_course_code.') '.get_lang('HasDel');
+	$message .= '<br /><br /><a href="../../index.php">'.get_lang('BackHome').' '.api_get_setting('siteName').'</a>';
 
-} // end if $delete
-else
-{
-	$message = "&quot;".$currentCourseName."&quot; "."(".$currentCourseCode.") "."<p>".get_lang("ByDel")."</p>"."<p>"."<a href=\"maintenance.php\">".get_lang("N")."</a>"."&nbsp;&nbsp;|&nbsp;&nbsp;"."<a href=\"".api_get_self()."?delete=yes\">".get_lang("Y")."</a>"."</p>";
-	$interbreadcrumb[] = array ("url" => "maintenance.php", "name" => get_lang('Maintenance'));
+} else {
+	$message = '&quot;'.$current_course_name.'&quot; ('.$current_course_code.') <p>'.get_lang('ByDel').'</p><p><a href="maintenance.php">'.get_lang('No').'</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="'.api_get_self().'?delete=yes">'.get_lang('Yes').'</a></p>';
+	$interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance'));
 }
-Display :: display_header($tool_name, "Settings");
+Display :: display_header($tool_name, 'Settings');
 api_display_tool_title($tool_name);
-Display::display_warning_message($message,false);
-/*
-==============================================================================
-		FOOTER
-==============================================================================
-*/
+Display::display_warning_message($message, false);
+
+/*	FOOTER */
+
 Display :: display_footer();
-?>

+ 25 - 24
main/course_info/download.lib.php

@@ -1,42 +1,43 @@
 <?php
+/* For licensing terms, see /license.txt */
+
+// TODO: Where this file is used? Is it needed at all?
 
 //require '../inc/global.inc.php';
 
 function create_backup_is_admin($_cid) {
-	
+
 	$this_section = SECTION_COURSES;
-	if(isset($_GET['session']) && $_GET['session'] == true ) 
-	{
-			$archive_path = api_get_path(SYS_ARCHIVE_PATH);
-			$_cid = true;
-			$is_courseAdmin = true;
+	if (isset($_GET['session']) && $_GET['session']) {
+		$archive_path = api_get_path(SYS_ARCHIVE_PATH);
+		$_cid = true;
+		$is_courseAdmin = true;
+	} else {
+		$archive_path = api_get_path(SYS_ARCHIVE_PATH);
 	}
-	 	else 
-	 	{
-			$archive_path = api_get_path(SYS_ARCHIVE_PATH);
-		}
-
-		$archive_file = $_GET['archive'];
-		$archive_file = str_replace(array('..', '/', '\\'), '', $archive_file);
-
-		list($extension) = getextension($archive_file);
-		
-	if (empty($extension) || !file_exists($archive_path.$archive_file)) 
-	{
+
+	$archive_file = $_GET['archive'];
+	$archive_file = str_replace(array('..', '/', '\\'), '', $archive_file);
+
+	list($extension) = getextension($archive_file);
+
+	if (empty($extension) || !file_exists($archive_path.$archive_file)) {
 		return false;
 	}
 
+	$extension = strtolower($extension);
 	$content_type = '';
-	if (in_array(strtolower($extension), array('xml','csv')) && (api_is_platform_admin(true) || api_is_drh())) {
+	if (in_array($extension, array('xml', 'csv')) && (api_is_platform_admin(true) || api_is_drh())) {
 		$content_type = 'application/force-download';
-	} elseif (strtolower($extension) == 'zip' || ('html' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin))) {
+	// TODO: The following unclear condition is commented ant is to be checked. A replacement has been proposed.
+	//} elseif (strtolower($extension) == 'zip' || ('html' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin))) {
+	} elseif ($extension == 'zip' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin)) {
+	//
 		$content_type = 'application/force-download';
 	}
 	if (empty($content_type)) {
-		return false ;
+		return false;
 	}
 	return true;
 }
-return true;
-
-?>
+return true; // TODO: Why is this line here?

+ 4 - 6
main/course_info/download.php

@@ -6,7 +6,7 @@ $this_section = SECTION_COURSES;
 
 require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php';
 
-if(isset($_GET['session']) && $_GET['session'] == true ){
+if (isset($_GET['session']) && $_GET['session'] == true) {
 	$archive_path = api_get_path(SYS_ARCHIVE_PATH).'temp/';
 	$_cid = true;
 	$is_courseAdmin = true;
@@ -19,17 +19,16 @@ $archive_file = str_replace(array('..', '/', '\\'), '', $archive_file);
 
 list($extension) = getextension($archive_file);
 
-
 if (empty($extension) || !file_exists($archive_path.$archive_file)) {
 	exit();
 }
 
+$extension = strtolower($extension);
 $content_type = '';
 
-if (in_array(strtolower($extension), array('xml','csv')) && (api_is_platform_admin(true) || api_is_drh())) {
+if (in_array($extension, array('xml', 'csv')) && (api_is_platform_admin(true) || api_is_drh())) {
 	$content_type = 'application/force-download';
-}
-elseif (strtolower($extension) == 'zip' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin)) {
+} elseif ($extension == 'zip' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin)) {
 	$content_type = 'application/force-download';
 }
 
@@ -37,7 +36,6 @@ if (empty($content_type)) {
 	api_not_allowed(true);
 }
 
-
 header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');
 header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
 header('Cache-Control: public');

+ 123 - 129
main/course_info/infocours.php

@@ -1,57 +1,58 @@
 <?php
 /* For licensing terms, see /license.txt */
+
 /**
-*	Code to display the course settings form (for the course admin)
-*	and activate the changes.
-*
-*	See ./inc/conf/course_info.conf.php for settings
-* @todo: Move $canBeEmpty from course_info.conf.php to config-settings
-* @todo: Take those config settings into account in this script
-* @author Patrick Cool <patrick.cool@UGent.be>
-* @author Roan Embrechts, refactoring
-* and improved course visibility|subscribe|unsubscribe options
-* @package chamilo.course_info
-*/
-/*	   INIT SECTION 	*/
-// name of the language file that needs to be included
-$language_file = array ('create_course', 'course_info');
+ *	Code to display the course settings form (for the course admin)
+ *	and activate the changes.
+ *
+ *	See ./inc/conf/course_info.conf.php for settings
+ * @todo: Move $canBeEmpty from course_info.conf.php to config-settings
+ * @todo: Take those config settings into account in this script
+ * @author Patrick Cool <patrick.cool@UGent.be>
+ * @author Roan Embrechts, refactoring
+ * and improved course visibility|subscribe|unsubscribe options
+ * @package chamilo.course_info
+ */
+
+/*	   INIT SECTION */
+
+// Language files that need to be included
+$language_file = array('create_course', 'course_info');
 require_once '../inc/global.inc.php';
 $this_section = SECTION_COURSES;
 
-$nameTools = get_lang("ModifInfo");
+$nameTools = get_lang('ModifInfo');
 
-/*	Libraries	*/
+/*	Libraries */
 require_once api_get_path(LIBRARY_PATH).'course.lib.php';
-require_once api_get_path(INCLUDE_PATH)."conf/course_info.conf.php";
-require_once api_get_path(INCLUDE_PATH)."lib/debug.lib.inc.php";
+require_once api_get_path(INCLUDE_PATH).'conf/course_info.conf.php';
+require_once api_get_path(INCLUDE_PATH).'lib/debug.lib.inc.php';
 require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
-/*	Constants and variables	*/
-define("MODULE_HELP_NAME", "Settings");
-define("COURSE_CHANGE_PROPERTIES", "COURSE_CHANGE_PROPERTIES");
+
+/*	Constants and variables */
+define('MODULE_HELP_NAME', 'Settings');
+define('COURSE_CHANGE_PROPERTIES', 'COURSE_CHANGE_PROPERTIES');
 $TABLECOURSE 				= Database :: get_main_table(TABLE_MAIN_COURSE);
 $TABLEFACULTY 				= Database :: get_main_table(TABLE_MAIN_CATEGORY);
 $TABLECOURSEHOME 			= Database :: get_course_table(TABLE_TOOL_LIST);
 $TABLELANGUAGES 			= Database :: get_main_table(TABLE_MAIN_LANGUAGE);
 $TABLEBBCONFIG 				= Database :: get_course_table(TOOL_FORUM_CONFIG_TABLE);
 $currentCourseID 			= $_course['sysCode'];
-$currentCourseRepository 	= $_course["path"];
+$currentCourseRepository 	= $_course['path'];
 $is_allowedToEdit 			= $is_courseAdmin || $is_platformAdmin;
 $course_setting_table 		= Database::get_course_table(TABLE_COURSE_SETTING);
 
-/*		LOGIC FUNCTIONS		*/
-function is_settings_editable()
-{
-	return $GLOBALS["course_info_is_editable"];
-}
-$course_code = $_course["sysCode"];
+$course_code = $_course['sysCode'];
 $course_access_settings = CourseManager :: get_access_settings($course_code);
 
-/*
-		MAIN CODE
-*/
+/*		LOGIC FUNCTIONS */
+function is_settings_editable() {
+	return $GLOBALS['course_info_is_editable'];
+}
+
+/*		MAIN CODE */
 
-if (!$is_allowedToEdit)
-{
+if (!$is_allowedToEdit) {
 	api_not_allowed(true);
 }
 
@@ -65,17 +66,17 @@ $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
 $sql = "SELECT code,name FROM ".$table_course_category." WHERE auth_course_child ='TRUE'  OR code = '".Database::escape_string($_course['categoryCode'])."'  ORDER BY tree_pos";
 $res = Database::query($sql);
 
-$s_select_course_tutor_name="SELECT tutor_name FROM $tbl_course WHERE code='$course_code'";
-$q_tutor=Database::query($s_select_course_tutor_name);
-$s_tutor=Database::result($q_tutor,0,"tutor_name");
+$s_select_course_tutor_name = "SELECT tutor_name FROM $tbl_course WHERE code='$course_code'";
+$q_tutor = Database::query($s_select_course_tutor_name);
+$s_tutor = Database::result($q_tutor, 0, 'tutor_name');
 
-$s_sql_course_titular="SELECT DISTINCT username, lastname, firstname FROM $tbl_user as user, $tbl_course_user as course_rel_user WHERE (course_rel_user.status='1') AND user.user_id=course_rel_user.user_id AND course_code='".$course_code."'";
-$q_result_titulars=Database::query($s_sql_course_titular);
+$s_sql_course_titular = "SELECT DISTINCT username, lastname, firstname FROM $tbl_user as user, $tbl_course_user as course_rel_user WHERE (course_rel_user.status='1') AND user.user_id=course_rel_user.user_id AND course_code='".$course_code."'";
+$q_result_titulars = Database::query($s_sql_course_titular);
 
 $target_name = api_sort_by_first_name() ? 'firstname' : 'lastname';
-if(Database::num_rows($q_result_titulars)==0){
-	$sql="SELECT username, lastname, firstname FROM $tbl_user as user, $tbl_admin as admin WHERE admin.user_id=user.user_id ORDER BY ".$target_name." ASC";
-	$q_result_titulars=Database::query($sql);
+if (Database::num_rows($q_result_titulars) == 0) {
+	$sql = "SELECT username, lastname, firstname FROM $tbl_user as user, $tbl_admin as admin WHERE admin.user_id=user.user_id ORDER BY ".$target_name." ASC";
+	$q_result_titulars = Database::query($sql);
 }
 
 $a_profs[0] = '-- '.get_lang('NoManager').' --';
@@ -94,8 +95,7 @@ while ($a_titulars = Database::fetch_array($q_result_titulars)) {
 	$a_profs[api_get_person_name($s_firstname, $s_lastname)] = api_get_person_name($s_lastname, $s_firstname).' ('.$s_username.')';
 }
 
-while ($cat = Database::fetch_array($res))
-{
+while ($cat = Database::fetch_array($res)) {
 	$categories[$cat['code']] = '('.$cat['code'].') '.$cat['name'];
 	ksort($categories);
 }
@@ -107,26 +107,26 @@ $linebreak = '<div class="row"><div class="label"></div><div class="formw" style
 $form = new FormValidator('update_course');
 
 // COURSE SETTINGS
-$form->addElement('html','<div class="sectiontitle"><a href="#header" style="float:right;">'.Display::return_icon('top.gif',get_lang('Top')).'</a><a name="coursesettings" id="coursesettings"></a>'.Display::return_icon('settings.gif',get_lang('CourseSettings')).' '.get_lang('CourseSettings').'</div>');
-$visual_code=$form->addElement('text','visual_code', get_lang('Code'));
-	$visual_code->freeze();
+$form->addElement('html', '<div class="sectiontitle"><a href="#header" style="float:right;">'.Display::return_icon('top.gif', get_lang('Top')).'</a><a name="coursesettings" id="coursesettings"></a>'.Display::return_icon('settings.gif', get_lang('CourseSettings')).' '.get_lang('CourseSettings').'</div>');
+$visual_code=$form->addElement('text', 'visual_code', get_lang('Code'));
+$visual_code->freeze();
 $form->applyFilter('visual_code', 'strtoupper');
 //$form->add_textfield('tutor_name', get_lang('Professors'), true, array ('size' => '60'));
 $prof = &$form->addElement('select', 'tutor_name', get_lang('Professors'), $a_profs);
-$form->applyFilter('tutor_name','html_filter');
+$form->applyFilter('tutor_name', 'html_filter');
 
 $prof -> setSelected($s_selected_tutor);
-$form->add_textfield('title', get_lang('Title'), true, array ('size' => '60'));
-//$form->applyFilter('title','html_filter');
-$form->applyFilter('title','trim');
+$form->add_textfield('title', get_lang('Title'), true, array('size' => '60'));
+//$form->applyFilter('title', 'html_filter');
+$form->applyFilter('title', 'trim');
 
 $form->addElement('select', 'category_code', get_lang('Fac'), $categories);
-$form->add_textfield('department_name', get_lang('Department'), false, array ('size' => '60'));
-//$form->applyFilter('department_name','html_filter');
-$form->applyFilter('department_name','trim');
+$form->add_textfield('department_name', get_lang('Department'), false, array('size' => '60'));
+//$form->applyFilter('department_name', 'html_filter');
+$form->applyFilter('department_name', 'trim');
 
-$form->add_textfield('department_url', get_lang('DepartmentUrl'), false, array ('size' => '60'));
-//$form->applyFilter('department_url','html_filter');
+$form->add_textfield('department_url', get_lang('DepartmentUrl'), false, array('size' => '60'));
+//$form->applyFilter('department_url', 'html_filter');
 
 $form->addRule('tutor_name', get_lang('ThisFieldIsRequired'), 'required');
 $form->addElement('select_language', 'course_language', get_lang('Ln'));
@@ -136,43 +136,42 @@ $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class=
 
 
 // COURSE ACCESS
-$form->addElement('html','<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif',get_lang('Top')).'</a><a name="coursesaccess" id="coursesaccess"></a>'.Display::return_icon('course.gif',get_lang('CourseAccess')).' '.get_lang('CourseAccess').'</div>');
+$form->addElement('html', '<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif', get_lang('Top')).'</a><a name="coursesaccess" id="coursesaccess"></a>'.Display::return_icon('course.gif', get_lang('CourseAccess')).' '.get_lang('CourseAccess').'</div>');
 $form->addElement('radio', 'visibility', get_lang("CourseAccess"), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
 $form->addElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
 $form->addElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
 $form->addElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED);
 $form->addElement('static', null, null, get_lang("CourseAccessConfigTip"));
-$form -> addElement('html',$linebreak);
+$form -> addElement('html', $linebreak);
 
 $form->addElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
 $form->addElement('radio', 'subscribe', null, get_lang('Denied'), 0);
-$form -> addElement('html',$linebreak);
+$form -> addElement('html', $linebreak);
 
 $form->addElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
 $form->addElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
-$form -> addElement('html',$linebreak);
+$form -> addElement('html', $linebreak);
 
-$form->add_textfield('course_registration_password', get_lang('CourseRegistrationPassword'), false, array ('size' => '60'));
+$form->add_textfield('course_registration_password', get_lang('CourseRegistrationPassword'), false, array('size' => '60'));
 
 $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
 
 
-
 // EMAIL NOTIFICATIONS
-$form->addElement('html','<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif',get_lang('Top')).'</a><a name="emailnotifications" id="emailnotifications"></a>'.Display::return_icon('mail.png',get_lang('EmailNotifications')).' '.get_lang('EmailNotifications').'</div>');
+$form->addElement('html', '<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif', get_lang('Top')).'</a><a name="emailnotifications" id="emailnotifications"></a>'.Display::return_icon('mail.png', get_lang('EmailNotifications')).' '.get_lang('EmailNotifications').'</div>');
 
 $form->addElement('radio', 'email_alert_to_teacher_on_new_user_in_course', get_lang('NewUserEmailAlert'), get_lang('NewUserEmailAlertEnable'), 1);
-$form->addElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null,get_lang('NewUserEmailAlertToTeacharAndTutor'),2);
+$form->addElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null, get_lang('NewUserEmailAlertToTeacharAndTutor'), 2);
 $form->addElement('radio', 'email_alert_to_teacher_on_new_user_in_course', null, get_lang('NewUserEmailAlertDisable'), 0);
-$form -> addElement('html',$linebreak);
+$form -> addElement('html', $linebreak);
 
 $form->addElement('radio', 'email_alert_manager_on_new_doc', get_lang('WorkEmailAlert'), get_lang('WorkEmailAlertActivate'), 1);
 $form->addElement('radio', 'email_alert_manager_on_new_doc', null, get_lang('WorkEmailAlertDeactivate'), 0);
-$form -> addElement('html',$linebreak);
+$form -> addElement('html', $linebreak);
 
 $form->addElement('radio', 'email_alert_on_new_doc_dropbox', get_lang('DropboxEmailAlert'), get_lang('DropboxEmailAlertActivate'), 1);
 $form->addElement('radio', 'email_alert_on_new_doc_dropbox', null, get_lang('DropboxEmailAlertDeactivate'), 0);
-$form -> addElement('html',$linebreak);
+$form -> addElement('html', $linebreak);
 
 $form->addElement('radio', 'email_alert_manager_on_new_quiz', get_lang('QuizEmailAlert'), get_lang('QuizEmailAlertActivate'), 1);
 $form->addElement('radio', 'email_alert_manager_on_new_quiz', null, get_lang('QuizEmailAlertDeactivate'), 0);
@@ -182,18 +181,18 @@ $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class=
 
 
 // USER RIGHTS
-$form->addElement('html','<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif',get_lang('Top')).'</a><a name="userrights" id="userrights"></a>'.Display::return_icon('members.gif',get_lang('UserRights')).' '.get_lang('UserRights').'</div>');
+$form->addElement('html', '<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif', get_lang('Top')).'</a><a name="userrights" id="userrights"></a>'.Display::return_icon('members.gif', get_lang('UserRights')).' '.get_lang('UserRights').'</div>');
 $form->addElement('radio', 'allow_user_edit_agenda', get_lang('AllowUserEditAgenda'), get_lang('AllowUserEditAgendaActivate'), 1);
 $form->addElement('radio', 'allow_user_edit_agenda', null, get_lang('AllowUserEditAgendaDeactivate'), 0);
-$form -> addElement('html',$linebreak);
+$form -> addElement('html', $linebreak);
 
 $form->addElement('radio', 'allow_user_edit_announcement', get_lang('AllowUserEditAnnouncement'), get_lang('AllowUserEditAnnouncementActivate'), 1);
 $form->addElement('radio', 'allow_user_edit_announcement', null, get_lang('AllowUserEditAnnouncementDeactivate'), 0);
-$form -> addElement('html',$linebreak);
+$form -> addElement('html', $linebreak);
 
 $form->addElement('radio', 'allow_user_image_forum', get_lang('AllowUserImageForum'), get_lang('AllowUserImageForumActivate'), 1);
 $form->addElement('radio', 'allow_user_image_forum', null, get_lang('AllowUserImageForumDeactivate'), 0);
-$form -> addElement('html',$linebreak);
+$form -> addElement('html', $linebreak);
 
 $form->addElement('radio', 'allow_user_view_user_list', get_lang('AllowUserViewUserList'), get_lang('AllowUserViewUserListActivate'), 1);
 $form->addElement('radio', 'allow_user_view_user_list', null, get_lang('AllowUserViewUserListDeactivate'), 0);
@@ -202,7 +201,7 @@ $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class=
 
 
 // CHAT SETTINGS
-$form->addElement('html','<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif',get_lang('Top')).'</a><a name="chatsettings" id="chatsettings"></a>'.Display::return_icon('chat.gif',get_lang('ConfigChat')).' '.get_lang('ConfigChat').'</div>');
+$form->addElement('html', '<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif', get_lang('Top')).'</a><a name="chatsettings" id="chatsettings"></a>'.Display::return_icon('chat.gif', get_lang('ConfigChat')).' '.get_lang('ConfigChat').'</div>');
 $form->addElement('radio', 'allow_open_chat_window', get_lang('AllowOpenchatWindow'), get_lang('AllowOpenChatWindowActivate'), 1);
 $form->addElement('radio', 'allow_open_chat_window', null, get_lang('AllowOpenChatWindowDeactivate'), 0);
 
@@ -211,22 +210,22 @@ $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class=
 
 // COURSE THEME PICKER
 if (api_get_setting('allow_course_theme') == 'true') {
-	$form->addElement('html','<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif',get_lang('Top')).'</a><a name="theme" id="theme"></a>'.Display::return_icon('theme.gif',get_lang('Theming')).' '.get_lang('Theming').'</div><div style="clear:both;"></div>');
+	$form->addElement('html','<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif', get_lang('Top')).'</a><a name="theme" id="theme"></a>'.Display::return_icon('theme.gif', get_lang('Theming')).' '.get_lang('Theming').'</div><div style="clear:both;"></div>');
 
-	//Allow Learning path
+	// Allow Learning path
 	$form->addElement('radio', 'allow_learning_path_theme', get_lang('AllowLearningPathTheme'), get_lang('AllowLearningPathThemeAllow'), 1);
 	$form->addElement('radio', 'allow_learning_path_theme', null, get_lang('AllowLearningPathThemeDisallow'), 0);
-	$form -> addElement('html',$linebreak);
+	$form -> addElement('html', $linebreak);
 
 	$form->addElement('select_theme', 'course_theme', get_lang('Theme'));
 	$form->applyFilter('course_theme', 'trim');
-	$form -> addElement('html',$linebreak);
+	$form -> addElement('html', $linebreak);
 }
 
 if (is_settings_editable()) {
 	$form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
 } else {
-	// is it allowed to edit the course settings?
+	// Is it allowed to edit the course settings?
 	if (!is_settings_editable())
 		$disabled_output = "disabled";
 	$form->freeze();
@@ -234,15 +233,16 @@ if (is_settings_editable()) {
 
 
 // THEMATIC SETTINGS
-$form->addElement('html','<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif',get_lang('Top')).'</a><a name="chatsettings" id="chatsettings"></a>'.Display::return_icon('attendance.gif',get_lang('ConfigChat')).' '.get_lang('ThematicAdvanceConfiguration').'</div>');
+$form->addElement('html', '<div class="sectiontitle" style="margin-top: 40px;"><a href="#header" style="float:right;">'.Display::return_icon('top.gif', get_lang('Top')).'</a><a name="chatsettings" id="chatsettings"></a>'.Display::return_icon('attendance.gif', get_lang('ConfigChat')).' '.get_lang('ThematicAdvanceConfiguration').'</div>');
 $form->addElement('radio', 'display_info_advance_inside_homecourse', get_lang('InfoAboutAdvanceInsideHomeCourse'), get_lang('DisplayAboutLastDoneAdvance'), 1);
-$form->addElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DisplayAboutNextAdvanceNotDone'), 0);
+$form->addElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DisplayAboutNextAdvanceNotDone'), 2);
+$form->addElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DoNotDisplayAnyAdvance'), 0);
 
 
 $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"');
 
 
-// get all the course information
+// Get all the course information
 $all_course_information =  CourseManager::get_course_information($_course['sysCode']);
 
 
@@ -259,29 +259,29 @@ $values['visibility'] = $_course['visibility'];
 $values['subscribe'] = $course_access_settings['subscribe'];
 $values['unsubscribe'] = $course_access_settings['unsubscribe'];
 $values['course_registration_password'] =  $all_course_information['registration_code'];
-// get send_mail_setting (auth)from table
+// Get send_mail_setting (auth)from table
 $values['email_alert_to_teacher_on_new_user_in_course'] = api_get_course_setting('email_alert_to_teacher_on_new_user_in_course');
-// get send_mail_setting (work)from table
+// Get send_mail_setting (work)from table
 $values['email_alert_manager_on_new_doc'] = api_get_course_setting('email_alert_manager_on_new_doc');
-// get send_mail_setting (dropbox) from table
+// Get send_mail_setting (dropbox) from table
 $values['email_alert_on_new_doc_dropbox'] = api_get_course_setting('email_alert_on_new_doc_dropbox');
-// get send_mail_setting (work)from table
+// Get send_mail_setting (work)from table
 $values['email_alert_manager_on_new_quiz'] = api_get_course_setting('email_alert_manager_on_new_quiz');
-// get allow_user_edit_agenda from table
+// Get allow_user_edit_agenda from table
 $values['allow_user_edit_agenda'] = api_get_course_setting('allow_user_edit_agenda');
-// get allow_user_edit_announcement from table
+// Get allow_user_edit_announcement from table
 $values['allow_user_edit_announcement'] = api_get_course_setting('allow_user_edit_announcement');
-// get allow_user_image_forum from table
+// Get allow_user_image_forum from table
 $values['allow_user_image_forum'] = api_get_course_setting('allow_user_image_forum');
-// get allow_open_chat_window from table
+// Get allow_open_chat_window from table
 $values['allow_open_chat_window'] = api_get_course_setting('allow_open_chat_window');
-// get course_theme from table
+// Get course_theme from table
 $values['course_theme'] = api_get_course_setting('course_theme');
-// get allow_learning_path_theme from table
+// Get allow_learning_path_theme from table
 $values['allow_learning_path_theme'] = api_get_course_setting('allow_learning_path_theme');
-//get allow show user list 
+//Get allow show user list
 $values['allow_user_view_user_list'] = api_get_course_setting('allow_user_view_user_list');
-//get allow show user list 
+//Get allow show user list
 $values['display_info_advance_inside_homecourse'] = api_get_course_setting('display_info_advance_inside_homecourse');
 
 
@@ -289,7 +289,7 @@ $form->setDefaults($values);
 // Validate form
 if ($form->validate() && is_settings_editable()) {
 	$update_values = $form->exportValues();
-	foreach ($update_values as $index => $value) {
+	foreach ($update_values as $index => & $value) {
 		$update_values[$index] = Database::escape_string($value);
 	}
 	$table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
@@ -308,99 +308,94 @@ if ($form->validate() && is_settings_editable()) {
 			WHERE code = '".$course_code."'";
 	Database::query($sql);
 
-	//update course_settings table - this assumes those records exist, otherwise triggers an error
+	// Update course_settings table - this assumes those records exist, otherwise triggers an error
 	$table_course_setting = Database::get_course_table(TABLE_COURSE_SETTING);
-	if($update_values['email_alert_to_teacher_on_new_user_in_course'] != $values['email_alert_to_teacher_on_new_user_in_course']){
+	if ($update_values['email_alert_to_teacher_on_new_user_in_course'] != $values['email_alert_to_teacher_on_new_user_in_course']) {
 		$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_to_teacher_on_new_user_in_course']." WHERE variable = 'email_alert_to_teacher_on_new_user_in_course' ";
 		Database::query($sql);
 	}
-	if($update_values['email_alert_manager_on_new_doc'] != $values['email_alert_manager_on_new_doc']){
+	if ($update_values['email_alert_manager_on_new_doc'] != $values['email_alert_manager_on_new_doc']) {
 		$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_manager_on_new_doc']." WHERE variable = 'email_alert_manager_on_new_doc' ";
 		Database::query($sql);
 	}
-	if($update_values['email_alert_on_new_doc_dropbox'] != $values['email_alert_on_new_doc_dropbox']){
+	if ($update_values['email_alert_on_new_doc_dropbox'] != $values['email_alert_on_new_doc_dropbox']) {
 		$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_on_new_doc_dropbox']." WHERE variable = 'email_alert_on_new_doc_dropbox' ";
 		Database::query($sql);
 	}
-	if($update_values['email_alert_manager_on_new_quiz'] != $values['email_alert_manager_on_new_quiz']){
+	if ($update_values['email_alert_manager_on_new_quiz'] != $values['email_alert_manager_on_new_quiz']) {
 		$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_manager_on_new_quiz']." WHERE variable = 'email_alert_manager_on_new_quiz' ";
 		Database::query($sql);
 	}
-	if($update_values['allow_user_edit_agenda'] != $values['allow_user_edit_agenda']){
+	if ($update_values['allow_user_edit_agenda'] != $values['allow_user_edit_agenda']) {
 		$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_user_edit_agenda']." WHERE variable = 'allow_user_edit_agenda' ";
 		Database::query($sql);
 	}
-	if($update_values['allow_user_edit_announcement'] != $values['allow_user_edit_announcement']){
+	if ($update_values['allow_user_edit_announcement'] != $values['allow_user_edit_announcement']) {
 		$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_user_edit_announcement']." WHERE variable = 'allow_user_edit_announcement' ";
 		Database::query($sql);
 	}
-	if($update_values['allow_user_image_forum'] != $values['allow_user_image_forum']){
+	if ($update_values['allow_user_image_forum'] != $values['allow_user_image_forum']) {
 		$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_user_image_forum']." WHERE variable = 'allow_user_image_forum' ";
 		Database::query($sql);
 	}
-	if($update_values['allow_open_chat_window'] != $values['allow_open_chat_window']){
+	if ($update_values['allow_open_chat_window'] != $values['allow_open_chat_window']) {
 		$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_open_chat_window']." WHERE variable = 'allow_open_chat_window' ";
 		Database::query($sql);
 	}
-	if($update_values['course_theme'] != $values['course_theme']){
+	if ($update_values['course_theme'] != $values['course_theme']) {
 		$sql = "UPDATE $table_course_setting SET value = '".$update_values['course_theme']."' WHERE variable = 'course_theme' ";
 		Database::query($sql);
 	}
-	if($update_values['allow_learningpath_theme'] != $values['allow_learning_path_theme']){
+	if ($update_values['allow_learningpath_theme'] != $values['allow_learning_path_theme']) {
 		$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_learning_path_theme']." WHERE variable = 'allow_learning_path_theme' ";
 		Database::query($sql);
 	}
-	
-	if($update_values['allow_user_view_user_list'] != $values['allow_user_view_user_list']){
+
+	if ($update_values['allow_user_view_user_list'] != $values['allow_user_view_user_list']) {
 		$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_user_view_user_list']." WHERE variable = 'allow_user_view_user_list' ";
 		Database::query($sql);
 	}
-	
-	if($update_values['display_info_advance_inside_homecourse'] != $values['display_info_advance_inside_homecourse']){
+
+	if ($update_values['display_info_advance_inside_homecourse'] != $values['display_info_advance_inside_homecourse']) {
 		$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['display_info_advance_inside_homecourse']." WHERE variable = 'display_info_advance_inside_homecourse' ";
 		Database::query($sql);
 	}
 
 	$cidReset = true;
 	$cidReq = $course_code;
-	include ('../inc/local.inc.php');
+	require '../inc/local.inc.php';
 	header('Location: infocours.php?action=show_message&amp;cidReq='.$course_code);
 	exit;
 }
-/*
------------------------------------------------------------
-	Header
------------------------------------------------------------
-*/
+
+/*	Header */
 
 Display :: display_header($nameTools, MODULE_HELP_NAME);
 
 //api_display_tool_title($nameTools);
-if (isset ($_GET['action']) && $_GET['action'] == 'show_message')
-	{
+if (isset($_GET['action']) && $_GET['action'] == 'show_message') {
 	Display :: display_normal_message(get_lang('ModifDone'));
-	}
+}
 
 // actions bar
 echo '<div class="actions">';
-echo '<a href="#coursesettings">'.Display::return_icon('settings.gif',get_lang('CourseSettings')).' '.get_lang('CourseSettings').'</a>';
-echo '<a href="#coursesaccess">'.Display::return_icon('course.gif',get_lang('CourseAccess')).' '.get_lang('CourseAccess').'</a>';
-echo '<a href="#emailnotifications">'.Display::return_icon('mail.png',get_lang('EmailNotifications')).' '.get_lang('EmailNotifications').'</a>';
-echo '<a href="#userrights">'.Display::return_icon('members.gif',get_lang('UserRights')).' '.get_lang('UserRights').'</a>';
-echo '<a href="#chatsettings">'.Display::return_icon('chat.gif',get_lang('ConfigChat')).' '.get_lang('ConfigChat').'</a>';
-if (api_get_setting('allow_course_theme') == 'true')
-{
-	echo '<a href="#theme">'.Display::return_icon('theme.gif',get_lang('Theming')).' '.get_lang('Theming').'</a>';
+echo '<a href="#coursesettings">'.Display::return_icon('settings.gif', get_lang('CourseSettings')).' '.get_lang('CourseSettings').'</a>';
+echo '<a href="#coursesaccess">'.Display::return_icon('course.gif', get_lang('CourseAccess')).' '.get_lang('CourseAccess').'</a>';
+echo '<a href="#emailnotifications">'.Display::return_icon('mail.png', get_lang('EmailNotifications')).' '.get_lang('EmailNotifications').'</a>';
+echo '<a href="#userrights">'.Display::return_icon('members.gif', get_lang('UserRights')).' '.get_lang('UserRights').'</a>';
+echo '<a href="#chatsettings">'.Display::return_icon('chat.gif', get_lang('ConfigChat')).' '.get_lang('ConfigChat').'</a>';
+if (api_get_setting('allow_course_theme') == 'true') {
+	echo '<a href="#theme">'.Display::return_icon('theme.gif', get_lang('Theming')).' '.get_lang('Theming').'</a>';
 }
 echo '</div>';
 
 // Display the form
 $form->display();
 
-//@todo this code is out dated should 
+// @todo this code is out dated should
+
+if ($showDiskQuota && $currentCourseDiskQuota != '') {
 
-	if ($showDiskQuota && $currentCourseDiskQuota != "") {
-		
 ?>
 <table>
 	<tr>
@@ -483,8 +478,7 @@ $form->display();
 </table>
 <?php
 
-	}
+}
 
 /*		FOOTER	*/
 Display::display_footer();
-?>

+ 17 - 17
main/course_info/maintenance.php

@@ -1,43 +1,43 @@
-<?php // $Id: infocours.php 14956 2008-04-20 14:21:32Z yannoo $
+<?php
 /* For licensing terms, see /license.txt */
 
 /*
  * Created on 18 October 2006 by Elixir Interactive http://www.elixir-interactive.com
  */
-// name of the language file that needs to be included
-$language_file = array ('admin','create_course', 'course_info', 'coursebackup');
+
+// Language files that need to be included
+$language_file = array('admin','create_course', 'course_info', 'coursebackup');
 
 require_once '../inc/global.inc.php';
 $this_section = SECTION_COURSES;
-$nameTools= get_lang('Maintenance');
+$nameTools = get_lang('Maintenance');
 api_block_anonymous_users();
 Display :: display_header($nameTools);
 api_display_tool_title($nameTools);
 
 ?>
 
-<div class="sectiontitle"><?php Display::display_icon('save_import.gif', get_lang("backup")); ?>&nbsp;&nbsp;<a href="../coursecopy/backup.php?<?php echo api_get_cidreq();?>"><?php echo get_lang("backup");?></a></div>
+<div class="sectiontitle"><?php Display::display_icon('save_import.gif', get_lang('backup')); ?>&nbsp;&nbsp;<a href="../coursecopy/backup.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('backup'); ?></a></div>
 <div class="sectioncomment">
 		<ul>
-		    <li><a href="../coursecopy/create_backup.php?<?php echo api_get_cidreq();?>"><?php echo get_lang('CreateBackup')  ?></a><br/>
-		    <?php echo get_lang('CreateBackupInfo') ?>
+		    <li><a href="../coursecopy/create_backup.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('CreateBackup'); ?></a><br/>
+		    <?php echo get_lang('CreateBackupInfo'); ?>
 		    </li>
-		    <li><a href="../coursecopy/import_backup.php?<?php echo api_get_cidreq();?>"><?php echo get_lang('ImportBackup')  ?></a><br/>
-		    <?php echo get_lang('ImportBackupInfo') ?>
+		    <li><a href="../coursecopy/import_backup.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('ImportBackup'); ?></a><br/>
+		    <?php echo get_lang('ImportBackupInfo'); ?>
 		    </li>
 	    </ul>
 </div>
 
-<div class="sectiontitle"><?php Display::display_icon('copy.gif', get_lang("CopyCourse")); ?>&nbsp;&nbsp;<a href="../coursecopy/copy_course.php?<?php echo api_get_cidreq();?>"><?php echo get_lang("CopyCourse");?></a></div>
-<div class="sectioncomment"><?php echo get_lang("DescriptionCopyCourse"); ?></div>
+<div class="sectiontitle"><?php Display::display_icon('copy.gif', get_lang('CopyCourse')); ?>&nbsp;&nbsp;<a href="../coursecopy/copy_course.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('CopyCourse'); ?></a></div>
+<div class="sectioncomment"><?php echo get_lang('DescriptionCopyCourse'); ?></div>
 
-<div class="sectiontitle"><?php Display::display_icon('tool_delete.gif', get_lang("recycle_course")); ?>&nbsp;&nbsp;<a href="../coursecopy/recycle_course.php?<?php echo api_get_cidreq();?>"><?php echo get_lang("recycle_course");?></a></div>
-<div class="sectioncomment"><?php echo get_lang("DescriptionRecycleCourse");?></div>
+<div class="sectiontitle"><?php Display::display_icon('tool_delete.gif', get_lang('recycle_course')); ?>&nbsp;&nbsp;<a href="../coursecopy/recycle_course.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('recycle_course'); ?></a></div>
+<div class="sectioncomment"><?php echo get_lang('DescriptionRecycleCourse'); ?></div>
 
-<div class="sectiontitle"><?php Display::display_icon('delete.gif',get_lang("DelCourse")); ?>&nbsp;&nbsp;<a href="../course_info/delete_course.php?<?php echo api_get_cidreq();?>"><?php echo get_lang("DelCourse");?></a></div>
-<div class="sectioncomment"><?php echo get_lang("DescriptionDeleteCourse");	?></div>
+<div class="sectiontitle"><?php Display::display_icon('delete.gif', get_lang('DelCourse')); ?>&nbsp;&nbsp;<a href="../course_info/delete_course.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('DelCourse'); ?></a></div>
+<div class="sectioncomment"><?php echo get_lang('DescriptionDeleteCourse');	?></div>
 
 <?php
-// footer
+// Footer
 Display::display_footer();
-?>

+ 40 - 64
main/course_info/postpone.php

@@ -1,55 +1,31 @@
-<?php  // $Id: postpone.php 10204 2006-11-26 20:46:53Z pcool $
-/*
-==============================================================================
-	Dokeos - elearning and course management software
-
-	Copyright (c) 2004 Dokeos S.A.
-	Copyright (c) 2003 Ghent University (UGent)
-	Copyright (c) 2001 Universite catholique de Louvain (UCL)
-
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
-
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
+<?php
+/* For licensing terms, see /license.txt */
 
-	See the GNU General Public License for more details.
+// TODO: Is this file needed anymore?
 
-	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
-	Mail: info@dokeos.com
-==============================================================================
-*/
 /**
-==============================================================================
-* MODIFY COURSE INFO                                          |
-* Modify course settings like:										 |
-* 1. Course title													 |
-* 2. Department													 |
-* 3. Course description URL in the university web					 |
-* Course code cannot be modified, because it gives the name for the	 |
-* course database and course web directory. Professor cannot be 		 |
-* changed either as it determines who is allowed to modify the course. |
-*
-*
-*	@author Thomas Depraetere
-*	@author Hugues Peeters
-*	@author Christophe Gesche
-*
-*	@package dokeos.course_info
-==============================================================================
-*/
-
-/*
-==============================================================================
-		INIT SECTION
-==============================================================================
-*/
-
-// name of the language file that needs to be included
-$language_file = "postpone";
-//$interbreadcrumb[]= array ("url"=>"index.php", "name"=> get_lang('Admin'));
+ * MODIFY COURSE INFO
+ * Modify course settings like:
+ * 1. Course title
+ * 2. Department
+ * 3. Course description URL in the university web
+ * Course code cannot be modified, because it gives the name for the
+ * course database and course web directory. Professor cannot be
+ * changed either as it determines who is allowed to modify the course.
+ *
+ * @author Thomas Depraetere
+ * @author Hugues Peeters
+ * @author Christophe Gesche
+ *
+ * @package chamilo.course_info
+ */
+
+/*	INIT SECTION */
+
+// Language file that needs to be included
+$language_file = 'postpone';
+
+//$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Admin'));
 $htmlHeadXtra[] = "
 <style type=\"text/css\">
 <!--
@@ -60,28 +36,29 @@ $htmlHeadXtra[] = "
 <STYLE media=\"print\" type=\"text/css\">
 TD {border-bottom: thin dashed Gray;}
 </STYLE>";
-include('../inc/global.inc.php');
-$this_section=SECTION_COURSES;
 
-include(api_get_path(LIBRARY_PATH).'debug.lib.inc.php');
-Display::display_header($nameTools,"Settings");
+require '../inc/global.inc.php';
+$this_section = SECTION_COURSES;
+
+@include api_get_path(LIBRARY_PATH).'debug.lib.inc.php';
+Display::display_header($nameTools, 'Settings');
 
-//include(api_get_path(CONFIGURATION_PATH)."postpone.conf.php");
+//include api_get_path(CONFIGURATION_PATH).'postpone.conf.php';
 
-$nameTools = get_lang('Postpone');
-$TABLECOURSE	= Database::get_main_table(TABLE_MAIN_COURSE);
-$is_allowedToEdit 			= $is_courseAdmin;
-$currentCourseID 			= $_course['sysCode'];
-$currentCourseRepository 	= $_course["path"];
+$nameTools					= get_lang('Postpone');
+$TABLECOURSE				= Database::get_main_table(TABLE_MAIN_COURSE);
+$is_allowedToEdit			= $is_courseAdmin;
+$currentCourseID			= $_course['sysCode'];
+$currentCourseRepository	= $_course['path'];
 
 
 $sqlCourseExtention 			= "SELECT last_visit, last_edit, creation_date, expiration_date FROM ".$TABLECOURSE." WHERE code = '".$_cid."'";
 $resultCourseExtention 			= Database::query($sqlCourseExtention);
 $currentCourseExtentionData 	= Database::fetch_array($resultCourseExtention);
-$currentCourseLastVisit 		= $currentCourseExtentionData["last_visit"];
-$currentCourseLastEdit			= $currentCourseExtentionData["last_edit"];
-$currentCourseCreationDate 		= $currentCourseExtentionData["creation_date"];
-$currentCourseExpirationDate	= $currentCourseExtentionData["expiration_date"];
+$currentCourseLastVisit 		= $currentCourseExtentionData['last_visit'];
+$currentCourseLastEdit			= $currentCourseExtentionData['last_edit'];
+$currentCourseCreationDate 		= $currentCourseExtentionData['creation_date'];
+$currentCourseExpirationDate	= $currentCourseExtentionData['expiration_date'];
 // HERE YOU CAN EDIT YOUR RULES TO EXTEND THE LIFE OF COURSE
 
 // $newCourseExpirationDate	= now() + $extendDelay
@@ -103,4 +80,3 @@ to give more time to a course before expiration.
 
 <?php
 Display::display_footer();
-?>

+ 217 - 0
main/course_progress/index.php

@@ -0,0 +1,217 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+/**
+* Template (front controller in MVC pattern) used for distpaching to the controllers depend on the current action  
+* @author Christian Fasanando <christian1827@gmail.com>
+* @package chamilo.course_progress
+*/
+
+// name of the language file that needs to be included
+$language_file = array ('course_description', 'pedaSuggest', 'userInfo', 'admin');
+
+// including files 
+require_once '../inc/global.inc.php';
+require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
+require_once api_get_path(LIBRARY_PATH).'thematic.lib.php';
+require_once api_get_path(LIBRARY_PATH).'app_view.php';
+//require_once 'attendance_controller.php';
+require_once 'thematic_controller.php';
+require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
+require_once api_get_path(LIBRARY_PATH).'course.lib.php';
+require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php';
+require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
+//require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php';
+
+// current section
+$this_section = SECTION_COURSES;
+
+// protect a course script
+api_protect_course_script(true);
+
+
+// defining constants
+define('ADD_THEMATIC_PLAN', 6);
+
+// get actions
+$actions = array('thematic_details', 'thematic_list', 'thematic_add', 'thematic_edit', 'thematic_delete', 'moveup', 'movedown', 
+				 'thematic_plan_list', 'thematic_plan_add', 'thematic_plan_edit', 'thematic_plan_delete', 
+				 'thematic_advance_list', 'thematic_advance_add', 'thematic_advance_edit', 'thematic_advance_delete');
+
+$action  = 'thematic_details';
+if (isset($_GET['action']) && in_array($_GET['action'],$actions)) {
+	$action = $_GET['action'];
+}
+
+if (isset($_POST['action']) && $_POST['action'] == 'thematic_delete_select') {
+	$action = 'thematic_delete_select';
+}
+
+if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true') {
+	$action = 'thematic_details';
+}
+
+if ($action == 'thematic_details' || $action == 'thematic_list') {
+	$_SESSION['thematic_control'] = $action;
+}
+
+// get thematic id
+if (isset($_GET['thematic_id'])) {
+	$thematic_id = intval($_GET['thematic_id']);
+}
+
+// get thematic plan description type
+if (isset($_GET['description_type'])) {
+	$description_type = intval($_GET['description_type']);
+}
+
+// instance thematic object for using like library here
+$thematic = new Thematic();
+
+// thematic controller object
+$thematic_controller = new ThematicController();
+
+if (!empty($thematic_id)) {
+	// thematic data by id
+	$thematic_data = $thematic->get_thematic_list($thematic_id);
+}
+
+// get default thematic plan title
+$default_thematic_plan_title = $thematic->get_default_thematic_plan_title();
+
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.js" type="text/javascript" language="javascript"></script>';
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.js" type="text/javascript" language="javascript"></script>';
+$htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.css" type="text/css" media="projection, screen">';
+$htmlHeadXtra[] = '<script language="javascript">
+		
+		function datetime_by_attendance(selected_value) {
+			$.ajax({
+				contentType: "application/x-www-form-urlencoded",
+				beforeSend: function(objeto) {},
+				type: "POST",
+				url: "'.api_get_path(WEB_AJAX_PATH).'thematic.ajax.php?a=get_datetime_by_attendance",
+				data: "attendance_id="+selected_value,
+				success: function(datos) {
+				 $("#div_datetime_attendance").html(datos);
+				}
+			});
+		}
+		
+		function update_done_thematic_advance(selected_value) {
+			$.ajax({
+				contentType: "application/x-www-form-urlencoded",
+				beforeSend: function(objeto) {},
+				type: "GET",
+				url: "'.api_get_path(WEB_AJAX_PATH).'thematic.ajax.php?a=update_done_thematic_advance&thematic_advance_id="+selected_value,
+				data: "thematic_advance_id="+selected_value,
+				success: function(datos) {
+				 $("#div_result").html(datos);
+				}
+			});
+			
+			// clean all radios
+			for (var i=0; i<$("input[@name=\'done_thematic\']").length;i++) {
+				var id_radio_thematic = $("input[@name=\'done_thematic\']").get(i).id;								
+				$("#td_"+id_radio_thematic).css({"background-color":"#FFF"});				
+			}
+			
+			// set background to previous radios 
+			for (var i=0; i<$("input[@name=\'done_thematic\']").length;i++) {
+				var id_radio_thematic = $("input[@name=\'done_thematic\']").get(i).id;								
+				$("#td_"+id_radio_thematic).css({"background-color":"#E5EDF9"});
+				if ($("input[@name=\'done_thematic\']").get(i).value == selected_value) {
+					break;
+				}
+			}		
+
+		}
+				
+		function check_per_attendance(obj) {	
+			if (obj.checked == true) {
+				document.getElementById(\'div_datetime_by_attendance\').style.display=\'block\';
+				document.getElementById(\'div_custom_datetime\').style.display=\'none\';
+			} else {
+				document.getElementById(\'div_datetime_by_attendance\').style.display=\'none\';
+				document.getElementById(\'div_custom_datetime\').style.display=\'block\';
+			}			
+		}
+
+		function check_per_custom_date(obj) {
+			if (obj.checked == true) {
+				document.getElementById(\'div_custom_datetime\').style.display=\'block\';
+				document.getElementById(\'div_datetime_by_attendance\').style.display=\'none\';
+			} else {
+				document.getElementById(\'div_custom_datetime\').style.display=\'none\';
+				document.getElementById(\'div_datetime_by_attendance\').style.display=\'block\';
+			}			
+		}
+
+		</script>';
+
+
+// interbreadcrumbs
+//$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_details'.$param_gradebook.$student_param, 'name' => get_lang('ToolAttendance'));
+//if ($action == 'attendance_add') {
+	//$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('CreateANewAttendance'));
+//}
+if ($action == 'thematic_list') {
+	$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl'));
+}
+if ($action == 'thematic_add') {
+	$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
+	$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicSection'));	
+}
+if ($action == 'thematic_edit') {
+	$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
+	$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('EditThematicSection'));	
+}
+if ($action == 'thematic_details') {
+	$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl'));	
+} 
+if ($action == 'thematic_plan_list' || $action == 'thematic_plan_delete') {	
+	$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));	
+	$interbreadcrumb[] = array ('url' => '#', 'name' => $thematic_data['title'].':'.get_lang('ThematicPlan'));	
+}
+if ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') {
+	$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
+	$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic_id, 'name' => $thematic_data['title'].':'.get_lang('ThematicPlan'));	
+	if ($description_type >= ADD_THEMATIC_PLAN) {
+		$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewBloc'));
+	} else {
+		$interbreadcrumb[] = array ('url' => '#', 'name' => $default_thematic_plan_title[$description_type]);	
+	}
+}
+if ($action == 'thematic_advance_list' || $action == 'thematic_advance_delete') {
+	$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
+	$interbreadcrumb[] = array ('url' => '#', 'name' => $thematic_data['title'].':'.get_lang('ThematicAdvance'));
+}
+if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
+	$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl'));
+	$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic_id, 'name' => $thematic_data['title'].':'.get_lang('ThematicAdvance'));
+	$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicAdvance'));
+}
+
+// distpacher actions to controller
+switch ($action) {		
+	case 'thematic_add'				:
+	case 'thematic_edit'			:
+	case 'thematic_delete'			:	
+	case 'thematic_delete_select'	:
+	case 'thematic_details'			:
+	case 'moveup'					:
+	case 'movedown'					:
+	case 'thematic_list'			:	$thematic_controller->thematic($action);
+										break;
+	case 'thematic_plan_list'		:
+	case 'thematic_plan_add'		:
+	case 'thematic_plan_edit'		:	
+	case 'thematic_plan_delete'		:	$thematic_controller->thematic_plan($action);
+										break;
+	case 'thematic_advance_list'	:
+	case 'thematic_advance_add'		:
+	case 'thematic_advance_edit'	:
+	case 'thematic_advance_delete'	:	$thematic_controller->thematic_advance($action);
+										break;
+}
+
+?>

+ 29 - 0
main/course_progress/layout.php

@@ -0,0 +1,29 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+/**
+* Layout (principal view) used for structuring other views  
+* @author Christian Fasanando <christian1827@gmail.com>
+* @package chamilo.course_progress
+*/
+
+// protect a course script
+api_protect_course_script(true);
+
+// Header
+$tool = TOOL_COURSE_PROGRESS;
+Display :: display_header('');
+
+// Introduction section
+Display::display_introduction_section($tool);
+
+// Tracking
+event_access_tool($tool);
+
+// Display
+echo $content;
+
+// Footer
+Display :: display_footer();
+
+?>

+ 36 - 42
main/attendance/thematic.php → main/course_progress/thematic.php

@@ -4,30 +4,23 @@
 /**
 * View (MVC patter) for thematic control 
 * @author Christian Fasanando <christian1827@gmail.com>
-* @package chamilo.attendance
+* @package chamilo.course_progress
 */
 
 // protect a course script
 api_protect_course_script(true);
 
-
 if (api_is_allowed_to_edit(null, true)) {
-	$param_gradebook = '';
-	if (isset($_SESSION['gradebook'])) {
-		$param_gradebook = '&gradebook='.Security::remove_XSS($_SESSION['gradebook']);
-	}
 	echo '<div class="actions" style="margin-bottom:30px">';
-	echo '<a href="index.php?'.api_get_cidreq().$param_gradebook.'&action=thematic_details">'.Display::return_icon('view_table.gif',get_lang('ThematicDetails')).' '.get_lang('ThematicDetails').'</a>';	
-	echo '<a href="index.php?'.api_get_cidreq().$param_gradebook.'&action=thematic_list">'.Display::return_icon('view_list.gif',get_lang('ThematicList')).' '.get_lang('ThematicList').'</a>';
+	echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_details">'.Display::return_icon('view_table.gif',get_lang('ThematicDetails')).' '.get_lang('ThematicDetails').'</a>';	
+	echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_list">'.Display::return_icon('view_list.gif',get_lang('ThematicList')).' '.get_lang('ThematicList').'</a>';
 	if ($action == 'thematic_list') {
-		echo '<a href="index.php?'.api_get_cidreq().$param_gradebook.'&action=thematic_add">'.Display::return_icon('introduction_add.gif',get_lang('NewThematicSection')).' '.get_lang('NewThematicSection').'</a>';
+		echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_add">'.Display::return_icon('introduction_add.gif',get_lang('NewThematicSection')).' '.get_lang('NewThematicSection').'</a>';
 	}
 	echo '</div>';
 }
 
 if ($action == 'thematic_list') {
-
-	echo '<div><strong>'.get_lang('ThematicList').'</strong></div><br />';
 	
 	$table = new SortableTable('thematic_list', array('Thematic', 'get_number_of_thematics'), array('Thematic', 'get_thematic_data'));
 	$table->set_additional_parameters($parameters);
@@ -36,7 +29,9 @@ if ($action == 'thematic_list') {
 	if (api_is_allowed_to_edit(null, true)) {
 		$table->set_header(2, get_lang('Actions'), false,array('style'=>'text-align:center;width:40%;'));
 		$table->set_form_actions(array ('thematic_delete_select' => get_lang('DeleteAllThematics')));	
-	}	
+	}
+	
+	echo '<div><strong>'.get_lang('ThematicList').'</strong></div><br />';	
 	$table->display();
 	
 } else if ($action == 'thematic_details') {
@@ -45,24 +40,24 @@ if ($action == 'thematic_list') {
 	if (!empty($thematic_id)) {
 		echo '<div><strong>'.$thematic_data[$thematic_id]['title'].': '.get_lang('Details').'</strong></div><br />';							
 	} else {
-		echo '<div><strong>'.get_lang('ThematicDetails').'</strong></div><br />';				
-	}
-	
-	// display information
-	$message = '<strong>'.get_lang('Information').'</strong><br />';
-	$message .= get_lang('ThematicDetailsDescription');	
-	Display::display_normal_message($message, false);
-	echo '<br />';
-		
-	// display progress
-	if (!empty($thematic_id)) {
-		echo '<div style="text-align:right;">'.get_lang('Progress').': <strong>'.$total_average_of_advances.'</strong>%</div><br />';
-	} else {
-		echo '<div style="text-align:right;">'.get_lang('Progress').': <strong><span id="div_result">'.$total_average_of_advances.'</span></strong>%</div><br />';
+		echo '<div><strong>'.get_lang('ThematicDetails').'</strong></div><br />';	
+		// display information
+		$message = '<strong>'.get_lang('Information').'</strong><br />';
+		$message .= get_lang('ThematicDetailsDescription');	
+		Display::display_normal_message($message, false);
+		echo '<br />';			
 	}
 	
 	// display thematic data
 	if (!empty($thematic_data)) {
+		
+		// display progress
+		if (!empty($thematic_id)) {
+			echo '<div style="text-align:right;">'.get_lang('Progress').': <strong>'.$total_average_of_advances.'</strong>%</div><br />';
+		} else {
+			echo '<div style="text-align:right;">'.get_lang('Progress').': <strong><span id="div_result">'.$total_average_of_advances.'</span></strong>%</div><br />';
+		}
+		
 		echo '<table width="100%" class="data_table">';	
 		echo '<tr><th width="35%">'.get_lang('Thematic').'</th><th width="30%">'.get_lang('ThematicPlan').'</th><th width="25%">'.get_lang('ThematicAdvance').'</th></tr>';
 	
@@ -75,7 +70,7 @@ if ($action == 'thematic_list') {
 				// display thematic plan data
 				echo '<td>';					
 					if (api_is_allowed_to_edit(null, true)) {
-						echo '<div style="text-align:right"><a href="index.php?'.api_get_cidreq().'&origin=thematic_details&action=thematic_plan_list&thematic_id='.$thematic['id'].$param_gradebook.'">'.Display::return_icon('lp_quiz.png',get_lang('EditThematicPlan'),array('style'=>'vertical-align:middle')).'</a></div><br />';
+						echo '<div style="text-align:right"><a href="index.php?'.api_get_cidreq().'&origin=thematic_details&action=thematic_plan_list&thematic_id='.$thematic['id'].'">'.Display::return_icon('lp_quiz.png',get_lang('EditThematicPlan'),array('style'=>'vertical-align:middle')).'</a></div><br />';
 					}
 					if (!empty($thematic_plan_data[$thematic['id']])) {
 						foreach ($thematic_plan_data[$thematic['id']] as $thematic_plan) {
@@ -89,15 +84,14 @@ if ($action == 'thematic_list') {
 				// display thematic advance data
 				echo '<td>';					
 					if (api_is_allowed_to_edit(null, true)) {
-						echo '<div style="text-align:right"><a href="index.php?'.api_get_cidreq().'&origin=thematic_details&action=thematic_advance_list&thematic_id='.$thematic['id'].$param_gradebook.'">'.Display::return_icon('lp_quiz.png',get_lang('EditThematicAdvance'),array('style'=>'vertical-align:middle')).'</a></div><br />';
+						echo '<div style="text-align:right"><a href="index.php?'.api_get_cidreq().'&origin=thematic_details&action=thematic_advance_list&thematic_id='.$thematic['id'].'">'.Display::return_icon('lp_quiz.png',get_lang('EditThematicAdvance'),array('style'=>'vertical-align:middle')).'</a></div><br />';
 					}					
 					echo '<table width="100%">';
-
 						if (!empty($thematic_advance_data[$thematic['id']])) {						
 							foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
 								echo '<tr>';
 								echo '<td width="90%">';
-									echo '<div><strong>'.api_get_local_time($thematic_advance['start_date']).'</strong></div>';
+									echo '<div><strong>'.api_convert_and_format_date($thematic_advance['start_date'], DATE_TIME_FORMAT_LONG, date_default_timezone_get()).'</strong></div>';
 									echo '<div>'.$thematic_advance['content'].'</div>';
 									echo '<div>'.get_lang('DurationInHours').' : '.$thematic_advance['duration'].'</div>';
 								echo '</td>';
@@ -123,17 +117,19 @@ if ($action == 'thematic_list') {
 								echo '</tr>';							 
 							}
 						} else {
-							echo '<tr><td width="90%"><div><em>'.get_lang('StillDoNotHaveAThematicAdvance').'</em></div></td><td>&nbsp;</td>';
+							echo '<tr><td width="90%"><div><em>'.get_lang('ThereIsNoAThematicAdvance').'</em></div></td><td>&nbsp;</td>';
 						}									
-					echo '</table>';
-							
+					echo '</table>';							
 				echo '</td>';				
 				echo '</tr>';				
 			}
-
 		echo '</table>';
 	} else {
-		echo '<div><em>'.get_lang('ThereIsStillAthematicSection').'</em></div>';
+		echo '<div><em>'.get_lang('ThereIsNoAThematicSection').'</em><br /><br />';
+		if (api_is_allowed_to_edit(null, true)) {
+			echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_add">'.Display::return_icon('addd.gif',get_lang('CreateAThematicSection'), array('style'=>'vertical-align:middle')).' '.get_lang('CreateAThematicSection').'</a>';
+		}
+		echo '</div>';
 	}
 	
 } else if ($action == 'thematic_add' || $action == 'thematic_edit') {
@@ -143,18 +139,13 @@ if ($action == 'thematic_list') {
 		$_SESSION['thematic_token'] = $token;
 	}
 	
-	// error messages
-	if ($error) {	
-		Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);	
-	}
-
 	$header_form = get_lang('NewThematicSection');
 	if ($action == 'thematic_edit') {
 		$header_form = get_lang('EditThematicSection');	
 	}
 	
 	// display form
-	$form = new FormValidator('thematic_add','POST','index.php?action=thematic_list&'.api_get_cidreq().$param_gradebook,'','style="width: 100%;"');
+	$form = new FormValidator('thematic_add','POST','index.php?action=thematic_list&'.api_get_cidreq(),'','style="width: 100%;"');
 	
 	$form->addElement('header', '', $header_form);	
 	$form->addElement('hidden', 'thematic_token',$token);
@@ -176,8 +167,11 @@ if ($action == 'thematic_list') {
 		$form->setDefaults($default);
 	}
 	
+	// error messages
+	if ($error) {	
+		Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);	
+	}
 	$form->display();
 		
 } 
-
 ?>

+ 25 - 28
main/attendance/thematic_advance.php → main/course_progress/thematic_advance.php

@@ -4,14 +4,12 @@
 /**
 * View (MVC patter) for thematic advance 
 * @author Christian Fasanando <christian1827@gmail.com>
-* @package chamilo.attendance
+* @package chamilo.course_progress
 */
 
 // protect a course script
 api_protect_course_script(true);
 
-
-
 if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
 
 	$header_form = get_lang('NewThematicAdvance');
@@ -19,13 +17,13 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
 		$header_form = get_lang('EditThematicAdvance');
 	}
 
-	if (!$error) {
+	if (!$start_date_error && !$duration_error) {
 		$token = md5(uniqid(rand(),TRUE));
 		$_SESSION['thematic_advance_token'] = $token;
 	}
 
 	// display form
-	$form = new FormValidator('thematic_advance','POST','index.php?action=thematic_advance_list&thematic_id='.$thematic_id.'&'.api_get_cidreq().$param_gradebook,'','style="width: 100%;"');
+	$form = new FormValidator('thematic_advance','POST','index.php?action=thematic_advance_list&thematic_id='.$thematic_id.'&'.api_get_cidreq(),'','style="width: 100%;"');
 	$form->addElement('header', '', $header_form);	
 	$form->addElement('hidden', 'thematic_advance_token',$token);
 	$form->addElement('hidden', 'action', $action);
@@ -38,7 +36,6 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
 	}
 		
 	$radios = array();
-
 	$radios[] = FormValidator::createElement('radio', 'start_date_type', null, get_lang('StartDateFromAnAttendance'),'1',array('onclick' => 'check_per_attendance(this)', 'id'=>'from_attendance'));
 	$radios[] = FormValidator::createElement('radio', 'start_date_type', null, get_lang('StartDateCustom'),'2',array('onclick' => 'check_per_custom_date(this)', 'id'=>'custom_date'));
 	$form->addGroup($radios, null, get_lang('StartDateOptions'));
@@ -61,7 +58,7 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
 	if (count($attendance_select) > 1) {	
 		$form->addElement('select', 'attendance_select', get_lang('Attendances'), $attendance_select, array('id' => 'id_attendance_select', 'onchange' => 'datetime_by_attendance(this.value)'));
 	} else {
-		$form->addElement('html', '<div class="row"><div class="label">'.get_lang('Attendances').'</div><div class="formw"><em>'.get_lang('ThereAreNoAttendancesInsideCourse').'</em></div></div>');
+		$form->addElement('html', '<div class="row"><div class="label">'.get_lang('Attendances').'</div><div class="formw"><strong><em>'.get_lang('ThereAreNoAttendancesInsideCourse').'</em></strong></div></div>');
 	}
 	
 	$form->addElement('html', '<div id="div_datetime_attendance">');
@@ -71,14 +68,15 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
 	$form->addElement('html', '</div>');
 		
 	$form->addElement('html', '</div>');
-	$hours = range(0,24);	
-	$form->addElement('select', 'duration_in_hours', get_lang('DurationInHours'), $hours);
+
+	$form->add_textfield('duration_in_hours', get_lang('DurationInHours'), false, array('size'=>'3'));
 	
 	$form->add_html_editor('content', get_lang('Content'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '150'));	
 	$form->addElement('html','<div class="clear" style="margin-top:50px;"></div>');
 	$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
 	
 	$default['start_date_type'] = 1;	
+	$default['custom_start_date'] = date('d-F-Y 00:00');
 	if (!empty($thematic_advance_data)) {
 
 		// set default values
@@ -98,42 +96,41 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') {
 	$form->setDefaults($default);
 	
 	// error messages
-	if ($error) {	
-		Display::display_error_message(get_lang('YouMustSelectAtleastAStartDate'),false);	
+	$msg_error = '';
+	if ($start_date_error) {	
+		$msg_error .= get_lang('YouMustSelectAtleastAStartDate').'<br />';		
+	}
+	if ($duration_error) {	
+		$msg_error .= get_lang('DurationInHoursMustBeNumeric');		
 	}
 	
+	if (!empty($msg_error)) {
+		Display::display_error_message($msg_error,false);	
+	}
+
 	$form->display();
 	
 } else if ($action == 'thematic_advance_list') {
 	
-	if (api_is_allowed_to_edit(null, true)) {
-		$param_gradebook = '';
-		if (isset($_SESSION['gradebook'])) {
-			$param_gradebook = '&gradebook='.Security::remove_XSS($_SESSION['gradebook']);
-		}
+	if (api_is_allowed_to_edit(null, true)) {		
 		echo '<div class="actions" style="margin-bottom:30px">';
-		echo '<a href="index.php?'.api_get_cidreq().$param_gradebook.'&action=thematic_advance_add&thematic_id='.$thematic_id.'">'.Display::return_icon('template_add.gif',get_lang('NewThematicAdvance')).' '.get_lang('NewThematicAdvance').'</a>';			
+		echo '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_add&thematic_id='.$thematic_id.'">'.Display::return_icon('template_add.gif',get_lang('NewThematicAdvance')).' '.get_lang('NewThematicAdvance').'</a>';			
 		echo '</div>';
 	}
 	
-	// thematic advance list	
-	//echo '<br /><strong>'.get_lang('ThematicAdvancesList').'</strong>';	
+	// thematic advance list		
 	$table = new SortableTable('thematic_advance_list', array('Thematic', 'get_number_of_thematic_advances'), array('Thematic', 'get_thematic_advance_data'));
 	$table->set_additional_parameters($parameters);
 	$table->set_header(0, '', false, array('style'=>'width:20px;'));
-	$table->set_header(1, get_lang('StartDate'), true );
-	$table->set_header(2, get_lang('DurationInHours'), true, array('style'=>'width:80px;'));
-	$table->set_header(3, get_lang('Content'), true);
+	$table->set_header(1, get_lang('StartDate'), false );
+	$table->set_header(2, get_lang('DurationInHours'), false, array('style'=>'width:80px;'));
+	$table->set_header(3, get_lang('Content'), false);
 	
 	if (api_is_allowed_to_edit(null, true)) {
-		$table->set_header(4, get_lang('Actions'), false,array('style'=>'text-align:center'));
-		//$table->set_form_actions(array ('thematic_advance_delete_select' => get_lang('DeleteAllThematicAdvances')));	
+		$table->set_header(4, get_lang('Actions'), false,array('style'=>'text-align:center'));	
 	}
 	
 	$table->display();	
 }
 
-
-
-
-?>
+?>

+ 32 - 27
main/attendance/thematic_controller.php → main/course_progress/thematic_controller.php

@@ -7,13 +7,13 @@
  * !!! WARNING !!! : ALL DATES IN THIS MODULE ARE STORED IN UTC ! DO NOT CONVERT DURING THE TRANSITION FROM CHAMILO 1.8.x TO 2.0
  * 
  * @author Christian Fasanando <christian1827@gmail.com>
- * @package chamilo.attendance
+ * @package chamilo.course_progress
  */
 
 /**
  * Thematic Controller script. Prepares the common background variables to give to the scripts corresponding to
  * the requested action
- * @package chamilo.attendance 
+ * @package chamilo.course_progress 
  */
 
 class ThematicController
@@ -23,7 +23,7 @@ class ThematicController
 	 * Constructor
 	 */
 	public function __construct() {		
-		$this->toolname = 'attendance';
+		$this->toolname = 'course_progress';
 		$this->view = new View($this->toolname);			
 	}
 	
@@ -126,7 +126,7 @@ class ThematicController
 	}
 	
 	/**
-	 * This method is used for thematic plant control (update, insert or listing)
+	 * This method is used for thematic plan control (update, insert or listing)
 	 * @param 	string	Action
 	 * render to thematic_plan.php 
 	 */	
@@ -135,7 +135,7 @@ class ThematicController
 		$data = array();
 		$error = false;
 		
-		if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {	    		
+		if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {   		
     		if (isset($_POST['action']) && ($_POST['action'] == 'thematic_plan_add' || $_POST['action'] == 'thematic_plan_edit')) {	    			
     			if (!empty($_POST['title'])) {
     				if ($_POST['thematic_plan_token'] == $_SESSION['thematic_plan_token']) {						    						    				    			
@@ -206,6 +206,11 @@ class ThematicController
 		$this->view->render();
 	}
 	
+	/**
+	 * This method is used for thematic advance control (update, insert or listing)
+	 * @param 	string	Action
+	 * render to thematic_advance.php 
+	 */	
 	public function thematic_advance($action) {
 		
 		$thematic= new Thematic();	
@@ -222,54 +227,54 @@ class ThematicController
 
 		if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {				
 			if (isset($_POST['action']) && ($_POST['action'] == 'thematic_advance_add' || $_POST['action'] == 'thematic_advance_edit')) {
-
-	    		if ($_POST['start_date_type'] == 1 && empty($_POST['start_date_by_attendance'])) {
+	    		if (($_POST['start_date_type'] == 1 && empty($_POST['start_date_by_attendance'])) || (!empty($_POST['duration_in_hours']) && !is_numeric($_POST['duration_in_hours'])) ) {	    			
 	    			
-	    			$error = true;
-					$data['error'] = $error;	
+	    			if ($_POST['start_date_type'] == 1 && empty($_POST['start_date_by_attendance'])) {
+	    				$start_date_error = true;
+						$data['start_date_error'] = $start_date_error;	
+	    			} 
+	    			
+	    			if (!empty($_POST['duration_in_hours']) && !is_numeric($_POST['duration_in_hours'])) {
+	    				$duration_error = true;
+						$data['duration_error'] = $duration_error;	
+	    			}
+
 					$data['action'] = $_POST['action'];	
 					$data['thematic_id'] = $_POST['thematic_id'];				
-					$data['attendance_select'] = $attendance_select;
-					
+					$data['attendance_select'] = $attendance_select;					
 					if (isset($_POST['thematic_advance_id'])) {
 						$data['thematic_advance_id'] = $_POST['thematic_advance_id'];
 						$thematic_advance_data = $thematic->get_thematic_advance_list($_POST['thematic_advance_id']);
 						$data['thematic_advance_data'] = $thematic_advance_data;		
 					}	
-
 					// render to the view
 					$this->view->set_data($data);
 					$this->view->set_layout('layout'); 
 					$this->view->set_template('thematic_advance');		       
-					$this->view->render();
-					
-	    			
+					$this->view->render();	    			
 	    		} else {	
 		    		if ($_POST['thematic_advance_token'] == $_SESSION['thematic_advance_token']) {						    						    			
-	
 		    			$thematic_advance_id = $_POST['thematic_advance_id'];
 		    			$thematic_id 	= $_POST['thematic_id'];	    			
-		    			$content 		= $_POST['content'];
-		    			
+		    			$content 		= $_POST['content'];		    			
+		    			$duration		= $_POST['duration_in_hours'];
 		    			if (isset($_POST['start_date_type']) && $_POST['start_date_type'] == 2) {
 		    				$start_date 	= $thematic->build_datetime_from_array($_POST['custom_start_date']);
 		    				$attendance_id 	= 0;	
 		    			} else {
 		    				$start_date 	= $_POST['start_date_by_attendance'];
 		    				$attendance_id 	= $_POST['attendance_select'];
-		    			}
-	
-		    			$duration		= $_POST['duration_in_hours'];
+		    			}		    			
 		    			$thematic->set_thematic_advance_attributes($thematic_advance_id, $thematic_id,  $attendance_id, $content, $start_date, $duration);	    				    								
-						$affected_rows = $thematic->thematic_advance_save();				    			
-			        	
+						$affected_rows = $thematic->thematic_advance_save();			        	
 			        	if ($affected_rows) {
 			        		// get last done thematic advance before move thematic list
 							$last_done_thematic_advance = $thematic->get_last_done_thematic_advance();
 							// update done advances with de current thematic list
-							$update_done_advances = $thematic->update_done_thematic_advances($last_done_thematic_advance);
-			        	}
-			        	
+							if (!empty($last_done_thematic_advance)) {
+								$update_done_advances = $thematic->update_done_thematic_advances($last_done_thematic_advance);
+							}
+			        	}			        	
 						unset($_SESSION['thematic_advance_token']);	        
 			        	$action = 'thematic_advance_list';		
 		    		}
@@ -319,4 +324,4 @@ class ThematicController
 	
 }
 
-?>
+?>

+ 9 - 11
main/attendance/thematic_plan.php → main/course_progress/thematic_plan.php

@@ -4,7 +4,7 @@
 /**
 * View (MVC patter) for thematic plan 
 * @author Christian Fasanando <christian1827@gmail.com>
-* @package chamilo.attendance
+* @package chamilo.course_progress
 */
 
 // actions menu
@@ -57,18 +57,12 @@ if ($action == 'thematic_plan_list') {
 		$header_form = get_lang('NewBloc');
 	} else {
 		$header_form = $default_thematic_plan_title[$description_type];		
-	}
-	
+	}	
 	if (!$error) {
 		$token = md5(uniqid(rand(),TRUE));
 		$_SESSION['thematic_plan_token'] = $token;
 	}
-	
-	// error messages
-	if ($error) { 	
-		Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);	
-	}
-	
+
 	// display form
 	$form = new FormValidator('thematic_plan_add','POST','index.php?action=thematic_plan_list&thematic_id='.$thematic_id.'&'.api_get_cidreq().$param_gradebook,'','style="width: 100%;"');
 	$form->addElement('header', '', $header_form);
@@ -102,9 +96,13 @@ if ($action == 'thematic_plan_list') {
 		$message .= $default_thematic_plan_question[$description_type];
 		Display::display_normal_message($message, false);
 	}
+
+	// error messages
+	if ($error) { 	
+		Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);	
+	}
 	
 	$form->display();		
 }
 
-
-?>
+?>

+ 2 - 1
main/gradebook/lib/fe/displaygradebook.php

@@ -57,7 +57,8 @@ class DisplayGradebook
 		if (!$evalobj->has_results())
 			$evalinfo .= '<br /><i>' . get_lang('NoResultsInEvaluation') . '</i>';
 		elseif ($scoredisplay->is_custom() && api_get_self() != '/dokeos/main/gradebook/gradebook_statistics.php')
-			$evalinfo .= '<br /><br /><a href="gradebook_statistics.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '. get_lang('ViewStatistics') . '</a>';
+		$evalinfo .= '<br /><br /><a href="gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '.Display::return_icon(('gradebook_eval_not_empty.gif'),get_lang('ViewResult')) . '</a>';
+		$evalinfo .= '<a href="gradebook_statistics.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '.Display::return_icon(('statistics.gif'),get_lang('ViewStatistics')) . '</a>';
 		$evalinfo .= '</td><td><img style="float:right; position:relative;" src="../img/tutorial.gif"></img></td></table>';
 		Display :: display_normal_message($evalinfo,false);
 		echo $header;

+ 5 - 5
main/gradebook/lib/fe/exportgradebook.php

@@ -11,10 +11,10 @@ function print_table ($data_array,$header_names,$view,$coursename) {
 	$printdata= '<!DOCTYPE html
      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.api_get_language_isocode().'" lang="'.api_get_language_isocode().'">
 <head>
 <title>'.get_lang('Print').'</title>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta http-equiv="Content-Type" content="text/html; charset='.api_get_system_encoding().'" />
 
 
 <style type="text/css">
@@ -58,8 +58,8 @@ a:active {text-decoration: none; font-weight : bold;  color : black;}
 }
 </style>
 </head>
-<body><div id="main">';
-	
+<body dir="'.api_get_text_direction().'"><div id="main">';
+
 	$printdata .= '<h2>'.$view.' : '.$coursename.'</h2>';
 	//@todo not necessary here
 	//$printdata .= '<h3>'.get_lang('Date').' : '.api_convert_and_format_date(null, DATE_FORMAT_SHORT). ' ' . api_convert_and_format_date(null, TIME_NO_SEC_FORMAT).'</h3>';
@@ -67,7 +67,7 @@ a:active {text-decoration: none; font-weight : bold;  color : black;}
 	foreach ($header_names as $header) {
 		$printdata .= '<th>'.$header.'</th>';
 	}
-	
+
 	foreach ($data_array as $data) {
 		$printdata .= '<tr>';
 		foreach ($data as $rowdata) {

+ 30 - 51
main/help/allowed_html_tags.php

@@ -1,90 +1,69 @@
 <?php
-/*
-==============================================================================
-	Dokeos - elearning and course management software
+/* For licensing terms, see /license.txt */
 
-	Copyright (c) 2004-2005 Dokeos S.A.
-	Copyright (c) Bart Mollet, Hogeschool Gent
-
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
+/**
+ *	This	 script displays a help window with an overview of the allowed HTML-
+ *   tags  and their attributes.
+ *
+ *	@package chamilo.help
+ */
 
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
+// Language file that needs to be included
+$language_file = 'help';
 
-	See the GNU General Public License for more details.
+require '../inc/global.inc.php';
+require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
+require_once api_get_path(LIBRARY_PATH).'formvalidator/Rule/HTML.php';
 
-	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
-	Mail: info@dokeos.com
-==============================================================================
-*/
-/**
-==============================================================================
-*	This	 script displays a help window with an overview of the allowed HTML-
-*   tags  and their attributes.
-*
-*	@package dokeos.help
-==============================================================================
-*/
-// name of the language file that needs to be included
-$language_file = 'help';
-include ('../inc/global.inc.php');
-require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
-require_once (api_get_path(LIBRARY_PATH).'formvalidator/Rule/HTML.php');
-$language_code = api_get_language_isocode($language_interface);
-header('Content-Type: text/html; charset='.$charset);
+header('Content-Type: text/html; charset='.api_get_system_encoding());
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $language_code; ?>" lang="<?php echo $language_code; ?>">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo api_get_language_isocode(); ?>" lang="<?php echo api_get_language_isocode(); ?>">
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
+<meta http-equiv="Content-Type" content="text/html; charset=<?php echo api_get_system_encoding(); ?>" />
 <title>
 <?php echo get_lang('AllowedHTMLTags'); ?>
 </title>
 <style type="text/css" media="screen, projection">
 /*<![CDATA[*/
-@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/public_admin/default.css";
+@import "<?php echo api_get_path(WEB_CSS_PATH); ?>chamilo/default.css";
 /*]]>*/
 </style>
 <?php
-if(api_get_setting('stylesheets')<>'')
-{
-	?>
+if (api_get_setting('stylesheets') != '') {
+?>
 	<style type="text/css" media="screen, projection">
 	/*<![CDATA[*/
-	@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo api_get_setting('stylesheets');?>/default.css";
+	@import "<?php echo api_get_path(WEB_CSS_PATH), api_get_setting('stylesheets'); ?>/default.css";
 	/*]]>*/
 	</style>
-	<?php
+<?php
 }
 ?>
 </head>
-<body>
+<body dir="<?php echo api_get_text_direction(); ?>">
 <div style="margin:10px;">
-<div style="text-align:right;"><a href="javascript:window.close();"><?php echo get_lang('Close'); ?></a></div>
+<div style="text-align:right;"><a href="javascript: window.close();"><?php echo get_lang('Close'); ?></a></div>
 <h4>
 <?php echo get_lang('AllowedHTMLTags'); ?>
 </h4>
 <?php
 $html_type = $_SESSION['status'] == COURSEMANAGER ? TEACHER_HTML : STUDENT_HTML;
 
-$fullpage = intval($_GET['fullpage']) == '0' ? false : true;
-$tags = HTML_QuickForm_Rule_HTML :: get_allowed_tags($html_type,$fullpage);
+$fullpage = intval($_GET['fullpage']) != 0;
+$tags = HTML_QuickForm_Rule_HTML :: get_allowed_tags($html_type, $fullpage);
 $table_header = array();
-$table_header[]= array('tag',true);
-$table_header[]= array('attributes',false);
-foreach ($tags as $tag => $attributes)
-{
+$table_header[] = array('tag', true);
+$table_header[] = array('attributes', false);
+foreach ($tags as $tag => & $attributes) {
 	$row = array();
 	$row[] = '<kbd>'.$tag.'</kbd>';
-	$row[] = '<kbd>&nbsp;'.implode(', ',array_keys($attributes)).'</kbd>';
+	$row[] = '<kbd>&nbsp;'.implode(', ', array_keys($attributes)).'</kbd>';
 	$table_data[] = $row;
 }
-Display::display_sortable_table($table_header,$table_data,array(),array(),array('fullpage'=>intval($_GET['fullpage'])));
+Display::display_sortable_table($table_header, $table_data, array(), array(), array('fullpage' => intval($_GET['fullpage'])));
 ?>
-<div style="text-align:right;"><a href="javascript:window.close();"><?php echo get_lang('Close'); ?></a></div>
+<div style="text-align:right;"><a href="javascript: window.close();"><?php echo get_lang('Close'); ?></a></div>
 </div>
 </body>
 </html>

+ 39 - 68
main/help/faq.php

@@ -1,117 +1,88 @@
 <?php
-/*
-==============================================================================
-	Dokeos - elearning and course management software
+/* For licensing terms, see /license.txt */
 
-	Copyright (c) 2004-2008 Dokeos SPRL
-	Copyright (c) 2003-2005 Ghent University (UGent)
-	Copyright (c) 2001 Universite catholique de Louvain (UCL)
-
-	Copyright (c) Sally "Example" Programmer (sally@somewhere.net)
+/**
+ *	This script displays a help window.
+ *
+ *	@package chamilo.help
+ */
 
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
+// Language file that needs to be included
+$language_file = 'help';
 
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
+require '../inc/global.inc.php';
+include_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
 
-	See the GNU General Public License for more details.
+$help_name = Security::remove_XSS($_GET['open']);
 
-	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
-	Mail: info@dokeos.com
-==============================================================================
-*/
-/**
-==============================================================================
-*	This script displays a help window.
-*
-*	@package dokeos.help
-==============================================================================
-*/
-// name of the language file that needs to be included
-$language_file='help';
-$helpName=$_GET['open'];
-include('../inc/global.inc.php');
-include_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
-$language_code = api_get_language_isocode($language_interface);
-header('Content-Type: text/html; charset='. $charset);
+header('Content-Type: text/html; charset='. api_get_system_encoding());
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $language_code; ?>" lang="<?php echo $language_code; ?>">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo api_get_language_isocode(); ?>" lang="<?php echo api_get_language_isocode(); ?>">
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
+<meta http-equiv="Content-Type" content="text/html; charset=<?php echo api_get_system_encoding(); ?>" />
 <title>
-<?php echo get_lang('H'.$helpName); ?>
+<?php echo get_lang('H'.$help_name); ?>
 </title>
 <style type="text/css" media="screen, projection">
 /*<![CDATA[*/
-@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/public_admin/default.css";
+@import "<?php echo api_get_path(WEB_CSS_PATH); ?>chamilo/default.css";
 /*]]>*/
 </style>
 <?php
-if(api_get_setting('stylesheets')<>'')
-{
-	?>
+if (api_get_setting('stylesheets') != '') {
+?>
 	<style type="text/css" media="screen, projection">
 	/*<![CDATA[*/
-	@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo api_get_setting('stylesheets');?>/default.css";
+	@import "<?php echo api_get_path(WEB_CSS_PATH), api_get_setting('stylesheets'); ?>/default.css";
 	/*]]>*/
 	</style>
-	<?php
+<?php
 }
 ?>
 </head>
-<body>
+<body dir="<?php echo api_get_text_direction(); ?>">
 <div style="margin:10px;">
-<div style="text-align:right;"><a href="javascript:window.close();"><?php echo get_lang('Close'); ?></a></div>
+<div style="text-align:right;"><a href="javascript: window.close();"><?php echo get_lang('Close'); ?></a></div>
 <h4>
 <?php
 echo get_lang('Faq');
 
-
-if(api_is_platform_admin())
-{
+if (api_is_platform_admin()) {
 	echo '&nbsp;<a href="faq.php?edit=true"><img src="'.api_get_path(WEB_IMG_PATH).'edit.gif" /></a>';
 }
 ?>
 </h4>
 <?php
 $faq_file = 'faq.html';
-if(!empty($_GET['edit']) && $_GET['edit']=='true' && api_is_platform_admin())
-{
-	$form = new FormValidator('set_faq','post','faq.php?edit=true');
+if (!empty($_GET['edit']) && $_GET['edit'] == 'true' && api_is_platform_admin()) {
+	$form = new FormValidator('set_faq', 'post', 'faq.php?edit=true');
 	$form -> add_html_editor('faq_content', null, false, false, array('ToolbarSet' => 'FAQ', 'Width' => '100%', 'Height' => '300'));
-	$form -> addElement('submit','faq_submit', get_lang('Ok'));
-	$form -> setDefaults(array('faq_content'=>file_get_contents(api_get_path(SYS_PATH).'home/faq.html')));
-	if($form -> validate())
-	{
+	$form -> addElement('submit', 'faq_submit', get_lang('Ok'));
+	$faq_content = @(string)file_get_contents(api_get_path(SYS_PATH).'home/faq.html');
+	$faq_content = api_to_system_encoding($faq_content, api_detect_encoding(strip_tags($faq_content)));
+	$form -> setDefaults(array('faq_content' => $faq_content));
+	if ($form -> validate()) {
 		$content = $form -> getSubmitValue('faq_content');
 		$fpath = api_get_path(SYS_PATH).'home/'.$faq_file;
-		if(is_file($fpath) && is_writeable($fpath))
-		{
-			$fp = fopen(api_get_path(SYS_PATH).'home/'.$faq_file,'w');
+		if (is_file($fpath) && is_writeable($fpath)) {
+			$fp = fopen(api_get_path(SYS_PATH).'home/'.$faq_file, 'w');
 			fwrite($fp, $content);
 			fclose($fp);
-		}
-		else
-		{
+		} else {
 			echo get_lang('WarningFaqFileNonWriteable').'<br />';
 		}
 		echo $content;
-	}
-	else
-	{
+	} else {
 		$form -> display();
 	}
-}
-else
-{
-	echo file_get_contents(api_get_path(SYS_PATH).'home/'.$faq_file);
+} else {
+	$faq_content = @(string)file_get_contents(api_get_path(SYS_PATH).'home/'.$faq_file);
+	$faq_content = api_to_system_encoding($faq_content, api_detect_encoding(strip_tags($faq_content)));
+	echo $faq_content;
 }
 ?>
-<div style="text-align:right;"><a href="javascript:window.close();"><?php echo get_lang('Close'); ?></a></div>
+<div style="text-align:right;"><a href="javascript: window.close();"><?php echo get_lang('Close'); ?></a></div>
 </div>
 </body>
 </html>

+ 42 - 74
main/help/help.php

@@ -1,127 +1,95 @@
 <?php
-/*
-==============================================================================
-	Dokeos - elearning and course management software
-
-	Copyright (c) 2004-2005 Dokeos S.A.
-	Copyright (c) 2003-2005 Ghent University (UGent)
-	Copyright (c) 2001 Universite catholique de Louvain (UCL)
-
-	Copyright (c) Sally "Example" Programmer (sally@somewhere.net)
+/* For licensing terms, see /license.txt */
 
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
+/**
+ *	This script displays a help window.
+ *
+ *	@package dokeos.help
+ */
 
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
+// Language file that needs to be included
+$language_file = 'help';
 
-	See the GNU General Public License for more details.
+require '../inc/global.inc.php';
 
-	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
-	Mail: info@dokeos.com
-==============================================================================
-*/
-/**
-==============================================================================
-*	This script displays a help window.
-*
-*	@package dokeos.help
-==============================================================================
-*/
-// name of the language file that needs to be included
-$language_file='help';
-$helpName=$_GET['open'];
-include('../inc/global.inc.php');
-$language_code = api_get_language_isocode($language_interface);
-header('Content-Type: text/html; charset='. $charset);
+$help_name = Security::remove_XSS($_GET['open']);
 
+header('Content-Type: text/html; charset='. api_get_system_encoding());
 
 /*
  * Choose CSS style platform's, user's, course's, or Learning path CSS
  */
 
 $platform_theme = api_get_setting('stylesheets'); 	// plataform's css
-$my_style=$platform_theme;
-if(api_get_setting('user_selected_theme') == 'true')
-{
+$my_style = $platform_theme;
+if (api_get_setting('user_selected_theme') == 'true') {
 	$useri = api_get_user_info();
 	$user_theme = $useri['theme'];
-	if(!empty($user_theme) && $user_theme != $my_style)
-	{
+	if (!empty($user_theme) && $user_theme != $my_style) {
 		$my_style = $user_theme;					// user's css
 	}
 }
 $mycourseid = api_get_course_id();
-if (!empty($mycourseid) && $mycourseid != -1)
-{
-	if (api_get_setting('allow_course_theme') == 'true')
-	{
-		$mycoursetheme=api_get_course_setting('course_theme');
-		if (!empty($mycoursetheme) && $mycoursetheme!=-1)
-		{
-			if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
-			{
-				$my_style = $mycoursetheme;		// course's css
+if (!empty($mycourseid) && $mycourseid != -1) {
+	if (api_get_setting('allow_course_theme') == 'true') {
+		$mycoursetheme = api_get_course_setting('course_theme');
+		if (!empty($mycoursetheme) && $mycoursetheme != -1) {
+			if(!empty($mycoursetheme) && $mycoursetheme != $my_style) {
+				$my_style = $mycoursetheme;			// course's css
 			}
 		}
 
-		$mycourselptheme=api_get_course_setting('allow_learning_path_theme');
-		if (!empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1)
-		{
+		$mycourselptheme = api_get_course_setting('allow_learning_path_theme');
+		if (!empty($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
 			global $lp_theme_css; //  it comes from the lp_controller.php
 			global $lp_theme_config; // it comes from the lp_controller.php
 
-			if (!empty($lp_theme_css))
-				{
-					$theme=$lp_theme_css;
-					if(!empty($theme) && $theme != $my_style)
-					{
-						$my_style = $theme;	 // LP's css
-					}
+			if (!empty($lp_theme_css)) {
+				$theme = $lp_theme_css;
+				if (!empty($theme) && $theme != $my_style) {
+					$my_style = $theme;	 // LP's css
 				}
+			}
 
 		}
 	}
 }
 
-if ($lp_theme_log){
-	$my_style=$platform_theme;
+if ($lp_theme_log) {
+	$my_style = $platform_theme;
 }
 
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $language_code; ?>" lang="<?php echo $language_code; ?>">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo api_get_language_isocode(); ?>" lang="<?php echo api_get_language_isocode(); ?>">
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset ?>" />
+<meta http-equiv="Content-Type" content="text/html; charset=<?php echo api_get_system_encoding(); ?>" />
 <title>
-<?php echo get_lang('H'.$helpName); ?>
+<?php echo get_lang('H'.$help_name); ?>
 </title>
 <?php
-if(api_get_setting('stylesheets')<>'')
-{
-	?>
+if (api_get_setting('stylesheets') != '') {
+?>
 	<style type="text/css" media="screen, projection">
 	/*<![CDATA[*/
-	@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo $my_style;?>/default.css";
+	@import "<?php echo api_get_path(WEB_CSS_PATH), $my_style;?>/default.css";
 	/*]]>*/
 	</style>
-	<?php
+<?php
 }
 ?>
 </head>
-<body>
+<body dir="<?php echo api_get_text_direction(); ?>">
 <div style="margin:10px;">
-<div style="text-align:right;"><a href="javascript:window.close();"><?php echo get_lang('Close'); ?></a></div>
+<div style="text-align:right;"><a href="javascript: window.close();"><?php echo get_lang('Close'); ?></a></div>
 <a href="faq.php"><?php echo get_lang('AccessToFaq') ?></a>
 <h4>
-<?php echo get_lang('H'.$helpName); ?>
+<?php echo get_lang('H'.$help_name); ?>
 </h4>
-<?php echo get_lang($helpName.'Content'); ?>
+<?php echo get_lang($help_name.'Content'); ?>
 <br /><br />
-<a href="faq.php"><?php echo get_lang('AccessToFaq') ?></a>
-<div style="text-align:right;"><a href="javascript:window.close();"><?php echo get_lang('Close'); ?></a></div>
+<a href="faq.php"><?php echo get_lang('AccessToFaq'); ?></a>
+<div style="text-align:right;"><a href="javascript: window.close();"><?php echo get_lang('Close'); ?></a></div>
 </div>
 </body>
 </html>

+ 11 - 7
main/inc/introductionSection.inc.php

@@ -145,6 +145,7 @@ if ($intro_cmdEdit || $intro_cmdAdd) {
 
 /* Executes the display */
 
+// display thematic advance inside a postit
 if ($intro_dispForm) {
 	$default['intro_content'] = $intro_content;
 	$form->setDefaults($default);
@@ -158,18 +159,20 @@ $thematic_description_html = '';
 
 if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
 
-	$thematic = new Thematic();	
-	if (api_get_course_setting('display_info_advance_inside_homecourse')) {		
+	$thematic = new Thematic();
+	if (api_get_course_setting('display_info_advance_inside_homecourse') == '1') {
+		$information_title = get_lang('InfoAboutLastDoneAdvance');
 		$last_done_advance =  $thematic->get_last_done_thematic_advance();
 		$thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance);
-	} else {
+	} else if(api_get_course_setting('display_info_advance_inside_homecourse') == '2') {
+		$information_title = get_lang('InfoAboutNextAdvanceNotDone');
 		$next_advance_not_done = $thematic->get_next_thematic_advance_not_done();
 		$thematic_advance_info = $thematic->get_thematic_advance_list($next_advance_not_done);
 	}
 		
 	if (!empty($thematic_advance_info)) {
 
-		$style_introduction_section = 'style="width:65%;float:left;margin-left:10%;"';
+		$style_introduction_section = 'style="width:65%;float:left;margin-left:5%;"';
 		$thematic_advance = get_lang('ThematicAdvance').'&nbsp;'.$thematic->get_total_average_of_thematic_advances().'%';		
 		if (api_is_allowed_to_edit(null, true)) {
 			$thematic_advance = '<a href="'.api_get_path(WEB_CODE_PATH).'attendance/index.php?action=thematic_details&'.api_get_cidreq().'">'.get_lang('ThematicAdvance').'&nbsp;'.$thematic->get_total_average_of_thematic_advances().'%</a>';
@@ -178,10 +181,11 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
 		
 		$thematic_description_html = '<div style="width:20%;float:left;font-size:10pt;"><div class="thematic-postit">
 								  <div class="thematic-postit-top"><a class="thematic-postit-head" style="" href="#">'.Display::return_icon('postit_top.png').'</a></div>
-								  <div class="thematic-postit-center">';
-		$thematic_description_html .= '<h3>'.$thematic_advance.'</h3>';							  								
+								  <div class="thematic-postit-center">'; 								
+		$thematic_description_html .= '<h3>'.$thematic_advance.'</h3>';	
+		$thematic_description_html .= '<h4>'.$information_title.'</h4>';						  								
 		$thematic_description_html .= '<div><strong>'.$thematic_info['title'].'</strong></div>';			
-		$thematic_description_html .= '<div><strong>'.api_get_local_time($thematic_advance_info['start_date']).'</strong></div>';
+		$thematic_description_html .= '<div><strong>'.api_convert_and_format_date($thematic_advance_info['start_date'], DATE_TIME_FORMAT_LONG, date_default_timezone_get()).'</strong></div>';
 		$thematic_description_html .= '<div>'.$thematic_advance_info['content'].'</div>';
 		$thematic_description_html .= '<div>'.get_lang('DurationInHours').' : '.$thematic_advance_info['duration'].'</div>';
 		$thematic_description_html .= '<br />';								  	

+ 2 - 0
main/inc/lib/add_course.lib.inc.php

@@ -2163,6 +2163,8 @@ function fill_Db_course($courseDbName, $courseRepository, $language,$default_doc
 	Database::query("INSERT INTO `" . $tbl_course_homepage . "` VALUES (NULL, '" . TOOL_GLOSSARY."','glossary/index.php','glossary.gif','".string2binary(api_get_setting('course_create_active_tools', 'glossary')). "','0','squaregrey.gif','NO','_self','authoring','0')");
 	Database::query("INSERT INTO `" . $tbl_course_homepage . "` VALUES (NULL, '" . TOOL_NOTEBOOK."','notebook/index.php','notebook.gif','".string2binary(api_get_setting('course_create_active_tools', 'notebook'))."','0','squaregrey.gif','NO','_self','interaction','0')");
 	Database::query("INSERT INTO `" . $tbl_course_homepage . "` VALUES (NULL, '" . TOOL_ATTENDANCE."','attendance/index.php','attendance.gif','".string2binary(api_get_setting('course_create_active_tools', 'attendances'))."','0','squaregrey.gif','NO','_self','authoring','0')");
+	Database::query("INSERT INTO `" . $tbl_course_homepage . "` VALUES (NULL, '" . TOOL_COURSE_PROGRESS."','course_progress/index.php','course_progress.gif','".string2binary(api_get_setting('course_create_active_tools', 'course_progress'))."','0','squaregrey.gif','NO','_self','authoring','0')");
+	
 	if(api_get_setting('service_visio','active')=='true')
 	{
 		$mycheck = api_get_setting('service_visio','visio_host');

+ 4 - 3
main/inc/lib/attendance.lib.php

@@ -198,7 +198,7 @@ class Attendance
 	 * edit attendaces inside table
 	 * @param 	int	   attendance id
 	 * @param  	bool   true for adding link in gradebook or false otherwise (optional)
-	 * @return 	int    affected rows
+	 * @return 	int    last id
 	 */
 	public function attendance_edit($attendance_id, $link_to_gradebook = false) {
 		global $_course;
@@ -220,7 +220,6 @@ class Attendance
 					attendance_weight = '".$weight_calification."'
 				WHERE id = '$attendance_id'";
 		Database::query($sql);
-		$affected_rows = Database::affected_rows();
 		if (!empty($affected_rows)) {
 			// update row item property table
 			$last_id = Database::insert_id();
@@ -237,7 +236,9 @@ class Attendance
 				Database::query('UPDATE '.$table_link.' SET weight='.$weight_calification.' WHERE id='.$link_id.'');
 			}
 		}
-		return $affected_rows;
+		$last_id = $attendance_id;
+		
+		return $last_id;
 	}
 
 	/**

+ 38 - 30
main/inc/lib/course_home.lib.php

@@ -55,14 +55,8 @@ class CourseHome {
 		$result = Database::query($sql);
 
 		// Grabbing all the tools from $course_tool_table
-		while ($row = Database::fetch_array($result)) {
-			if ($row['img'] != 'file_html.gif' && $row['img'] != 'file_html_na.gif'
-					&& $row['img'] != 'scormbuilder.gif' && $row['img'] != 'scormbuilder_na.gif'
-					&& $row['img'] != 'blog.gif' && $row['img'] != 'blog_na.gif'
-					&& $row['img'] != 'external.gif' && $row['img'] != 'external_na.gif') {
-				$row['name_translated'] = get_lang(ucfirst($row['name']));
-			}
-			$all_tools[] = $row;
+		while ($tool = Database::fetch_array($result)) {
+			$all_tools[] = $tool;
 		}
 
 		// Grabbing all the links that have the property on_homepage set to 1
@@ -102,12 +96,12 @@ class CourseHome {
 
 		foreach ($all_tools as & $tool) {
 			if (api_get_session_id() != 0 && in_array($tool['name'], array('course_maintenance', 'course_setting'))) {
-					continue;
+				continue;
 			}
 
 			$cell_content = '';
 			// The name of the tool
-			$tool_name = !empty($tool['name_translated']) ? $tool['name_translated'] : @htmlspecialchars($tool['name'], ENT_QUOTES, $charset); // RH: added htmlspecialchars
+			$tool_name = self::translate_tool_name($tool);
 
 			$link_annex = '';
 			// The url of the tool
@@ -309,21 +303,14 @@ class CourseHome {
 				echo '<td width="50%" height="30">';
 
 				if (strpos($tool['name'], 'visio_') !== false) {
-					echo '<a  '.$class.' href="javascript: void(0);" onclick="javascript: window.open(\'' . htmlspecialchars($tool['link']).(($tool['image']=="external.gif" || $tool['image']=="external_na.gif") ? '' : $qm_or_amp.api_get_cidreq()) . '\',\'window_visio'.$_SESSION['_cid'].'\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $tool['target'] . '">';
+					echo '<a  '.$class.' href="javascript: void(0);" onclick="javascript: window.open(\'' . htmlspecialchars($tool['link']).(($tool['image'] == 'external.gif' || $tool['image'] == 'external_na.gif') ? '' : $qm_or_amp.api_get_cidreq()) . '\',\'window_visio'.$_SESSION['_cid'].'\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $tool['target'] . '">';
 				} elseif (strpos($tool['name'], 'chat') !== false && api_get_course_setting('allow_open_chat_window')) {
 					echo '<a href="javascript: void(0);" onclick="javascript: window.open(\'' . htmlspecialchars($tool['link']).$qm_or_amp.api_get_cidreq() . '\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $tool['target'] . '"'.$class.'>';
 				} else {
 					echo '<a href="'. htmlspecialchars($tool['link']).(($tool['image'] == 'external.gif' || $tool['image'] == 'external_na.gif') ? '' : $qm_or_amp.api_get_cidreq()).'" target="' , $tool['target'], '" '.$class.'>';
 				}
 
-				if ($tool['image'] == 'file_html.gif' || $tool['image'] == 'file_html_na.gif'
-						|| $tool['image'] == 'scormbuilder.gif' || $tool['image'] == 'scormbuilder_na.gif'
-						|| $tool['image'] == 'blog.gif' || $tool['image'] == 'blog_na.gif'
-						|| $tool['image'] == 'external.gif' || $tool['image'] == 'external_na.gif') {
-					$tool_name = @htmlspecialchars($tool['name'], ENT_QUOTES, $charset);
-				} else {
-					$tool_name = get_lang(ucfirst($tool['name']));
-				}
+				$tool_name = self::translate_tool_name($tool);
 				echo Display::return_icon($tool['image'], $tool_name),'&nbsp;', $tool_name,'</a>';
 
 				// This part displays the links to hide or remove a tool.
@@ -373,7 +360,7 @@ class CourseHome {
 					}
 				}
 				if (is_array($lnk)) {
-					foreach($lnk as $this_link) {
+					foreach ($lnk as & $this_link) {
 						if (!$tool['adminlink']) {
 							echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;id='.$tool['id'].'&amp;'.$this_link['cmd'].'">'.$this_link['name'].'</a>';
 						}
@@ -572,6 +559,7 @@ class CourseHome {
 		$course_tool_table = Database::get_course_table(TABLE_TOOL_LIST);
 		$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
 		$is_platform_admin = api_is_platform_admin();
+
 		$i = 0;
 		if (isset($all_tools_list)) {
 			$lnk = '';
@@ -669,16 +657,7 @@ class CourseHome {
 				}
 				echo $toollink;
 
-				if ($tool['image'] == 'file_html.gif' || $tool['image'] == 'file_html_na.gif'
-						|| $tool['image'] == 'scormbuilder.gif' || $tool['image'] == 'scormbuilder_na.gif'
-						|| $tool['image'] == 'blog.gif' || $tool['image'] == 'blog_na.gif'
-						|| $tool['image'] == 'external.gif' || $tool['image'] == 'external_na.gif') {
-					$tool_name = stripslashes($tool['name']);
-				} else {
-					$list = explode('_', $tool['name']);
-					foreach ($list as & $item) { $item = ucfirst($item); }
-					$tool_name = get_lang('Tool'.implode($list));
-				}
+				$tool_name = self::translate_tool_name($tool);
 				Display::display_icon($tool['image'], $tool_name, array('class' => 'tool-icon', 'id' => 'toolimage_'.$tool['id']));
 
 				// Validacion when belongs to a session
@@ -754,4 +733,33 @@ class CourseHome {
 		return $output;
 	}
 
+	/**
+	 * Retrieves the name-field within a tool-record and translates it on necessity.
+	 * @param array $tool		The input record.
+	 * @return string			Returns the name of the corresponding tool.
+	 */
+	public static function translate_tool_name(& $tool) {
+		static $already_translated_icons = array(
+			'file_html.gif', 'file_html_na.gif',
+			'scormbuilder.gif', 'scormbuilder_na.gif',
+			'blog.gif', 'blog_na.gif',
+			'external.gif', 'external_na.gif'
+		);
+
+		if (in_array($tool['image'], $already_translated_icons)) {
+			$tool_name = Security::remove_XSS(stripslashes($tool['name']));
+		} else {
+			$variable = 'Tool'.api_underscore_to_camel_case($tool['name']); // The newly opened language variables.
+			$variable_old = ucfirst($tool['name']);         // The old language variables as a second chance exist.
+			if (api_is_translated($variable)) {
+				$tool_name = get_lang($variable);
+			} elseif (api_is_translated($variable_old)) {
+				$tool_name = get_lang($variable_old);
+			} else {
+				$tool_name = get_lang($variable);
+			}
+		}
+
+		return $tool_name;
+	}
 }

+ 2 - 11
main/inc/lib/fckeditor/fckeditor.php

@@ -381,7 +381,7 @@ class FCKeditor
 			$toolbar_config[$this->ToolbarSet] = array();
 			if (preg_match('/[a-zA-Z_]+/', $toolbar_dir) && preg_match('/[a-zA-Z_]+/', $this->ToolbarSet)) { // A security check.
 				// Seeking the toolbar.
-				@include api_get_path(LIBRARY_PATH).'fckeditor/toolbars/'.$toolbar_dir.'/'.self::camel_case_to_underscore($this->ToolbarSet).'.php';
+				@include api_get_path(LIBRARY_PATH).'fckeditor/toolbars/'.$toolbar_dir.'/'.api_camel_case_to_underscore($this->ToolbarSet).'.php';
 				if (!isset($config['ToolbarSets']['Normal'])) {
 					// No toolbar has been found yet.
 					if ($toolbar_dir == 'default') {
@@ -389,7 +389,7 @@ class FCKeditor
 						$this->ToolbarSet = 'Default';
 					} else {
 						// The custom toolbar does not exist, then trying to load the default one.
-						@include api_get_path(LIBRARY_PATH).'fckeditor/toolbars/default/'.self::camel_case_to_underscore($this->ToolbarSet).'.php';
+						@include api_get_path(LIBRARY_PATH).'fckeditor/toolbars/default/'.api_camel_case_to_underscore($this->ToolbarSet).'.php';
 						if (!isset($config['ToolbarSets']['Normal'])) {
 							// It does not exist in default toolbar definitions, giving up.
 							$this->ToolbarSet = 'Default';
@@ -664,13 +664,4 @@ class FCKeditor
 		@fclose($fp);
 		return $file_exists;
 	}
-
-	/*
-	 * Convers a string from camel case to underscore.
-	 * @param string $string
-	 * @return string
-	 */
-	private function camel_case_to_underscore($string) {
-		return strtolower(preg_replace('/([a-z])([A-Z])/', "$1_$2", $string));
-	}
 }

+ 101 - 81
main/inc/lib/internationalization.lib.php

@@ -16,6 +16,10 @@
  * Constants
  */
 
+// Special tags for marking untranslated variables.
+define('SPECIAL_OPENING_TAG', '[=');
+define('SPECIAL_CLOSING_TAG', '=]');
+
 // Predefined date formats in Chamilo provided by the language sub-system.
 // To be used as a parameter for the function api_format_date().
 define('TIME_NO_SEC_FORMAT', 0);	// 15:23
@@ -84,54 +88,57 @@ function api_set_internationalization_default_encoding($encoding) {
  * Language support
  */
 
+// These variables are for internal purposes only, they serve the function api_is_translated().
+$_api_is_translated = false;
+$_api_is_translated_call = false;
+
 /**
  * Returns a translated (localized) string, called by its identificator.
- * @param string $variable		This is the identificator (name) of the translated string to be retrieved.
- * @param string $notrans		This parameter directs whether a link to DLTT to be shown for untranslated strings
- * 								($notrans = 'DLTT' means "yes", any other value means "no").
+ * @param string $variable				This is the identificator (name) of the translated string to be retrieved.
+ * @param string $reserved				This parameter has been reserved for future use.
  * @param string $language (optional)	Language indentificator. If it is omited, the current interface language is assumed.
- * @return string				Returns the requested string in the correspondent language.
+ * @return string						Returns the requested string in the correspondent language.
  *
  * @author Roan Embrechts
  * @author Patrick Cool
- * @author Ivan Tcholakov, April-September 2009 (caching functionality, additional parameter $language).
+ * @author Ivan Tcholakov, 2009-2010 (caching functionality, additional parameter $language, other adaptations).
  *
  * Notes:
  * 1. If the name of a given language variable has the prefix "lang" it may be omited, i.e. get_lang('langYes') == get_lang('Yes').
- * 2. When server type in Chamilo config settings is set as test (development) server and $notrans = 'DLTT', untranslated variables
- * are shown as links to DLTT where translations may be proposed.
- * 3. Additionally, untranslated variables might be indicated by special opening and closing tags  -  [=  =]
- * They do not show up in these two cases (for both production and test server modes):
- * - when the special setting 'hide_dltt_markup' is set so;
- * - when showing the DLTT link (on untranslated variable) is intentionaly suppressed by a developer, using the input parameter
- * $notrans, i.e. when the function is called in this way: get_lang('MyText', '')
- * 4. Translations are created by using a special tool: Chamilo Translation Application.
+ * 2. Untranslated variables might be indicated by special opening and closing tags  -  [=  =]
+ * The special tags do not show up in these two cases:
+ * - when the system has been switched to "production server mode";
+ * - when a special platform setting 'hide_dltt_markup' is set to "true" (the name of this setting comes from history);
+ * 3. Translations are created many contributors through using a special tool: Chamilo Translation Application.
  * @link http://translate.chamilo.org/
- * 5. DLTT means Dokeos Language Translation Tool - it was previously used.
- * @link http://www.dokeos.com/DLTT/
  */
-function get_lang($variable, $notrans = 'DLTT', $language = null) {
-
-	// We introduced the possibility to request specific language by the aditional parameter $language to this function.
-
-	// By manipulating this global variable the translation may be done in different languages too (not the elegant way).
-	global $language_interface;
+function get_lang($variable, $reserved = null, $language = null) {
 
-	// Because of possibility for manipulations of the global variable $language_interface, we need its initial value.
-	global $language_interface_initial_value;
+	global
+		// For serving some old hacks:
+		// By manipulating this global variable the translation may be done in different languages too (not the elegant way).
+		$language_interface,
+		// Because of possibility for manipulations of the global variable $language_interface, we need its initial value.
+		$language_interface_initial_value,
+		// For serving the function is_translated()
+		$_api_is_translated, $_api_is_translated_call;
 
 	// Caching results from some API functions, for speed.
-	static $langpath;
+	static $encoding, $is_utf8_encoding, $langpath, $test_server_mode, $show_special_markup;
+	if (!isset($is_utf8_encoding)) {
+		$encoding = api_get_system_encoding();
+	}
+	if (!isset($is_utf8_encoding)) {
+		$is_utf8_encoding = api_is_utf8($encoding);
+	}
 	if (!isset($langpath)) {
 		$langpath = api_get_path(SYS_LANG_PATH);
 	}
-	static $test_server_mode;
 	if (!isset($test_server_mode)) {
 		$test_server_mode = api_get_setting('server_type') == 'test';
 	}
-	static $hide_dltt_markup;
-	if (!isset($hide_dltt_markup)) {
-		$hide_dltt_markup = api_get_setting('hide_dltt_markup') == 'true';
+	if (!isset($show_special_markup)) {
+		$show_special_markup = api_get_setting('hide_dltt_markup') != 'true' || $test_server_mode;
 	}
 
 	// Combining both ways for requesting specific language.
@@ -140,22 +147,21 @@ function get_lang($variable, $notrans = 'DLTT', $language = null) {
 	}
 	$is_interface_language = $language == $language_interface_initial_value;
 
-	// This is a flag for showing the link to the DLTT when the requested variable has no translation within the language files.
-	$dltt = $notrans == 'DLTT' && $is_interface_language;
-
 	// This is a cache for already translated language variables. By using it, we avoid repetitive translations, gaining speed.
 	static $cache;
 
 	// Looking up into the cache for existing translation.
-	if (isset($cache[$language][$dltt][$variable])) {
+	if (isset($cache[$language][$variable]) && !$_api_is_translated_call) {
 		// There is a previously saved translation, returning it.
-		return $cache[$language][$dltt][$variable];
+		return $cache[$language][$variable];
 	}
 
+	$_api_is_translated = false;
+
 	// There is no cached translation, we have to retrieve it:
 	// - from a global variable (the faster way) - on production server mode;
 	// - from a local variable after reloading the language files - on test server mode or when requested language is different than the genuine interface language.
-	$read_global_variables = $is_interface_language && !$test_server_mode;
+	$read_global_variables = $is_interface_language && !$test_server_mode && !$_api_is_translated_call;
 
 	// Reloading the language files when it is necessary.
 	if (!$read_global_variables) {
@@ -171,52 +177,66 @@ function get_lang($variable, $notrans = 'DLTT', $language = null) {
 		}
 	}
 
-	// Opening and closing tags for missing variables.
-	if ($hide_dltt_markup || !$dltt) {
-		$ot = ''; $ct = '';
-	} else {
-		$ot = '[='; $ct = '=]';
-	}
-
 	// Translation mode for production servers.
 	if (!$test_server_mode) {
 		if ($read_global_variables) {
-			$langvar = isset($GLOBALS[$variable]) ? $GLOBALS[$variable] : (isset($GLOBALS["lang$variable"]) ? $GLOBALS["lang$variable"] : $ot.$variable.$ct);
+			if (isset($GLOBALS[$variable])) {
+				$langvar = $GLOBALS[$variable];
+				$_api_is_translated = true;
+			} elseif (isset($GLOBALS["lang$variable"])) {
+				$langvar = $GLOBALS["lang$variable"];
+				$_api_is_translated = true;
+			} else {
+				$langvar = $show_special_markup ? SPECIAL_OPENING_TAG.$variable.SPECIAL_CLOSING_TAG : $variable;
+			}
 		} else {
-			/*
-			@eval("\$langvar=\$$variable;"); // Note (RH): $$var doesn't work with arrays, see PHP doc
-			if (!isset($langvar)) {
-				@eval("\$langvar=\$lang$variable;");
-				if (!isset($langvar)) {
-					$langvar = $ot.$variable.$ct;
-				}
+			if (isset($$variable)) {
+				$langvar = $$variable;
+				$_api_is_translated = true;
+			} elseif (isset(${"lang$variable"})) {
+				$langvar = ${"lang$variable"};
+				$_api_is_translated = true;
+			} else {
+				$langvar = $show_special_markup ? SPECIAL_OPENING_TAG.$variable.SPECIAL_CLOSING_TAG : $variable;
 			}
-			*/
-			$langvar = isset($$variable) ? $$variable : (isset(${"lang$variable"}) ? ${"lang$variable"} : $ot.$variable.$ct);
 		}
-		return $cache[$language][$dltt][$variable] = is_string($langvar) ? _get_lang_purifier(str_replace("\\'", "'", $langvar), $language) : $langvar;
+		if (empty($langvar) || !is_string($langvar)) {
+			$_api_is_translated = false;
+		}
+		return $cache[$language][$variable] = $_api_is_translated ? ($is_utf8_encoding ? $langvar : api_utf8_decode($langvar, $encoding)) : $langvar;
 	}
 
 	// Translation mode for test/development servers.
 	if (!is_string($variable)) {
-		return $cache[$language][$dltt][$variable] = $ot.'get_lang(?)'.$ct;
+		return $cache[$language][$variable] = SPECIAL_OPENING_TAG.'get_lang(?)'.SPECIAL_CLOSING_TAG;
+	}
+	if (isset($$variable)) {
+		$langvar = $$variable;
+		$_api_is_translated = true;
+	} elseif (isset(${"lang$variable"})) {
+		$langvar = ${"lang$variable"};
+		$_api_is_translated = true;
 	}
-	/*
-	@eval("\$langvar=\$$variable;"); // Note (RH): $$var doesn't work with arrays, see PHP doc
-	if (!isset($langvar)) {
-		@eval("\$langvar=\$lang$variable;");
+	if (empty($langvar) || !is_string($langvar)) {
+		$_api_is_translated = false;
 	}
-	*/
-	$langvar = isset($$variable) ? $$variable : ${"lang$variable"};
-	// TODO: Ivan, 12-FEB-2010: These generated links (translation suggestions) to the Dokeos' site have to be corrected, I don't know how.
-	return $cache[$language][$dltt][$variable] =
-		isset($langvar) && is_string($langvar) && !empty($langvar)
-			? _get_lang_purifier(str_replace("\\'", "'", $langvar), $language)
-			: (!$dltt
-				? $ot.$variable.$ct
-				: $ot.$variable.$ct."<a href=\"http://www.dokeos.com/DLTT/suggestion.php?file=".
-					(!is_array($language_files) ? $language_files : implode('.inc.php', $language_files)).".inc.php&amp;variable=$".
-					$variable."&amp;language=".$language."\" target=\"_blank\" style=\"color:#FF0000\"><strong>#</strong></a>");
+	return $cache[$language][$variable] =
+		$_api_is_translated ? ($is_utf8_encoding ? $langvar : api_utf8_decode($langvar, $encoding)) : ($show_special_markup ? SPECIAL_OPENING_TAG.$variable.SPECIAL_CLOSING_TAG : $variable);
+}
+
+/**
+ * Checks whether exists a translated (localized) string.
+ * @param string $variable				This is the identificator (name) of the translated string to be checked.
+ * @param string $language (optional)	Language indentificator. If it is omited, the current interface language is assumed.
+ * @return bool							Returns TRUE if translation exists, FALSE otherwise.
+ * @author Ivan Tcholakov, 2010.
+ */
+function api_is_translated($variable, $language = null) {
+	global $_api_is_translated, $_api_is_translated_call;
+	$_api_is_translated_call = true;
+	get_lang($variable, $language);
+	$_api_is_translated_call = false;
+	return $_api_is_translated;
 }
 
 /**
@@ -495,11 +515,11 @@ function api_get_local_time($time = null, $to_timezone=null, $from_timezone=null
 
 /**
  * Converts a string into a timestamp safely (handling timezones), using strtotime
- * 
+ *
  * @param string String to be converted
  * @param string Timezone (if null, the timezone will be determined based on user preference, or timezone chosen by the admin for the platform)
  * @return int Timestamp
- * 
+ *
  * @author Guillaume Viguier <guillaume.viguier@beeznest.com>
  */
 function api_strtotime($time, $timezone = null) {
@@ -513,33 +533,33 @@ function api_strtotime($time, $timezone = null) {
 /**
  * Returns formated date/time, correspondent to a given language.
  * The given date should be in the timezone chosen by the administrator and/or user. Use api_get_local_time to get it.
- * 
+ *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  * @author Christophe Gesche<gesche@ipm.ucl.ac.be>
  *         originally inspired from from PhpMyAdmin
  * @author Ivan Tcholakov, 2009, code refactoring, adding support for predefined date/time formats.
  * @author Guillaume Viguier <guillaume.viguier@beeznest.com>
- * 
+ *
  * @param mixed Timestamp or datetime string
  * @param mixed Date format (string or int; see date formats in the Chamilo system: TIME_NO_SEC_FORMAT, DATE_FORMAT_SHORT, DATE_FORMAT_LONG, DATE_TIME_FORMAT_LONG)
  * @param string $language (optional)		Language indentificator. If it is omited, the current interface language is assumed.
  * @return string							Returns the formatted date.
- * 
+ *
  * @link http://php.net/manual/en/function.strftime.php
  */
 function api_format_date($time, $format = null, $language = null) {
-	
+
 	$system_timezone = date_default_timezone_get();
 	date_default_timezone_set(_api_get_timezone());
-	
+
 	if (is_string($time)) {
 		$time = strtotime($time);
 	}
-	
+
 	if (is_null($format)) {
 		$format = DATE_TIME_FORMAT_LONG;
 	}
-	
+
 	$datetype = null;
 	$timetype = null;
 	if(is_int($format)) {
@@ -580,7 +600,7 @@ function api_format_date($time, $format = null, $language = null) {
 				}
 		}
 	}
-	
+
 	if (IS_PHP_53 && INTL_INSTALLED && $datetype !== null && $timetype !== null) {
 		// Use ICU
 		if (is_null($language)) {
@@ -621,7 +641,7 @@ function date_to_str_ago($date) {
 	static $min_decade, $min_year, $min_month, $min_week, $min_day, $min_hour, $min_minute;
 	static $min_decades, $min_years, $min_months, $min_weeks, $min_days, $min_hours, $min_minutes;
 	static $sec_time_time, $sec_time_sing, $sec_time_plu;
-	
+
 	$system_timezone = date_default_timezone_get();
 	date_default_timezone_set(_api_get_timezone());
 
@@ -726,7 +746,7 @@ function date_to_str_ago($date) {
 	} else {
 		$str = $str_result[0];
 	}
-	
+
 	date_default_timezone_set($system_timezone);
 	return $str;
 }
@@ -737,7 +757,7 @@ function date_to_str_ago($date) {
  * @param mixed Format to be used
  * @param string Timezone to be converted from. If null, UTC will be assumed.
  * @return string Converted and localized date
- * 
+ *
  * @author Guillaume Viguier <guillaume.viguier@beeznest.com>
  */
 function api_convert_and_format_date($time = null, $format = null, $from_timezone = null) {

+ 0 - 26
main/inc/lib/internationalization_internal.lib.php

@@ -37,32 +37,6 @@ $_api_collator = null;
  * Appendix to "Language support"
  */
 
-/**
- * Upgrades the function get_lang() with the following logic:
- * 1. Checks whether the retrieved human language string is UTF-8 valid or not.
- * 2. If the system encoding is UTF-8 and the string is not UTF-8, the function
- * performs conversion from supposed non UTF-8 encodeng.
- * 3. If the system encoding is non UTF-8 but the string is valid UTF-8, then
- * conversion from UTF-8 is performed.
- * 4. At the end the string is purified from HTML entities.
- * @param string $string	This is the retrieved human language string.
- * @param string $language	A language identiticator.
- * @return string			Returns the human language string, checked for proper encoding and purified.
- */
-function & _get_lang_purifier(& $string, & $language) {
-	$system_encoding = api_get_system_encoding();
-	if (api_is_utf8($system_encoding)) {
-		if (!api_is_valid_utf8($string)) {
-			$string = api_utf8_encode($string, api_get_non_utf8_encoding($language));
-		}
-	} else {
-		if (api_is_valid_utf8($string)) {
-			$string = api_utf8_decode($string, $system_encoding);
-		}
-	}
-	return api_html_entity_decode($string, ENT_QUOTES, $system_encoding);
-}
-
 /**
  * This function returns an array of those languages that can use Latin 1 encoding.
  * @return array	The array of languages that can use Latin 1 encoding (ISO-8859-15, ISO-8859-1, WINDOWS-1252, ...).

+ 10 - 9
main/inc/lib/main_api.lib.php

@@ -97,6 +97,7 @@ define('TOOL_GLOSSARY','glossary');
 define('TOOL_GRADEBOOK','gradebook');
 define('TOOL_NOTEBOOK','notebook');
 define('TOOL_ATTENDANCE','attendance');
+define('TOOL_COURSE_PROGRESS','course_progress');
 
 // CONSTANTS defining Chamilo interface sections
 define('SECTION_CAMPUS', 'mycampus');
@@ -4184,15 +4185,15 @@ function api_calculate_image_size($image_width, $image_height, $target_width, $t
  */
 function api_get_tools_lists($my_tool = null) {
 	$tools_list = array(
-		TOOL_DOCUMENT,TOOL_THUMBNAIL,TOOL_HOTPOTATOES,
-		TOOL_CALENDAR_EVENT,TOOL_LINK,TOOL_COURSE_DESCRIPTION,TOOL_SEARCH,
-		TOOL_LEARNPATH,TOOL_ANNOUNCEMENT,TOOL_FORUM,TOOL_THREAD,TOOL_POST,
-		TOOL_DROPBOX,TOOL_QUIZ,TOOL_USER,TOOL_GROUP,TOOL_BLOGS,TOOL_CHAT,
-		TOOL_CONFERENCE,TOOL_STUDENTPUBLICATION,TOOL_TRACKING,TOOL_HOMEPAGE_LINK,
-		TOOL_COURSE_SETTING,TOOL_BACKUP,TOOL_COPY_COURSE_CONTENT,TOOL_RECYCLE_COURSE,
-		TOOL_COURSE_HOMEPAGE,TOOL_COURSE_RIGHTS_OVERVIEW,TOOL_UPLOAD,TOOL_COURSE_MAINTENANCE,
-		TOOL_VISIO,TOOL_VISIO_CONFERENCE,TOOL_VISIO_CLASSROOM,TOOL_SURVEY,TOOL_WIKI,
-		TOOL_GLOSSARY,TOOL_GRADEBOOK,TOOL_NOTEBOOK,TOOL_ATTENDANCE
+		TOOL_DOCUMENT, TOOL_THUMBNAIL, TOOL_HOTPOTATOES,
+		TOOL_CALENDAR_EVENT, TOOL_LINK, TOOL_COURSE_DESCRIPTION, TOOL_SEARCH,
+		TOOL_LEARNPATH, TOOL_ANNOUNCEMENT, TOOL_FORUM, TOOL_THREAD, TOOL_POST,
+		TOOL_DROPBOX, TOOL_QUIZ, TOOL_USER, TOOL_GROUP, TOOL_BLOGS, TOOL_CHAT,
+		TOOL_CONFERENCE, TOOL_STUDENTPUBLICATION, TOOL_TRACKING, TOOL_HOMEPAGE_LINK,
+		TOOL_COURSE_SETTING, TOOL_BACKUP, TOOL_COPY_COURSE_CONTENT, TOOL_RECYCLE_COURSE,
+		TOOL_COURSE_HOMEPAGE, TOOL_COURSE_RIGHTS_OVERVIEW, TOOL_UPLOAD, TOOL_COURSE_MAINTENANCE,
+		TOOL_VISIO, TOOL_VISIO_CONFERENCE, TOOL_VISIO_CLASSROOM, TOOL_SURVEY, TOOL_WIKI,
+		TOOL_GLOSSARY, TOOL_GRADEBOOK, TOOL_NOTEBOOK, TOOL_ATTENDANCE, TOOL_COURSE_PROGRESS
 	);
 	if (empty($my_tool)) {
 		return $tools_list;

+ 33 - 3
main/inc/lib/text.lib.php

@@ -2,14 +2,44 @@
 /* For licensing terms, see /license.txt */
 
 /**
- *	This is the text library for Chamilo.
- *	Include/require it in your code to use its functionality.
+ * This is the text library for Chamilo.
+ * It is loaded during the global initialization,
+ * so the functions below are available everywhere.
  *
- *	@package chamilo.library
+ * @package chamilo.library
  */
 
 /*	FUNCTIONS */
 
+/**
+ * Convers a string from camel case into underscore.
+ * Works correctly with ASCII strings only, implementation for human-language strings is not necessary.
+ * @param string $string							The input string (ASCII)
+ * @return string									The converted result string
+ */
+function api_camel_case_to_underscore($string) {
+	return strtolower(preg_replace('/([a-z])([A-Z])/', "$1_$2", $string));
+}
+
+/**
+ * Converts a string with underscores into camel case.
+ * Works correctly with ASCII strings only, implementation for human-language strings is not necessary.
+ * @param string $string							The input string (ASCII)
+ * @param bool $capitalise_first_char (optional)	If true (default), the function capitalises the first char in the result string.
+ * @return string									The converted result string
+ */
+function api_underscore_to_camel_case($string, $capitalise_first_char = true) {
+	if ($capitalise_first_char) {
+		$string = ucfirst($string);
+	}
+	return preg_replace_callback('/_([a-z])/', '_api_camelize', $string);
+}
+
+// A function for internal use, only for this library.
+function _api_camelize($match) {
+	return strtoupper($match[1]);
+}
+
 /**
  * Truncates a string.
  *

+ 33 - 14
main/inc/lib/thematic.lib.php

@@ -35,7 +35,7 @@ class Thematic
 	 * Get the total number of thematic inside current course and current session
 	 * @see SortableTable#get_total_number_of_items()
 	 */
-	public function get_number_of_thematics() {		
+	public function get_number_of_thematics() {	
 		$tbl_thematic = Database :: get_course_table(TABLE_THEMATIC);
 		$session_id = api_get_session_id();
 		$condition_session = api_get_session_condition($session_id);
@@ -223,33 +223,42 @@ class Thematic
 	 * @return int last thematic id
 	 */
 	public function thematic_save() {
-		
+		global $_course;
 		// definition database table		
 		$tbl_thematic = Database::get_course_table(TABLE_THEMATIC);
-		
+				
 		// protect data
 		$id = intval($this->thematic_id);
 		$title = Database::escape_string($this->thematic_title);
 		$content = Database::escape_string($this->thematic_content);
 		$session_id = intval($this->session_id);
+		$user_id = api_get_user_id();
 		
 		// get the maximum display order of all the glossary items
-		$max_thematic_item = $this->get_max_thematic_item();
+		$max_thematic_item = $this->get_max_thematic_item();		
 		
 		if (empty($id)) {			
 			// insert
 			$sql = "INSERT INTO $tbl_thematic(title, content, active, display_order, session_id) VALUES ('$title', '$content', 1, ".(intval($max_thematic_item)+1).", $session_id) ";
 			Database::query($sql);
-			$last_id = Database::insert_id();
+			$last_id = Database::insert_id();			
+			if (Database::affected_rows()) {
+				// save inside item property table
+				$last_id = Database::insert_id();
+				api_item_property_update($_course, TOOL_COURSE_PROGRESS, $last_id,"CourseProgressAdded", $user_id);
+			}			
 		} else {
 			// update
 			$sql = "UPDATE $tbl_thematic SET title = '$title', content = '$content', session_id = $session_id WHERE id = $id ";
 			Database::query($sql);
 			$last_id = $id;
-		}
-		
-		return $last_id;
-			
+			if (Database::affected_rows()) {
+				// save inside item property table
+				$last_id = Database::insert_id();
+				api_item_property_update($_course, TOOL_COURSE_PROGRESS, $last_id,"CourseProgressUpdated", $user_id);
+			}
+		}		
+		return $last_id;			
 	}
 	
 	/**
@@ -258,21 +267,30 @@ class Thematic
 	 * @return	int			Affected rows
 	 */
 	public function thematic_destroy($thematic_id) {
-		
+		global $_course;
 		$tbl_thematic = Database::get_course_table(TABLE_THEMATIC);
 		$affected_rows = 0;
+		$user_id = api_get_user_id();
 		if (is_array($thematic_id)) {
 			foreach ($thematic_id as $id) {
 				$id	= intval($id);
 				$sql = "UPDATE $tbl_thematic SET active = 0 WHERE id = $id";
 				Database::query($sql);
-				$affected_rows += Database::affected_rows();				
+				$affected_rows += Database::affected_rows();
+				if (!empty($affected_rows)) {
+					// update row item property table
+					api_item_property_update($_course, TOOL_COURSE_PROGRESS, $id,"delete", $user_id);
+				}			
 			}
 		} else  {
 			$thematic_id	= intval($thematic_id);
 			$sql = "UPDATE $tbl_thematic SET active = 0 WHERE id = $thematic_id";
 			Database::query($sql);
-			$affected_rows = Database::affected_rows();			
+			$affected_rows = Database::affected_rows();	
+			if (!empty($affected_rows)) {
+				// update row item property table
+				api_item_property_update($_course, TOOL_COURSE_PROGRESS, $thematic_id,"delete", $user_id);
+			}		
 		}
 		return $affected_rows;
 				
@@ -328,8 +346,9 @@ class Thematic
 		}
 		
 		$i = 1;
-		while ($thematic_advance = Database::fetch_row($res)) {								
-			$thematic_advance[1] = api_get_local_time($thematic_advance[1]);						
+		while ($thematic_advance = Database::fetch_row($res)) {		
+			
+			$thematic_advance[1] = api_convert_and_format_date($thematic_advance[1], DATE_TIME_FORMAT_LONG, date_default_timezone_get());
 			if (api_is_allowed_to_edit(null, true)) {
 				$actions  = '';						
 				$actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].$param_gradebook.'">'.Display::return_icon('edit.gif',get_lang('Edit')).'</a>&nbsp;';

+ 4 - 14
main/inc/tool_navigation_menu.inc.php

@@ -6,6 +6,7 @@
  *
  *	@package dokeos.include
  */
+require_once api_get_path(LIBRARY_PATH).'course_home.lib.php'; // For using the method CourseHome::translate_tool_name();
 
 define('SHORTCUTS_HORIZONTAL', 0);
 define('SHORTCUTS_VERTICAL', 1);
@@ -30,7 +31,7 @@ function get_navigation_items($include_admin_tools = false) {
 
 		$user_id = api_get_user_id();
 
-		$course_tools_table = Database :: get_course_table(TABLE_TOOL_LIST,$database);
+		$course_tools_table = Database :: get_course_table(TABLE_TOOL_LIST, $database);
 
 		/*	Link to the Course homepage */
 
@@ -44,17 +45,9 @@ function get_navigation_items($include_admin_tools = false) {
 		$sql_result = Database::query($sql_menu_query);
 		while ($row = Database::fetch_array($sql_result)) {
 			$navigation_items[$row['id']] = $row;
-			/*
-			if (!stristr($row['link'], 'http://'))
-			*/
 			if (stripos($row['link'], 'http://') === false && stripos($row['link'], 'https://') === false) {
 				$navigation_items[$row['id']]['link'] = api_get_path(REL_CODE_PATH).$row['link'];
-				/*
-				$navigation_items[$row['id']]['name'] = $row['image'] == 'scormbuilder.gif' ? $navigation_items[$row['id']]['name'] : get_lang(ucfirst($navigation_items[$row['id']]['name']));
-				*/
-				if ($row['image'] != 'scormbuilder.gif' && $row['image'] != 'blog.gif') {
-					$navigation_items[$row['id']]['name'] = get_lang(ucfirst($navigation_items[$row['id']]['name']));
-				}
+				$navigation_items[$row['id']]['name'] = CourseHome::translate_tool_name($row);
 			}
 		}
 
@@ -67,7 +60,7 @@ function get_navigation_items($include_admin_tools = false) {
 									WHERE link='course_info/infocours.php'";
 			$sql_result = Database::query($course_settings_sql);
 			$course_setting_info = Database::fetch_array($sql_result);
-			$course_setting_visual_name = get_lang(api_ucfirst($course_setting_info['name']));
+			$course_setting_visual_name = CourseHome::translate_tool_name($course_setting_info);
 			if (api_get_session_id() == 0) {
 				// course settings item
 				$navigation_items['course_settings']['image'] = $course_setting_info['image'];
@@ -212,9 +205,6 @@ function show_navigation_tool_shortcuts($orientation = SHORTCUTS_HORIZONTAL) {
 	$navigation_items = get_navigation_items(false);
 	foreach ($navigation_items as $key => $navigation_item) {
 		if (strpos($navigation_item['link'],'chat') !== false && api_get_course_setting('allow_open_chat_window')) {
-	    	/*
-		  	echo '<a href="#" onclick="window.open(\''.$navigation_item['link'].'\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $navigation_item['target'] . '"';
-		  	*/
 		  	echo '<a href="javascript: void(0);" onclick="javascript: window.open(\''.$navigation_item['link'].'\',\'window_chat'.$_SESSION['_cid'].'\',config=\'height=\'+380+\', width=\'+625+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $navigation_item['target'] . '"';
 	    } else {
 		  	echo '<a href="'.$navigation_item['link'].'"';

+ 5 - 3
main/install/db_main.sql

@@ -288,7 +288,8 @@ INSERT INTO course_module VALUES
 (26,'gradebook','gradebook/index.php','gradebook.gif',2,2,'basic'),
 (27,'glossary','glossary/index.php','glossary.gif',2,1,'basic'),
 (28,'notebook','notebook/index.php','notebook.gif',2,1,'basic'),
-(29,'attendance','attendance/index.php','attendance.gif',2,1,'basic');
+(29,'attendance','attendance/index.php','attendance.gif',2,1,'basic'),
+(30,'course_progress','course_progress/index.php','course_progress.gif',2,1,'basic');
 UNLOCK TABLES;
 /*!40000 ALTER TABLE course_module ENABLE KEYS */;
 
@@ -724,7 +725,8 @@ VALUES
 ('course_create_active_tools','survey','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Survey', 0),
 ('course_create_active_tools','glossary','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Glossary', 0),
 ('course_create_active_tools','notebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Notebook', 0),
-('course_create_active_tools','attendances','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Attendances', 0),
+('course_create_active_tools','attendances','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Attendances', 0),
+('course_create_active_tools','course_progress','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'CourseProgress', 0),
 ('advanced_filemanager',NULL,'radio','Editor','false','AdvancedFileManagerTitle','AdvancedFileManagerComment',NULL,NULL, 0),
 ('allow_reservation', NULL, 'radio', 'Tools', 'false', 'AllowReservationTitle', 'AllowReservationComment', NULL, NULL, 0),
 ('profile','apikeys','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'ApiKeys', 0),
@@ -757,7 +759,7 @@ VALUES
 ('show_tabs', 'dashboard', 'checkbox', 'Platform', 'true', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsDashboard', 1),
 ('use_users_timezone', 'timezones', 'radio', 'Timezones', 'true', 'UseUsersTimezoneTitle','UseUsersTimezoneComment',NULL,'Timezones', 1),
 ('timezone_value', 'timezones', 'select', 'Timezones', '', 'TimezoneValueTitle','TimezoneValueComment',NULL,'Timezones', 1),
-('dokeos_database_version', NULL, 'textfield', NULL,'1.8.7.11140','DokeosDatabaseVersion','',NULL,NULL,0);
+('dokeos_database_version', NULL, 'textfield', NULL,'1.8.7.11182','DokeosDatabaseVersion','',NULL,NULL,0);
 
 
 UNLOCK TABLES;

+ 6 - 3
main/install/migrate-db-1.8.6.2-1.8.7-pre.sql

@@ -63,16 +63,18 @@ ALTER TABLE gradebook_result_log CHANGE date_log created_at DATETIME NOT NULL de
 
 INSERT INTO user_field(field_type, field_variable, field_display_text, field_visible, field_changeable) VALUES(11, 'timezone', 'Timezone', 0, 0);
 
-INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_create_active_tools','attendances','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Attendances', 0);
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_create_active_tools','attendances','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Attendances', 0);
 
 ALTER TABLE user_field_values CHANGE id id BIGINT NOT NULL AUTO_INCREMENT;
 ALTER TABLE user_field_values ADD INDEX (user_id, field_id);
 
-UPDATE settings_current SET selected_value = '1.8.7.11140' WHERE variable = 'dokeos_database_version';
+UPDATE settings_current SET selected_value = '1.8.7.11182' WHERE variable = 'dokeos_database_version';
 
 ALTER TABLE course_rel_user DROP PRIMARY KEY, ADD PRIMARY KEY (course_code, user_id, relation_type);
 ALTER TABLE session_rel_user DROP PRIMARY KEY, ADD PRIMARY KEY (id_session, id_user, relation_type);
 
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('course_create_active_tools','course_progress','checkbox','Tools','false','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'CourseProgress', 0);
+
 -- xxSTATSxx
 CREATE TABLE track_e_item_property(id int NOT NULL auto_increment PRIMARY KEY, course_id int NOT NULL, item_property_id int NOT NULL, title varchar(255), content text, progress int NOT NULL default 0, lastedit_date datetime NOT NULL default '0000-00-00 00:00:00', lastedit_user_id int  NOT NULL, session_id int NOT NULL default 0);
 ALTER TABLE track_e_item_property ADD INDEX (course_id, item_property_id, session_id);
@@ -124,4 +126,5 @@ CREATE TABLE thematic_plan (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, thematic
 ALTER TABLE thematic_plan ADD INDEX (thematic_id, description_type); 
 CREATE TABLE thematic_advance (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, thematic_id INT NOT NULL, attendance_id INT NOT NULL DEFAULT 0, content TEXT NOT NULL, start_date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', duration INT NOT NULL DEFAULT 0, done_advance tinyint NOT NULL DEFAULT 0);
 ALTER TABLE thematic_advance ADD INDEX (thematic_id);
-INSERT INTO course_setting (variable,value,category) VALUES ('display_info_advance_inside_homecourse',1,'thematic_advance');
+INSERT INTO course_setting (variable,value,category) VALUES ('display_info_advance_inside_homecourse',1,'thematic_advance');
+INSERT INTO tool(name, link, image, visibility, admin, address, added_tool, target, category) VALUES ('course_progress','course_progress/index.php','course_progress.gif',0,'0','squaregrey.gif',0,'_self','authoring');

+ 3 - 0
main/lang/bulgarian/course_info.inc.php

@@ -113,4 +113,7 @@ $NewUserEmailAlert = "Известяване на инструктора по e-
 $NewUserEmailAlertEnable = "Да се уведомява с e-mail преподавателя, когато потребител се регистрира самостоятелно в курса";
 $NewUserEmailAlertToTeacharAndTutor = "Да се уведомяват с e-mail преподавателите и инструкторите, когато потребител се регистрира самостоятелно в курса";
 $NewUserEmailAlertDisable = "Изключване на уведомяването с e-mail на новозаписаните курсисти";
+$AllowUserViewUserList = "Разрешанаве на курситите да виждат списъка с потребителите";
+$AllowUserViewUserListActivate = "Разрешаване";
+$AllowUserViewUserListDeactivate = "Забрана";
 ?>

+ 15 - 0
main/lang/bulgarian/exercice.inc.php

@@ -348,5 +348,20 @@ $QuestionTypeDoesNotBelongToFeedbackTypeInExercise = "Типът въпрос н
 $SessionIsReadOnly = "Сесията е само за четене.";
 $EnableTimerControl = "Включване на таймер";
 $ExerciseTotalDurationInMinutes = "Продължителност на целия тест в минути";
+$ToContinueUseMenu = "За продължение използвайте страничното меню.";
 $RandomAnswers = "Случаен ред на предложените отговори";
+$NotMarkActivity = "Тази дейност не може да бъде оценена.";
+$YouHaveToCreateAtLeastOneAnswer = "Трябва да създадете поне един отговор.";
+$ExerciseAttempted = "Тестът е пробван.";
+$MultipleSelectCombination = "Същата избрана комбинация";
+$MultipleAnswerCombination = "Същата комбинация от отговори";
+$ExerciceExpiredTimeMessage = "Времевият лимит на теста е надхвърлен.";
+$EditingExerciseCauseProblemsInLP = "Редактирането на теста може да доведе до проблеми в пътеката за обучение.";
+$AreYouSureToCopy = "Сигурни ли сте, че искате да копирате";
+$ExerciseCopied = "Тестът е копиран.";
+$AreYouSureToDeleteResults = "Сигурни ли сте, че искате да изтриете резултатите?";
+$XResultsCleaned = "%d резултата са изтрити.";
+$CopyExercise = "Копиране на теста в нов";
+$CleanStudentResults = "Изтриване на всички резултати на курсистите за теста";
+$ImportQtiQuiz = "Qti2 импорт на тестове.";
 ?>

+ 78 - 2
main/lang/bulgarian/trad4all.inc.php

@@ -6,7 +6,7 @@ $Title = "Заглавие";
 $By = "От";
 $UsersOnline = "Посетители";
 $Remove = "Премахване";
-$langEnter = "<< Обратно към списъка с курсовете";
+$langEnter = "Обратно към списъка с курсовете";
 $Description = "Описание";
 $Links = "Връзки";
 $langWorks = "Задачи";
@@ -38,6 +38,7 @@ $langUniqueSelect = "Само един верен отговор";
 $CreateCategory = "Създаване на категория";
 $SendFile = "Качване на документа";
 $SaveChanges = "Запис на промените";
+$SearchTerm = "Израз за търсене";
 $langCourseCreate = "Създаване на нов курс";
 $langTodo = "Предложения";
 $UserName = "Потребителско име";
@@ -82,6 +83,7 @@ $AddNewQuestionType = "Добавяне на нов тип въпрос";
 $Numbered = "Номериран";
 $iso639_2_code = "bg";
 $iso639_1_code = "bg";
+$charset = "windows-1251";
 $text_dir = "ltr";
 $left_font_family = "verdana, helvetica, arial, geneva, sans-serif";
 $right_font_family = "helvetica, arial, geneva, sans-serif";
@@ -143,6 +145,26 @@ $AddedResources = "Прикрепени ресурси";
 $lang_modify_resource = "Промяна/добавяне на ресурс";
 $lang_resource = "Ресурс";
 $lang_resources = "Ресурси";
+$langNameOfLang['arabic'] = "арабски";
+$langNameOfLang['brazilian'] = "бразилски португалски";
+$langNameOfLang['bulgarian'] = "български";
+$langNameOfLang['catalan'] = "каталонски";
+$langNameOfLang['croatian'] = "хърватски";
+$langNameOfLang['danish'] = "датски";
+$langNameOfLang['dutch'] = "холандски";
+$langNameOfLang['english'] = "английски";
+$langNameOfLang['finnish'] = "финландски";
+$langNameOfLang['french'] = "френски";
+$langNameOfLang['galician'] = "галицийски";
+$langNameOfLang['german'] = "немски";
+$langNameOfLang['greek'] = "гръцки";
+$langNameOfLang['italian'] = "италиански";
+$langNameOfLang['japanese'] = "японски";
+$langNameOfLang['polish'] = "полски";
+$langNameOfLang['portuguese'] = "португалски";
+$langNameOfLang['russian'] = "руски";
+$langNameOfLang['simpl_chinese'] = "китайски";
+$langNameOfLang['spanish'] = "испански";
 $Close = "Затваряне";
 $langPlatform = "Система";
 $localLangName = "български";
@@ -165,6 +187,14 @@ $WithSelected = "С маркираните";
 $langOnLine = "Посетители";
 $langUsers = "Потребители";
 $langPlatformAdmin = "Администриране";
+$langNameOfLang['hungarian'] = "унгарски";
+$langNameOfLang['indonesian'] = "индонезийски";
+$langNameOfLang['malay'] = "малайски";
+$langNameOfLang['slovenian'] = "словенски";
+$langNameOfLang['swedish'] = "шведски";
+$langNameOfLang['thai'] = "тайландски";
+$langNameOfLang['turkce'] = "турски";
+$langNameOfLang['vietnamese'] = "виетнамски";
 $UserInfo = "потребителска информация";
 $langModifyQuestion = "Промяна на въпроса";
 $langNameOfLang = "Наименование на езика";
@@ -177,7 +207,7 @@ $PlataformAdmin = "Администратор на системата";
 $Groups = "Групи";
 $GroupManagement = "Управление на групите";
 $All = "Всички";
-$None = "Никои";
+$None = "Няма";
 $langSorry = "Първо изберете курс.";
 $langDenied = "Това действие е позволено само за преподаватели.";
 $Today = "днес";
@@ -592,7 +622,9 @@ $SessionNameAndCourseTitle = "Име на сесия и име на курс";
 $CreationDate = "Дата на създаване";
 $LastUpdateDate = "Последна промяна";
 $ViewHistoryChange = "Преглед на историята на промените";
+$langNameOfLang['asturian'] = "астурийски";
 $SearchGoToLearningPath = "Към пътеката за обучение";
+$SearchLectureLibrary = "Библиотека с материали";
 $SearchImagePreview = "Изображение за преглед";
 $SearchAdvancedOptions = "Опции за разширено търсене";
 $SearchResetKeywords = "Изчистване на ключовите думи";
@@ -608,6 +640,7 @@ $OrderBy = "Сортиране по";
 $Notebook = "Бележки";
 $FieldRequired = "Задължителни полета";
 $BookingSystem = "Система за резервации";
+$Any = "Всеки";
 $SpecificSearchFields = "Допълнително поле за търсене";
 $AddSpecificSearchField = "Добавяне на допълнително поле за търсене";
 $SaveSettings = "Запис на настройките";
@@ -666,19 +699,62 @@ $GraphicNotAvailable = "Няма изображение";
 $BackTo = "Обратно към";
 $HistoryTrainingSessions = "История на обучителните сесии";
 $ConversionFailled = "Конвертирането не е успешно.";
+$AlreadyExists = "Вече съществува.";
 $TheNewWordHasBeenAdded = "Новата дума е добавена.";
 $EventType = "Вид на събитието";
 $DataType = "Тип на данните";
 $Value = "Сойност";
 $System = "Система";
 $ImportantActivities = "Важни дейности";
+$Parent = "Родител";
 $SurveyAdded = "Добавена е анкета.";
 $WikiAdded = "Добавено е Wiki.";
 $ReadOnly = "Само за четене";
+$Unacceptable = "Не се приема";
 $HistoryTrainingSession = "История на обучителната сесия";
 $FirstPage = "Първа страница";
 $LastPage = "Последна страница";
 $Coachs = "Инструктори";
+$langNameOfLang['bosnian'] = "босненски";
+$langNameOfLang['czech'] = "чешки";
+$langNameOfLang['dari'] = "дари";
+$langNameOfLang['friulian'] = "фурлан";
+$langNameOfLang['georgian'] = "грузински";
+$langNameOfLang['korean'] = "корейски";
+$langNameOfLang['latvian'] = "латвийски";
+$langNameOfLang['lithuanian'] = "литовски";
+$langNameOfLang['macedonian'] = "македонски";
+$langNameOfLang['norwegian'] = "норвежки";
+$langNameOfLang['pashto'] = "пущунски";
+$langNameOfLang['persian'] = "фарси";
+$langNameOfLang['quechua_cusco'] = "кечуа";
+$langNameOfLang['romanian'] = "румънски";
+$langNameOfLang['serbian'] = "сръбски";
+$langNameOfLang['slovak'] = "словашки";
+$langNameOfLang['swahili'] = "суахили";
+$langNameOfLang['trad_chinese'] = "традиционен китайски";
+$ChamiloInstallation = "Инсталиране на Chamilo";
+$langNameOfLang['ukrainian'] = "украински";
+$langNameOfLang['yoruba'] = "йоруба";
+$New = "Нов";
+$YouMustToInstallTheExtensionLDAP = "Разширението LDAP трябва да бъде инсталирано.";
+$InvitationDenied = "Поканата е отказана.";
+$UserAdded = "Добавен е потребител.";
+$Metadata = "Метаданни";
+$langAddMetadata = "Преглед / редактиране на метаданните";
+$SendMessage = "Изпращане на съобщение";
+$NoDataAvailable = "Няма данни.";
+$EditMyProfile = "Редактиране на профила";
+$Announcements = "Обяви";
+$Password = "Парола";
+$DescriptionGroup = "Описание на групата";
+$Installation = "Инсталиране";
+$ReadTheInstallationGuide = "Прочетете ръководството за инсталиране.";
+$InstallChamilo = "Инсталиране на Chamilo";
 $TitleColumnGradebook = "Име на колоната в отчета за оценяване";
 $QualifyWeight = "Тегло на оценката";
+$EditProfile = "Редактиране на профила";
+$Timezone = "Времева зона";
+$LoginEnter = "Добре (Ok)";
+$AditionalNotes = "Бележки";
 ?>

+ 10 - 0
main/lang/english/trad4all.inc.php

@@ -845,4 +845,14 @@ $ToolCourseMaintenance = "Backup";
 $AreYouSureToDeleteAllDates = "Are you sure you want to delete all dates?";
 $AddADateTime = "Add a date time";
 $DeleteAllAttendances = "Delete all created attendances";
+$ThematicControl = "Thematic control";
+$ThematicDetails = "Thematic view with details";
+$ThematicList = "Thematic view as list";
+$Thematic = "Thematic";
+$ThematicPlan = "Thematic plan";
+$EditThematicPlan = "Edit tematic advance";
+$ThereIsNoStillAthematicSection = "There is not still a thematic section";
+$NewThematicSection = "New thematic section";
+$DeleteAllThematics = "Delete all thematics";
+$EditTematicAdvance = "Edit tematic advance";
 ?>

+ 0 - 1
main/lang/french/tracking.inc.php

@@ -250,7 +250,6 @@ $DashboardList = "Liste du panneau de contrôle";
 $YouHaveNotEnabledBlocks = "Vous n'avez activé aucun bloc";
 $BlocksHaveBeenUpdatedSuccessfully = "Les blocs ont été mis à jour";
 $AssignSessionsTo = "Assigner des sessions à %s";
-$DeleteAllAttendances = "Supprimer toutes les assistances créées";
 $AttendanceSheetDescription = "Les répertoires de présences vous permettent de réunir les feuilles de présences par groupe. Par exemple, vous pourriez vouloir prendre les présence pour les cours théoriques séparément des cours pratiques.
 Chaque élément montrera tous les apprenants comme présents par défaut. C'est à vous de noter leur absence en décochant les cases correspondantes.";
 $AttendanceSheetReport = "Rapport de présences";

+ 12 - 0
main/lang/galician/admin.inc.php

@@ -1168,4 +1168,16 @@ $Section = "Sección";
 $Expected = "Esperado";
 $Setting = "Parámetro";
 $Current = "Actual";
+$SessionGCMaxLifetimeInfo = "O tempo máximo de vida do recolector de lixo é o tempo máximo que se da entre dúas execucións do recolector de lixo";
+$PHPVersionInfo = "Versión PHP";
+$FileUploadsInfo = "A carga de arquivos indica se a subida de arquivos está autorizada";
+$UploadMaxFilesizeInfo = "Tamaño máximo dun arquivo cando se sube. Este axuste debe, na maioría dos casos, ir acompañado da variable post_max_size";
+$MagicQuotesRuntimeInfo = "Esta é unha característica non recomendada que convirte os valores devoltos por todas as funcións que devolven valores externos en valores con barras de escape. Esta funcionalidade *non* debería activarse";
+$PostMaxSizeInfo = "Este é o tamaño máximo dos envíos realizados ao través de formularios utilizando o método POST (é dicir, a forma típica de carga de arquivos mediante formularios)";
+$SafeModeInfo = "Modo seguro é unha característica obsoleta de PHP que limita (mal) o acceso dos scripts PHP a outros recursos. Recoméndase deixalo desactivado";
+$DisplayErrorsInfo = "Amosa os erros na pantalla. Activalo en servidores de desenvolvemento e desactivalo en servidores de produción";
+$MaxInputTimeInfo = "O tempo máximo permitido para que un formulario sexa procesado polo servidor. Se se sobrepasa, o proceso abandoase e devolve unha páxina en branco";
+$DefaultCharsetInfo = "Xogo de caracteres predeterminado que será enviado cando se devolvan as páxinas";
+$RegisterGlobalsInfo = "Permite seleccionar, ou non, o uso de variables globais. O uso desta funcionalidade representa un risco de seguridade";
+$ShortOpenTagInfo = "Permite utilizar etiquetas abreviadas ou non. Esta funcionalidade non se debería usar";
 ?>

+ 11 - 11
main/lang/slovenian/tracking.inc.php

@@ -5,14 +5,14 @@ for more information: see languages.txt in the lang folder.
 $langToolName = "Uvoz tečajev Blackboard";
 $TrackingDisabled = "Sledenje je onemogočil administrator.";
 $InactivesStudents = "Neaktivni tečajniki";
-$AverageTimeSpentOnThePlatform = "Povprečen čas porabljen na platformi";
-$AverageCoursePerStudent = "Povprečno število tečajev na uporabnika";
-$AverageProgressInLearnpath = "Povprečen napredek v učnih poteh";
-$AverageResultsToTheExercices = "Povprečen rezultat vaj in testov";
+$AverageTimeSpentOnThePlatform = "Čas porabljen na platformi";
+$AverageCoursePerStudent = "Število tečajev na uporabnika";
+$AverageProgressInLearnpath = "Napredek v tečajih";
+$AverageResultsToTheExercices = "Rezultati vaj/testov";
 $SeeStudentList = "Poglej seznam uporabnikov";
 $NbActiveSessions = "Aktivne seje";
 $NbPastSessions = "Pretekle seje";
-$NbFutureSessions = "Prihodnje seje";
+$NbFutureSessions = "Prihajajoče seje";
 $NbStudentPerSession = "Število uporabnikov na sejo";
 $NbCoursesPerSession = "Št. tečajev na sejo";
 $SeeSessionList = "Poglej seznam sej";
@@ -22,12 +22,12 @@ $langToolsAccess = "Dostop do orodij";
 $langCourseAccess = "Dostop do tečaja";
 $langLinksAccess = "Povezave";
 $langDocumentsAccess = "Dokumenti";
-$langScormAccess = "Učna pot";
-$langLinksDetails = "Povezave, ki jih je uporabil tečajnik";
-$langWorksDetails = "Izdelki, ki jih je objavil (uploaded) tečajnik v imenu 'Avtorjev'";
+$langScormAccess = "Tečaji";
+$langLinksDetails = "Uporabljene povezave";
+$langWorksDetails = "Oddani (naloženi) izdelki";
 $langLoginsDetails = "Klikni na ime meseca za dodatne podrobnosti";
-$langDocumentsDetails = "Dokumenti, ki si jih je tečajnik prepisal (downloaded)";
-$langExercicesDetails = "Rezultat opravljenih vaj";
+$langDocumentsDetails = "Prenešeni dokumenti";
+$langExercicesDetails = "Rezultati vaj/testov";
 $langBackToList = "Povratek na seznam uporabnikov";
 $langDetails = "Podrobnosti";
 $langStatsOfCourse = "Statistika tečaja";
@@ -40,7 +40,7 @@ $langLoginsTitleCountColumn = "Število vstopov";
 $langToolTitleToolnameColumn = "Ime orodja";
 $langToolTitleUsersColumn = "Kliki uporabnikov";
 $langToolTitleCountColumn = "Celotno število klikov";
-$langLinksTitleLinkColumn = "Povezave";
+$langLinksTitleLinkColumn = "Povezava";
 $langLinksTitleUsersColumn = "Kliki uporabnikov";
 $langLinksTitleCountColumn = "Celotno število klikov";
 $langExercicesTitleExerciceColumn = "Vaja";

+ 54 - 54
main/lang/slovenian/trad4all.inc.php

@@ -6,7 +6,7 @@ $Title = "Naslov";
 $By = "(Od)";
 $UsersOnline = "Aktivnih uporabnikov";
 $Remove = "Odstrani";
-$langEnter = "Povratek na seznam mojih tečajev";
+$langEnter = "Nazaj na seznam tečajev";
 $Description = "Opis";
 $Links = "Povezave";
 $langWorks = "Objave tečajnikov";
@@ -20,11 +20,11 @@ $langNewDir = "Ime nove mape";
 $langDirCr = "Mapa je narejena";
 $Download = "Prenos";
 $langGroup = "Skupine";
-$langEdit = "uredi";
+$langEdit = "Uredi";
 $langGroupForum = "Forum skupine";
 $Language = "Jezik";
 $LoginName = "Uporabniško ime";
-$AutostartMp3 = "Kliknite OK, če želite, da bo avdio datoteka predvajana avtomatično";
+$AutostartMp3 = "Želite, da se avdio datoteka predvaja avtomatično?";
 $Assignments = "Zadolžitve";
 $Forum = "Forumi";
 $langDelImage = "Odstrani sliko";
@@ -33,32 +33,32 @@ $langUp = "Gor";
 $Down = "dol";
 $Up = "gor";
 $Theme = "Tema";
-$TheListIsEmpty = "Seznam je prazen.";
-$langUniqueSelect = "Večkratna izbira (En odgovor)";
+$TheListIsEmpty = "Prazno";
+$langUniqueSelect = "Večkratna izbira";
 $CreateCategory = "Ustvari kategorijo";
 $SendFile = "Pošlji datoteko";
 $SaveChanges = "Shrani spremembe";
 $SearchTerm = "Iskani izraz";
 $TooShort = "Prekratko";
-$langCourseCreate = "Tvori spletno stran tečaja";
+$langCourseCreate = "Tvori tečaj";
 $langTodo = "Predlogi";
 $UserName = "Uporabniško ime";
 $lang_show_hide = "Prikaži / skrij";
-$langCategoryMod = "Spremeni kategorijo";
+$langCategoryMod = "Uredi kategorijo";
 $Hide = "Skrij";
 $langDear = "Spoštovani";
 $langArchive = "arhiv";
-$langCourseCode = "Koda tečaja";
+$langCourseCode = "Koda";
 $langNoDescription = "Brez opisa";
-$langOfficialCode = "Uradna koda";
+$langOfficialCode = "Koda";
 $FirstName = "Ime";
 $LastName = "Priimek";
-$Status = "Status";
+$Status = "Profil";
 $langEmail = "E-pošta";
 $SlideshowConversion = "Pretvorba prosojnic";
 $UploadFile = "Naloži datoteko";
 $AvailableFrom = "Dostopen od";
-$AvailableTill = "Dostopen do";
+$AvailableTill = "do";
 $Preview = "Predogled";
 $Type = "Vrsta";
 $EmailAddress = "E-poštni naslov";
@@ -69,11 +69,11 @@ $Update = "Ažuriraj";
 $SelectQuestionType = "Izberi tip vprašanja";
 $CurrentCourse = "Trenuten tečaj";
 $Back = "Nazaj";
-$Info = "informacije";
+$Info = "Informacije";
 $Search = "Išči";
 $AdvancedSearch = "Napredno iskanje";
 $Open = "Prost odgovor";
-$Import = "Uvozi";
+$Import = "Uveljavi";
 $AddAnother = "Dodaj naslednjega";
 $Author = "Avtor";
 $TrueFalse = "Pravilno / Nepravilno";
@@ -81,7 +81,7 @@ $QuestionType = "Tip vprašanja";
 $NoSearchResults = "Iskanje se je zaključilo brez rezultatov";
 $SelectQuestion = "Izberi vprašanje";
 $AddNewQuestionType = "Dodaj nov tip vprašanja";
-$Numbered = "Oštevilčen";
+$Numbered = "Oštevilčeno";
 $iso639_2_code = "sl";
 $iso639_1_code = "slv";
 $charset = "utf-8";
@@ -101,13 +101,13 @@ $langAllowed = "Dovoljeno";
 $langBackHome = "Povratek na domačo stran";
 $langPropositions = "Predlogi izboljšav";
 $langMaj = "Ažuriraj";
-$langModify = "spremeni";
+$langModify = "Uredi";
 $langDelete = "odstrani";
-$langInvisible = "Skrij";
-$langSave = "Shrani";
+$langInvisible = "nevidno";
+$langSave = "Pošlji sporočilo";
 $langMove = "Premakni";
 $Help = "Pomoč";
-$langOk = "OK";
+$langOk = "Uveljavi";
 $langAdd = "Dodaj";
 $langAddIntro = "Dodaj uvodno besedilo";
 $langBackList = "Vrni se na seznam";
@@ -116,11 +116,11 @@ $langEmpty = "Nekaj polj si pustil praznih.<br />V brkljalniku se <b>vrni</b>  n
 $langConfirmYourChoice = "Potrdi izbiro";
 $langAnd = "in";
 $langChoice = "Tvoja izbira";
-$langFinish = "Končaj";
+$langFinish = "Zaključi test";
 $langCancel = "Prekliči";
 $langNotAllowed = "Ni dovoljeno";
 $langNotLogged = "Nisi prijavljen v tečaj";
-$langManager = "upravitelj";
+$langManager = "Upravitelj";
 $langOptional = "Opcija";
 $NextPage = "Naslednja stran";
 $PreviousPage = "Predhodna stran";
@@ -134,16 +134,16 @@ $langDate = "Datum";
 $langAmong = "izmed";
 $langShow = "Prikaži";
 $langMyCourses = "Moji tečaji";
-$langModifyProfile = "Moj profil";
-$langMyStats = "Vpogled v mojo statistiko";
+$langModifyProfile = "Profil";
+$langMyStats = "Poglej moje napredovanje";
 $langLogout = "Odjava";
-$langMyAgenda = "Moja agenda";
+$langMyAgenda = "Osebna agenda";
 $langCourseHomepage = "Domača stran tečaja";
 $langCourseManagerview = "Učiteljev pogled";
 $langStudentView = "Uporabnikov pogled";
 $AddResource = "Dodaj";
 $AddedResources = "Priponke";
-$lang_modify_resource = "Spremeni / Dodaj resurse";
+$lang_modify_resource = "Uredi / Dodaj resurse";
 $lang_resource = "Resurs";
 $lang_resources = "Resursi";
 $langNameOfLang['arabic'] = "arabic";
@@ -169,24 +169,24 @@ $langNameOfLang['russian'] = "russian";
 $langNameOfLang['simpl_chinese'] = "simpl_chinese";
 $langNameOfLang['spanish'] = "spanish";
 $Close = "zapri";
-$langPlatform = "Platforma";
+$langPlatform = "Portal";
 $localLangName = "jezik";
 $email = "e-pošta";
 $langCourseCodeAlreadyExists = "Oprostite, koda tečaja že obstaja. Izberite drugo kodo.";
 $Statistics = "Statistika";
-$langGrouplist = "seznam skupine";
+$langGrouplist = "Seznam skupine";
 $langPrevious = "prejšnji";
 $DestDirectoryDoesntExist = "Ciljna mapa ne obstaja";
 $Courses = "tečaji";
 $In = "v";
 $langShowAll = "Prikaži vse";
-$langPage = "stran";
+$langPage = "Stran";
 $englishLangName = "English";
 $Home = "Domov";
 $langAreYouSureToDelete = "Ali resnično želiš brisanje";
 $SelectAll = "Izberi vse";
-$UnSelectAll = "izberi nobenega";
-$WithSelected = "z izbranimi";
+$UnSelectAll = "Izberi nobenega";
+$WithSelected = "Z izbranimi";
 $langOnLine = "Aktiven";
 $langUsers = "Uporabniki";
 $langPlatformAdmin = "Administracija platforme";
@@ -200,18 +200,18 @@ $langNameOfLang['thai'] = "thai";
 $langNameOfLang['turkce'] = "turkish";
 $langNameOfLang['vietnamese'] = "vietnamese";
 $UserInfo = "informacije o uporabniku";
-$langModifyQuestion = "Uredi vprašanje";
-$langNameOfLang = "yme jezika";
+$langModifyQuestion = "Shrani vprašanje";
+$langNameOfLang = "Ime jezika";
 $langCheckAll = "Izberi vse";
 $langNbAnnoucement = "Obvestilo";
 $lang_no_access_here = "Tu ni dostopa";
 $langOtherCourses = "ostali tečaji";
-$Doc = "dokument";
-$PlataformAdmin = "Admin platforme";
+$Doc = "Tečaj";
+$PlataformAdmin = "Admin portala";
 $Groups = "Skupine";
 $GroupManagement = "Upravljanje skupin";
-$All = "vsi";
-$None = "Brez";
+$All = "Vsi";
+$None = "noben";
 $langSorry = "Najprej izberite tečaj";
 $langDenied = "Ta funkcija je dostopna le administratorjem tečaja";
 $Today = "danes";
@@ -285,30 +285,30 @@ $PleaseTryAgain = "Prosim, poskusite znova!";
 $UplNoFileUploaded = "Nobena datoteke ni bila naložena.";
 $UplSelectFileFirst = "Izberite datoteko predenj pritisnete na gumb Naloži.";
 $UplNotAZip = "Datoteka, ki ste jo izbrali, ni ZIP datoteka.";
-$UplUploadSucceeded = "Prepis je bil uspešen!";
+$UplUploadSucceeded = "Nalaganje je bilo uspešno!";
 $ExportAsCSV = "Izvozi kot CSV datoteko";
-$ExportAsXLS = "Izvozi kot XLS datoteko";
+$ExportAsXLS = "Izvozi kot Excel datoteko";
 $langOpenarea = "Osebna interesna področja";
 $Done = "Končano";
 $Documents = "Dokumenti";
 $DocumentAdded = "Dokument dodan";
 $DocumentUpdated = "Dokument ažuriran";
 $DocumentInFolderUpdated = "Dokument ažuriran v mapi";
-$Course_description = "Opis tečaja";
+$Course_description = "Opis";
 $Calendar_event = "Agenda";
 $Document = "Dokument";
-$Learnpath = "Učna pot";
-$Link = "Povezava";
+$Learnpath = "Tečaji";
+$Link = "Povezave";
 $Announcement = "Obvestila";
 $Dropbox = "Nabiralnik";
-$Quiz = "Vaje";
-$langChat = "Klepetalnica";
+$Quiz = "Testi";
+$langChat = "Klepet";
 $Conference = "Konference";
 $Student_publication = "Izdelki tečajnikov";
 $Tracking = "Sledenje";
 $langhomepage_link = "Dodaj povezavo na to stran";
-$Course_setting = "Nastavitve tečaja";
-$langbackup = "Arhiviranje tečaja";
+$Course_setting = "Nastavitve";
+$langbackup = "Arhiviranje in uvoz";
 $langcopy_course_content = "Kopiranje vsebin tečaja";
 $langrecycle_course = "Recikliranje tečaja";
 $StartDate = "Začetni datum";
@@ -318,7 +318,7 @@ $EndTime = "Končni čas";
 $langYouWereCalled = "Pozvan si na klepet z";
 $langDoYouAccept = "Ali ga sprejmeš ?";
 $Everybody = "Vsi";
-$SentTo = "Prejemniki";
+$SentTo = "Vidno za";
 $Export = "Izvozi";
 $Tools = "Orodja";
 $Everyone = "Vsi";
@@ -327,13 +327,13 @@ $Student = "Tečajnik";
 $Teacher = "Učitelj";
 $Send2All = "Niste izbrali uporabnika / skupine. Element je viden vsem uporabnikom";
 $Wiki = "Wiki skupine";
-$Complete = "popolno";
+$Complete = "Popolno";
 $Incomplete = "Nepopolno";
-$reservation = "rezervacija";
+$reservation = "Rezerviraj resurs";
 $StartTimeWindow = "Začetek";
 $EndTimeWindow = "Konec";
 $AccessNotAllowed = "Dostop do te strani ni dovoljen / not allowed";
-$InThisCourse = "V tem tečaju";
+$InThisCourse = "v tem tečaju";
 $ThisFieldIsRequired = "zahtevano polje";
 $AllowedHTMLTags = "Dovoli HTML oznake";
 $FormHasErrorsPleaseComplete = "Obrazec vsebuje nepopolne ali nepravilne podatke. Preveri jih ponovno.";
@@ -348,8 +348,8 @@ $ViewRight = "Poglej";
 $EditRight = "Uredi";
 $DeleteRight = "Odstrani";
 $OverviewCourseRights = "Pregled vlog in pravic";
-$SeeAllRightsAllLocationsForSpecificRole = "Glede na vloge";
-$SeeAllRolesAllLocationsForSpecificRight = "Poglej vse vloge in lokacije za specifično pravico";
+$SeeAllRightsAllLocationsForSpecificRole = "Glede na vlogo";
+$SeeAllRolesAllLocationsForSpecificRight = "Glede na pravico";
 $langAdvanced = "Zgradi";
 $RightValueModified = "Vrednost je bila spremenjena.";
 $course_rights = "Pregled vlog in pravic";
@@ -365,7 +365,7 @@ $Anonymous = "Anonimno";
 $h = "ur";
 $CreateNewGlobalRole = "Ustvari novo globalno vlogo";
 $CreateNewLocalRole = "Ustvari novo lokalno vlogo";
-$Actions = "Akcija";
+$Actions = "Podrobno";
 $Inbox = "Prejeto";
 $ComposeMessage = "Sestavi sporočilo";
 $Other = "Ostalo";
@@ -374,7 +374,7 @@ $CampusHomepage = "Domača stran portala";
 $YouHaveNewMessage = "Imaš novo sporočilo !";
 $myActiveSessions = "Moje aktivne seje";
 $myInactiveSessions = "Moje neaktivne seje";
-$FileUpload = "Prenos datoteke";
+$FileUpload = "Nalaganje datoteke";
 $langMyActiveSessions = "Moje aktivne seje";
 $langMyInActiveSessions = "Moje neaktivne seje";
 $langMySpace = "Poročila";
@@ -405,10 +405,10 @@ $NoTel = "Ni tel";
 $SendMail = "Pošlji e-pošto";
 $RdvAgenda = "Zapis agende";
 $VideoConf = "Video konferenca";
-$MyProgress = "Moj napredek";
+$MyProgress = "Napredek";
 $NoOnlineStudents = "Ni aktivnih tečajnikov";
 $InCourse = "v tečaju";
-$UserOnlineListSession = "Seznam trenutno aktivnih tečajnikov - Seja";
+$UserOnlineListSession = "Aktivni tečajni - v mojih učnih sejah";
 $From = "Od";
 $To = "Za";
 $Content = "Vsebina";

+ 1 - 1
main/lang/spanish/announcements.inc.php

@@ -18,7 +18,7 @@ $langOn = "Hay";
 $langRegUser = "usuarios inscritos en el curso";
 $langUnvalid = "tienen una dirección de correo inválida o una dirección de correo sin especificar";
 $langModifAnn = "Modificar este anuncio";
-$langModify = "modificar";
+$langModify = "Modificar";
 $langDelete = "Eliminar";
 $langTitle = "Título";
 $langHelp = "ayuda";

+ 1 - 0
main/lang/spanish/course_info.inc.php

@@ -116,4 +116,5 @@ $NewUserEmailAlertDisable = "Desactivar el aviso por correo electrónico de la a
 $AllowUserViewUserList = "Permitir al usuario ver la lista de usuarios";
 $AllowUserViewUserListActivate = "Activar permitir al usuario ver la lista de usuarios";
 $AllowUserViewUserListDeactivate = "Desactivar permitir al usuario ver la lista de usuarios";
+$DoNotDisplayAnyAdvance = "No mostrar ningún avance";
 ?>

+ 1 - 0
main/lang/spanish/learnpath.inc.php

@@ -247,4 +247,5 @@ $SaveAudioAndOrganization = "Guardar audio y Organización";
 $UploadOnlyMp3Files = "Por favor, envíe sólo archivos mp3";
 $ModifyHotPotatoes = "Modificar hotpotatoes";
 $SaveHotpotatoes = "Guardar hotpotatoes";
+$ReturnToLPList = "Volver a lista de lecciones";
 ?>

+ 38 - 1
main/lang/spanish/trad4all.inc.php

@@ -845,4 +845,41 @@ $ToolCourseMaintenance = "Mantenimiento del curso";
 $AreYouSureToDeleteAllDates = "¿Confirma que desea borrar todas las fechas?";
 $AddADateTime = "Añadir fecha";
 $DeleteAllAttendances = "Eliminar todas las asistencias creadas";
-?>
+$ThematicControl = "Control tematico";
+$ThematicDetails = "Vista temática con detalles";
+$ThematicList = "Vista temática como lista";
+$Thematic = "Temática";
+$ThematicPlan = "Plan temático";
+$EditThematicPlan = "Editar plan temático";
+$EditThematicAdvance = "Editar avance temático";
+$ThereIsNoStillAthematicSection = "Todavía no hay una sección temática";
+$NewThematicSection = "Nueva sección temática";
+$DeleteAllThematics = "Borrar todas las temáticas";
+$ThematicDetailsDescription = "Se detalla las temáticas con sus respectivos planes y avances, para asignar un avance como terminado se debe seleccionar la fecha de acuerdo al orden y el sistema determinará las anteriores fechas como terminadas";
+$SkillToAcquireQuestions = "¿Qué habilidades se adquieren al término de esta sección temática?";
+$SkillToAcquire = "Habilidad a adquirir";
+$InfrastructureQuestions = "¿Qué infraestructura es necesaria para llevar a cabo con normalidad esta sección temática?";
+$Infrastructure = "Infraestructura";
+$AditionalNotesQuestions = "¿Qué otras cosas se requiere?";
+$DurationInHours = "Duración en horas";
+$ThereAreNoAttendancesInsideCourse = "No hay asistencias dentro del curso";
+$YouMustSelectAtleastAStartDate = "Seleccione al menos una fecha de inicio";
+$EditTematicAdvance = "Editar avance temático";
+$AditionalNotes = "Notas adicionales";
+$StartDateFromAnAttendance = "Fecha de inicio a partir de una asistencia";
+$StartDateCustom = "Fecha de inicio personalizado";
+$StartDateOptions = "Opciones de fecha de inicio";
+$ThematicAdvanceConfiguration = "Configuración para el avance temático";
+$InfoAboutAdvanceInsideHomeCourse = "Información sobre el avance temático en la página principal del curso";
+$DisplayAboutLastDoneAdvance = "Mostrar información sobre el último avance temático hecho";
+$DisplayAboutNextAdvanceNotDone = "Mostrar información sobre el siguiente avance temático que no esta hecho";
+$InfoAboutLastDoneAdvance = "Información sobre el último avance temático realizado";
+$InfoAboutNextAdvanceNotDone = "Información sobre el siguiente avance temático que aún no se ha realizado";
+$ThereIsNoAThematicSection = "No hay una sección temática";
+$ThereIsNoAThematicAdvance = "No existe un avance temático";
+$StillDoNotHaveAThematicPlan = "Aún no tiene un plan temático";
+$NewThematicAdvance = "Nuevo avance temático";
+$DurationInHoursMustBeNumeric = "La duración en horas debe ser un número";
+$EditThematicSection = "Editar sección temática";
+$CreateAThematicSection = "Crear una sección temática";
+?>

+ 1 - 1
main/mySpace/myStudents.php

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

+ 4 - 3
main/newscorm/content_makers.inc.php

@@ -18,7 +18,9 @@
   	'Blackboard',
   	'Calfat',
   	'Captivate',
-  	'Claroline',
+    'Chamilo',
+    'Chamilo 2',
+    'Claroline',
 	'Commest',
 	'Coursebuilder',
 	'Docent',
@@ -47,5 +49,4 @@
 	'U&I Learning',
     'Udutu',
 	'WebCT'
-  );
-?>
+  );

+ 8 - 4
main/newscorm/learnpath.class.php

@@ -2760,15 +2760,19 @@ class learnpath {
 			if ($this->get_lp_session_id()==api_get_session_id()) {
 				$html .= '<div class="actions_lp">';
 				if ($display_action_links_with_icons) {
-					$html .= '<a href="lp_controller.php?' . api_get_cidreq() . '">'. get_lang('CourseList') . '</a>';
+					$html .= '<div style = "text-align:center;">';
 					$html .= "<a href='lp_controller.php?" . api_get_cidreq() . "&amp;action=build&amp;lp_id=" . $this->lp_id . "' target='_parent'>" . Display :: return_icon('learnpath_build.gif', get_lang('Build')) . ' ' . get_lang('Build') . "</a>";
 					$html .= "<a href='lp_controller.php?" . api_get_cidreq() . "&amp;action=admin_view&amp;lp_id=" . $this->lp_id . "' target='_parent'>" . Display :: return_icon('learnpath_organize.gif', get_lang('BasicOverview')) . ' ' . get_lang('BasicOverview') . "</a>";
-					$html .= '<span>' . Display :: return_icon('learnpath_view_na.gif', get_lang("Display")) . ' <b>' . get_lang("Display") . '</b></span>';
+					$html .= '<span>' . Display :: return_icon('learnpath_view_na.gif', get_lang("Display")) . ' <b>' . get_lang("Display") . '</b></span><br />';
+					$html .= '<a href="lp_controller.php?' . api_get_cidreq() . '">'. get_lang('ReturnToLPList') . '</a>';
+					$html .= '</div>';
 				} else {
-					$html .= '<a href="lp_controller.php?' . api_get_cidreq() . '">'. get_lang('CourseList') . '</a>';
+					$html .= '<div style = "text-align:center;">';
 					$html .= "<a href='lp_controller.php?" . api_get_cidreq() . "&amp;gradebook=$gradebook&amp;action=build&amp;lp_id=" . $this->lp_id . "' target='_parent'>" . get_lang('Build') . "</a>";
 					$html .= "<a href='lp_controller.php?" . api_get_cidreq() . "&amp;action=admin_view&amp;lp_id=" . $this->lp_id . "' target='_parent'>" . get_lang('BasicOverview') . "</a>";
-					$html .= '<span><b>' . get_lang('Display') . '</b></span>';
+					$html .= '<span><b>' . get_lang('Display') . '</b></span><br />';
+					$html .= '<a href="lp_controller.php?' . api_get_cidreq() . '">'. get_lang('ReturnToLPList') . '</a>';
+					$html .= '</div>';
 				}
 				$html .= '</div>';
 			}

+ 12 - 11
tests/main/inc/lib/internationalization.lib.test.php

@@ -1,12 +1,12 @@
 <?php
+/* For licensing terms, see /license.txt */
 
 /**
  * This is a test of internationalization.lib.php which is
  * a common purpose library for supporting internationalization
  * related functions. Only the public API is tested here.
  * @author Ricardo Rodriguez Salazar, 2009.
- * @author Ivan Tcholakov, September 2009.
- * For licensing terms, see /dokeos_license.txt
+ * @author Ivan Tcholakov, 2009-2010.
  *
  * Notes:
  * 1. While saving this file, please, preserve its UTF-8 encoding.
@@ -521,9 +521,10 @@ class TestInternationalization extends UnitTestCase {
 	public function test_api_ereg() {
 		$pattern = 'scorm/showinframes.php([^"\'&]*)(&|&amp;)file=([^"\'&]*)$';
 		$string = 'http://localhost/dokeos/main/scorm/showinframes.php?id=5&amp;file=test.php';
-		$res = api_ereg($pattern, $string);
+		$regs = array();
+		$res = api_ereg($pattern, $string, $regs);
 		$this->assertTrue(is_numeric($res));
-		$this->assertTrue($res == 45);
+		//var_dump($regs);
 		//var_dump($res);
 	}
 
@@ -538,13 +539,13 @@ class TestInternationalization extends UnitTestCase {
 		//var_dump($res);
 	}
 
-	public function testapi_eregi() {
+	public function test_api_eregi() {
 		$pattern = 'scorm/showinframes.php([^"\'&]*)(&|&amp;)file=([^"\'&]*)$';
 		$string = 'http://localhost/dokeos/main/scorm/showinframes.php?id=5&amp;file=test.php';
-		$regs = '';
+		$regs = array();
 		$res = api_eregi($pattern, $string, $regs);
 		$this->assertTrue(is_numeric($res));
-		$this->assertTrue($res == 45);
+		//var_dump($regs);
 		//var_dump($res);
 	}
 
@@ -1385,13 +1386,13 @@ class TestInternationalization extends UnitTestCase {
 		}
 		//var_dump('<pre>'.$res.'</pre>');
 	}
-	
+
 	public function test_api_get_local_time_with_datetime() {
 		$datetime_not_converted = '2010-03-13 16:24:02';
 		$datetime_gmtplus1 = api_get_local_time($datetime_not_converted, 'Europe/Paris', 'America/Lima');
 		$this->assertEqual($datetime_gmtplus1, '2010-03-13 22:24:02');
 	}
-	
+
 	public function test_api_get_local_time_with_timestamp() {
 		$current_timestamp = time();
 		$datetime = api_get_local_time($current_timestamp, 'Europe/Paris');
@@ -1400,7 +1401,7 @@ class TestInternationalization extends UnitTestCase {
 		$this->assertEqual($datetime, date('Y-m-d H:i:s', $current_timestamp));
 		date_default_timezone_set($system_timezone);
 	}
-	
+
 	public function test_api_get_utc_datetime_with_string() {
 		$timestamp = time();
 		$timezone = _api_get_timezone();
@@ -1411,7 +1412,7 @@ class TestInternationalization extends UnitTestCase {
 		$this->assertEqual($datetime_utc, gmdate('Y-m-d H:i:s', $timestamp));
 		date_default_timezone_set($system_timezone);
 	}
-	
+
 	public function test_api_get_utc_datetime_with_timestamp() {
 		$timestamp = time();
 		$this->assertEqual(api_get_utc_datetime($timestamp), gmdate("Y-m-d H:i:s", $timestamp));

+ 22 - 0
tests/main/inc/lib/text.lib.test.php

@@ -3,6 +3,28 @@ require_once(api_get_path(LIBRARY_PATH).'text.lib.php');
 
 class TestText extends UnitTestCase {
 
+	public function test_api_camel_case_to_underscore() {
+		$input_strings    = array('myDocuments', 'MyProfile', 'CreateNewCourse', 'Create_New_course');
+		$expected_results = array('my_documents', 'my_profile', 'create_new_course', 'create_new_course');
+		$results = array_map('api_camel_case_to_underscore', $input_strings);
+		$this->assertTrue($results == $expected_results);
+		//var_dump($results);
+	}
+
+	function test_api_underscore_to_camel_case() {
+		$input_strings     = array('my_documents', 'My_profile', 'create_new_course');
+		$expected_results1 = array('MyDocuments', 'MyProfile', 'CreateNewCourse');
+		$expected_results2 = array('myDocuments', 'MyProfile', 'createNewCourse');
+		$func = create_function('$param', 'return api_underscore_to_camel_case($param, false);');
+		$results1 = array('MyDocuments', 'MyProfile', 'CreateNewCourse');
+		$results2 = array('myDocuments', 'MyProfile', 'createNewCourse');
+		$results1 = array_map('api_underscore_to_camel_case', $input_strings);
+		$results2 = array_map($func, $input_strings);
+		$this->assertTrue($results1 == $expected_results1 && $results2 == $expected_results2);
+		//var_dump($results1);
+		//var_dump($results2);
+	}
+
 	function test_text_parse_glossary() {
 		$input='';
 		$res=_text_parse_glossary($input);