Prechádzať zdrojové kódy

Feature #306 - Trimming totally trailing whitespace in php-source files, part 3 (final), 161 files.

Ivan Tcholakov 15 rokov pred
rodič
commit
965f0ad605
100 zmenil súbory, kde vykonal 3054 pridanie a 3054 odobranie
  1. 1 1
      main/search/index.php
  2. 3 3
      main/search/search_suggestions.php
  3. 1 1
      main/social/contacts.inc.php
  4. 35 35
      main/social/data_personal.inc.php
  5. 4 4
      main/social/group_contact.inc.php
  6. 38 38
      main/social/index.php
  7. 185 185
      main/social/profile.php
  8. 6 6
      main/social/qualify_contact.inc.php
  9. 3 3
      main/social/register_friend.php
  10. 5 5
      main/social/select_friend_response.php
  11. 6 6
      main/social/select_options.php
  12. 6 6
      main/social/show_search_image.inc.php
  13. 28 28
      main/survey/create_new_survey.php
  14. 175 175
      main/survey/fillsurvey.php
  15. 1 1
      main/survey/preview.php
  16. 31 31
      main/survey/question.php
  17. 1 1
      main/survey/reporting.php
  18. 8 8
      main/survey/survey.download.inc.php
  19. 76 76
      main/survey/survey.lib.php
  20. 40 40
      main/survey/survey.php
  21. 6 6
      main/survey/survey_invite.php
  22. 5 5
      main/survey/survey_list.php
  23. 33 33
      main/template/exampletables.php
  24. 29 29
      main/template/template.php
  25. 34 34
      main/tracking/courseLog.php
  26. 91 91
      main/tracking/courseLogCSV.php
  27. 1 1
      main/tracking/course_access_details.php
  28. 1 1
      main/tracking/logins_details.php
  29. 40 40
      main/tracking/toolaccess_details.php
  30. 8 8
      main/tracking/userLog.php
  31. 19 19
      main/tracking/userlogCSV.php
  32. 1 1
      main/upload/form.document.php
  33. 1 1
      main/upload/form.scorm.php
  34. 1 1
      main/upload/index.php
  35. 8 8
      main/upload/upload.document.php
  36. 1 1
      main/upload/upload.php
  37. 1 1
      main/upload/upload.scorm.php
  38. 9 9
      main/upload/upload_ppt.php
  39. 10 10
      main/upload/upload_word.php
  40. 1 1
      main/user/class.php
  41. 1 1
      main/user/subscribe_class.php
  42. 94 94
      main/user/subscribe_user.php
  43. 9 9
      main/user/user.php
  44. 58 58
      main/user/userInfo.php
  45. 16 16
      main/user/userInfoLib.php
  46. 15 15
      main/user/user_add.php
  47. 2 2
      main/webservices/registration.soap.php
  48. 43 43
      main/wiki/diff.inc.php
  49. 9 9
      main/wiki/export_html2pdf.php
  50. 239 239
      main/wiki/index.php
  51. 217 217
      main/wiki/wiki.inc.php
  52. 3 3
      main/work/download.php
  53. 10 10
      main/work/downloadfolder.inc.php
  54. 233 233
      main/work/work.lib.php
  55. 229 229
      main/work/work.php
  56. 1 1
      plugin/date/index.act.php
  57. 2 2
      plugin/date/plugin.php
  58. 7 7
      plugin/search/client/filter_user.lib.php
  59. 11 11
      plugin/search/client/searchit.php
  60. 5 5
      plugin/search/client/www/indexer_login.php
  61. 10 10
      plugin/search/index.php
  62. 4 4
      plugin/search/plugin.php
  63. 2 2
      plugin/search/server/www/search.php
  64. 13 13
      plugin/search/server/www/search.xml.php
  65. 1 1
      tests/all.test1.php
  66. 3 3
      tests/all.test2.php
  67. 2 2
      tests/all.test3.php
  68. 1 1
      tests/datafiller/data_users.php
  69. 2 2
      tests/datafiller/fill_users.php
  70. 2 2
      tests/dokeostest.php
  71. 1 1
      tests/dummy.test.php
  72. 1 1
      tests/dummy2.test.php
  73. 73 73
      tests/main/admin/calendar.lib.test.php
  74. 42 42
      tests/main/admin/statistics/statistics.lib.test.php
  75. 8 8
      tests/main/admin/sub_language.class.test.php
  76. 8 8
      tests/main/auth/lost_password.lib.test.php
  77. 24 24
      tests/main/auth/openid/openid.lib.test.php
  78. 5 5
      tests/main/auth/openid/xrds.lib.test.php
  79. 5 5
      tests/main/chat/chat_functions.lib.test.php
  80. 1 1
      tests/main/conference/get_translation.lib.test.php
  81. 32 32
      tests/main/exercice/hotpotatoes.lib.test.php
  82. 5 5
      tests/main/inc/banner.inc.test.php
  83. 9 9
      tests/main/inc/course_document.inc.test.php
  84. 48 48
      tests/main/inc/lib/add_course.lib.inc.test.php
  85. 109 109
      tests/main/inc/lib/blog.lib.test.php
  86. 25 25
      tests/main/inc/lib/classmanager.lib.test.php
  87. 78 78
      tests/main/inc/lib/course.lib.test.php
  88. 51 51
      tests/main/inc/lib/database.lib.test.php
  89. 9 9
      tests/main/inc/lib/debug.lib.inc.test.php
  90. 31 31
      tests/main/inc/lib/display.lib.test.php
  91. 23 23
      tests/main/inc/lib/document.lib.test.php
  92. 13 13
      tests/main/inc/lib/events.lib.inc.test.php
  93. 13 13
      tests/main/inc/lib/export.lib.inc.test.php
  94. 20 20
      tests/main/inc/lib/fileDisplay.lib.test.php
  95. 30 30
      tests/main/inc/lib/fileManager.lib.test.php
  96. 72 72
      tests/main/inc/lib/fileUpload.lib.test.php
  97. 23 23
      tests/main/inc/lib/geometry.lib.test.php
  98. 82 82
      tests/main/inc/lib/groupmanager.lib.test.php
  99. 15 15
      tests/main/inc/lib/image.lib.test.php
  100. 1 1
      tests/main/inc/lib/import.lib.test.php

+ 1 - 1
main/search/index.php

@@ -14,7 +14,7 @@ if (extension_loaded('xapian')) {
 	include_once (api_get_path(LIBRARY_PATH).'debug.lib.inc.php');
 	include_once (api_get_path(LIBRARY_PATH).'system_announcements.lib.php');
 	include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
-	include_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');	
+	include_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
 	//api_block_anonymous_users(); // only users who are logged in can proceed
 	require '../newscorm/lp_list_search.php';
 } else {

+ 3 - 3
main/search/search_suggestions.php

@@ -37,7 +37,7 @@ function get_suggestions_from_search_engine($q) {
                 $field_val = array();
                 $sql2 = "SELECT * FROM $table_sfv where course_code = '$cc' AND tool_id = '$ti' AND ref_id = '$ri' ORDER BY field_id";
                 $res2 = api_sql_query($sql2,__FILE__,__LINE__);
-                // TODO this code doesn't manage multiple terms in one same field just yet (should duplicate results in this case) 
+                // TODO this code doesn't manage multiple terms in one same field just yet (should duplicate results in this case)
                 $field_id = 0;
                 while ($row2 = Database::fetch_array($res2)) {
                     //TODO : this code is not perfect yet. It overrides the
@@ -59,8 +59,8 @@ function get_suggestions_from_search_engine($q) {
                     	//We found the same field id twice, split the output
                         // array to allow for two sets of results (copy all
                         // existing array elements into copies and update the
-                        // copies) eg. Yannick - Car - Driving in $output[1] 
-                        // will create a copy as Yannick - Car - Speed 
+                        // copies) eg. Yannick - Car - Driving in $output[1]
+                        // will create a copy as Yannick - Car - Speed
                         // in $output[3]
                         $c = count($output);
                         for ($i=0;$i<$c; $i++) {

+ 1 - 1
main/social/contacts.inc.php

@@ -29,7 +29,7 @@ $image_path = UserManager::get_user_picture_path_by_id ($user_id,'web',false,tru
         echo '&nbsp;&nbsp;Dokeos&nbsp;&nbsp;-&nbsp;&nbsp;';
         $user_id=api_get_user_id();
         $user_info=api_get_user_info($user_id);
-        echo $name_user=api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName'])); 
+        echo $name_user=api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName']));
          ?></td>
         </tr>
     </table>

+ 35 - 35
main/social/data_personal.inc.php

@@ -7,73 +7,73 @@ require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
 require_once api_get_path(LIBRARY_PATH).'social.lib.php';
 require_once api_get_path(LIBRARY_PATH).'course.lib.php';
 
-// @todo here we must show the user information as read only 
+// @todo here we must show the user information as read only
 //User picture size is calculated from SYSTEM path
 $user_info= UserManager::get_user_info_by_id(api_get_user_id());
 $img_array= UserManager::get_user_picture_path_by_id(api_get_user_id(),'web',true,true);
 
 if (isset($_POST['load_ajax'])) {
 	require_once api_get_path(LIBRARY_PATH).'blog.lib.php';
-	require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';	
+	require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
 	$user_id = intval($_SESSION['social_user_id']);
 	if ($_POST['action']) {$action = $_POST['action'];}
 	switch($action) {
 		case 'load_course' :
 			$course_db =  $_POST['course_code'];
-			// @todo goto the course link							
+			// @todo goto the course link
 			//echo '<a href="'.api_get_path(WEB_COURSE_PATH).$course_directory.'/?id_session='.$my_course['id_session'].'">'.get_lang('GotoCourse').'</a>';
 			$course_id=CourseManager::get_course_id_by_database_name($course_db);
-	
+
 			if (api_is_user_of_course($course_id,api_get_user_id())) {
-				
+
 				$table_forums 			= Database :: get_course_table(TABLE_FORUM,$course_db);
 				$table_threads 			= Database :: get_course_table(TABLE_FORUM_THREAD,$course_db);
 				$table_posts 			= Database :: get_course_table(TABLE_FORUM_POST,$course_db);
 				$table_item_property 	= Database :: get_course_table(TABLE_ITEM_PROPERTY,$course_db);
 				$table_users 			= Database :: get_main_table(TABLE_MAIN_USER);
-				
+
 				//------Forum messages
-						
+
 				$forum_result = get_all_post_from_user($user_id, $course_db);
 				$all_result_data = 0;
-				if ($forum_result !='') {					
+				if ($forum_result !='') {
 					api_display_tool_title(get_lang('Forum'));
 					echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;" >';
 					echo api_xml_http_response_encode($forum_result);
-					echo '</div>';	
+					echo '</div>';
 					echo '<br />';
 					$all_result_data++;
-				}							
-				
+				}
+
 				//------Blog posts
-				$result = get_blog_post_from_user($course_db, $user_id); 
+				$result = get_blog_post_from_user($course_db, $user_id);
 				if (!empty($result)) {
 					echo '<div class="clear"></div><br />';
-					api_display_tool_title(api_xml_http_response_encode(get_lang('BlogPosts')));				
+					api_display_tool_title(api_xml_http_response_encode(get_lang('BlogPosts')));
 					echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">';
 					echo api_xml_http_response_encode($result);
 					echo '</div>';
 					echo '<br />';
-					$all_result_data++;				
+					$all_result_data++;
 				}
-				
-				//------Blog comments			
-				$result = get_blog_comment_from_user($course_db, $user_id); 
+
+				//------Blog comments
+				$result = get_blog_comment_from_user($course_db, $user_id);
 				if (!empty($result)) {
-					api_display_tool_title(api_xml_http_response_encode(get_lang('BlogComments')));							
+					api_display_tool_title(api_xml_http_response_encode(get_lang('BlogComments')));
 					echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">';
 					echo api_xml_http_response_encode($result);
 					echo '</div>';
 					echo '<br />';
-					$all_result_data++;		
+					$all_result_data++;
 				}
 				if ($all_result_data == 0) {
 					echo api_xml_http_response_encode(get_lang('NoDataAvailable'));
 				}
-				
+
 			} else {
 					echo '<div class="clear"></div><br />';
-					api_display_tool_title(api_xml_http_response_encode(get_lang('Details')));	
+					api_display_tool_title(api_xml_http_response_encode(get_lang('Details')));
 					echo '<div class="social-background-content" style="background:#FAF9F6; padding:0px;">';
 					echo api_xml_http_response_encode(get_lang('UserNonRegisteredAtTheCourse'));
 					echo '<div class="clear"></div><br />';
@@ -85,7 +85,7 @@ if (isset($_POST['load_ajax'])) {
 			//echo 'load2';
 		break;
 		default:
-					
+
 	}
 } else {
 	// normal behavior
@@ -96,11 +96,11 @@ $language_variable=api_xml_http_response_encode(get_lang('PersonalData'));
 	echo '<div class="actions">';
 	echo '<a href="../auth/profile.php?show=1"">'.Display::return_icon('edit.gif',api_xml_http_response_encode(get_lang('EditInformation'))).'&nbsp;'.api_xml_http_response_encode(get_lang('EditInformation')).'</a>&nbsp;&nbsp;';
 	if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true' && api_get_user_id()<>2 && api_get_user_id()<>0) {
-		echo '<a href="../social/profile.php?shared=true">'.Display::return_icon('shared_profile.png',api_xml_http_response_encode(get_lang('ViewSharedProfile'))).'&nbsp;'.api_xml_http_response_encode(get_lang('ViewSharedProfile')).'</a>';		
+		echo '<a href="../social/profile.php?shared=true">'.Display::return_icon('shared_profile.png',api_xml_http_response_encode(get_lang('ViewSharedProfile'))).'&nbsp;'.api_xml_http_response_encode(get_lang('ViewSharedProfile')).'</a>';
 	}
-	echo '</div>';	
-	echo '<div id="profile_container">';			
-		echo '<div class="social-profile-info" style="float:left;position:relative">';			
+	echo '</div>';
+	echo '<div id="profile_container">';
+		echo '<div class="social-profile-info" style="float:left;position:relative">';
 			echo '<dt>'.api_xml_http_response_encode(get_lang('UserName')).'</dt>
 			<dd>'. api_xml_http_response_encode($user_info['username']).'	</dd>';
 			if (api_is_western_name_order()) {
@@ -114,19 +114,19 @@ $language_variable=api_xml_http_response_encode(get_lang('PersonalData'));
 				echo '<dt>'.api_xml_http_response_encode(get_lang('FirstName')).'</dt>
 				<dd>'. api_xml_http_response_encode($user_info['firstname']).'</dd>';
 			}
-			echo '<dt>'.api_xml_http_response_encode(get_lang('OfficialCode')).'</dt>	
+			echo '<dt>'.api_xml_http_response_encode(get_lang('OfficialCode')).'</dt>
 			<dd>'. api_xml_http_response_encode($user_info['official_code']).'</dd>';
 			echo '<dt>'.api_xml_http_response_encode(get_lang('Email')).'</dt>
 			<dd>'. api_xml_http_response_encode($user_info['email']).'</dd>';
 			echo '<dt>'.api_xml_http_response_encode(get_lang('Phone')).'</dt>
-			<dd>'. api_xml_http_response_encode($user_info['phone']).'</dd>';			
+			<dd>'. api_xml_http_response_encode($user_info['phone']).'</dd>';
 		echo '</div>';
-		
+
 		echo '<div style="float:left;position:relative">';
-		echo '<div id="picture" style="width:200px;float:left;position:relative;margin-top:10px;">'; 
+		echo '<div id="picture" style="width:200px;float:left;position:relative;margin-top:10px;">';
 			echo '<img src='.$img_array['dir'].$img_array['file'].' />';
-		echo '</div>';	
-		/*if (api_get_setting('allow_message_tool')=='true') {	
+		echo '</div>';
+		/*if (api_get_setting('allow_message_tool')=='true') {
 			require_once api_get_path(LIBRARY_PATH).'message.lib.php';
 			$number_of_new_messages = MessageManager::get_new_messages();
 			$number_of_outbox_message=MessageManager::get_number_of_messages_sent();
@@ -139,13 +139,13 @@ $language_variable=api_xml_http_response_encode(get_lang('PersonalData'));
 					<p>
 						<a href="../social/index.php#remote-tab-2" class="message-body">'.get_lang('Inbox').$cant_msg.' </a><br />
 						<a href="../social/index.php#remote-tab-3" class="message-body">'.get_lang('Outbox').$cant_out_box.'</a><br />
-					</p>';		
+					</p>';
 			echo '<img src="../img/delete.gif" alt="'.get_lang('Close').'" title="'.get_lang('Close').'"  class="message-delete" onclick="delete_message_js()" />';
 			if ($number_of_new_messages_of_friend>0) {
 				echo '<br/>';
 			}
 			echo '</div>';
-		}*/				
-		echo '</div>';			
+		}*/
+		echo '</div>';
 }
 ?>

+ 4 - 4
main/social/group_contact.inc.php

@@ -42,7 +42,7 @@ for ($p=0;$p<count($list_groups);$p++) {
 		$list_friends_id=array();
 		$list_friends_dir=array();
 		$list_friends_file=array();
-		if (count($list_path_friends)!=0) { 
+		if (count($list_path_friends)!=0) {
 	for ($z=0;$z<count($list_path_friends['id_friend']);$z++) {
 		$list_friends_id[]  = $list_path_friends['id_friend'][$z]['friend_user_id'];
 		$list_friends_dir[] = $list_path_friends['path_friend'][$z]['dir'];
@@ -58,7 +58,7 @@ for ($p=0;$p<count($list_groups);$p++) {
 		}
 		while ($j<$number_of_images) {
 			if ($list_friends_file[$j]<>"") {
-				$user_info=api_get_user_info($list_friends_id[$j]);				
+				$user_info=api_get_user_info($list_friends_id[$j]);
 				$user_name=api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName']));
 				if($list_friends_file[$j]==='unknown.jpg') {
 					$big='';
@@ -75,8 +75,8 @@ for ($p=0;$p<count($list_groups);$p++) {
 			$j++;
 		}
 	}
-	echo $friend_html; 
-		}  
+	echo $friend_html;
+		}
 		else {
 			echo api_xml_http_response_encode(get_lang('YouDontHaveContactsInThisGroup'));
 		}

+ 38 - 38
main/social/index.php

@@ -17,7 +17,7 @@ $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thi
 $htmlHeadXtra[]='<style type="text/css" media="all">@import "'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.css";</style>';
 $htmlHeadXtra[] = '<script type="text/javascript">
 $(function() {
-	$("#container-9").tabs({ remote: true});	     
+	$("#container-9").tabs({ remote: true});
 });
 function register_friend(element_input) {
 	name_button=$(element_input).attr("id");
@@ -35,13 +35,13 @@ function register_friend(element_input) {
 		 $("div#"+name_div_id).hide("slow");
 		 $("#id_response").html(datos);
 		}
-	});		
+	});
 }
 function denied_friend (element_input) {
 	name_button=$(element_input).attr("id");
 	name_div_id="id_"+name_button.substring(13);
 	user_id=name_div_id.split("_");
-	friend_user_id=user_id[1];	
+	friend_user_id=user_id[1];
 	 $.ajax({
 		contentType: "application/x-www-form-urlencoded",
 		beforeSend: function(objeto) {
@@ -95,8 +95,8 @@ function set_qualify_friend() {
 	}
 	if (type_friend==null) {
 		alert("'.get_lang('SelectOneGroup', '').'");
-		return false;		
-	}	
+		return false;
+	}
 	if (confirm("'.get_lang('AttachContactsPersonal', '').' ?")) {
 		 $.ajax({
 			contentType: "application/x-www-form-urlencoded",
@@ -161,10 +161,10 @@ function toogle_function (element_html){
 		}
 	}
 	if (my_image=="visible.gif") {
-		$(ident).hide("slow");	
+		$(ident).hide("slow");
 		$(id_button).attr("src","../img/invisible_na.gif");
 	} else {
-		$(ident).show("slow");	
+		$(ident).show("slow");
 		$(id_button).attr("src","../img/visible.gif");
 	}
 }
@@ -177,23 +177,23 @@ function unselectall_cheks() {
 function submit_form (path_submit) {
 	if (path_submit=="inbox") {
 		if (count_checkbox("inbox") > 0) {
-		   document.getElementById(\'form_send\').action="../social/index.php?inbox=true#remote-tab-2";		
+		   document.getElementById(\'form_send\').action="../social/index.php?inbox=true#remote-tab-2";
 		   if (confirm("'.get_lang('ConfirmYourChoice', '').'")) {
 		   		$("#form_send").submit();
-		   }	
+		   }
 		} else {
 			alert("'.get_lang('SelectTheCheckbox', '').'");
 		}
 
 	} else {
 		if (count_checkbox("outbox") > 0) {
-			document.getElementById(\'form_send_out\').action="../social/index.php?outbox=true#remote-tab-3";		
-		   if (confirm("'.get_lang('ConfirmYourChoice', '').'")) {			
+			document.getElementById(\'form_send_out\').action="../social/index.php?outbox=true#remote-tab-3";
+		   if (confirm("'.get_lang('ConfirmYourChoice', '').'")) {
 				$("#form_send_out").submit();
 		   }
 		} else {
 			alert("'.get_lang('SelectedMoreOptions', '').'");
-		}			
+		}
 	}
 }
 function count_checkbox(status_type) {
@@ -205,7 +205,7 @@ function count_checkbox(status_type) {
 		       cont = cont + 1;
 		    }
 		}
-		return cont;	
+		return cont;
 	} else {
 		var checkboxes = document.getElementsByName("out[]");
 		var cont = 0;
@@ -214,13 +214,13 @@ function count_checkbox(status_type) {
 		       cont = cont + 1;
 		    }
 		}
-		return cont;	
+		return cont;
 	}
 }
 function get_action_url_and_show_messages (name_rs,name_id) {
 	$(".confirmation-message").remove();
 	$(".normal-message").remove();
-	$(".error-message").remove();	
+	$(".error-message").remove();
 		 $.ajax({
 			contentType: "application/x-www-form-urlencoded",
 			beforeSend: function(objeto) {
@@ -230,7 +230,7 @@ function get_action_url_and_show_messages (name_rs,name_id) {
 			data: "rs="+name_rs+"&id="+name_id,
 			success: function(datos) {
 			 $("div#div_content_messages").html(datos);
-			 $("div#div_content_table_data").html(" ");	
+			 $("div#div_content_table_data").html(" ");
 			}
 		});
 }
@@ -247,7 +247,7 @@ function close_div_show (my_div) {
 			url: "../messages/inbox.php",
 			data:"",
 			success: function(datos) {
-			 $("div#div_content_table_data").html(datos);	
+			 $("div#div_content_table_data").html(datos);
 			}
 		});
 }
@@ -266,7 +266,7 @@ function reply_to_messages (my_action,name_rs,name_id) {
 			url: "../messages/new_message.php",
 			data:"re_id="+name_rs+"&id="+name_id,
 			success: function(datos) {
-			 $("div#div_content_messages").html(datos);	
+			 $("div#div_content_messages").html(datos);
 			}
 		});
 	}
@@ -286,10 +286,10 @@ function compose_and_show_message (my_action,name_rs) {
 			url: "../messages/new_message.php",
 			data:"rs="+name_rs,
 			success: function(datos) {
-			 $("div#div_content_messages").html(datos);	
+			 $("div#div_content_messages").html(datos);
 			}
-		});		
-	}		
+		});
+	}
 }
 function send_request_and_search() {
 	cont=0;
@@ -297,7 +297,7 @@ function send_request_and_search() {
       	name=$("#id_text_name").get(0).value;
       	if (name.length==0) {
       		return false;
-      	}    		
+      	}
 		$.ajax({
 				contentType: "application/x-www-form-urlencoded",
 				beforeSend: function(objeto) {
@@ -307,22 +307,22 @@ function send_request_and_search() {
 				url: "../social/select_options.php",
 				data: "search="+name,
 				success: function(datos){
-					
+
 					num_records=datos.split(\'</option>\');
 					if (num_records.length==1) {
-						$("#id_div_search").html("");					
+						$("#id_div_search").html("");
 						return false;
 					} else {
 						 $("#id_div_search").html(datos)
 						  list_search_hide();
 					}
-	
+
 						$("#id_search_name").bind("click", function() {
 							name_option=$("select#id_search_name option:selected").text();
 							code_option=$("select#id_search_name option:selected").val();
 							 $("#user_list").attr("value", code_option);
 							 $("#id_text_name").attr("value", name_option);
-							 
+
 							 $("#id_div_search").html("");
 							 cont++;
 						 });
@@ -335,7 +335,7 @@ function delete_one_message (num_id) {
 		$("div#div_content_table_data").html("");
 		$(".confirmation-message").remove();
 		$(".normal-message").remove();
-		$(".error-message").remove();				
+		$(".error-message").remove();
 			$.ajax({
 				contentType: "application/x-www-form-urlencoded",
 				beforeSend: function(objeto) {
@@ -374,13 +374,13 @@ function close_and_open_outbox() {
 			url: "../messages/outbox.php",
 			data:"",
 			success: function(datos) {
-			 $("div#div_content_table_data_sent").html(datos);	
+			 $("div#div_content_table_data_sent").html(datos);
 			}
 		});
 }
 function delete_one_message_outbox (num_id) {
 		$("div#div_content_messages_sent").html("");
-		$("div#div_content_table_data_sent").html("");	
+		$("div#div_content_table_data_sent").html("");
 			$.ajax({
 				contentType: "application/x-www-form-urlencoded",
 				beforeSend: function(objeto) {
@@ -404,9 +404,9 @@ if (api_get_setting('allow_message_tool')=='true') {
 	$htmlHeadXtra[] ='<script type="text/javascript">
 		function delete_message_js() {
 			$(".message-content").animate({ opacity: "hide" }, "slow");
-			$(".message-view").animate({ opacity: "show" }, "slow");			
+			$(".message-view").animate({ opacity: "show" }, "slow");
 		}
-	</script>';	
+	</script>';
 }
 $htmlHeadXtra[] = '<link rel="stylesheet" href="../inc/lib/javascript/jquery.tabs.css" type="text/css" media="print, projection, screen">';
 $htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_CODE_PATH).'css/'.api_get_setting('stylesheets').'/jquery.tabs.css" type="text/css" media="print, projection, screen">';
@@ -430,7 +430,7 @@ if ((api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_mess
 	$interbreadcrumb[]= array (
 	'url' => 'index.php?#remote-tab-1',
 	'name' => get_lang('MessageTool')
-	);	
+	);
 }
 
 Display :: display_header('');
@@ -460,27 +460,27 @@ if (isset($_GET['sendform'])) {
 		$form_delete_outbox[]=$_POST['out'][$i];
 	}
 	$form_info_outbox=implode(',',$form_delete_outbox);
-	$form_send_data_message='?form_delete_outbox='.($form_info_outbox);	
+	$form_send_data_message='?form_delete_outbox='.($form_info_outbox);
 }
 $form_url_send=isset($form_send_data_message) ? $form_send_data_message :'';
 ?>
 <div id="container-9">
     <ul>
         <li><a href="data_personal.inc.php"><span><?php Display :: display_icon('profile.png',get_lang('PersonalData')); echo '&nbsp;&nbsp;'.get_lang('PersonalData'); ?></span></a></li>
-        <?php 
-       	if (api_get_setting('allow_message_tool')=='true') { 
-       	?>        
+        <?php
+       	if (api_get_setting('allow_message_tool')=='true') {
+       	?>
         <li><a href="../messages/inbox.php<?php echo $form_url_send; ?>"><span><?php Display :: display_icon('inbox.png',get_lang('Inbox')); echo '&nbsp;&nbsp;'.get_lang('Inbox');?></span></a></li>
         <li><a href="../messages/outbox.php<?php echo $form_url_send; ?>"><span><?php Display :: display_icon('outbox.png',get_lang('Outbox') ); echo '&nbsp;&nbsp;'.get_lang('Outbox');?></span></a></li>
         <?php }
-  	 	if (api_get_setting('allow_social_tool')=='true') {      
+  	 	if (api_get_setting('allow_social_tool')=='true') {
         ?>
         <li><a href="select_friend_response.php"><span><?php Display :: display_icon('pending_invitation.png',get_lang('PendingInvitations'), array('height'=>'22px')); echo '&nbsp;&nbsp;'.get_lang('PendingInvitations'); ?></span></a></li>
         <li><a href="contacts.inc.php"><span><?php Display :: display_icon('contacts.png',get_lang('Contacts')); echo '&nbsp;&nbsp;'.get_lang('Contacts'); ?></span></a></li>
         <li><a href="group_contact.inc.php"><span><?php Display :: display_icon('group_contact.png',get_lang('ContactsGroups')); echo '&nbsp;&nbsp;'.get_lang('ContactsGroups'); ?></span></a></li>
         <?php
   	 	}
-        ?>     
+        ?>
     </ul>
     <?php //echo '<div id="show">&nbsp;</div>';?>
 </div>

+ 185 - 185
main/social/profile.php

@@ -11,7 +11,7 @@
  * Init
  */
 $language_file = array('registration','messages','userInfo','admin','forum','blog');
-$cidReset = true;	
+$cidReset = true;
 require '../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
 require_once api_get_path(LIBRARY_PATH).'social.lib.php';
@@ -20,33 +20,33 @@ $user_id = api_get_user_id();
 $show_full_profile = true;
 
 //I'm your friend? I can see your profile?
-if (isset($_GET['u'])) {	
-	$user_id 	= (int) Database::escape_string($_GET['u']);	
-	// It's me! 
+if (isset($_GET['u'])) {
+	$user_id 	= (int) Database::escape_string($_GET['u']);
+	// It's me!
 	if (api_get_user_id() != $user_id) {
-		$user_info	= UserManager::get_user_info_by_id($user_id);	
-		$show_full_profile = false;	
+		$user_info	= UserManager::get_user_info_by_id($user_id);
+		$show_full_profile = false;
 		if ($user_info==false) {
 			// user does no exist !!
 			api_not_allowed();
 		} else {
 			//checking the relationship between me and my friend
 			$my_status= UserFriend::get_relation_between_contacts(api_get_user_id(), $user_id);
-			if (in_array($my_status, array(SOCIALPARENT, SOCIALFRIEND, SOCIALGOODFRIEND))) {	
-				$show_full_profile = true;			
+			if (in_array($my_status, array(SOCIALPARENT, SOCIALFRIEND, SOCIALGOODFRIEND))) {
+				$show_full_profile = true;
 			}
-			//checking the relationship between my friend and me		
-			$my_friend_status = UserFriend::get_relation_between_contacts($user_id, api_get_user_id());		
+			//checking the relationship between my friend and me
+			$my_friend_status = UserFriend::get_relation_between_contacts($user_id, api_get_user_id());
 			if (in_array($my_friend_status, array(SOCIALPARENT, SOCIALFRIEND, SOCIALGOODFRIEND))) {
-				$show_full_profile = true;			
+				$show_full_profile = true;
 			} else {
 				// im probably not a good friend
 				$show_full_profile = false;
 			}
-		}	
+		}
 	} else {
-		$user_info	= UserManager::get_user_info_by_id($user_id);	
-	}		
+		$user_info	= UserManager::get_user_info_by_id($user_id);
+	}
 } else {
 	$user_info	= UserManager::get_user_info_by_id($user_id);
 }
@@ -67,20 +67,20 @@ $htmlHeadXtra[] = '<link rel="stylesheet" href="'.api_get_path(WEB_LIBRARY_PATH)
 $htmlHeadXtra[] = '
 <script type="text/javascript">
 function toogle_function (element_html, course_code){
-	elem_id=$(element_html).attr("id");	
-	id_elem=elem_id.split("_"); 
+	elem_id=$(element_html).attr("id");
+	id_elem=elem_id.split("_");
 	ident="div#div_group_"+id_elem[1];
-	 
-	id_button="#btn_"+id_elem[1]; 
-	elem_src=$(id_button).attr("src"); 
+
+	id_button="#btn_"+id_elem[1];
+	elem_src=$(id_button).attr("src");
 	image_show=elem_src.split("/");
 	my_image=image_show[2];
-	var content = \'social_content\' + id_elem[1]; 
+	var content = \'social_content\' + id_elem[1];
 	if (my_image=="nolines_plus.gif") {
 		$(id_button).attr("src","../img/nolines_minus.gif"); var action = "load_course";
-		$("div#"+content).show("slow");	
+		$("div#"+content).show("slow");
 	} else {
-		$("div#"+content).hide("slow");	
+		$("div#"+content).hide("slow");
 		$(id_button).attr("src","../img/nolines_plus.gif"); var action = "unload";
 		return false;
 	}
@@ -96,7 +96,7 @@ function toogle_function (element_html, course_code){
 		 //$("div#"+name_div_id).hide("slow");
 		 $("div#"+content).html(datos);
 		}
-	});		
+	});
 }
 </script>';
 $htmlHeadXtra[] = '<script type="text/javascript">
@@ -105,7 +105,7 @@ $(document).ready(function (){
 		if (confirm("'.get_lang('SendMessageInvitation', '').'")) {
 			$("#form_register_friend").submit();
 		}
-	}); 
+	});
 });
 function change_panel (mypanel_id,myuser_id) {
 		$.ajax({
@@ -119,10 +119,10 @@ function change_panel (mypanel_id,myuser_id) {
 			 $("div#id_content_panel_init").html(datos);
 			 $("div#display_response_id").html("");
 			}
-		});	
+		});
 }
 function action_database_panel (option_id,myuser_id) {
-	
+
 	if (option_id==5) {
 		my_txt_subject=$("#txt_subject_id").val();
 	} else {
@@ -144,8 +144,8 @@ function action_database_panel (option_id,myuser_id) {
 		success: function(datos) {
 		 $("#display_response_id").html(datos);
 		}
-	});	
-}	
+	});
+}
 function display_hide () {
 		setTimeout("hide_display_message()",3000);
 }
@@ -160,7 +160,7 @@ function hide_display_message () {
 	}catch(e) {
 		$("#txt_area_invite").val("");
 	}
-}	
+}
 function register_friend(element_input) {
  if(confirm("'.get_lang('AddToFriends').'")) {
 		name_button=$(element_input).attr("id");
@@ -197,17 +197,17 @@ $interbreadcrumb[]= array (
 );
 
 if (isset($_GET['u']) && is_numeric($_GET['u'])) {
-	$info_user=api_get_user_info($_GET['u']);	
+	$info_user=api_get_user_info($_GET['u']);
 	$interbreadcrumb[]= array (
 		'url' => 'javascript: void(0);',
 		'name' => api_get_person_name($info_user['firstName'], $info_user['lastName'])
-	);	
+	);
 }
 if (isset($_GET['u'])) {
 	$param_user='u='.Security::remove_XSS($_GET['u']);
 }else {
 	$info_user=api_get_user_info(api_get_user_id());
-	$param_user='';	
+	$param_user='';
 }
 $_SESSION['social_user_id'] = $user_id;
 /**
@@ -227,7 +227,7 @@ function get_logged_user_course_html($my_course, $count) {
 	$course_tool_table 		 = Database :: get_course_table(TABLE_TOOL_LIST, $course_database);
 	$tool_edit_table 		 = Database :: get_course_table(TABLE_ITEM_PROPERTY, $course_database);
 	$course_group_user_table = Database :: get_course_table(TOOL_USER, $course_database);
-		
+
 	$user_id = api_get_user_id();
 	$course_system_code = $my_course['k'];
 	$course_visual_code = $my_course['c'];
@@ -238,24 +238,24 @@ function get_logged_user_course_html($my_course, $count) {
 	$course_info = Database :: get_course_info($course_system_code);
 	//error_log(print_r($course_info,true));
 	$course_access_settings = CourseManager :: get_access_settings($course_system_code);
-	
+
 	$course_visibility = $course_access_settings['visibility'];
-	
-	$user_in_course_status = CourseManager :: get_user_in_course_status(api_get_user_id(), $course_system_code);		
+
+	$user_in_course_status = CourseManager :: get_user_in_course_status(api_get_user_id(), $course_system_code);
 	//function logic - act on the data
 	$is_virtual_course = CourseManager :: is_virtual_course_from_system_code($my_course['k']);
-	if ($is_virtual_course) { 
+	if ($is_virtual_course) {
 		// If the current user is also subscribed in the real course to which this
 		// virtual course is linked, we don't need to display the virtual course entry in
 		// the course list - it is combined with the real course entry.
-		$target_course_code = CourseManager :: get_target_of_linked_course($course_system_code);		
+		$target_course_code = CourseManager :: get_target_of_linked_course($course_system_code);
 		$is_subscribed_in_target_course = CourseManager :: is_user_subscribed_in_course(api_get_user_id(), $target_course_code);
-		if ($is_subscribed_in_target_course) {			
+		if ($is_subscribed_in_target_course) {
 			return; //do not display this course entry
 		}
 	}
 	$has_virtual_courses = CourseManager :: has_virtual_courses_from_code($course_system_code, api_get_user_id());
-	if ($has_virtual_courses) { 
+	if ($has_virtual_courses) {
 		$return_result = CourseManager :: determine_course_title_from_course_info(api_get_user_id(), $course_info);
 		$course_display_title = $return_result['title'];
 		$course_display_code = $return_result['code'];
@@ -276,12 +276,12 @@ function get_logged_user_course_html($my_course, $count) {
 		$s_htlm_status_icon=Display::return_icon('students.gif', get_lang('Student'));
 	}
 
-	//display course entry		
+	//display course entry
 	$result .= '<div id="div_'.$count.'">';
 	//$result .= '<a id="btn_'.$count.'" href="#" onclick="toogle_function(this,\''.$course_database.'\')">';
 	$result .= '<h2><img src="../img/nolines_plus.gif" id="btn_'.$count.'" onclick="toogle_function(this,\''.$course_database.'\' )">';
 	$result .= $s_htlm_status_icon;
-	
+
 	//show a hyperlink to the course, unless the course is closed and user is not course admin
 	if ($course_visibility != COURSE_VISIBILITY_CLOSED || $user_in_course_status == COURSEMANAGER) {
 		$result .= '<a href="javascript:void(0)" id="ln_'.$count.'"  onclick=toogle_function(this,\''.$course_database.'\');>&nbsp;'.$course_title.'</a></h2>';
@@ -302,7 +302,7 @@ function get_logged_user_course_html($my_course, $count) {
 		$result .= $course_display_title." "." ".get_lang('CourseClosed')."";
 	}
 	// show the course_code and teacher if chosen to display this
-	// we dont need this! 	
+	// we dont need this!
 	/*
 			if (api_get_setting('display_coursecode_in_courselist') == 'true' OR api_get_setting('display_teacher_in_courselist') == 'true') {
 				$result .= '<br />';
@@ -360,23 +360,23 @@ function get_logged_user_course_html($my_course, $count) {
 		}
 		$result .= '</ul>';
 	}
-	$result .= '</li>';		
+	$result .= '</li>';
 	$result .= '</div>';
-	
+
 	if (api_get_setting('use_session_mode')=='true' && !$nosession) {
 		$session = '';
 		$active = false;
 		if (!empty($my_course['session_name'])) {
-			
+
 			// Request for the name of the general coach
-			$sql = 'SELECT lastname, firstname 
+			$sql = 'SELECT lastname, firstname
 					FROM '.$tbl_session.' ts  LEFT JOIN '.$main_user_table .' tu
 					ON ts.id_coach = tu.user_id
 					WHERE ts.id='.(int) $my_course['id_session']. ' LIMIT 1';
 			$rs = api_sql_query($sql, __FILE__, __LINE__);
 			$sessioncoach = api_store_result($rs);
 			$sessioncoach = $sessioncoach[0];
-		
+
 			$session = array();
 			$session['title'] = $my_course['session_name'];
 			if ( $my_course['date_start']=='0000-00-00' ) {
@@ -396,7 +396,7 @@ function get_logged_user_course_html($my_course, $count) {
 		$output = array ($my_course['user_course_cat'], $result, $my_course['id_session'], $session, 'active'=>$active);
 	} else {
 		$output = array ($my_course['user_course_cat'], $result);
-	}	
+	}
 	//$my_course['creation_date'];
 	return $output;
 }
@@ -443,7 +443,7 @@ function get_user_feeds($user,$limit=5) {
  */
 Display :: display_header(null);
 
-// @todo here we must show the user information as read only 
+// @todo here we must show the user information as read only
 //User picture size is calculated from SYSTEM path
 
 $img_array= UserManager::get_user_picture_path_by_id($user_id,'web',true,true);
@@ -453,17 +453,17 @@ $img_array= UserManager::get_user_picture_path_by_id($user_id,'web',true,true);
 if (USE_JQUERY_CORNERS_SCRIPT) {
 //
 echo $s="<script>$(document).ready( function(){
-		  $('.rounded').corners();		  
+		  $('.rounded').corners();
 		});</script>";
 //
 }
 //
-			
+
 //echo '<div id="actions">';
 //echo '<a href="../auth/profile.php?show=1"">'.Display::return_icon('edit.gif').'&nbsp;'.api_convert_encoding(get_lang('EditInformation'),'UTF-8',$charset).'</a>';
 //echo '</div>';
 
-//Setting some course info 
+//Setting some course info
 $my_user_id=isset($_GET['u']) ? Security::remove_XSS($_GET['u']) : api_get_user_id();
 $personal_course_list = UserManager::get_personal_session_course_list($my_user_id);
 $course_list_code = array();
@@ -475,17 +475,17 @@ $i=1;
 if (is_array($personal_course_list)) {
 	foreach ($personal_course_list as $my_course) {
 		if ($i<=10) {
-			$list[] = get_logged_user_course_html($my_course,$i);	
-			//$course_list_code[] = array('code'=>$my_course['c'],'dbName'=>$my_course['db'], 'title'=>$my_course['i']); cause double 
+			$list[] = get_logged_user_course_html($my_course,$i);
+			//$course_list_code[] = array('code'=>$my_course['c'],'dbName'=>$my_course['db'], 'title'=>$my_course['i']); cause double
 			$course_list_code[] = array('code'=>$my_course['c'],'dbName'=>$my_course['db']);
-			
+
 		} else {
 			break;
 		}
 		$i++;
 	}
 	//to avoid repeted courses
-	$course_list_code = array_unique_dimensional($course_list_code);	
+	$course_list_code = array_unique_dimensional($course_list_code);
 }
 
 echo '<div class="actions-title">';
@@ -493,30 +493,30 @@ if ($user_id == api_get_user_id())
 	echo get_lang('ViewMySharedProfile');
 else
 	echo get_lang('ViewSharedProfile').' - '.api_get_person_name($user_info['firstname'], $user_info['lastname']);
-		
-echo '</div>';					
+
+echo '</div>';
 
 echo '<div id="social-profile-wrapper">';
 // RIGHT COLUMN
-    echo '<div id="social-profile-right">';			
+    echo '<div id="social-profile-right">';
 		//---- FRIENDS
 
 		if ($show_full_profile) {
 			$list_path_friends= $list_path_normal_friends = $list_path_parents = array();
-			
-			$list_path_good_friends		= UserFriend::get_list_path_web_by_user_id($user_id, SOCIALGOODFRIEND);	
-			$list_path_normal_friends	= UserFriend::get_list_path_web_by_user_id($user_id, SOCIALFRIEND);			
+
+			$list_path_good_friends		= UserFriend::get_list_path_web_by_user_id($user_id, SOCIALGOODFRIEND);
+			$list_path_normal_friends	= UserFriend::get_list_path_web_by_user_id($user_id, SOCIALFRIEND);
 			$list_path_parents 			= UserFriend::get_list_path_web_by_user_id($user_id, SOCIALPARENT);
-			
+
 			$list_path_friends = array_merge_recursive($list_path_good_friends, $list_path_normal_friends, $list_path_parents);
-			
+
 			$friend_html='';
 			$number_of_images=3;
 			$number_friends=0;
 			$list_friends_id=array();
 			$list_friends_dir=array();
 			$list_friends_file=array();
-			
+
 			if (count($list_path_friends)!=0) {
 				$friends_count = count($list_path_friends['id_friend']);
 
@@ -529,19 +529,19 @@ echo '<div id="social-profile-wrapper">';
 				$number_loop   = ($number_friends/$number_of_images);
 				$loop_friends  = ceil($number_loop);
 				$j=0;
-				$friend_html .= '<div class="sectiontitle">'.get_lang('SocialFriend').'</div>';	
-				$friend_html.= '<div id="friend-container" class="social-friend-container">';							
+				$friend_html .= '<div class="sectiontitle">'.get_lang('SocialFriend').'</div>';
+				$friend_html.= '<div id="friend-container" class="social-friend-container">';
 					$friend_html.= '<div id="friend-header">';
 							//$friend_html.=  $friends_count.' '.get_lang('Friends');
 						if ($friends_count == 1)
 							$friend_html.= '<div style="float:left;">'.$friends_count.' '.get_lang('Friend').'</div>';
-						else 
+						else
 							$friend_html.= '<div style="float:left;">'.$friends_count.' '.get_lang('Friends').'</div>';
-						if (api_get_user_id() == $user_id)	
-					$friend_html.= '<div style="float:right;"><a href="index.php?#remote-tab-6">'.get_lang('SeeAll').'</a></div>';													
-					$friend_html.= '</div>'; // close div friend-header						
-								
-				for ($k=0;$k<$loop_friends;$k++) {				
+						if (api_get_user_id() == $user_id)
+					$friend_html.= '<div style="float:right;"><a href="index.php?#remote-tab-6">'.get_lang('SeeAll').'</a></div>';
+					$friend_html.= '</div>'; // close div friend-header
+
+				for ($k=0;$k<$loop_friends;$k++) {
 					if ($j==$number_of_images) {
 						$number_of_images=$number_of_images*2;
 					}
@@ -556,38 +556,38 @@ echo '<div id="social-profile-wrapper">';
 							$friend_html.='<img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' id="imgfriend_'.$list_friends_id[$j].'" title="'.$name_user.'" />';
 							$friend_html.= '</center></span>';
 							$friend_html.= '<center class="friend">'.api_get_person_name($my_user_info['firstName'], $my_user_info['lastName']).'</a></center>';
-							$friend_html.= '</div>';				
+							$friend_html.= '</div>';
 						}
-						$j++; 
-					}				
+						$j++;
+					}
 				}
 			} else {
 				// No friends!! :(
 					$friend_html .= '<div class="sectiontitle">'.get_lang('Friends').'</div>';
-					$friend_html.= '<div id="friend-container" class="social-friend-container">';					
+					$friend_html.= '<div id="friend-container" class="social-friend-container">';
 					$friend_html.= '<div id="friend-header">';
-				$friend_html.= '<div style="float:left; padding:0px 8px 0px 8px;">'.get_lang('NoFriendsInYourContactList').'<br /><a href="'.api_get_path(WEB_PATH).'whoisonline.php">'.get_lang('TryAndFindSomeFriends').'</a></div>';				
-				$friend_html.= '</div>'; // close div friend-header					
+				$friend_html.= '<div style="float:left; padding:0px 8px 0px 8px;">'.get_lang('NoFriendsInYourContactList').'<br /><a href="'.api_get_path(WEB_PATH).'whoisonline.php">'.get_lang('TryAndFindSomeFriends').'</a></div>';
+				$friend_html.= '</div>'; // close div friend-header
 			}
-			$friend_html.= '</div>';		
-			echo $friend_html; 				
-			//Pending invitations	
+			$friend_html.= '</div>';
+			echo $friend_html;
+			//Pending invitations
 			if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) {
 			$pending_invitations = UserFriend::get_list_invitation_of_friends_by_user_id(api_get_user_id());
 			$list_get_path_web=UserFriend::get_list_web_path_user_invitation_by_user_id(api_get_user_id());
 			$count_pending_invitations = count($pending_invitations);
-			//echo '<div class="clear"></div><br />';		
+			//echo '<div class="clear"></div><br />';
 				//javascript:register_friend(this)
 				//var_dump($pending_invitations);
 			echo '<div class="clear"></div><br />';
 			echo '<div id="social-profile-invitations" >';
 			if ($count_pending_invitations > 0) {
 				echo '<div class="sectiontitle">';
-					echo api_convert_encoding(get_lang('PendingInvitations'),$charset,'UTF-8'); 
+					echo api_convert_encoding(get_lang('PendingInvitations'),$charset,'UTF-8');
 					echo '</div><br />';
 				for ($i=0;$i<$count_pending_invitations;$i++) {
 					//var_dump($invitations);
-						echo '<div id="dpending_'.$pending_invitations[$i]['user_sender_id'].'" class="friend_invitations">'; 
+						echo '<div id="dpending_'.$pending_invitations[$i]['user_sender_id'].'" class="friend_invitations">';
 						echo '<div style="float:left;width:60px;" >';
 							echo '<img style="margin-bottom:5px;" src="'.$list_get_path_web[$i]['dir'].'/'.$list_get_path_web[$i]['file'].'" width="60px">';
 						echo '</div>';
@@ -603,8 +603,8 @@ echo '<div id="social-profile-wrapper">';
 			}
 			echo '</div>';
 			}
-			
-			//--Productions			
+
+			//--Productions
 			$production_list =  UserManager::build_production_list($user_id);
 			if (!empty($production_list )) {
 				echo '<div class="clear"></div><br />';
@@ -613,13 +613,13 @@ echo '<div id="social-profile-wrapper">';
 				echo '</div>';
 				echo '<div class="rounded1">';
 				echo $production_list;
-				echo '</div>';	
-			}			
-			
-			// Images uploaded by course			
+				echo '</div>';
+			}
+
+			// Images uploaded by course
 			$file_list = '';
 			if (is_array($course_list_code) && count($course_list_code)>0) {
-			foreach ($course_list_code as $course) { 
+			foreach ($course_list_code as $course) {
 				$file_list.= UserManager::get_user_upload_files_by_course($user_id,$course['code']);
 			}
 			}
@@ -631,21 +631,21 @@ echo '<div id="social-profile-wrapper">';
 				echo '</div><br />';
 				echo '</br><div class="social-content-information">';
 				echo $file_list;
-				echo '</div>';		
+				echo '</div>';
 			}
-			
-			//loading this information 
-			
+
+			//loading this information
+
 			//-- Competences
 			if (!empty($user_info['competences']) || !empty($user_info['diplomas']) || !empty($user_info['openarea']) || !empty($user_info['teach']) ) {
 				echo '<div class="clear"></div>';
-				echo '<div class="sectiontitle">';				
+				echo '<div class="sectiontitle">';
 				echo get_lang('MoreInformation');
 				echo '</div>';
 			}
 			echo '<div class="social-content-competences">';
 			$cut_size = 220;
-			if (!empty($user_info['competences'])) {		
+			if (!empty($user_info['competences'])) {
 				echo '<br />';
 				echo '<div class="social-background-content" style="width:100%;">';
 				echo '<div class="social-actions-message">'.get_lang('MyCompetences').'</div>';
@@ -653,36 +653,36 @@ echo '<div id="social-profile-wrapper">';
 				echo '</div>';
 				echo '<br />';
 			}
-			
-			if (!empty($user_info['diplomas'])) {	
-				echo '<div class="social-background-content" style="width:100%;" >';					
+
+			if (!empty($user_info['diplomas'])) {
+				echo '<div class="social-background-content" style="width:100%;" >';
 				echo '<div class="social-actions-message">'.get_lang('MyDiplomas').'</div>';
-				echo cut($user_info['diplomas'],$cut_size); 
+				echo cut($user_info['diplomas'],$cut_size);
 				echo '</div>';
 				echo '<br />';
 			}
-			if (!empty($user_info['openarea'])) {	
-				echo '<div class="social-background-content" style="width:100%;" >';	
+			if (!empty($user_info['openarea'])) {
+				echo '<div class="social-background-content" style="width:100%;" >';
 				echo '<div class="social-actions-message">'.get_lang('MyPersonalOpenArea').'</div>';
-				echo cut($user_info['openarea'],$cut_size); 
+				echo cut($user_info['openarea'],$cut_size);
 				echo '</div>';
 				echo '<br />';
 			}
-			if (!empty($user_info['teach'])) {	
-				echo '<div class="social-background-content" style="width:100%;" >';					
+			if (!empty($user_info['teach'])) {
+				echo '<div class="social-background-content" style="width:100%;" >';
 				echo '<div class="social-actions-message">'.get_lang('MyTeach').'</div>';
 				echo cut($user_info['teach'],$cut_size);
 				echo '</div>';
 				echo '<br />';
-			}				
-			echo '</div>';				
+			}
+			echo '</div>';
 		} else {
-			echo '<div class="clear"></div><br />';	
+			echo '<div class="clear"></div><br />';
 		}
-		
+
 	echo '</div>'; // end of content section
-			
-		
+
+
 echo '<div id="social-profile-container">';
 	// LEFT COLUMN
 	echo '<div id="social-profile-left">';
@@ -700,28 +700,28 @@ echo '<div id="social-profile-container">';
     	  		// if i'm me
     	  		echo '<div>';
     	  		echo Display::return_icon('email.gif');
-    	  		echo '&nbsp;<a href="../social/index.php#remote-tab-2">'.get_lang('MyInbox').'</a>&nbsp;'; 
+    	  		echo '&nbsp;<a href="../social/index.php#remote-tab-2">'.get_lang('MyInbox').'</a>&nbsp;';
     	  		echo '</div>';
     	  		echo '<div>';
     	  		echo Display::return_icon('edit.gif');
-    	  		echo '&nbsp;<a href="../auth/profile.php?show=1">'.get_lang('EditInformation').'</a>&nbsp;';    	  			
-    	  		echo '</div>'; 	  			
+    	  		echo '&nbsp;<a href="../auth/profile.php?show=1">'.get_lang('EditInformation').'</a>&nbsp;';
+    	  		echo '</div>';
     	  	} else {
-    	  		echo '&nbsp;<a href="../messages/send_message_to_userfriend.inc.php?height=365&width=610&user_friend='.$user_id.'&view=profile&view_panel=1" class="thickbox" title="'.get_lang('SendMessage').'">'.Display::return_icon('message_new.png').'&nbsp;&nbsp;'.get_lang('SendMessage').'</a><br />'; 
-    	  		//echo '&nbsp;&nbsp;<a href="javascript: void(0);">'.get_lang('SendMessage').'</a>';	
+    	  		echo '&nbsp;<a href="../messages/send_message_to_userfriend.inc.php?height=365&width=610&user_friend='.$user_id.'&view=profile&view_panel=1" class="thickbox" title="'.get_lang('SendMessage').'">'.Display::return_icon('message_new.png').'&nbsp;&nbsp;'.get_lang('SendMessage').'</a><br />';
+    	  		//echo '&nbsp;&nbsp;<a href="javascript: void(0);">'.get_lang('SendMessage').'</a>';
     	  	}
     	  	echo '</div>';
     	  	echo '<br />';
-    	  	
+
     	  	// Send message or Add to friend links
     	  	/*if (!$show_full_profile) {
-    	  		echo '&nbsp;&nbsp;<a href="../messages/send_message_to_userfriend.inc.php?height=365&width=610&user_friend='.$user_id.'&view=profile" class="thickbox" title="'.get_lang('SendMessage').'">'.Display::return_icon('message_new.png').'&nbsp;&nbsp;'.get_lang('SendMessage').'</a><br />'; 		
+    	  		echo '&nbsp;&nbsp;<a href="../messages/send_message_to_userfriend.inc.php?height=365&width=610&user_friend='.$user_id.'&view=profile" class="thickbox" title="'.get_lang('SendMessage').'">'.Display::return_icon('message_new.png').'&nbsp;&nbsp;'.get_lang('SendMessage').'</a><br />';
     	  	}*/
-    	  	
+
 			// Extra information
-    	  	
-    	  	if ($show_full_profile) {    	  		
-				//-- Extra Data							
+
+    	  	if ($show_full_profile) {
+				//-- Extra Data
 				$t_uf = Database :: get_main_table(TABLE_MAIN_USER_FIELD);
 				$t_ufo = Database :: get_main_table(TABLE_MAIN_USER_FIELD_OPTIONS);
 				$extra_user_data = UserManager::get_extra_user_data($user_id);
@@ -740,27 +740,27 @@ echo '<div id="social-profile-container">';
 						$row_field = Database::fetch_row($res_field);
 						$field_display_text = $row_field[0];
 						$field_visible = $row_field[1];
-						$field_type = $row_field[2];												
-						
+						$field_type = $row_field[2];
+
 						if ($field_visible == 1) {
-							if (is_array($data)) {																																
-								$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.implode(',',$data).'<br />';								
-							} else {								
-								if ($field_type == 8) {							
+							if (is_array($data)) {
+								$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.implode(',',$data).'<br />';
+							} else {
+								if ($field_type == 8) {
 									$id_options = explode(';',$data);
-									$value_options = array();							
+									$value_options = array();
 									// get option display text from user_field_options table
-									foreach ($id_options as $id_option) {														
+									foreach ($id_options as $id_option) {
 										$sql = "SELECT option_display_text FROM $t_ufo WHERE id = '$id_option'";
 										$res_options = Database::query($sql,__FILE__,__LINE__);
 										$row_options = Database::fetch_row($res_options);
 										$value_options[] = $row_options[0];
 									}
-									$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.implode(' ',$value_options).'<br />'; 							
+									$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.implode(' ',$value_options).'<br />';
 								}
 								else {
 									$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.$data.'<br />';
-								}								
+								}
 							}
 						}
 					}
@@ -768,47 +768,47 @@ echo '<div id="social-profile-container">';
 					if (!empty($extra_information_value)) {
 						$extra_information .= $extra_information_value;
 				}
-					$extra_information .= '</div>';			
+					$extra_information .= '</div>';
 					$extra_information .= '<br /><br />';
 				}
-				// 	if there are information to show				
+				// 	if there are information to show
 				if (!empty($extra_information_value))
 					echo $extra_information;
-				
-				
+
+
 				// ---- My Agenda Items
 				$my_agenda_items = show_simple_personal_agenda($user_id);
 				if (!empty($my_agenda_items)) {
-					echo '<div class="sectiontitle">';					
+					echo '<div class="sectiontitle">';
 					echo get_lang('MyAgenda');
 					echo '</div>';
 					$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
 					echo '<div class="social-content-agenda">';
-					echo '<div class="social-background-content">';	
-					echo $my_agenda_items; 
+					echo '<div class="social-background-content">';
+					echo $my_agenda_items;
 					echo '</div>';
 
 					echo '<br /><br />';
 					echo '</div>';
 				}
-					
+
 				//-----Announcements
-				$announcement_content = '';		
+				$announcement_content = '';
 				$my_announcement_by_user_id=isset($_GET['u']) ? Security::remove_XSS($_GET['u']) : api_get_user_id();
 
 		    	foreach ($course_list_code as $course) {
-	    			$content = get_all_annoucement_by_user_course($course['dbName'],$my_announcement_by_user_id);	 			
-	    			$course_info=api_get_course_info($course['code']); 			
-	    	  		if (!empty($content)) {	 		    	  			  
-						$announcement_content.= '<div class="social-background-content" style="width:100%">';	
-						$announcement_content.= '<div class="actions">'.$course_info['name'].'</div>';					
-						$announcement_content.= $content;	
+	    			$content = get_all_annoucement_by_user_course($course['dbName'],$my_announcement_by_user_id);
+	    			$course_info=api_get_course_info($course['code']);
+	    	  		if (!empty($content)) {
+						$announcement_content.= '<div class="social-background-content" style="width:100%">';
+						$announcement_content.= '<div class="actions">'.$course_info['name'].'</div>';
+						$announcement_content.= $content;
 						$announcement_content.= '</div>';
 						$announcement_content.= '<br/>';
 	    	  		}
 
 	    	  	}
-	    	  	
+
 	    	  	if(!empty($announcement_content)) {
 	    	  		echo '<div class="sectiontitle">';
 	    	  		echo get_lang('Announcements');
@@ -816,54 +816,54 @@ echo '<div id="social-profile-container">';
 	    	  		echo '<div class="social-content-announcements">';
 	    	  		echo $announcement_content.'<br/>';
 	    	  		echo '</div>';
-	    	  	}					
+	    	  	}
     	  	}
     echo '</div>';
-    
-    
+
+
   	// CENTER COLUMN
-  	
-  	
+
+
 	echo '<div id="social-profile-content">';
 
-		    //--- Basic Information	
-		    echo '<div class="sectiontitle">';		
+		    //--- Basic Information
+		    echo '<div class="sectiontitle">';
 			echo get_lang('Information');  //class="social-profile-info"
 			echo '</div>';
 			echo '<div class="social-content-information">';
-			if ($show_full_profile) {		 
-				echo '<div class="social-profile-info" >';					
+			if ($show_full_profile) {
+				echo '<div class="social-profile-info" >';
 					echo '<dt>'.get_lang('UserName').'</dt>
-						  <dd>'. $user_info['username'].'	</dd>';					
+						  <dd>'. $user_info['username'].'	</dd>';
 					if (!empty($user_info['firstname']) || !empty($user_info['lastname']))
-						echo '<dt>'.get_lang('Name').'</dt>		
-						  	  <dd>'. api_get_person_name($user_info['firstname'], $user_info['lastname']).'</dd>';					
-					if (!empty($user_info['official_code']))					
-						echo '<dt>'.get_lang('OfficialCode').'</dt>	
+						echo '<dt>'.get_lang('Name').'</dt>
+						  	  <dd>'. api_get_person_name($user_info['firstname'], $user_info['lastname']).'</dd>';
+					if (!empty($user_info['official_code']))
+						echo '<dt>'.get_lang('OfficialCode').'</dt>
 						  <dd>'.$user_info['official_code'].'</dd>';
 					if (!empty($user_info['email']))
 						if (api_get_setting('show_email_addresses')=='true')
-							echo '<dt>'.get_lang('Email').'</dt>			
+							echo '<dt>'.get_lang('Email').'</dt>
 						  <dd>'.$user_info['email'].'</dd>';
 					if (!empty($user_info['phone']))
-						echo '<dt>'.get_lang('Phone').'</dt>			
+						echo '<dt>'.get_lang('Phone').'</dt>
 						  <dd>'. $user_info['phone'].'</dd>';
 					echo '</dl>';
-				echo '</div>';			
+				echo '</div>';
 			} else {
 				echo '<div class="social-profile-info" >';
 					echo '<dl>';
 					if (!empty($user_info['firstname']) || !empty($user_info['lastname']))
-						echo '<dt>'.get_lang('Name').'</dt>		
-						  <dd>'. api_get_person_name($user_info['firstname'], $user_info['lastname']).'</dd>';					
+						echo '<dt>'.get_lang('Name').'</dt>
+						  <dd>'. api_get_person_name($user_info['firstname'], $user_info['lastname']).'</dd>';
 				echo '</div>';
 			}
 
-			echo '<div class="clear"></div><br />';			
-			echo '</div>';		
+			echo '<div class="clear"></div><br />';
+			echo '</div>';
 			// COURSES LIST
-			if ($show_full_profile) {							
-				//print_r($personal_course_list);		
+			if ($show_full_profile) {
+				//print_r($personal_course_list);
 				//echo '<pre>';
 				if ( is_array($list) ) {
 					echo '<div class="sectiontitle">';
@@ -874,15 +874,15 @@ echo '<div id="social-profile-container">';
 					$old_user_category = 0;
 					$i=1;
 					foreach($list as $key=>$value) {
-						if ( empty($value[2]) ) { //if out of any session				
+						if ( empty($value[2]) ) { //if out of any session
 							echo $value[1];
 							//echo '<div id="loading'.$i.'">&nbsp;</div>';
-							//class="social-profile-rounded maincourse"							
-							echo '<div id="social_content'.$i.'"  style="background : #EFEFEF; padding:0px; ">';							
-							echo '</div>';		
+							//class="social-profile-rounded maincourse"
+							echo '<div id="social_content'.$i.'"  style="background : #EFEFEF; padding:0px; ">';
+							echo '</div>';
 							$i++;
 						}
-					}				
+					}
 					$listActives = $listInactives = $listCourses = array();
 					foreach ( $list as $key=>$value ) {
 						if ( $value['active'] ) { //if the session is still active (as told by get_logged_user_course_html())
@@ -894,8 +894,8 @@ echo '<div id="social-profile-container">';
 					/*
 					// --- Session registered
 					api_display_tool_title(get_lang('Sessions'));
-					if(count($listActives)>0) {			
-						echo "<ul class=\"courseslist\">\n";	
+					if(count($listActives)>0) {
+						echo "<ul class=\"courseslist\">\n";
 						foreach ($listActives as $key => $value) {
 							if (!empty($value[2])) {
 								if ((isset($old_session) && $old_session != $value[2]) or ((!isset($old_session)) && isset($value[2]))) {
@@ -908,13 +908,13 @@ echo '<div id="social-profile-container">';
 									if ( !empty($value[3]['coach']) ) {
 										echo '<li class="session_box_coach">'.$value[3]['coach'].'</li>';
 									}
-									echo '</ul>';	
+									echo '</ul>';
 									echo '<ul class="session_course_item">';
 								}
 							}
-							echo $value[1];	
-						}	
-						echo '</ul>';	
+							echo $value[1];
+						}
+						echo '</ul>';
 					}
 					*/
 				}

+ 6 - 6
main/social/qualify_contact.inc.php

@@ -1,6 +1,6 @@
 <?php //$id: $
 /* For licensing terms, see /dokeos_license.txt */
- 
+
 $language_file=array('registration','messages','userInfo','admin');
 require_once '../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
@@ -24,10 +24,10 @@ $user_friend_relation=UserFriend::get_relation_between_contacts(api_get_user_id(
 <table width="600" border="0" cellspacing="0" cellpadding="0">
 	<tr>
 	   	 <td width="600" align="left">
-	   	 	<td width="50%"><br/>	   	 		
+	   	 	<td width="50%"><br/>
 	   	 		<img src="<?php echo Security::remove_XSS($img_user[1]); ?>" />
 	   	 		<?php
-	   	 		echo '<br /><br />'.$name_user=api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName'])); 
+	   	 		echo '<br /><br />'.$name_user=api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName']));
 	   	 		?>
 	   	 	</td>
 	   	 <td width="50%"><div align="left">
@@ -39,10 +39,10 @@ for ($k=0;$k<$number_list;$k++) {
    	} else {
    		$check='';
 	}
-	?>					    
+	?>
 	<input <?php echo $check; ?> style="margin-left:50px" type="radio" class="radio" name="list_type_friend"  value="<?php echo api_xml_http_response_encode($list_of_options[$k]['id']); ?>" />
-	<?php 
-	echo  api_xml_http_response_encode(get_lang($list_of_options[$k]['title'])); 
+	<?php
+	echo  api_xml_http_response_encode(get_lang($list_of_options[$k]['title']));
 	echo '<br />';
 	?>
 	<?php

+ 3 - 3
main/social/register_friend.php

@@ -19,12 +19,12 @@ $is_my_friend            = Security::remove_XSS($_POST['is_my_friend']); //filte
 if (isset($_POST['is_my_friend'])) {
 	$relation_type='3';//my friend
 } else {
-	$relation_type='1';//Contact unknown	
+	$relation_type='1';//Contact unknown
 }
 
 if (isset($_POST['friend_id'])) {
 	UserFriend::register_friend ((int)$the_current_user_id,(int)$my_current_friend,(int)$relation_type);
-	UserFriend::register_friend ((int)$my_current_friend,(int)$the_current_user_id,(int)$relation_type);	
+	UserFriend::register_friend ((int)$my_current_friend,(int)$the_current_user_id,(int)$relation_type);
 	UserFriend::invitation_accepted ((int)$my_current_friend,(int)$the_current_user_id);
 	if (isset($_POST['is_my_friend'])) {
 		echo api_xml_http_response_encode(get_lang('AddedContactToList'));
@@ -35,7 +35,7 @@ if (isset($_POST['friend_id'])) {
 }
 if (isset($_POST['denied_friend_id'])) {
 	UserFriend::invitation_denied((int)$my_denied_current_friend,(int)$the_current_user_id);
-	Display::display_confirmation_message(api_xml_http_response_encode(get_lang('InvitationDenied')));	
+	Display::display_confirmation_message(api_xml_http_response_encode(get_lang('InvitationDenied')));
 }
 if (isset($_POST['delete_friend_id'])) {
 	UserFriend::removed_friend((int)$my_delete_friend);

+ 5 - 5
main/social/select_friend_response.php

@@ -57,7 +57,7 @@ cellpadding="0" cellspacing="0" bgcolor="#9DACBF">
                             <table width="100%" border="0" cellpadding="0" cellspacing="0">
                               <tr>
                                 <td width="500" height="22" valign="top" style="padding:2px;">
-                                <?php 
+                                <?php
                                 $user_id=$list_get_invitation[$i]['user_sender_id'];
                                 $user_info=api_get_user_info($user_id);
                                 echo api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName']));
@@ -67,7 +67,7 @@ cellpadding="0" cellspacing="0" bgcolor="#9DACBF">
                           </tr>
                           <tr>
                             <td height="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
-                              
+
                               <tr>
                                 <td width="500" height="5"></td>
                                 </tr>
@@ -99,15 +99,15 @@ cellpadding="0" cellspacing="0" bgcolor="#9DACBF">
               <tr>
                 <td width="600" height="25" valign="top" style="padding:4px;"><div align="right">
        				<button class="save" name="btn_accepted" type="submit" id="<?php echo "btn_accepted_".$user_id ?>" value="<?php echo api_xml_http_response_encode(get_lang('Accept'));?>"onclick="javascript:register_friend(this)"><?php echo api_xml_http_response_encode(get_lang('Accept')) ?></button>
-     				<button class="cancel" name="btn_denied" type="submit" id="<?php echo "btn_deniedst_".$user_id ?>" value="<?php echo api_xml_http_response_encode(get_lang('Deny')); ?>" onclick="javascript:denied_friend(this)" ><?php echo api_xml_http_response_encode(get_lang('Deny'))?></button> 
+     				<button class="cancel" name="btn_denied" type="submit" id="<?php echo "btn_deniedst_".$user_id ?>" value="<?php echo api_xml_http_response_encode(get_lang('Deny')); ?>" onclick="javascript:denied_friend(this)" ><?php echo api_xml_http_response_encode(get_lang('Deny'))?></button>
                   </div></td>
                     </tr>
             </table></td>
               </tr>
-          
+
         </table></td>
         </tr>
-      
+
     </table></td>
   </tr>
 </table>

+ 6 - 6
main/social/select_options.php

@@ -6,26 +6,26 @@ require '../inc/global.inc.php';
 $track_online_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE);
 $tbl_my_user = Database :: get_main_table(TABLE_MAIN_USER);
 $tbl_my_user_friend = Database :: get_main_table(TABLE_MAIN_USER_FRIEND);
-$search=Database::escape_string(Security::remove_XSS($_POST['search'])); 
-$current_date=date('Y-m-d H:i:s',time()); 
+$search=Database::escape_string(Security::remove_XSS($_POST['search']));
+$current_date=date('Y-m-d H:i:s',time());
 $html_form='<select id="id_search_name" name="id_search_name" size="8"" style="width:350px;">';
 $user_id = api_get_user_id();
 $is_western_name_order = api_is_western_name_order();
 if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') {
-	$sql = 'SELECT DISTINCT u.user_id as id, '.($is_western_name_order ? 'concat(u.firstname," ",u.lastname," ","( ",u.email," )")' : 'concat(u.lastname," ",u.firstname," ","( ",u.email," )")').' as name 
+	$sql = 'SELECT DISTINCT u.user_id as id, '.($is_western_name_order ? 'concat(u.firstname," ",u.lastname," ","( ",u.email," )")' : 'concat(u.lastname," ",u.firstname," ","( ",u.email," )")').' as name
 	FROM '.$tbl_my_user_friend.' uf ' .
  	'INNER JOIN '.$tbl_my_user.' AS u  ON uf.friend_user_id = u.user_id ' .
  	'WHERE relation_type<>6 AND friend_user_id<>'.(int)$user_id.' AND '.($is_western_name_order ? 'concat(u.firstname, " ", u.lastname)' : 'concat(u.lastname, " ", u.firstname)').' like CONCAT("%","'.$search.'","%") ';
 } elseif (api_get_setting('allow_social_tool')=='false' && api_get_setting('allow_message_tool')=='true') {
 	$valid=api_get_setting('time_limit_whosonline');
 	$sql='SELECT DISTINCT u.user_id as id, '.($is_western_name_order ? 'concat(u.firstname," ",u.lastname," ","( ",u.email," )")' : 'concat(u.lastname," ",u.firstname," ","( ",u.email," )")').' as name
-	 FROM '.$tbl_my_user.' u INNER JOIN '.$track_online_table.' t ON u.user_id=t.login_user_id 
-	 WHERE DATE_ADD(login_date,INTERVAL "'.$valid.'" MINUTE) >= "'.$current_date.'" AND '.($is_western_name_order ? 'concat(u.firstname, " ", u.lastname)' : 'concat(u.lastname, " ", u.firstname)').' like CONCAT("%","'.$search.'","%") '; 	
+	 FROM '.$tbl_my_user.' u INNER JOIN '.$track_online_table.' t ON u.user_id=t.login_user_id
+	 WHERE DATE_ADD(login_date,INTERVAL "'.$valid.'" MINUTE) >= "'.$current_date.'" AND '.($is_western_name_order ? 'concat(u.firstname, " ", u.lastname)' : 'concat(u.lastname, " ", u.firstname)').' like CONCAT("%","'.$search.'","%") ';
 }
 
 $res=Database::query($sql,__FILE__,__LINE__);
 while ($row=Database::fetch_array($res,'ASSOC')) {
-	$html_form.='<option value="'.$row['id'].'">'.api_xml_http_response_encode($row['name']).'</option>';	
+	$html_form.='<option value="'.$row['id'].'">'.api_xml_http_response_encode($row['name']).'</option>';
 }
 $html_form.='</select>';
 echo $html_form;

+ 6 - 6
main/social/show_search_image.inc.php

@@ -4,7 +4,7 @@
 	Dokeos - elearning and course management software
 
 	Copyright (c) 2009 Dokeos SPRL
-	Copyright (c) Julio Montoya Armas 
+	Copyright (c) Julio Montoya Armas
 
 	For a full list of contributors, see "credits.txt".
 	The full license can be read in "license.txt".
@@ -34,9 +34,9 @@ $list_path_friends=array();
 $user_id=api_get_user_id();
 $name_search=Security::remove_XSS($_POST['search_name_q']);
 if (isset($name_search) && $name_search!='undefined') {
-	$list_path_friends=UserFriend::get_list_path_web_by_user_id($user_id,null,$name_search);		
+	$list_path_friends=UserFriend::get_list_path_web_by_user_id($user_id,null,$name_search);
 } else {
-	$list_path_friends=UserFriend::get_list_path_web_by_user_id($user_id);		
+	$list_path_friends=UserFriend::get_list_path_web_by_user_id($user_id);
 }
 $friend_html='';
 $number_of_images=8;
@@ -44,7 +44,7 @@ $number_friends=0;
 $list_friends_id=array();
 $list_friends_dir=array();
 $list_friends_file=array();
-if (count($list_path_friends)!=0) { 
+if (count($list_path_friends)!=0) {
 	for ($z=0;$z<count($list_path_friends['id_friend']);$z++) {
 		$list_friends_id[]  = $list_path_friends['id_friend'][$z]['friend_user_id'];
 		$list_friends_dir[] = $list_path_friends['path_friend'][$z]['dir'];
@@ -54,7 +54,7 @@ if (count($list_path_friends)!=0) {
 	$number_loop   = ($number_friends/$number_of_images);
 	$loop_friends  = ceil($number_loop);
 	$j=0;
-	$friend_html.= '<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFC" >';		
+	$friend_html.= '<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFC" >';
 	for ($k=0;$k<$loop_friends;$k++) {
 		$friend_html.='<tr><td valign="top">';
 		if ($j==$number_of_images) {
@@ -80,5 +80,5 @@ if (count($list_path_friends)!=0) {
 	}
 	$friend_html.='<br/></table>';
 }
-echo $friend_html; 
+echo $friend_html;
 ?>

+ 28 - 28
main/survey/create_new_survey.php

@@ -37,7 +37,7 @@ $language_file = 'survey';
 require_once ('../inc/global.inc.php');
 
 $htmlHeadXtra[] = '<script type="text/javascript" language="javascript">
-		
+
 		function advanced_parameters() {
 			if(document.getElementById(\'options\').style.display == \'none\') {
 					document.getElementById(\'options\').style.display = \'block\';
@@ -45,9 +45,9 @@ $htmlHeadXtra[] = '<script type="text/javascript" language="javascript">
 			} else {
 					document.getElementById(\'options\').style.display = \'none\';
 					document.getElementById(\'plus_minus\').innerHTML=\'&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\';
-			}		
+			}
 		}
-	</script>';	
+	</script>';
 
 // including additional libraries
 /** @todo check if these are all needed */
@@ -111,7 +111,7 @@ if ($_GET['action'] == 'edit' AND isset($survey_id) AND is_numeric($survey_id))
 	/*
 	$defaults['survey_share'] = array();
 	$defaults['survey_share']['survey_share'] = $survey_data['survey_share'];
-	
+
 	if (!is_numeric($survey_data['survey_share']) OR $survey_data['survey_share'] == 0)
 	{
 		$form_share_value = 'true';
@@ -121,7 +121,7 @@ if ($_GET['action'] == 'edit' AND isset($survey_id) AND is_numeric($survey_id))
 		$form_share_value = $defaults['survey_share']['survey_share'];
 	}
 	*/
-	
+
 	$defaults['anonymous'] = $survey_data['anonymous'];
 }
 else
@@ -152,7 +152,7 @@ $survey_code = $form->addElement('text', 'survey_code', get_lang('SurveyCode'),
 if ($_GET['action'] == 'edit') {
 	$survey_code->freeze();
 	$form->applyFilter('survey_code', 'api_strtoupper');
-} 
+}
 
 $form->addElement('html_editor', 'survey_title', get_lang('SurveyTitle'), null, array('ToolbarSet' => 'Survey', 'Width' => '100%', 'Height' => '200'));
 $form->addElement('html_editor', 'survey_subtitle', get_lang('SurveySubTitle'), null, array('ToolbarSet' => 'Survey', 'Width' => '100%', 'Height' => '100', 'ToolbarStartExpanded' => false));
@@ -192,16 +192,16 @@ $surveytypes[1] = get_lang('Conditional');
 
 
 if ($_GET['action'] == 'add')
-{		
+{
 	$form->addElement('hidden','survey_type',0);
-    $form -> addElement('html','<div id="options" style="display: none;">');		
+    $form -> addElement('html','<div id="options" style="display: none;">');
 	require_once(api_get_path(LIBRARY_PATH).'surveymanager.lib.php');
-	$survey_tree = new SurveyTree();	
-	$list_surveys = $survey_tree->createList($survey_tree->surveylist);	
-	$list_surveys[0]=''; 
+	$survey_tree = new SurveyTree();
+	$list_surveys = $survey_tree->createList($survey_tree->surveylist);
+	$list_surveys[0]='';
 	$form->addElement('select', 'parent_id', get_lang('ParentSurvey'), $list_surveys);
 	$defaults['parent_id']=0;
-} 
+}
 
 if ($survey_data['survey_type']==1 || $_GET['action'] == 'add' )
 {
@@ -210,7 +210,7 @@ if ($survey_data['survey_type']==1 || $_GET['action'] == 'add' )
 }
 
 if ((isset($_GET['action']) && $_GET['action'] == 'edit') && !empty($survey_id) )
-{	
+{
 	if ($survey_data['anonymous']==0  ) {
 		// Aditional Parameters
 		$form -> addElement('html','<div class="row">
@@ -218,10 +218,10 @@ if ((isset($_GET['action']) && $_GET['action'] == 'edit') && !empty($survey_id)
 			<a href="javascript: void(0);" onclick="javascript: advanced_parameters();" ><span id="plus_minus">&nbsp;'.Display::return_icon('div_show.gif',null,array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'</span></a>
 		</div>
 		<div class="formw">
-			&nbsp;	
+			&nbsp;
 		</div>
 		</div>');
-		$form -> addElement('html','<div id="options" style="display:none">');		
+		$form -> addElement('html','<div id="options" style="display:none">');
 		$form->addElement('checkbox', 'show_form_profile', get_lang('ShowFormProfile'),'','onclick="javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
 
 		if ($survey_data['show_form_profile']== 1) {
@@ -229,23 +229,23 @@ if ((isset($_GET['action']) && $_GET['action'] == 'edit') && !empty($survey_id)
 		} else {
 			$form -> addElement('html','<div id="options_field" style="display:none">');
 		}
-		
+
 		$field_list=SurveyUtil::make_field_list();
 		if (is_array ($field_list))
 		{
-			//TODO hide and show the list in a fancy DIV 			
+			//TODO hide and show the list in a fancy DIV
 			foreach ($field_list  as $key=> $field)
 			{
 				if ($field['visibility']==1)
 				{
-					$form->addElement('checkbox', 'profile_'.$key, ' ','&nbsp;&nbsp;'.$field['name'] );				
+					$form->addElement('checkbox', 'profile_'.$key, ' ','&nbsp;&nbsp;'.$field['name'] );
 					$input_name_list.= 'profile_'.$key.',';
 				}
 			}
 			// necesary to know the fields
 			$form->addElement('hidden', 'input_name_list', $input_name_list );
-			
-			//set defaults form fields		
+
+			//set defaults form fields
 			if ($survey_data['form_fields'])
 			{
 				$form_fields=explode('@',$survey_data['form_fields']);
@@ -258,10 +258,10 @@ if ((isset($_GET['action']) && $_GET['action'] == 'edit') && !empty($survey_id)
 					}
 				}
 			}
-		}		
+		}
 		$form->addElement('html', '</div></div>');
 	}
- 	
+
 }
 $form -> addElement('html','</div><br />');
 if(isset($_GET['survey_id']) && $_GET['action']=='edit') {
@@ -269,7 +269,7 @@ if(isset($_GET['survey_id']) && $_GET['action']=='edit') {
 	$text=get_lang('ModifySurvey');
 } else {
 	$class="add";
-	$text=get_lang('CreateSurvey'); 
+	$text=get_lang('CreateSurvey');
 }
 $form->addElement('style_submit_button', 'submit_survey', $text, 'class="'.$class.'"');
 
@@ -283,7 +283,7 @@ $form->addRule('survey_title', '<div class="required">'.get_lang('ThisFieldIsReq
 $form->addRule('start_date', get_lang('InvalidDate'), 'date');
 $form->addRule('end_date', get_lang('InvalidDate'), 'date');
 $form->addRule(array ('start_date', 'end_date'), get_lang('StartDateShouldBeBeforeEndDate'), 'date_compare', 'lte');
-	
+
 // setting the default values
 $form->setDefaults($defaults);
 
@@ -294,8 +294,8 @@ if( $form->validate() )
 	$values = $form->exportValues();
 	// storing the survey
 	$return = survey_manager::store_survey($values);
-	
-	/*// deleting the shared survey if the survey is getting unshared (this only happens when editing)	
+
+	/*// deleting the shared survey if the survey is getting unshared (this only happens when editing)
 	if (is_numeric($survey_data['survey_share']) AND $values['survey_share']['survey_share'] == 0 AND $values['survey_id']<>'')
 	{
 		survey_manager::delete_survey($survey_data['survey_share'], true);
@@ -310,10 +310,10 @@ if( $form->validate() )
 	{
 		// Displaying the header
 		Display::display_header($tool_name);
-		
+
 		// display the error
 		Display::display_error_message(get_lang($return['message']), false);
-		
+
 		// display the form
 		$form->display();
 	}

+ 175 - 175
main/survey/fillsurvey.php

@@ -40,9 +40,9 @@ if (!isset($_GET['cidReq']))
 {
 	$cidReset = true;
 }
-else 
+else
 {
-	$_cid = $_GET['cidReq']; 
+	$_cid = $_GET['cidReq'];
 }
 
 // including the global dokeos file
@@ -75,7 +75,7 @@ $table_user 					= Database :: get_main_table(TABLE_MAIN_USER);
 $table_survey_invitation 		= Database :: get_course_table(TABLE_SURVEY_INVITATION, $_course['db_name']);
 
 // first we check if the needed parameters are present
-if ((!isset ($_GET['course']) || !isset ($_GET['invitationcode']))&& !isset($_GET['user_id'])) 
+if ((!isset ($_GET['course']) || !isset ($_GET['invitationcode']))&& !isset($_GET['user_id']))
 {
 	Display :: display_error_message(get_lang('SurveyParametersMissingUseCopyPaste'), false);
 	Display :: display_footer();
@@ -85,7 +85,7 @@ $invitationcode = $_GET['invitationcode'];
 // start auto-invitation feature FS#3403 (all-users-can-do-the-survey-URL handling)
 if ($invitationcode == "auto" && isset($_GET['scode'])){
     // not intended for anonymous users
-    if (!(isset ($_user['user_id']) && $_user['user_id']) || api_is_anonymous($_user['user_id'],true)) {		
+    if (!(isset ($_user['user_id']) && $_user['user_id']) || api_is_anonymous($_user['user_id'],true)) {
 		api_not_allowed();
     }
     $userid = $_user['user_id'];
@@ -105,7 +105,7 @@ if ($invitationcode == "auto" && isset($_GET['scode'])){
         if (Database :: num_rows($result) == 0){ // ok
             $sql = "insert into $table_survey_invitation (survey_code,user, invitation_code, invitation_date) ";
             $sql .= " values (\"$scode\", \"$userid\", \"$autoInvitationcode\", now())";
-            api_sql_query($sql, __FILE__, __LINE__);           
+            api_sql_query($sql, __FILE__, __LINE__);
         }
         // from here we use the new invitationcode auto-userid-surveycode string
         $_GET['invitationcode'] = $autoInvitationcode;
@@ -126,7 +126,7 @@ if (Database::num_rows($result) < 1)
 $survey_invitation = Database::fetch_array($result,'ASSOC');
 
 // now we check if the user already filled the survey
-if ($survey_invitation['answered'] == 1 && !isset($_GET['user_id'])) 
+if ($survey_invitation['answered'] == 1 && !isset($_GET['user_id']))
 {
 	Display :: display_error_message(get_lang('YouAlreadyFilledThisSurvey'), false);
 	Display :: display_footer();
@@ -137,7 +137,7 @@ if ($survey_invitation['answered'] == 1 && !isset($_GET['user_id']))
 // If this is the case there will be a language choice
 $sql = "SELECT * FROM $table_survey WHERE code='".Database::escape_string($survey_invitation['survey_code'])."'";
 $result = api_sql_query($sql, __FILE__, __LINE__);
-  
+
 if (Database::num_rows($result) > 1)
 {
 	if ($_POST['language'])
@@ -180,21 +180,21 @@ if (count($_POST)>0)
 		// getting all the types of the question (because of the special treatment of the score question type
 		$sql = "SELECT * FROM $table_survey_question WHERE survey_id = '".Database::escape_string($survey_invitation['survey_id'])."'";
 		$result = api_sql_query($sql, __FILE__, __LINE__);
-		
+
 		while ($row = Database::fetch_array($result,'ASSOC'))
 		{
 			$types[$row['question_id']] = $row['type'];
-		}	
-	
+		}
+
 		// looping through all the post values
 		foreach ($_POST as $key=>$value)
 		{
 			// if the post value key contains the string 'question' then it is an answer on a question
-			if (strstr($key, 'question')) 
+			if (strstr($key, 'question'))
 			{
 				// finding the question id by removing 'question'
 				$survey_question_id = str_replace('question', '',$key);
-	
+
 				// if the post value is an array then we have a multiple response question or a scoring question type
 				// remark: when it is a multiple response then the value of the array is the option_id
 				// 		   when it is a scoring question then the key of the array is the option_id and the value is the value
@@ -232,7 +232,7 @@ if (count($_POST)>0)
 							//$value = 0;
 						}
 					}
-	
+
 					$survey_question_answer = $value;
 					SurveyUtil::remove_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id);
 					SurveyUtil::store_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id, $value, $option_value, $survey_data);
@@ -243,7 +243,7 @@ if (count($_POST)>0)
 	}
 	elseif ($survey_data['survey_type']==='1')	//conditional/personality-test type surveys
     {
-		// getting all the types of the question (because of the special treatment of the score question type		
+		// getting all the types of the question (because of the special treatment of the score question type
 		$shuffle='';
 		if ($survey_data['shuffle']=='1')
 		{
@@ -254,20 +254,20 @@ if (count($_POST)>0)
 				AND survey_group_pri='0' $shuffle
 				";
 		$result = api_sql_query($sql, __FILE__, __LINE__);
-        // there is only one question type for conditional surveys		
+        // there is only one question type for conditional surveys
 		while ($row = Database::fetch_array($result,'ASSOC'))
 		{
 			$types[$row['question_id']] = $row['type'];
-		}		
-		
+		}
+
 		// looping through all the post values
 		foreach ($_POST as $key=>$value)
 		{
 			// if the post value key contains the string 'question' then it is an answer to a question
 			if (strstr($key,'question'))
-			{	
+			{
 				// finding the question id by removing 'question'
-				$survey_question_id = str_replace('question', '',$key);				
+				$survey_question_id = str_replace('question', '',$key);
 				// we select the correct answer and the puntuacion
 				$sql = "SELECT value FROM $table_survey_question_option " .
                         " WHERE question_option_id='".Database::escape_string($value)."'";
@@ -279,9 +279,9 @@ if (count($_POST)>0)
                 //we save the answer after making sure that a possible previous attempt is deleted
 				SurveyUtil::remove_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id);
 				SurveyUtil::store_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id, $value, $option_value, $survey_data);
-				//SurveyUtil::store_answer($user,$survey_id,$question_id, $option_id, $option_value, $survey_data);				
+				//SurveyUtil::store_answer($user,$survey_id,$question_id, $option_id, $option_value, $survey_data);
 			}
-		}		
+		}
 	}
     else //in case it's another type than 0 or 1
     {
@@ -302,7 +302,7 @@ if (!isset($_GET['show']))
 	// the first thing we do is delete the session
 	unset($_SESSION['paged_questions']);
 	unset($_SESSION['page_questions_sec']);
-	$paged_questions_sec=array(); 
+	$paged_questions_sec=array();
 
 	echo '<div id="survey_content" class="survey_content">'.$survey_data['survey_introduction'].'</div>';
 	$limit = 0;
@@ -310,13 +310,13 @@ if (!isset($_GET['show']))
 
 $user_id = api_get_user_id();
 
-if ($user_id == 0) 
+if ($user_id == 0)
 {
 	$user_id = $survey_invitation['user'];
 }
 $user_data = UserManager :: get_user_info_by_id($user_id);
 
-if ($survey_data['form_fields']!='' && $survey_data['anonymous'] == 0 && is_array($user_data)) 
+if ($survey_data['form_fields']!='' && $survey_data['anonymous'] == 0 && is_array($user_data))
 {
 	//echo "<pre>"; print_r($survey_invitation);
 	$form_fields = explode('@', $survey_data['form_fields']);
@@ -339,13 +339,13 @@ if ($survey_data['form_fields']!='' && $survey_data['anonymous'] == 0 && is_arra
 
 	if (api_is_western_name_order()) {
 		if ($list['firstname'] == 1 ) {
-			//FIRST NAME		
+			//FIRST NAME
 			$form->addElement('text', 'firstname', get_lang('FirstName'), array ('size' => 40));
 			if (api_get_setting('profile', 'name') !== 'true') {
 				$form->freeze(array ('firstname'));
 			}
 			$form->applyFilter(array ('firstname'), 'stripslashes');
-			$form->applyFilter(array ('firstname'), 'trim');		
+			$form->applyFilter(array ('firstname'), 'trim');
 			$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
 		}
 		if ($list['lastname'] == 1) {
@@ -356,7 +356,7 @@ if ($survey_data['form_fields']!='' && $survey_data['anonymous'] == 0 && is_arra
 			}
 			$form->applyFilter(array ('lastname'), 'stripslashes');
 			$form->applyFilter(array ('lastname'), 'trim');
-			$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');		
+			$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
 		}
 	} else {
 		if ($list['lastname'] == 1) {
@@ -367,16 +367,16 @@ if ($survey_data['form_fields']!='' && $survey_data['anonymous'] == 0 && is_arra
 			}
 			$form->applyFilter(array ('lastname'), 'stripslashes');
 			$form->applyFilter(array ('lastname'), 'trim');
-			$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');		
+			$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
 		}
 		if ($list['firstname'] == 1 ) {
-			//FIRST NAME		
+			//FIRST NAME
 			$form->addElement('text', 'firstname', get_lang('FirstName'), array ('size' => 40));
 			if (api_get_setting('profile', 'name') !== 'true') {
 				$form->freeze(array ('firstname'));
 			}
 			$form->applyFilter(array ('firstname'), 'stripslashes');
-			$form->applyFilter(array ('firstname'), 'trim');		
+			$form->applyFilter(array ('firstname'), 'trim');
 			$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
 		}
 	}
@@ -386,7 +386,7 @@ if ($survey_data['form_fields']!='' && $survey_data['anonymous'] == 0 && is_arra
 		if (CONFVAL_ASK_FOR_OFFICIAL_CODE) {
 			$form->addElement('text', 'official_code', get_lang('OfficialCode'), array (
 				'size' => 40
-			)); 
+			));
 			if (api_get_setting('profile', 'officialcode') !== 'true')
 				$form->freeze('official_code');
 			$form->applyFilter('official_code', 'stripslashes');
@@ -580,33 +580,33 @@ if ($survey_data['form_fields'] && $survey_data['anonymous'] == 0 && is_array($u
 			}
 		}
 		//$_GET['show_form']=0;
-		//$show_form=0; 
+		//$show_form=0;
 		$_GET['show']=0;
 		$show=0;
-		//we unset the sessions  
+		//we unset the sessions
 		unset($_SESSION['paged_questions']);
 		unset($_SESSION['page_questions_sec']);
 		$paged_questions_sec=array();
-	
-	} 
+
+	}
 	//elseif ($_GET['show_form']==1) //	// displaying the field
 	else {
 		echo '<div id="survey_content" class="survey_content">' . get_lang('UpdateInformation') . '</div>';
 		//we unset the sessions
 		unset($_SESSION['paged_questions']);
 		unset($_SESSION['page_questions_sec']);
-		$paged_questions_sec=array();		
+		$paged_questions_sec=array();
 		$form->display();
 	}
 }
 
 // displaying the survey thanks message
 if (isset($_POST['finish_survey']))
-{	
+{
 	echo '<div id="survey_content" class="survey_content"><strong>'.get_lang('SurveyFinished').'</strong> <br />'.$survey_data['survey_thanks'].'</div>';
 	survey_manager::update_survey_answered($survey_data['survey_id'], $survey_invitation['user'], $survey_invitation['survey_code']);
 	unset($_SESSION['paged_questions']);
-	unset($_SESSION['page_questions_sec']); 
+	unset($_SESSION['page_questions_sec']);
 	Display :: display_footer();
 	exit();
 }
@@ -616,7 +616,7 @@ $shuffle='';
 if ($survey_data['shuffle']==1)
 {
 	$shuffle= ' BY RAND() ';
-}		
+}
 
 if ( isset($_GET['show']) || isset($_POST['personality']))
 {
@@ -625,7 +625,7 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 	$questions_displayed = array();
 	$counter = 0;
     $paged_questions = array();
-	
+
 	// if non-conditional survey
 	if ($survey_data['survey_type']==='0')
 	{
@@ -634,7 +634,7 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
     		$sql = "SELECT * FROM $table_survey_question
     				WHERE survey_id = '".Database::escape_string($survey_invitation['survey_id'])."'
     				ORDER BY sort ASC";
-    		$result = api_sql_query($sql, __FILE__, __LINE__);		
+    		$result = api_sql_query($sql, __FILE__, __LINE__);
     		while ($row = Database::fetch_array($result,'ASSOC'))
     		{
     			if($row['type'] == 'pagebreak')
@@ -644,7 +644,7 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
     			else
     			{
     				// ids from question of the current survey
-    				$paged_questions[$counter][] = $row['question_id']; 
+    				$paged_questions[$counter][] = $row['question_id'];
     			}
     		}
             $_SESSION['paged_questions'] = $paged_questions;
@@ -653,14 +653,14 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
         {
         	$paged_questions = $_SESSION['paged_questions'];
         }
-        
+
 		if (key_exists($_GET['show'], $paged_questions)) {
 			if (isset($_GET['user_id'])) {
 
 			// get the user into survey answer table (user or anonymus)
 			$my_user_id=($survey_data['anonymous']==1) ? $_SESSION['surveyuser'] :api_get_user_id();
-				
-			$sql = "SELECT survey_question.survey_group_sec1, survey_question.survey_group_sec2, survey_question.survey_group_pri,					
+
+			$sql = "SELECT survey_question.survey_group_sec1, survey_question.survey_group_sec2, survey_question.survey_group_pri,
 					survey_question.question_id, survey_question.survey_id, survey_question.survey_question, survey_question.display, survey_question.sort, survey_question.type, survey_question.max_value,
 					survey_question_option.question_option_id, survey_question_option.option_text, survey_question_option.sort as option_sort
 					FROM $table_survey_question survey_question
@@ -671,7 +671,7 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 					ORDER BY survey_question.sort, survey_question_option.sort ASC";
 			} else {
 
-			$sql = "SELECT survey_question.survey_group_sec1, survey_question.survey_group_sec2, survey_question.survey_group_pri,					
+			$sql = "SELECT survey_question.survey_group_sec1, survey_question.survey_group_sec2, survey_question.survey_group_pri,
 					survey_question.question_id, survey_question.survey_id, survey_question.survey_question, survey_question.display, survey_question.sort, survey_question.type, survey_question.max_value,
 					survey_question_option.question_option_id, survey_question_option.option_text, survey_question_option.sort as option_sort
 					FROM $table_survey_question survey_question
@@ -681,13 +681,13 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 					AND survey_question.question_id IN (".implode(',',$paged_questions[$_GET['show']]).")
 					ORDER BY survey_question.sort, survey_question_option.sort ASC";
 			}
-	
+
 			$result = api_sql_query($sql, __FILE__, __LINE__);
 			$question_counter_max = Database::num_rows($result);
 			$counter = 0;
 			$limit=0;
 			$questions = array();
-			
+
 			while ($row = Database :: fetch_array($result, 'ASSOC')) {
 
 				// if the type is not a pagebreak we store it in the $questions array
@@ -698,7 +698,7 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 					$questions[$row['sort']]['display'] = $row['display'];
 					$questions[$row['sort']]['type'] = $row['type'];
 					$questions[$row['sort']]['options'][$row['question_option_id']] = $row['option_text'];
-					$questions[$row['sort']]['maximum_score'] = $row['max_value'];				
+					$questions[$row['sort']]['maximum_score'] = $row['max_value'];
 				}
 				// if the type is a pagebreak we are finished loading the questions for this page
 				else {
@@ -709,63 +709,63 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 		}
 	}
 	elseif ($survey_data['survey_type']==='1')
-	{		
+	{
 		$my_survey_id=Database::escape_string($survey_invitation['survey_id']);
 		$current_user = Database::escape_string($survey_invitation['user']);
-				
+
 		if (isset($_POST['personality']))
 		{
-			// Compute the results to get the 3 groups nearest to the user's personality			
+			// Compute the results to get the 3 groups nearest to the user's personality
 			if ($shuffle=='')
-				$order = 'BY sort ASC ';				
+				$order = 'BY sort ASC ';
 			else
 				$order = $shuffle;
-            
+
 			$answer_list=array();
 
 			// get current user results
 			$results=array();
 			$sql = "SELECT survey_group_pri, user, SUM(value) as value
-					FROM $table_survey_answer as survey_answer INNER JOIN $table_survey_question as survey_question 
+					FROM $table_survey_answer as survey_answer INNER JOIN $table_survey_question as survey_question
 					ON  (survey_question.question_id = survey_answer.question_id)
 					WHERE survey_answer.survey_id='".$my_survey_id."' AND
 					survey_answer.user='".$current_user."'
 					GROUP BY survey_group_pri
 					ORDER BY survey_group_pri
 					";
-			
+
 			$result = api_sql_query($sql, __FILE__, __LINE__);
 			while ($row = Database :: fetch_array($result)) {
 				$answer_list['value']=$row['value'];
 				$answer_list['group']=$row['survey_group_pri'];
 				$results[]=$answer_list;
 			}
-			
+
 			//echo "<br>";print_r($results);	echo "<br>";
-			
+
 			// get the total score for each group of questions
-			$totals=array();			
-			$sql = "SELECT SUM(temp.value) as value, temp.survey_group_pri FROM 
-					(SELECT MAX(value) as value,  survey_group_pri, survey_question.question_id 
-					FROM $table_survey_question as survey_question 
-					INNER JOIN $table_survey_question_option as survey_question_option 
+			$totals=array();
+			$sql = "SELECT SUM(temp.value) as value, temp.survey_group_pri FROM
+					(SELECT MAX(value) as value,  survey_group_pri, survey_question.question_id
+					FROM $table_survey_question as survey_question
+					INNER JOIN $table_survey_question_option as survey_question_option
 					ON (survey_question.question_id = survey_question_option.question_id)
 					WHERE survey_question.survey_id='".$my_survey_id."'  AND  survey_group_sec1='0' AND survey_group_sec2='0'
 					GROUP BY survey_group_pri, survey_question.question_id) as temp
 					GROUP BY temp.survey_group_pri
 					ORDER BY temp.survey_group_pri";
-					
+
 			$result = api_sql_query($sql, __FILE__, __LINE__);
 			while ($row = Database::fetch_array($result))
-			{		
+			{
 				$list['value']=$row['value'];
 				$list['group']=$row['survey_group_pri'];
 				$totals[]=$list;
 			}
 			//echo '<pre>'; print_r($totals);
-			
+
 			$final_results=array();
-			
+
             //get a percentage score for each group
 			for ($i = 0; $i < count($totals); $i++) {
 				for ($j = 0; $j < count($results); $j++) {
@@ -773,10 +773,10 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 						$group=$totals[$i]['group'];
 						$porcen=($results[$j]['value'] / $totals[$i]['value'] );
 						$final_results[$group]=$porcen;
-					}					
-				}				
+					}
+				}
 			}
-							
+
 			// sort the results by score (getting a list of group IDs by score into $groups)
 			arsort($final_results);
 			$groups=array_keys($final_results);
@@ -786,7 +786,7 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 			echo "<br>";
 			print_r($final_results);
             echo '</pre>';
-		    */					
+		    */
 			$result=array();
 			$count_result=0;
 			foreach ($final_results as $key => $sub_result) {
@@ -796,7 +796,7 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 				);
 				$count_result++;
 			}
-			
+
 
 			/*
 			//i.e 70% - 70% -70% 70%  $equal_count =3
@@ -810,22 +810,22 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 				{
 					break;
 				}
-				$i++;	
+				$i++;
 			}
 			echo 'eq'. $equal_count;
 			echo "<br>";
 			if 	($equal_count==0)
 			{
-				//i.e 70% 70% -60% 60%  $equal_count = 1 only we get the first 2 options			
+				//i.e 70% 70% -60% 60%  $equal_count = 1 only we get the first 2 options
 				if ( ($result[0]['value']  == $result[1]['value'])  &&  ($result[2]['value']==$result[3]['value']) )
 				{
-					$group_cant=1;			
-				} 
+					$group_cant=1;
+				}
 				else
 				{	// by default we chose the highest 3
 					$group_cant=2;
-				}		
-			} 
+				}
+			}
 			elseif ($equal_count==2)
 			{
 				$group_cant=2;
@@ -835,7 +835,7 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 				$group_cant=-1;
 			}
 			*/
-			
+
 			//i.e 70% - 70% -70% 70%  $equal_count =3
 
 			$i = 0;
@@ -845,17 +845,17 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 			if ($count_result>0)
 			{
 				// Count the number of scores equal to the first
-				while (1) 
+				while (1)
 				{
-					if ($result[$i]['value'] == $result[$i +1]['value']) 
+					if ($result[$i]['value'] == $result[$i +1]['value'])
 					{
 						$equal_count++;
-					} 
-					else 
+					}
+					else
 					{
 						break;
 					}
-					$i++;				
+					$i++;
 				}
 			}
 			else
@@ -870,22 +870,22 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 			if ($equal_count<4)
 			{
 				//if there is one or less score equalities
-				if ($equal_count === 0 || $equal_count === 1) 
+				if ($equal_count === 0 || $equal_count === 1)
 					{
-					//i.e 70% - 70% -60% - 60%  $equal_count = 1 we only get the first 2 options	
-					if (($result[0]['value'] == $result[1]['value']) && ($result[2]['value'] == $result[3]['value'])) 
+					//i.e 70% - 70% -60% - 60%  $equal_count = 1 we only get the first 2 options
+					if (($result[0]['value'] == $result[1]['value']) && ($result[2]['value'] == $result[3]['value']))
 					{
 						$group_cant = 1;
 					}
-					//i.e 70% - 70% -0% - 0% 	-	$equal_count = 0 we only get the first 2 options	
+					//i.e 70% - 70% -0% - 0% 	-	$equal_count = 0 we only get the first 2 options
 					/*elseif (($result[0]['value'] == $result[1]['value']) && ($result[1]['value'] != $result[2]['value']) ) {
-						$group_cant=0;			
+						$group_cant=0;
 					}*/
 					/*
-					//i.e 70% - 70% -60% - 60%  $equal_count = 0 we only get the first 2 options	
+					//i.e 70% - 70% -60% - 60%  $equal_count = 0 we only get the first 2 options
 					elseif ( ($result[0]['value']  == $result[1]['value'])  &&  ($result[2]['value'] == $result[3]['value']) )
 					{
-						$group_cant=0;				
+						$group_cant=0;
 					}*/
 					//i.e. 80% - 70% - 70% - 70%
 					elseif (($result[0]['value'] != $result[1]['value']) && ($result[1]['value'] == $result[2]['value']) && ($result[2]['value'] == $result[3]['value'])) {
@@ -895,11 +895,11 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 					{
 					//i.e. 80% - 70% - 70% - 50
 					//i.e. 80% - 80% - 70% - 50
-						 	 
+
 						// by default we choose the highest 3
-						$group_cant=2;				
-					}		
-				} 
+						$group_cant=2;
+					}
+				}
 				else
 				{
 					//if there are two score equalities
@@ -907,25 +907,25 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 				}
 
 				//@todo
-				// conditional_status 
-				// 0 no determinado 
-				// 1 determinado 
+				// conditional_status
+				// 0 no determinado
+				// 1 determinado
 				// 2 un solo valor
 				// 3 valores iguales
-								
+
 				if ($group_cant>0)
-				{				
+				{
 					//echo '$equal_count'.$group_cant;
-					// we only get highest 3			
-					$secondary ='';		
+					// we only get highest 3
+					$secondary ='';
 					$combi='';
-					
+
 					for ($i = 0; $i <= $group_cant; $i++) {
 						$group1=$groups[$i];
 						$group2=$groups[$i+1];
 						// here we made all the posibilities with the 3 groups
 						if ($group_cant == 2 && $i == $group_cant) {
-							$group2=$groups[0];				
+							$group2=$groups[0];
 							$secondary .= " OR ( survey_group_sec1 = '$group1' AND  survey_group_sec2 = '$group2') ";
 							$secondary .= " OR ( survey_group_sec1 = '$group2' AND survey_group_sec2 = '$group1' ) ";
 							$combi.= $group1.' - '.$group2." or ".$group2.' - '.$group1."<br>";
@@ -939,7 +939,7 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 								$secondary .= " OR ( survey_group_sec1 = '$group2' AND survey_group_sec2 = '$group1' ) ";
 								$combi.= $group1.' - '.$group2." or ".$group2.' - '.$group1."<br>";
 							}
-						}										 
+						}
 					}
 					/*
                     echo '<pre>';
@@ -948,7 +948,7 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 					echo '</pre>';
 					*/
 					// create the new select with the questions from the secondary phase
-					if (empty($_SESSION['page_questions_sec']) && !is_array($_SESSION['page_questions_sec']) && count($_SESSION['page_questions_sec']==0)) 
+					if (empty($_SESSION['page_questions_sec']) && !is_array($_SESSION['page_questions_sec']) && count($_SESSION['page_questions_sec']==0))
 					{
 
     					$sql = "SELECT * FROM $table_survey_question
@@ -962,7 +962,7 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
     						if ($survey_data['one_question_per_page']==1)
     						{
     							$paged_questions_sec[$counter][] = $row['question_id'];
-    							$counter++; 
+    							$counter++;
     						}
     						else
     							if($row['type'] == 'pagebreak')
@@ -970,32 +970,32 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
     								$counter++;
 								} else {
     								// ids from question of the current survey
-    								$paged_questions_sec[$counter][] = $row['question_id']; 
-    							}					
+    								$paged_questions_sec[$counter][] = $row['question_id'];
+    							}
     					}
-                        $_SESSION['paged_questions_sec'] = $paged_questions_sec;			
+                        $_SESSION['paged_questions_sec'] = $paged_questions_sec;
                     }
                     else
-                    {	
+                    {
                     	$paged_questions_sec = $_SESSION['paged_questions_sec'];
                     }
 					//print_r($paged_questions_sec);
 
-                    $paged_questions = $_SESSION['paged_questions']; //for the sake of pages counting 
+                    $paged_questions = $_SESSION['paged_questions']; //for the sake of pages counting
                     //$paged_questions = $paged_questions_sec; //for the sake of pages counting coming up at display time...
-                    	
-					if ($shuffle=='') 
-						$shuffle=' BY survey_question.sort, survey_question_option.sort ASC ';	
-							
+
+					if ($shuffle=='')
+						$shuffle=' BY survey_question.sort, survey_question_option.sort ASC ';
+
 					//$val=0;
 					//if ($survey_data['one_question_per_page']==0)
 					//{
 						$val=(int)$_POST['personality'];
-					//}			
+					//}
 					//echo '<pre>';print_r($paged_questions_sec);echo '</pre>';
 					if (is_array($paged_questions_sec))
 					{
-						$sql = "SELECT survey_question.survey_group_sec1, survey_question.survey_group_sec2, survey_question.survey_group_pri,				
+						$sql = "SELECT survey_question.survey_group_sec1, survey_question.survey_group_sec2, survey_question.survey_group_pri,
 								survey_question.question_id, survey_question.survey_id, survey_question.survey_question, survey_question.display, survey_question.sort, survey_question.type, survey_question.max_value,
 								survey_question_option.question_option_id, survey_question_option.option_text, survey_question_option.sort as option_sort
 								FROM $table_survey_question survey_question
@@ -1009,7 +1009,7 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 						$question_counter_max = Database::num_rows($result);
 						$counter = 0;
 						$limit=0;
-						$questions = array();			
+						$questions = array();
 						while ($row = Database::fetch_array($result,'ASSOC'))
 						{
 							// if the type is not a pagebreak we store it in the $questions array
@@ -1021,7 +1021,7 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 								$questions[$row['sort']]['type'] = $row['type'];
 								$questions[$row['sort']]['options'][$row['question_option_id']] = $row['option_text'];
 								$questions[$row['sort']]['maximum_score'] = $row['max_value'];
-								// personality params					
+								// personality params
 								$questions[$row['sort']]['survey_group_sec1'] = $row['survey_group_sec1'];
 								$questions[$row['sort']]['survey_group_sec2'] = $row['survey_group_sec2'];
 								$questions[$row['sort']]['survey_group_pri'] = $row['survey_group_pri'];
@@ -1035,7 +1035,7 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 						}
 					}
 					else
-					{	
+					{
 						echo get_lang('SurveyUndetermined');
 					}
 
@@ -1045,48 +1045,48 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 					echo get_lang('SurveyUndetermined');
 				}
 			}
-			else 
+			else
 			{
 				echo get_lang('SurveyUndetermined');
 			}
 		}
-		else 
-		{	
+		else
+		{
 			//We need this variable only in the 2nd set of questions when personality is set.
 			unset($_SESSION['page_questions_sec']);
 			$paged_questions_sec=array();
 
-			// Only the questions from the basic group	
-			//the 50 questions A B C D E F G	
+			// Only the questions from the basic group
+			//the 50 questions A B C D E F G
 			$order_sql= $shuffle;
-			if ($shuffle=='') 
+			if ($shuffle=='')
 				$order_sql=' BY question_id ';
-						 
+
             if(empty($_SESSION['paged_questions']))
             {
     			$sql = "SELECT * FROM $table_survey_question
-    						 WHERE survey_id = '".Database::escape_string($survey_invitation['survey_id'])."' 
-    					  	 AND survey_group_sec1='0' AND survey_group_sec2='0'  
+    						 WHERE survey_id = '".Database::escape_string($survey_invitation['survey_id'])."'
+    					  	 AND survey_group_sec1='0' AND survey_group_sec2='0'
     						 ORDER ".$order_sql." ";
     			//echo "<br>";echo "<br>";
-    			$result = api_sql_query($sql, __FILE__, __LINE__);					
-    			$counter=0;			
+    			$result = api_sql_query($sql, __FILE__, __LINE__);
+    			$counter=0;
     			while ($row = Database::fetch_array($result,'ASSOC'))
     			{
     				if ($survey_data['one_question_per_page']==1)
     				{
     					$paged_questions[$counter][] = $row['question_id'];
-    					$counter++; 
+    					$counter++;
 					} else {
 						if ($row['type'] == 'pagebreak') {
     						$counter++;
 						} else {
     						// ids from question of the current survey
-    						$paged_questions[$counter][] = $row['question_id']; 
+    						$paged_questions[$counter][] = $row['question_id'];
     					}
     				}
     			}
-                $_SESSION['paged_questions'] = $paged_questions; 
+                $_SESSION['paged_questions'] = $paged_questions;
             }
             else
             {
@@ -1096,36 +1096,36 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 			//print_r($paged_questions);
             //print_r($paged_questions);
 			//if (key_exists($_GET['show'],$paged_questions))
-			//{		
+			//{
 			$order_sql= $shuffle;
-			if ($shuffle=='') 
+			if ($shuffle=='')
 				$order_sql=' BY survey_question.sort, survey_question_option.sort ASC ';
-			
+
 			//$val=0;
 			//if ($survey_data['one_question_per_page']==0)
 			//{
 				$val=$_GET['show'];
 			//}
 			//echo '<pre>';print_r($paged_questions);echo $val;
-			
+
 			$result=null;
 			if ($val!='')
 			{
 				$imploded= implode(',', $paged_questions[$val]);
-				if ($imploded!=''){ 
+				if ($imploded!=''){
 					// the answers are always in the same order NO shuffle
 					$order_sql = ' BY survey_question.sort, survey_question_option.sort ASC ';
-					$sql = "SELECT survey_question.survey_group_sec1, survey_question.survey_group_sec2, survey_question.survey_group_pri,				
+					$sql = "SELECT survey_question.survey_group_sec1, survey_question.survey_group_sec2, survey_question.survey_group_pri,
 							survey_question.question_id, survey_question.survey_id, survey_question.survey_question, survey_question.display, survey_question.sort, survey_question.type, survey_question.max_value,
 							survey_question_option.question_option_id, survey_question_option.option_text, survey_question_option.sort as option_sort
 							FROM $table_survey_question survey_question
 							LEFT JOIN $table_survey_question_option survey_question_option
 							ON survey_question.question_id = survey_question_option.question_id
 							WHERE survey_question.survey_id = '" . Database :: escape_string($survey_invitation['survey_id']) . "'
-							AND survey_question.question_id IN (" .$imploded. ")  
-							ORDER $order_sql ";	
+							AND survey_question.question_id IN (" .$imploded. ")
+							ORDER $order_sql ";
 					$result = api_sql_query($sql, __FILE__, __LINE__);
-					$question_counter_max = Database :: num_rows($result);				
+					$question_counter_max = Database :: num_rows($result);
 				}
 			}
 			if (!is_null($result))
@@ -1145,7 +1145,7 @@ if ( isset($_GET['show']) || isset($_POST['personality']))
 						$questions[$row['sort']]['type'] = $row['type'];
 						$questions[$row['sort']]['options'][$row['question_option_id']] = $row['option_text'];
 						$questions[$row['sort']]['maximum_score'] = $row['max_value'];
-						// personality params					
+						// personality params
 						$questions[$row['sort']]['survey_group_sec1'] = $row['survey_group_sec1'];
 						$questions[$row['sort']]['survey_group_sec2'] = $row['survey_group_sec2'];
 						$questions[$row['sort']]['survey_group_pri'] = $row['survey_group_pri'];
@@ -1211,16 +1211,16 @@ if(isset($questions) && is_array($questions))
 }
 
 if ($survey_data['survey_type']==='0')
-{	
+{
 	if ($survey_data['show_form_profile']==0)
 	{
-		// the normal survey as always		
+		// the normal survey as always
 		if (($show < $numberofpages) || !$_GET['show']) //$show = $_GET['show']+1
 		{
 			//echo '<input type="submit" name="next_survey_page" value="' . get_lang('Next') . ' " class="next" />';
 			echo '<button type="submit" name="next_survey_page" class="next">'.get_lang('NextQuestion').'</button>';
 		}
-		
+
 		if ($show >= $numberofpages && $_GET['show']) {
 			//echo '<input type="submit" name="finish_survey" value="' . get_lang('FinishSurvey') . '" class="next" />';
 			echo '<button type="submit" name="finish_survey" class="next">'.get_lang('FinishSurvey').'</button>';
@@ -1230,44 +1230,44 @@ if ($survey_data['survey_type']==='0')
 	{
 		// the normal survey as always but with the form profile
 		if (isset ($_GET['show']))
-		{ 
+		{
 			$numberofpages=count($paged_questions);
 			if (($show < $numberofpages) || !$_GET['show']) //$show = $_GET['show']+1
 			{
 				//echo '<input type="submit" name="next_survey_page" value="' . get_lang('Next') . '" class="next" />';
 				echo '<button type="submit" name="next_survey_page" class="next">'.get_lang('Next').'</button>';
-			}	
-		
+			}
+
 			if ($show >= $numberofpages && $_GET['show'] )
-			{ 		
+			{
 				//echo '<input type="submit" name="finish_survey" value="' . get_lang('FinishSurvey') . '" class="next" />';
 				echo '<button type="submit" name="finish_survey" class="next">'.get_lang('FinishSurvey').'</button>';
 			}
 		}
 	}
-		
+
 }
 elseif ($survey_data['survey_type'] === '1') //conditional/personality-test type survey
 {
 	if (isset ($_GET['show']) || isset ($_POST['personality']))
 	{
-		$numberofpages = count($paged_questions);				
+		$numberofpages = count($paged_questions);
 		//echo "<br>"; echo 'num pages norma:'.$numberofpages;echo "<br>";
 		//echo '<pre>';print_r($paged_questions_sec);
-		if (!empty ($paged_questions_sec) && count($paged_questions_sec) > 0) 
-		{ 
-			//in case we're in the second phase, also sum the second group questions			
+		if (!empty ($paged_questions_sec) && count($paged_questions_sec) > 0)
+		{
+			//in case we're in the second phase, also sum the second group questions
 			//echo 'pagesec :'.count($paged_questions_sec);
 			$numberofpages += count($paged_questions_sec);
-			//echo 'pagesec :';					
+			//echo 'pagesec :';
 		}
-		else 
+		else
 		{
 			// we need this variable only if personality ==1
 			unset($_SESSION['page_questions_sec']);
 			$paged_questions_sec=array();
 		}
-		
+
 		/*echo "<br>";
 		echo 'num pages:'.$numberofpages;echo "<br>";
 		echo 'show :'.$show;echo "<br>";
@@ -1277,7 +1277,7 @@ elseif ($survey_data['survey_type'] === '1') //conditional/personality-test type
 		//echo $show.' / '.$numberofpages."<br />";
 		if ($personality ==0)
 		if ( ($show <= $numberofpages) || !$_GET['show'] ) //$show = $_GET['show']+1
-		{	
+		{
 			//echo '<input type="submit" name="next_survey_page" value="' . get_lang('Next') . ' " class="next" />';
 			echo '<button type="submit" name="next_survey_page" class="next">'.get_lang('Next').'</button>';
 			if ($survey_data['one_question_per_page']==0)
@@ -1293,19 +1293,19 @@ elseif ($survey_data['survey_type'] === '1') //conditional/personality-test type
 				{
 					echo '<input type="hidden" name="personality" value="' . $personality . '">';
 				}
-			}	
-				
+			}
+
 			if ($numberofpages == $show)
 				echo '<input type="hidden" name="personality" value="' . $personality . '">';
 		}
-		
+
 		if ($show > $numberofpages && $_GET['show']  && $personality==0)
-		{	
+		{
 			echo '<input type="hidden" name="personality" value="' . $personality . '">';
-			//$numberofpages = count($paged_questions);	
+			//$numberofpages = count($paged_questions);
 			//echo $numberofpages = count($paged_questions_sec);
 			//echo $personality.' / '.$numberofpages;
-			//echo "<br />"; 
+			//echo "<br />";
 			//if ($personality > count($paged_questions_sec) - 1)
 			//|| $numberofpages == $show  +$personality +1
 			//echo $show + $personality;
@@ -1315,7 +1315,7 @@ elseif ($survey_data['survey_type'] === '1') //conditional/personality-test type
 		{
 			if ($survey_data['one_question_per_page']==1)
 			{
-		
+
 				if ($show >= $numberofpages)
 				{
 					//echo '<input type="submit" name="finish_survey" value="' . get_lang('FinishSurvey') . ' " class="next" />';
@@ -1325,19 +1325,19 @@ elseif ($survey_data['survey_type'] === '1') //conditional/personality-test type
 				{
 					echo '<input type="hidden" name="personality" value="' . $personality . '">';
 					//echo '<input type="submit" name="next_survey_page" value="' . get_lang('Next') . '" class="next" />';
-					echo '<button type="submit" name="next_survey_page" class="next">'.get_lang('Next').'</button>';					
-				}			
-			}	
+					echo '<button type="submit" name="next_survey_page" class="next">'.get_lang('Next').'</button>';
+				}
+			}
 			else
 			{
 				// if the personality test hidden input was set.
 				//echo '<input type="submit" name="finish_survey" value="' . get_lang('FinishSurvey') . ' " class="next" />';
-				echo '<button type="submit" name="finish_survey" class="next">'.get_lang('FinishSurvey').'</button>';				
+				echo '<button type="submit" name="finish_survey" class="next">'.get_lang('FinishSurvey').'</button>';
 			}
 		}
 	}
-	// this is the case when the show_profile_form is true but there are not form_fields 
-	elseif ($survey_data['form_fields'] == '') 
+	// this is the case when the show_profile_form is true but there are not form_fields
+	elseif ($survey_data['form_fields'] == '')
 	{
 		//echo '<input type="submit" name="next_survey_page" value="' . get_lang('Next') . ' " class="next" />';
 		echo '<button type="submit" name="next_survey_page" class="next">'.get_lang('Next').'</button>';
@@ -1345,7 +1345,7 @@ elseif ($survey_data['survey_type'] === '1') //conditional/personality-test type
 	elseif(!is_array($user_data))
 	{	// if the user is not registered in the platform we do not show the form to update his information
 		//echo '<input type="submit" name="next_survey_page" value="' . get_lang('Next') . ' " class="next" />';
-		echo '<button type="submit" name="next_survey_page" class="next">'.get_lang('Next').'</button>';	 
+		echo '<button type="submit" name="next_survey_page" class="next">'.get_lang('Next').'</button>';
 	}
 }
 echo '</form>';

+ 1 - 1
main/survey/preview.php

@@ -23,7 +23,7 @@
 *	@package dokeos.survey
 * 	@author unknown, the initial survey that did not make it in 1.8 because of bad code
 * 	@author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code
-*	@author Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modifications 
+*	@author Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modifications
 * 	@version $Id: survey_list.php 10680 2007-01-11 21:26:23Z pcool $
 *
 * 	@todo use quickforms for the forms

+ 31 - 31
main/survey/question.php

@@ -42,7 +42,7 @@ $htmlHeadXtra[] = '<script type="text/javascript">
 							//Allow dokeos install in IE
 							$("button").click(function() {
 								$("#is_executable").attr("value",$(this).attr("name"));
-							});		
+							});
 		 				} ); </script>';
 
 /** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/
@@ -59,11 +59,11 @@ if ($request_index<>$is_valid_request) {
 	if ($request_index=='save_question') {
 		unset($_POST[$request_index]);
 	} elseif ($request_index=='add_answer') {
-		unset($_POST[$request_index]);			
+		unset($_POST[$request_index]);
 	} elseif($request_index=='remove_answer') {
-		unset($_POST[$request_index]);		
+		unset($_POST[$request_index]);
 	}
-} 
+}
 
 // Database table definitions
 $table_survey 					= Database :: get_course_table(TABLE_SURVEY);
@@ -92,7 +92,7 @@ if($survey_data['survey_type']==1) {
 	$rs = api_sql_query($sql,__FILE__,__LINE__);
 	if(Database::num_rows($rs)===0) {
 		header('Location: survey.php?survey_id='.(int)$_GET['survey_id'].'&message='.'YouNeedToCreateGroups');
-		exit;	
+		exit;
 	}
 }
 
@@ -111,7 +111,7 @@ if ($_GET['action'] == 'edit') {
 // the possible question types
 $possible_types = array('personality','yesno', 'multiplechoice', 'multipleresponse', 'open', 'dropdown', 'comment', 'pagebreak', 'percentage', 'score');
 
-// actions 
+// actions
 $actions = '<div class="actions">';
 $actions .= '<a href="survey.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'">'.Display::return_icon('back.png',get_lang('BackToSurvey')).get_lang('BackToSurvey').'</a>';
 $actions .= '</div>';
@@ -119,7 +119,7 @@ $actions .= '</div>';
 if (!in_array($_GET['type'], $possible_types))
 {
 	Display :: display_header($tool_name,'Survey');
-	echo $actions; 
+	echo $actions;
 	Display :: display_error_message(get_lang('TypeDoesNotExist'), false);
 	Display :: display_footer();
 }
@@ -128,70 +128,70 @@ if (!in_array($_GET['type'], $possible_types))
 if (empty($_POST['save_question']) && in_array($_GET['type'],$possible_types)) {
 	if (!isset($_POST['save_question'])) {
 		// Displaying the header
-		Display::display_header($tool_name,'Survey');	
-		echo $actions; 
-		$error_message='';	
-		// Displys message if exists					
-		if (isset($_SESSION['temp_sys_message'])) {	
+		Display::display_header($tool_name,'Survey');
+		echo $actions;
+		$error_message='';
+		// Displys message if exists
+		if (isset($_SESSION['temp_sys_message'])) {
 			$error_message=$_SESSION['temp_sys_message'];
-			unset($_SESSION['temp_sys_message']);				
+			unset($_SESSION['temp_sys_message']);
 			if ($error_message=='PleaseEnterAQuestion' || $error_message=='PleasFillAllAnswer'|| $error_message=='PleaseChooseACondition'|| $error_message=='ChooseDifferentCategories') {
-				Display::display_error_message(get_lang($error_message), true);			
-			} 		
+				Display::display_error_message(get_lang($error_message), true);
+			}
 		}
 	}
 	$form = new $_GET['type'];
 
 	// The defaults values for the form
 	$form_content['answers'] = array('', '');
-	
+
 	if ($_GET['type'] == 'yesno') {
 		$form_content['answers'][0]=get_lang('Yes');
 		$form_content['answers'][1]=get_lang('No');
 	}
-	
+
 	if ($_GET['type'] == 'personality') {
 		$form_content['answers'][0]=get_lang('1');
 		$form_content['answers'][1]=get_lang('2');
 		$form_content['answers'][2]=get_lang('3');
 		$form_content['answers'][3]=get_lang('4');
 		$form_content['answers'][4]=get_lang('5');
-		
+
 		$form_content['values'][0]=0;
 		$form_content['values'][1]=0;
 		$form_content['values'][2]=1;
 		$form_content['values'][3]=2;
-		$form_content['values'][4]=3;	
+		$form_content['values'][4]=3;
 	}
-		
+
 	// We are editing a question
 	if (isset($_GET['question_id']) AND !empty($_GET['question_id'])) {
-		$form_content = survey_manager::get_question($_GET['question_id']);		
+		$form_content = survey_manager::get_question($_GET['question_id']);
 	}
 
 	// an action has been performed (for instance adding a possible answer, moving an answer, ...)
-	if ($_POST) {	
+	if ($_POST) {
 		$form_content = $_POST;
 		$form_content = $form->handle_action($form_content);
 	}
-	
-	if ($error_message!='') {						
+
+	if ($error_message!='') {
 		$form_content['question']=$_SESSION['temp_user_message'];
 		$form_content['answers']=$_SESSION['temp_answers'];
 		$form_content['values']=$_SESSION['temp_values'];
 		$form_content['horizontalvertical'] = $_SESSION['temp_horizontalvertical'];
-		
-		
+
+
 		unset($_SESSION['temp_user_message']);
 		unset($_SESSION['temp_answers']);
-		unset($_SESSION['temp_values']);								
+		unset($_SESSION['temp_values']);
 		unset($_SESSION['temp_horizontalvertical']);
 	}
-	
+
 	$form->create_form($form_content);
-	$form->render_form();	 
-} else {	
-	$form_content = $_POST;	
+	$form->render_form();
+} else {
+	$form_content = $_POST;
 	$form = new question();
 	$form->handle_action($form_content);
 }

+ 1 - 1
main/survey/reporting.php

@@ -64,7 +64,7 @@ if ($_POST['export_report'])
 
 			header('Content-type: application/octet-stream');
 			header('Content-Type: application/force-download');
-			
+
 			if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT']))
 			{
 				header('Content-Disposition: filename= '.$filename);

+ 8 - 8
main/survey/survey.download.inc.php

@@ -22,7 +22,7 @@
  *	@package dokeos.survey
  *	@author Arnaud Ligot <arnaud@cblue.be>
  *	@version $Id: $
- *	
+ *
  *	small peace code to enable user to access images included into survey
  *	which are accessible by non authenticated users. This file is included
  *	by document/download.php
@@ -34,7 +34,7 @@ function check_download_survey($course, $invitation, $doc_url) {
 
 	// getting all the course information
 	$_course = CourseManager::get_course_information($course);
-	
+
 	// Database table definitions
 	$table_survey 					= Database :: get_course_table(TABLE_SURVEY, $_course['db_name']);
 	$table_survey_question 			= Database :: get_course_table(TABLE_SURVEY_QUESTION, $_course['db_name']);
@@ -64,12 +64,12 @@ function check_download_survey($course, $invitation, $doc_url) {
 	}
 
 	// very basic security check: check if a text field from a survey/answer/option contains the name of the document requested
-	
+
 
 	//////////////
 	// fetch survey ID
 	//////////////
-	
+
 	// If this is the case there will be a language choice
 	$sql = "SELECT * FROM $table_survey WHERE code='".Database::escape_string($survey_invitation['survey_code'])."'";
 	$result = api_sql_query($sql, __FILE__, __LINE__);
@@ -101,10 +101,10 @@ function check_download_survey($course, $invitation, $doc_url) {
 	}
 	$sql = "select count(*) from $table_survey where survey_id = ".$survey_invitation['survey_id']."
 								and (
-									title LIKE '%$doc_url%' 
-									or subtitle LIKE '%$doc_url%' 
-									or intro LIKE '%$doc_url%' 
-									or surveythanks LIKE '%$doc_url%' 
+									title LIKE '%$doc_url%'
+									or subtitle LIKE '%$doc_url%'
+									or intro LIKE '%$doc_url%'
+									or surveythanks LIKE '%$doc_url%'
 								)
 		union select count(*) from $table_survey_question  where survey_id = ".$survey_invitation['survey_id']."
 								and (

+ 76 - 76
main/survey/survey.lib.php

@@ -59,7 +59,7 @@ class survey_manager
 		if (isset($_GET['course'])) {
 			$my_course_id=Security::remove_XSS($_GET['course']);
 		} else {
-			$my_course_id=api_get_course_id();	
+			$my_course_id=api_get_course_id();
 		}
 		$my_course_info=api_get_course_info($my_course_id);
 		$table_survey = Database :: get_course_table(TABLE_SURVEY, $my_course_info['dbName']);
@@ -70,7 +70,7 @@ class survey_manager
 		$sql = "SELECT * FROM $table_survey WHERE survey_id='".Database::escape_string($survey_id)."'";
 		$result = api_sql_query($sql, __FILE__, __LINE__);
 		$return = array();
-		
+
 		if (Database::num_rows($result)> 0) {
 			$return = Database::fetch_array($result,'ASSOC');
 			// we do this (temporarily) to have the array match the quickform elements immediately
@@ -86,10 +86,10 @@ class survey_manager
 			$return['survey_thanks'] 		= $return['surveythanks'];
 			$return['survey_type'] 		    = $return['survey_type'];
 			$return['one_question_per_page']= $return['one_question_per_page'];
-			
+
 			$return['show_form_profile']	= $return['show_form_profile'];
 			$return['input_name_list']		= $return['input_name_list'];
-			
+
 			$return['shuffle'] 		= $return['shuffle'];
 			$return['parent_id'] 		= $return['parent_id'];
 			$return['survey_version'] 		= $return['survey_version'];
@@ -493,7 +493,7 @@ class survey_manager
 		{
 			$session_where = ' AND session_id = "'.api_get_session_id().'" ';
 		}
-		
+
 		$sql = 'DELETE FROM '.$table_survey_invitation.' WHERE survey_code = "'.Database::escape_string($datas['code']).'" '.$session_where.' ';
 		api_sql_query($sql, __FILE__, __LINE__);
 
@@ -1237,7 +1237,7 @@ class survey_manager
 	 * @todo write the function
 	 *
 	 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
-	 * @version January 2007,december 2008 
+	 * @version January 2007,december 2008
 	 */
 	function delete_all_survey_answers($survey_id) {
 		$table_survey_answer 	= Database :: get_course_table(TABLE_SURVEY_ANSWER);
@@ -1323,7 +1323,7 @@ class question
 	{
 		global $charset;
 		global $survey_data;
-		
+
 		//$tool_name = '<img src="../img/'.survey_manager::icon_question($_GET['type']).'" alt="'.get_lang(ucfirst($_GET['type'])).'" title="'.get_lang(ucfirst($_GET['type'])).'" />';
 		$tool_name = Display::return_icon(survey_manager::icon_question(Security::remove_XSS($_GET['type'])),get_lang(ucfirst(Security::remove_XSS($_GET['type']))),array('align'=>'middle', 'height'=>'22px')).' ';
 		if ($_GET['action'] == 'add') {
@@ -1332,12 +1332,12 @@ class question
 		if ($_GET['action'] == 'edit') {
 			$tool_name .= get_lang('EditQuestion');
 		}
-		
+
 		if ($_GET['type'] == 'yesno') {
 			$tool_name .= ': '.get_lang('YesNo');
 		} else if ($_GET['type'] == 'multiplechoice') {
 			$tool_name .= ': '.get_lang('UniqueSelect');
-		} else {		
+		} else {
 			$tool_name .= ': '.get_lang(api_ucfirst(Security::remove_XSS($_GET['type'])));
 		}
 
@@ -1356,9 +1356,9 @@ class question
 		$this->html .= '		<div class="formw">';
 		$this->html .= api_return_html_area('question', Security::remove_XSS(stripslashes($form_content['question'])), '', '', null, array('ToolbarSet' => 'Survey', 'Width' => '100%', 'Height' => '120'));
 		$this->html .= '		</div>';
-		$this->html .= '	</div>';		
-		
-		
+		$this->html .= '	</div>';
+
+
 
 		/*
 		$this->html .= '	<tr>';
@@ -1370,7 +1370,7 @@ class question
 
 		//$this->html .= '<table>';
 
-		//$this->html .='	<tr><td colspan="">&nbsp;</td></tr>'; 
+		//$this->html .='	<tr><td colspan="">&nbsp;</td></tr>';
 
 		if($survey_data['survey_type']==1) {
 			$table_survey_question_group = Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP);
@@ -1425,9 +1425,9 @@ class question
 			$text=get_lang('ModifyQuestionSurvey');
 		} else {
 			$class="add";
-			$text=get_lang('CreateQuestionSurvey'); 
-		}		
-		
+			$text=get_lang('CreateQuestionSurvey');
+		}
+
 		if ($_GET['type']=='yesno' || $_GET['type']=='open'|| $_GET['type']=='percentage' || $_GET['type']=='comment' || $_GET['type']=='pagebreak') {
 			$this->html .= '	<div class="row">';
 			$this->html .= '		<div class="label">';
@@ -1437,7 +1437,7 @@ class question
 		$this->html .= '			<button class="'.$class.'"type="submit" name="save_question">'.$text.'</button>';
 		$this->html .= '		</div>';
 		$this->html .= '	</div>';
-		
+
 		//$this->html .='	</table>';
 
 		$this->html .= '</form>';
@@ -1498,22 +1498,22 @@ class question
 		}
 
 		// saving a question
-		if (isset($_POST['save_question'])) {					
+		if (isset($_POST['save_question'])) {
 			$message = survey_manager::save_question($form_content);
 
-			if ($message == 'QuestionAdded' || $message == 'QuestionUpdated' ) {				
+			if ($message == 'QuestionAdded' || $message == 'QuestionUpdated' ) {
 				$sql='SELECT COUNT(*) FROM '.Database :: get_course_table(TABLE_SURVEY_QUESTION).' WHERE survey_id = '.(int)$_GET['survey_id'];
 				$res = Database :: fetch_array (api_sql_query($sql, __FILE__, __LINE__));
 
-				if ($config['survey']['debug']) {				
+				if ($config['survey']['debug']) {
 					Display :: display_header();
 					Display :: display_confirmation_message($message.'<br />'.get_lang('ReturnTo').' <a href="survey.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'">'.get_lang('Survey').'</a>', false);
-				} else {					
+				} else {
 					header('Location:survey.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'&message='.$message);
 					exit();
 				}
-			} else {			
-				if ($message == 'PleaseEnterAQuestion' || $message=='PleasFillAllAnswer'|| $message=='PleaseChooseACondition'|| $message=='ChooseDifferentCategories') {							
+			} else {
+				if ($message == 'PleaseEnterAQuestion' || $message=='PleasFillAllAnswer'|| $message=='PleaseChooseACondition'|| $message=='ChooseDifferentCategories') {
 					$_SESSION['temp_user_message']=$form_content['question'];
 					$_SESSION['temp_horizontalvertical'] = $form_content['horizontalvertical'];
 					$_SESSION['temp_sys_message']=$message;
@@ -1570,7 +1570,7 @@ class question
 		$return .= '		<input type="hidden" name="is_executable" id="is_executable" value="-" />';
 		$return .= '			<button class="minus" type="submit" name="remove_answer" "'.$remove_answer_attribute.'">'.get_lang('RemoveAnswer').' </button>';
 		$return .= '			<button class="plus" type="submit" name="add_answer">'.get_lang('AddAnswer').'</button>';
-	
+
 		return $return;
 	}
 
@@ -1628,7 +1628,7 @@ class yesno extends question
 		$this->html .= 				get_lang('AnswerOptions');
 		$this->html .= '		</div>';
 		$this->html .= '		<div class="formw">';
-		$this->html .= '			<table>';	
+		$this->html .= '			<table>';
 		$this->html .= '	<tr>';
 		$this->html .= '		<td align="right"><label for="answers[0]">1</label></td>';
 		//$this->html .= '		<td><input type="text" name="answers[0]" id="answers[0]" value="'.$form_content['answers'][0].'" /></td>';
@@ -1644,8 +1644,8 @@ class yesno extends question
 		$this->html .= '	</tr>';
 		$this->html .= '			</table>';
 		$this->html .= '		</div>';
-		$this->html .= '	</div>';	
-		
+		$this->html .= '	</div>';
+
 
 	}
 
@@ -1675,7 +1675,7 @@ class yesno extends question
 					$this->html .= '<br />';
 				}
 			} else {
-				$this->html .= '/>'.$value.'</label>';	
+				$this->html .= '/>'.$value.'</label>';
 			}
 		}
 		echo '<div class="survey_question_wrapper">';
@@ -1750,7 +1750,7 @@ class multiplechoice extends question
 		// The buttons for adding or removing
 		$this->html .= ' 			</table>';
 		$this->html .= '		</div>';
-		$this->html .= '	</div>';		
+		$this->html .= '	</div>';
 
 		$this->html .= parent :: add_remove_buttons($form_content);
 
@@ -1931,11 +1931,11 @@ class multipleresponse extends question
 			if ($key<$total_number_of_answers-1) {
 				$this->html .= '			<input type="image" src="../img/down.gif"  value="move_down['.$key.']" name="move_down['.$key.']"/>';
 			}
-			
+
 			if ($key>0) {
 				$this->html .= '			<input type="image" src="../img/up.gif"  value="move_up['.$key.']" name="move_up['.$key.']"/>';
 			}
-			
+
 			if ($total_number_of_answers> 2) {
 				$this->html .= '			<input type="image" src="../img/delete.gif"  value="delete_answer['.$key.']" name="delete_answer['.$key.']"/>';
 			}
@@ -1945,8 +1945,8 @@ class multipleresponse extends question
 		// The buttons for adding or removing
 		$this->html .= ' 			</table>';
 		$this->html .= '		</div>';
-		$this->html .= '	</div>';			
-		$this->html .= parent :: add_remove_buttons($form_content);	
+		$this->html .= '	</div>';
+		$this->html .= parent :: add_remove_buttons($form_content);
 	}
 
 	/**
@@ -1975,7 +1975,7 @@ class multipleresponse extends question
 					$this->html .= '<br />';
 				}
 			} else {
-				$this->html .= '/>'.$value.'</label>';	
+				$this->html .= '/>'.$value.'</label>';
 			}
 		}
 		echo '<div class="survey_question_wrapper">';
@@ -2032,7 +2032,7 @@ class dropdown extends question
 		// The buttons for adding or removing
 		$this->html .= ' 			</table>';
 		$this->html .= '		</div>';
-		$this->html .= '	</div>';		
+		$this->html .= '	</div>';
 		$this->html .= parent :: add_remove_buttons($form_content);
 	}
 
@@ -2217,7 +2217,7 @@ class score extends question
 		$this->html .= '			<input type="text" name="maximum_score" value="'.$form_content['maximum_score'].'">';
 		$this->html .= '		</div>';
 		$this->html .= '	</div>';
-				
+
 
 		// The answers
 		$this->html .= '	<div class="row">';
@@ -2252,8 +2252,8 @@ class score extends question
 		// The buttons for adding or removing
 		$this->html .= ' 			</table>';
 		$this->html .= '		</div>';
-		$this->html .= '	</div>';			
-		$this->html .= parent :: add_remove_buttons($form_content);	
+		$this->html .= '	</div>';
+		$this->html .= parent :: add_remove_buttons($form_content);
 	}
 
 	function render_question($form_content, $answers=array())
@@ -2528,12 +2528,12 @@ class SurveyUtil {
 			SurveyUtil::display_complete_report();
 		}
 		if ($_GET['action'] == 'deleteuserreport')
-		{	
-			SurveyUtil::delete_user_report($_GET['survey_id'],$_GET['user']);	
+		{
+			SurveyUtil::delete_user_report($_GET['survey_id'],$_GET['user']);
 			//SurveyUtil::display_user_report(); //Could work but looks a bit clunky
 		}
 	}
-	
+
 	/**
 	 * This function deletes the report of an user who wants to retake the survey
 	 * @param integer survey_id
@@ -2546,19 +2546,19 @@ class SurveyUtil {
 		$table_survey_answer 		= Database :: get_course_table(TABLE_SURVEY_ANSWER);
 		$table_survey_invitation 	= Database :: get_course_table(TABLE_SURVEY_INVITATION);
 		$table_survey 				= Database :: get_course_table(TABLE_SURVEY);
-		
-		if (!empty($survey_id) && !empty($user_id)) {					
+
+		if (!empty($survey_id) && !empty($user_id)) {
 			// delete data from survey_answer by user_id and survey_id
-			$sql = "DELETE FROM $table_survey_answer WHERE survey_id = '".(int)$survey_id."' AND user = '".(int)$user_id."'";			
+			$sql = "DELETE FROM $table_survey_answer WHERE survey_id = '".(int)$survey_id."' AND user = '".(int)$user_id."'";
 			$result = api_sql_query($sql, __FILE__, __LINE__);
 			// update field answered from survey_invitation by user_id and survey_id
-			$sql = "UPDATE $table_survey_invitation SET answered = '0' WHERE survey_code = (SELECT code FROM $table_survey WHERE survey_id = '".(int)$survey_id."') AND user = '".(int)$user_id."'";			
+			$sql = "UPDATE $table_survey_invitation SET answered = '0' WHERE survey_code = (SELECT code FROM $table_survey WHERE survey_id = '".(int)$survey_id."') AND user = '".(int)$user_id."'";
 			$result = api_sql_query($sql, __FILE__, __LINE__);
 		}
-		if($result !== false) {			
+		if($result !== false) {
 			$message = get_lang('SurveyUserAnswersHaveBeenRemovedSuccessfully').'<br />
-					<a href="reporting.php?action=userreport&survey_id='.Security::remove_XSS($survey_id).'">'.get_lang('GoBack').'</a>';	
-			Display::display_confirmation_message($message, false);	
+					<a href="reporting.php?action=userreport&survey_id='.Security::remove_XSS($survey_id).'">'.get_lang('GoBack').'</a>';
+			Display::display_confirmation_message($message, false);
 		}
 	}
 
@@ -2590,7 +2590,7 @@ class SurveyUtil {
 
 			// export the user report
 			echo '<a href="javascript: void(0);" onclick="document.form1a.submit();">'.Display::return_icon('csv.gif', get_lang('ExportAsCSV')).' '.get_lang('ExportAsCSV').'</a> ';
-			echo '<a href="javascript: void(0);" onclick="document.form1b.submit();">'.Display::return_icon('excel.gif', get_lang('ExportAsXLS')).' '.get_lang('ExportAsXLS').'</a> ';						
+			echo '<a href="javascript: void(0);" onclick="document.form1b.submit();">'.Display::return_icon('excel.gif', get_lang('ExportAsXLS')).' '.get_lang('ExportAsXLS').'</a> ';
 			echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'&user_id='.Security::remove_XSS($_GET['user']).'">';
 			echo '<input type="hidden" name="export_report" value="export_report">';
 			echo '<input type="hidden" name="export_format" value="csv">';
@@ -2602,7 +2602,7 @@ class SurveyUtil {
 			echo '<form id="form2" name="form2" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'">';
 		}
 		echo '</div>';
-			
+
 		// step 1: selection of the user
 		echo "<script language=\"JavaScript\" type=\"text/JavaScript\">
 		<!--
@@ -2616,7 +2616,7 @@ class SurveyUtil {
 		echo get_lang('SelectUserWhoFilledSurvey').'<br />';
 		echo '<select name="user" onchange="jumpMenu(\'parent\',this,0)">';
 		echo '<option value="reporting.php?action='.Security::remove_XSS($_GET['action']).'&amp;survey_id='.Security::remove_XSS($_GET['survey_id']).'">'.get_lang('SelectUser').'</option>';
-		
+
 		foreach ($people_filled as $key=>$person)
 		{
 			if ($survey_data['anonymous'] == 0)
@@ -2628,7 +2628,7 @@ class SurveyUtil {
 					$name = $person['invited_user'];
 				}
 			}
-			else 
+			else
 			{
 				$name  = $key+1;
 				$id = $person;
@@ -2641,12 +2641,12 @@ class SurveyUtil {
 			echo '>'.$name.'</option>';
 		}
 		echo '</select>';
-	    
+
 		// step 2: displaying the survey and the answer of the selected users
 		if (isset($_GET['user']))
 		{
 			Display::display_normal_message(get_lang('AllQuestionsOnOnePage'), false);
-			
+
 			// getting all the questions and options
 			$sql = "SELECT 	survey_question.question_id, survey_question.survey_id, survey_question.survey_question, survey_question.display, survey_question.max_value, survey_question.sort, survey_question.type,
 							survey_question_option.question_option_id, survey_question_option.option_text, survey_question_option.sort as option_sort
@@ -2997,8 +2997,8 @@ class SurveyUtil {
 		// actions bar
 		echo '<div class="actions">';
 		echo '<a href="reporting.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview')).' '.get_lang('BackTo').' '.get_lang('ReportingOverview').'</a>';
-		echo '</div>';		
-	
+		echo '</div>';
+
 		// the form
 		echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'">';
 		echo '<input type="hidden" name="export_report" value="export_report">';
@@ -3742,10 +3742,10 @@ class SurveyUtil {
 
 		// getting all the questions
 		$questions = survey_manager::get_questions($_GET['survey_id']);
-		
+
 		// actions bar
 		echo '<div class="actions">';
-		echo '<a href="reporting.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview')).' '.get_lang('BackTo').' '.get_lang('ReportingOverview').'</a>';		
+		echo '<a href="reporting.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview')).' '.get_lang('BackTo').' '.get_lang('ReportingOverview').'</a>';
 		echo '</div>';
 
 		// displaying an information message that only the questions with predefined answers can be used in a comparative report
@@ -4166,7 +4166,7 @@ class SurveyUtil {
                     SurveyUtil::send_invitation_mail($value, $invitation_code, $invitation_title, $invitation_text);
                     $counter++;
                 }
-                
+
             }
             return $counter; // number of invitations sent
         }
@@ -4178,7 +4178,7 @@ class SurveyUtil {
 	 * @param	invitedUser - the userId (course user) or emailaddress of additional user
          * $param       $invitation_code - the unique invitation code for the URL
 	 * @return	void
-	 * 
+	 *
 	 */
         function send_invitation_mail($invitedUser, $invitation_code, $invitation_title, $invitation_text) {
             global $_user;
@@ -4354,7 +4354,7 @@ class SurveyUtil {
 					<div class="formw">
 						<input type="text" name="keyword_title"/>
 					</div>
-				</div>';	
+				</div>';
 		echo '	<div class="row">
 					<div class="label">
 						'.get_lang('Code').'
@@ -4362,7 +4362,7 @@ class SurveyUtil {
 					<div class="formw">
 						<input type="text" name="keyword_code"/>
 					</div>
-				</div>';			
+				</div>';
 		echo '	<div class="row">
 					<div class="label">
 						'.get_lang('Language').'
@@ -4374,9 +4374,9 @@ class SurveyUtil {
 		{
 			echo '<option value="'.$languages['folder'][$index].'">'.$name.'</option>';
 		}
-		echo '			</select>';		
+		echo '			</select>';
 		echo '		</div>
-				</div>';		
+				</div>';
 		echo '<input type="hidden" name="cidReq" value="'.api_get_course_id().'"/>';
 		echo '	<div class="row">
 					<div class="label">
@@ -4384,7 +4384,7 @@ class SurveyUtil {
 					<div class="formw">
 						<button class="search" type="submit" name="do_search">'.get_lang('Search').'</button>
 					</div>
-				</div>';		
+				</div>';
 		echo '</form>';
 		echo '<div style="clear: both;margin-bottom: 10px;"></div>';
 	}
@@ -4749,11 +4749,11 @@ class SurveyUtil {
 
 		$sql='SELECT question_id from '.$table_survey_question;
 		$result=api_sql_query($sql,__FILE__,__LINE__);
-		
+
 		while($row=Database::fetch_array($result,'ASSOC')) {
 			$all_question_id[]=$row;
 		}
-		
+
 		$count=0;
 		for ($i=0;$i<count($all_question_id);$i++) {
 			$sql='SELECT COUNT(*) as count FROM '.$table_survey_answer.' WHERE question_id='.Database::escape_string($all_question_id[$i]['question_id']).' AND user='.api_get_user_id();
@@ -4769,7 +4769,7 @@ class SurveyUtil {
 				break;
 			}
 		}
-		
+
 		echo '<table class="data_table">';
 		echo '<tr>';
 		echo '	<th>'.get_lang('SurveyName').'</th>';
@@ -4785,10 +4785,10 @@ class SurveyUtil {
 		$counter = 0;
 		while ($row = Database::fetch_array($result,'ASSOC')) {
 			// get the user into survey answer table (user or anonymus)
-			$sql = "SELECT user FROM $table_survey_answer 
+			$sql = "SELECT user FROM $table_survey_answer
 				    WHERE survey_id = (SELECT survey_id from $table_survey WHERE code ='".Database::escape_string($row['code'])."')";
 			$result_answer = api_sql_query($sql, __FILE__, __LINE__);
-			$row_answer = Database::fetch_array($result_answer,'ASSOC');	
+			$row_answer = Database::fetch_array($result_answer,'ASSOC');
 			echo '<tr>';
 			if ($row['answered'] == 0)
 			{
@@ -5060,8 +5060,8 @@ class SurveyUtil {
 	 * @author Isaac Flores Paz <florespaz@bidsoftperu.com>
 	 * @param int $user_id - User ID
 	 * @param int $user_id_answer - User in survey answer table (user id or anonymus)
-	 * @return boolean  
-	 *  
+	 * @return boolean
+	 *
 	 */
 	function show_link_available($user_id,$survey_code,$user_answer)
 	{
@@ -5073,15 +5073,15 @@ class SurveyUtil {
 		$survey_code = Database::escape_string($survey_code);
 		$user_id = Database::escape_string($user_id);
 		$user_answer = Database::escape_string($user_answer);
-			
+
 		$sql='SELECT COUNT(*) as count FROM '.$table_survey_invitation.' WHERE user='.$user_id.' AND survey_code="'.$survey_code.'" AND answered="1"';
 		$sql2='SELECT COUNT(*) as count FROM '.$table_survey.' s INNER JOIN '.$table_survey_question.' q ON s.survey_id=q.survey_id WHERE s.code="'.$survey_code.'" AND q.type NOT IN("pagebreak","comment")';
-		$sql3='SELECT COUNT(DISTINCT question_id) as count FROM '.$table_survey_answer.' WHERE survey_id=(SELECT survey_id FROM '.$table_survey.' WHERE code="'.$survey_code.'") AND user="'.$user_answer.'" ';		
-		
+		$sql3='SELECT COUNT(DISTINCT question_id) as count FROM '.$table_survey_answer.' WHERE survey_id=(SELECT survey_id FROM '.$table_survey.' WHERE code="'.$survey_code.'") AND user="'.$user_answer.'" ';
+
 		$result=api_sql_query($sql,__FILE__,__LINE__);
 		$result2=api_sql_query($sql2,__FILE__,__LINE__);
 		$result3=api_sql_query($sql3,__FILE__,__LINE__);
-		
+
 		$row=Database::fetch_array($result,'ASSOC');
 		$row2=Database::fetch_array($result2,'ASSOC');
 		$row3=Database::fetch_array($result3,'ASSOC');

+ 40 - 40
main/survey/survey.php

@@ -47,14 +47,14 @@ $interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('Surv
 // getting the survey information
 if (isset($_GET['survey_id'])) {
 	$course_code = api_get_course_id();
-	if ($course_code!=-1) {		
+	if ($course_code!=-1) {
 		$survey_data = survey_manager::get_survey($survey_id);
 	} else {
 		Display :: display_header(get_lang('Survey'));
 		Display :: display_error_message(get_lang('NotAllowed'), false);
 		Display :: display_footer();
 		exit;
-	}	
+	}
 }
 
 if (api_substr($survey_data['title'],0,3)!='<p>'){
@@ -71,34 +71,34 @@ if (api_strlen(strip_tags($survey_data['title'])) > 40)
 if($is_survey_type_1 && ($_GET['action']=='addgroup')||($_GET['action']=='deletegroup'))
 {
 	$_POST['name'] = trim($_POST['name']);
-	
+
 	if(($_GET['action']=='addgroup'))
 	{
 		if(!empty($_POST['group_id']))
 		{
 			api_sql_query('UPDATE '.$table_survey_question_group.' SET description = \''.Database::escape_string($_POST['description']).'\' WHERE id = \''.Database::escape_string($_POST['group_id']).'\'');
 			$sendmsg = 'GroupUpdatedSuccessfully';
-		} 
+		}
 		elseif(!empty($_POST['name']))
 		{
-			api_sql_query('INSERT INTO '.$table_survey_question_group.' (name,description,survey_id) values (\''.Database::escape_string($_POST['name']).'\',\''.Database::escape_string($_POST['description']).'\',\''.Database::escape_string($survey_id).'\') ');	
+			api_sql_query('INSERT INTO '.$table_survey_question_group.' (name,description,survey_id) values (\''.Database::escape_string($_POST['name']).'\',\''.Database::escape_string($_POST['description']).'\',\''.Database::escape_string($survey_id).'\') ');
 			$sendmsg = 'GroupCreatedSuccessfully';
 		} else {
 			$sendmsg = 'GroupNeedName';
 		}
-	}	
-		
+	}
+
 	if($_GET['action']=='deletegroup'){
 		api_sql_query('DELETE FROM '.$table_survey_question_group.' WHERE id = '.Database::escape_string($_GET['gid']).' and survey_id = '.Database::escape_string($survey_id));
-		$sendmsg = 'GroupDeletedSuccessfully';	
+		$sendmsg = 'GroupDeletedSuccessfully';
 	}
-	
+
 	header('Location:survey.php?survey_id='.$survey_id.'&sendmsg='.$sendmsg);
 	exit;
 }
 
 // Displaying the header
-Display::display_header($tool_name,'Survey'); 
+Display::display_header($tool_name,'Survey');
 
 // Action handling
 $my_action_survey		= Security::remove_XSS($_GET['action']);
@@ -123,7 +123,7 @@ if (isset($_GET['message'])) {
 	if (in_array($_GET['message'], array('QuestionAdded','QuestionUpdated'))) {
 		Display::display_confirmation_message(get_lang($message_information));
 	}
-	
+
 	if (in_array($_GET['message'], array('YouNeedToCreateGroups'))) {
 		Display::display_warning_message(get_lang($message_information), false);
 	}
@@ -141,23 +141,23 @@ $survey_actions .= '<a href="survey_invite.php?'.api_get_cidreq().'&amp;survey_i
 $survey_actions .= '<a href="reporting.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).' '.get_lang('Reporting').'</a>';
 echo '<div class="actions">'.$survey_actions.'</div>';
 
-if ($survey_data['survey_type']==0) {	
-	echo '<div class="actionsbig">';	
-	echo '<a style="padding-left:0px;" href="question.php?'.api_get_cidreq().'&amp;action=add&type=yesno&amp;survey_id='.$survey_id.'">'.Display::return_icon('yesno.gif',get_lang('YesNo')).'<br/>'.get_lang('YesNo').'</a>';	 
-	echo '<a href="question.php?'.api_get_cidreq().'&amp;action=add&type=multiplechoice&amp;survey_id='.$survey_id.'">'.Display::return_icon('mcua.gif',get_lang('UniqueSelect')).'<br />'.get_lang('UniqueSelect').'</a>';	
+if ($survey_data['survey_type']==0) {
+	echo '<div class="actionsbig">';
+	echo '<a style="padding-left:0px;" href="question.php?'.api_get_cidreq().'&amp;action=add&type=yesno&amp;survey_id='.$survey_id.'">'.Display::return_icon('yesno.gif',get_lang('YesNo')).'<br/>'.get_lang('YesNo').'</a>';
+	echo '<a href="question.php?'.api_get_cidreq().'&amp;action=add&type=multiplechoice&amp;survey_id='.$survey_id.'">'.Display::return_icon('mcua.gif',get_lang('UniqueSelect')).'<br />'.get_lang('UniqueSelect').'</a>';
 	echo '<a href="question.php?'.api_get_cidreq().'&amp;action=add&type=multipleresponse&amp;survey_id='.$survey_id.'">'.Display::return_icon('mcma.gif',get_lang('MultipleResponse')).'<br />'.get_lang('MultipleResponse').'</a>';
 	echo '<a href="question.php?'.api_get_cidreq().'&amp;action=add&type=open&amp;survey_id='.$survey_id.'">'.Display::return_icon('open_answer.gif',get_lang('Open')).'<br />'.get_lang('Open').'</a>';
-	echo '<a href="question.php?'.api_get_cidreq().'&amp;action=add&type=dropdown&amp;survey_id='.$survey_id.'">'.Display::return_icon('dropdown.gif',get_lang('Dropdown')).'<br />'.get_lang('Dropdown').'</a>';	
+	echo '<a href="question.php?'.api_get_cidreq().'&amp;action=add&type=dropdown&amp;survey_id='.$survey_id.'">'.Display::return_icon('dropdown.gif',get_lang('Dropdown')).'<br />'.get_lang('Dropdown').'</a>';
 	echo '<a href="question.php?'.api_get_cidreq().'&amp;action=add&type=percentage&amp;survey_id='.$survey_id.'">'.Display::return_icon('percentagequestion.gif',get_lang('Percentage')).'<br />'.get_lang('Percentage').'</a>';
 	echo '<a href="question.php?'.api_get_cidreq().'&amp;action=add&type=score&amp;survey_id='.$survey_id.'">'.Display::return_icon('scorequestion.gif',get_lang('Score')).'<br />'.get_lang('Score').'</a>';
 	echo '<a href="question.php?'.api_get_cidreq().'&amp;action=add&type=comment&amp;survey_id='.$survey_id.'">'.Display::return_icon('commentquestion.gif',get_lang('Comment')).'<br />'.get_lang('Comment').'</a>';
 	echo '<a href="question.php?'.api_get_cidreq().'&amp;action=add&type=pagebreak&amp;survey_id='.$survey_id.'">'.Display::return_icon('page_end.gif',get_lang('Pagebreak')).'<br />'.get_lang('Pagebreak').'</a>';
 	echo '</div>';
-} else {	
+} else {
 	echo '<div class="actionsbig">';
 	//echo '<a href="group.php?'.api_get_cidreq().'&amp;action=add&amp;survey_id='.$survey_id.'"><img src="../img/yesno.gif" /><br />'.get_lang('Add groups').'</a></div>';
 	echo '<a style="padding-left:0px;" href="question.php?'.api_get_cidreq().'&amp;action=add&type=personality&amp;survey_id='.$survey_id.'"><img src="../img/yesno.gif" />'.get_lang('PersonalityQuestion').'</a></div>';
-	echo '</div>';	 
+	echo '</div>';
 }
 
 // Displaying the table header with all the questions
@@ -168,7 +168,7 @@ echo '		<th>'.get_lang('Title').'</th>';
 echo '		<th>'.get_lang('Type').'</th>';
 echo '		<th width="50" >'.get_lang('NumberOfOptions').'</th>';
 echo '		<th width="100">'.get_lang('Modify').'</th>';
-if($is_survey_type_1) { 
+if($is_survey_type_1) {
 	echo '<th width="100">'.get_lang('Condition').'</th>';
     echo '<th width="40">'.get_lang('Group').'</th>';
 }
@@ -183,7 +183,7 @@ while($row = Database::fetch_array($result)) {
 }
 $sql = "SELECT survey_question.*, count(survey_question_option.question_option_id) as number_of_options
 			FROM $table_survey_question survey_question
-			LEFT JOIN $table_survey_question_option survey_question_option 
+			LEFT JOIN $table_survey_question_option survey_question_option
 			ON survey_question.question_id = survey_question_option.question_id
 			WHERE survey_question.survey_id = '".Database::escape_string($survey_id)."'
 			GROUP BY survey_question.question_id
@@ -199,16 +199,16 @@ while ($row = Database::fetch_array($result,'ASSOC')) {
 	} else {
 		echo $row['survey_question'];
 	}
-	
+
 	if ($row['type'] == 'yesno') {
 		$tool_name = get_lang('YesNo');
 	} else if ($row['type'] == 'multiplechoice') {
 		$tool_name = get_lang('UniqueSelect');
-	} else {		
+	} else {
 		$tool_name = get_lang(api_ucfirst(Security::remove_XSS($row['type'])));
 	}
-	
-	
+
+
 	echo '</td>';
 	echo '	<td>'.$tool_name.'</td>';
 	echo '	<td>'.$row['number_of_options'].'</td>';
@@ -225,48 +225,48 @@ while ($row = Database::fetch_array($result,'ASSOC')) {
 	{
 		echo '		<a href="survey.php?'.api_get_cidreq().'&amp;action=movedown&amp;survey_id='.$survey_id.'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('down.gif', get_lang('MoveDown')).'</a>';
 	} else {
-		Display::display_icon('down_na.gif');	
+		Display::display_icon('down_na.gif');
 	}
 	echo '	</td>';
 	$question_counter++;
-	
+
 	if($is_survey_type_1)
     {
     	echo '<td>'.(($row['survey_group_pri']==0)?get_lang('Secondary'):get_lang('Primary')).'</td>';
         echo '<td>'.(($row['survey_group_pri']==0)?$groups[$row['survey_group_sec1']].'-'.$groups[$row['survey_group_sec2']]:$groups[$row['survey_group_pri']]).'</td>';
     }
-	echo '</tr>'; 
+	echo '</tr>';
 }
 echo '</table>';
 
 if($is_survey_type_1)
 {
 	echo '<br /><br /><b>'.get_lang('ManageGroups').'</b><br /><br />';
-	
+
 	if (in_array($_GET['sendmsg'], array('GroupUpdatedSuccessfully','GroupDeletedSuccessfully','GroupCreatedSuccessfully'))){
 		echo Display::display_confirmation_message(get_lang($_GET['sendmsg']), false);
 	}
-	
+
 	if (in_array($_GET['sendmsg'], array('GroupNeedName'))){
 		echo Display::display_warning_message(get_lang($_GET['sendmsg']), false);
 	}
-	
+
 	echo '<table border="0"><tr><td width="100">'.get_lang('Name').'</td><td>'.get_lang('Description').'</td></tr></table>';
-	
+
 	echo '<form action="survey.php?action=addgroup&survey_id='.$survey_id.'" method="post">';
-	if($_GET['action']=='editgroup') {	
+	if($_GET['action']=='editgroup') {
 		$sql = 'SELECT name,description FROM '.$table_survey_question_group.' WHERE id = '.Database::escape_string($_GET['gid']).' AND survey_id = '.Database::escape_string($survey_id).' limit 1';
 		$rs = api_sql_query($sql,__FILE__,__LINE__);
 		$editedrow = Database::fetch_array($rs,'ASSOC');
-	
+
 		echo	'<input type="text" maxlength="20" name="name" value="'.$editedrow['name'].'" size="10" disabled>';
-		echo	'<input type="text" maxlength="150" name="description" value="'.$editedrow['description'].'" size="40">';	
-		echo	'<input type="hidden" name="group_id" value="'.Security::remove_XSS($_GET['gid']).'">';		
+		echo	'<input type="text" maxlength="150" name="description" value="'.$editedrow['description'].'" size="40">';
+		echo	'<input type="hidden" name="group_id" value="'.Security::remove_XSS($_GET['gid']).'">';
 		echo	'<input type="submit" value="'.get_lang('Save').'"'.'<input type="button" value="'.get_lang('Cancel').'" onclick="window.location.href = \'survey.php?survey_id='.Security::remove_XSS($survey_id).'\';" />';
 	} else {
 		echo	'<input type="text" maxlength="20" name="name" value="" size="10">';
 		echo	'<input type="text" maxlength="250" name="description" value="" size="80">';
-		echo	'<input type="submit" value="'.get_lang('Create').'"';	
+		echo	'<input type="submit" value="'.get_lang('Create').'"';
 	}
 	echo	'</form><br />';
 
@@ -275,10 +275,10 @@ if($is_survey_type_1)
 	echo '		<th width="200">'.get_lang('Name').'</th>';
 	echo '		<th>'.get_lang('Description').'</th>';
 	echo '		<th width="100">'.get_lang('Modify').'</th>';
-	echo '	</tr>';	
-	
+	echo '	</tr>';
+
 	$sql = 'SELECT id,name,description FROM '.$table_survey_question_group.' WHERE survey_id = '.Database::escape_string($survey_id).' ORDER BY name';
-	
+
 	$rs = api_sql_query($sql,__FILE__,__LINE__);
 	while($row = Database::fetch_array($rs,ASSOC)){
 		$grouplist .= '<tr><td>'.$row['name'].'</td><td>'.$row['description'].'</td><td>'.
@@ -287,7 +287,7 @@ if($is_survey_type_1)
 		'<a href="survey.php?survey_id='.$survey_id.'&gid='.$row['id'].'&action=deletegroup" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('DeleteSurveyGroup'),$row['name']).'?',ENT_QUOTES,$charset)).'\')) return false;">'.
 		Display::return_icon('delete.gif', get_lang('Delete')).'</a>'.
 		'</td></tr>';
-	}				
+	}
 	echo $grouplist.'</table>';
 }
 

+ 6 - 6
main/survey/survey_invite.php

@@ -83,7 +83,7 @@ $interbreadcrumb[] = array ('url' => 'survey_list.php', 'name' => get_lang('Surv
 if (api_is_course_admin()) {
     $interbreadcrumb[] = array ('url' => 'survey.php?survey_id='.$survey_id, 'name' => $urlname);
 } else {
-    $interbreadcrumb[] = array ('url' => 'survey_invite.php?survey_id='.$survey_id, 'name' => $urlname);    
+    $interbreadcrumb[] = array ('url' => 'survey_invite.php?survey_id='.$survey_id, 'name' => $urlname);
 }
 $tool_name = get_lang('SurveyPublication');
 
@@ -159,13 +159,13 @@ $form->addRule('mail_text', get_lang('ThisFieldIsRequired'), 'required');
 
 $portal_url = $_configuration['root_web'];
 if ($_configuration['multiple_access_urls']==true) {
-	$access_url_id = api_get_current_access_url_id();				
+	$access_url_id = api_get_current_access_url_id();
 	if ($access_url_id != -1 ){
 		$url = api_get_access_url($access_url_id);
 		$portal_url = $url['url'];
 	}
-}	
-		  
+}
+
 // show the URL that can be used by users to fill a survey without invitation
 $auto_survey_link = $portal_url.$_configuration['code_append'].
             'survey/'.'fillsurvey.php?course='.$_course['sysCode'].
@@ -178,7 +178,7 @@ if ($form->validate())
 	// save the invitation mail
 	SurveyUtil::save_invite_mail($values['mail_text'], $values['mail_title'], !empty($survey_data['invite_mail']));
 	// saving the invitations for the course users
-	$count_course_users = SurveyUtil::save_invitations($values['course_users'], $values['mail_title'], 
+	$count_course_users = SurveyUtil::save_invitations($values['course_users'], $values['mail_title'],
                 $values['mail_text'], $values['resend_to_all'], $values['send_mail'], $values['remindUnAnswered']);
 	// saving the invitations for the additional users
 	$values['additional_users'] = $values['additional_users'].';'; 	// this is for the case when you enter only one email
@@ -188,7 +188,7 @@ if ($form->validate())
 	{
 		$additional_users[$i] = trim($additional_users[$i]);
 	}
-	$counter_additional_users = SurveyUtil::save_invitations($additional_users, $values['mail_title'], 
+	$counter_additional_users = SurveyUtil::save_invitations($additional_users, $values['mail_title'],
             $values['mail_text'], $values['resend_to_all'], $values['send_mail'], $values['remindUnAnswered']);
 	// updating the invited field in the survey table
 	SurveyUtil::update_count_invited($survey_data['code']);

+ 5 - 5
main/survey/survey_list.php

@@ -47,7 +47,7 @@ require_once('survey.lib.php');
 require_once (api_get_path(LIBRARY_PATH)."/course.lib.php");
 
 /** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/
-if (!api_is_allowed_to_edit(false,true)) //coach can see this 
+if (!api_is_allowed_to_edit(false,true)) //coach can see this
 {
 	Display :: display_header(get_lang('SurveyList'));
 	SurveyUtil::survey_list_user($_user['user_id']);
@@ -71,7 +71,7 @@ if (isset ($_GET['search']) && $_GET['search'] == 'advanced')
 }
 else
 {
-	$tool_name = get_lang('SurveyList'); 
+	$tool_name = get_lang('SurveyList');
 }
 
 
@@ -122,11 +122,11 @@ if(isset($_GET['action']) && $_GET['action'] == 'empty')
 			api_not_allowed();
 			exit;
 		}
-	} else { 
+	} else {
 		if (!(api_is_course_admin() || api_is_platform_admin())) {
 			api_not_allowed();
-			exit;			
-		} 
+			exit;
+		}
 	}
 	$return = survey_manager::empty_survey(intval($_GET['survey_id']));
 	if ($return)

+ 33 - 33
main/template/exampletables.php

@@ -1,82 +1,82 @@
-<?php // $Id: exampletables.php,v 1.2 2006/03/15 14:34:45 pcool Exp $ 
+<?php // $Id: exampletables.php,v 1.2 2006/03/15 14:34:45 pcool Exp $
 /*
-============================================================================== 
+==============================================================================
 	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)
 	Copyright (c) Vrije Universiteit Brussel (VUB)
-	
+
 	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 file is a code template; 
+==============================================================================
+*	This file is a code template;
 *	copy the code and paste it in a new file to begin your own work.
 *
 *	@package dokeos.plugin
-============================================================================== 
+==============================================================================
 */
-	
+
 /*
-============================================================================== 
+==============================================================================
 		INIT SECTION
-============================================================================== 
+==============================================================================
 */
 
-// global settings initialisation 
+// global settings initialisation
 // also provides access to main api (inc/lib/main_api.lib.php)
-include("../inc/global.inc.php"); 
+include("../inc/global.inc.php");
 
 /*
 -----------------------------------------------------------
 	Libraries
 -----------------------------------------------------------
-*/ 
+*/
 
 //main_api.lib.php by default included
 //also the display and database libraries are loaded by default
-	
+
 /*
 -----------------------------------------------------------
 	Header
 -----------------------------------------------------------
 */
 
-$nameTools = "Table examples (for developers)"; // title of the page (should come from the language file) 
+$nameTools = "Table examples (for developers)"; // title of the page (should come from the language file)
 Display::display_header($nameTools);
 /*
 -----------------------------------------------------------
 	Constants
 -----------------------------------------------------------
-*/ 
+*/
 
 define ("REPEAT_COUNT", "5");
 
 
 /*
-============================================================================== 
+==============================================================================
 		FUNCTIONS
-============================================================================== 
+==============================================================================
 */
-	
+
 /*
-============================================================================== 
+==============================================================================
 		MAIN CODE
-============================================================================== 
-*/ 
+==============================================================================
+*/
 
 api_display_tool_title($nameTools);
 
@@ -88,7 +88,7 @@ $column_header[$row++] = "Column 3";
 /*
 	An important parameter for display_complex_table_header
 	is $properties, an array with elements, all of which have defaults
-	
+
 	"width" - the table width, e.g. "85%"
 	"class" - the class to use for the table, e.g. "class=\"data_table\""
 				by default class is  "class=\"data_table\""
@@ -99,7 +99,7 @@ $column_header[$row++] = "Column 3";
 -----------------------------------------------------------
 	Table that hilites
 -----------------------------------------------------------
-*/ 
+*/
 
 Display::display_normal_message("The following table hilites on mouseover (hover), this is the Display API default.");
 
@@ -120,7 +120,7 @@ echo "<br/><br/>";
 -----------------------------------------------------------
 	Table that alternates row colours
 -----------------------------------------------------------
-*/ 
+*/
 Display::display_normal_message("The following table has alternating row colours and no hilite");
 
 $properties["class"] = ""; //no hilite
@@ -136,10 +136,10 @@ for ($i = 0; $i < REPEAT_COUNT; $i++)
 Display::display_table_footer();
 
 /*
-============================================================================== 
-		FOOTER 
-============================================================================== 
-*/ 
+==============================================================================
+		FOOTER
+==============================================================================
+*/
 
 Display::display_footer();
 ?>

+ 29 - 29
main/template/template.php

@@ -2,90 +2,90 @@
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004-2006 Dokeos S.A.
 	Copyright (c) Sally "Example" Programmer (sally@somewhere.net)
 	//add your name + the name of your organisation - if any - to this list
-	
+
 	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 address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
 ==============================================================================
 */
 /**
 ==============================================================================
-*	This file is a code template; 
+*	This file is a code template;
 *	copy the code and paste it in a new file to begin your own work.
 *
 *	@package dokeos.plugin
 ==============================================================================
 */
-	
+
 /*
 ==============================================================================
 		INIT SECTION
 ==============================================================================
-*/ 
-// global settings initialisation 
+*/
+// global settings initialisation
 // also provides access to main, database and display API libraries
-include("../inc/global.inc.php"); 
+include("../inc/global.inc.php");
 
 /*
 -----------------------------------------------------------
 	Libraries
 -----------------------------------------------------------
-*/ 
+*/
 //the main_api.lib.php, database.lib.php and display.lib.php
 //libraries are included by default
 
-	
+
 /*
 -----------------------------------------------------------
 	Header
 -----------------------------------------------------------
-*/ 
+*/
 
 //	Optional extra http or html header
-//	If you need to add some HTTP/HTML headers code 
+//	If you need to add some HTTP/HTML headers code
 //	like JavaScript functions, stylesheets, redirects, put them here.
 
-// $httpHeadXtra[] = ""; 
-// $httpHeadXtra[] = ""; 
-//    ... 
-// 
-// $htmlHeadXtra[] = ""; 
-// $htmlHeadXtra[] = ""; 
-//    ... 
+// $httpHeadXtra[] = "";
+// $httpHeadXtra[] = "";
+//    ...
+//
+// $htmlHeadXtra[] = "";
+// $htmlHeadXtra[] = "";
+//    ...
 
-$tool_name = "Example Plugin"; // title of the page (should come from the language file) 
+$tool_name = "Example Plugin"; // title of the page (should come from the language file)
 Display::display_header($tool_name);
 
-	
+
 /*
 ==============================================================================
 		FUNCTIONS
 ==============================================================================
-*/ 
+*/
 
 // put your functions here
 // if the list gets large, divide them into different sections:
-// display functions, tool logic functions, database functions	
+// display functions, tool logic functions, database functions
 // try to place your functions into an API library or separate functions file - it helps reuse
-	
+
 /*
 ==============================================================================
 		MAIN CODE
 ==============================================================================
-*/ 
+*/
 
 // Put your main code here. Keep this section short,
 // it's better to use functions for any non-trivial code
@@ -97,8 +97,8 @@ Display::display_normal_message("Hello world!");
 
 /*
 ==============================================================================
-		FOOTER 
+		FOOTER
 ==============================================================================
-*/ 
+*/
 Display::display_footer();
 ?>

+ 34 - 34
main/tracking/courseLog.php

@@ -16,7 +16,7 @@
  */
 $pathopen = isset($_REQUEST['pathopen']) ? $_REQUEST['pathopen'] : null;
 
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file[] = 'admin';
 $language_file[] = 'tracking';
 $language_file[] = 'scorm';
@@ -123,7 +123,7 @@ Display::display_header($nameTools, 'Tracking');
 
 require api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';
 require api_get_path(SYS_CODE_PATH).'resourcelinker/resourcelinker.inc.php';
- 
+
 $a_students = CourseManager :: get_student_list_from_course_code($_course['id'], true, (empty($_SESSION['id_session']) ? null : $_SESSION['id_session']));
 $nbStudents = count($a_students);
 
@@ -152,7 +152,7 @@ if ($_GET['studentlist'] == 'false') {
 	echo get_lang('StudentsTracking').' | <a href="courseLog.php?'.api_get_cidreq().'&studentlist=false">'.get_lang('CourseTracking').'</a>';
 }
 echo '&nbsp;<a href="javascript: void(0);" onclick="javascript: window.print();"><img align="absbottom" src="../img/printmgr.gif">&nbsp;'.get_lang('Print').'</a>';
-if($_GET['studentlist'] == 'false') {	
+if($_GET['studentlist'] == 'false') {
 	echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv&studentlist=false"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>';
 } else {
 	echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&export=csv"><img align="absbottom" src="../img/excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>';
@@ -185,7 +185,7 @@ if ($_GET['studentlist'] == 'false') {
 		foreach ($flat_list as $lp_id => $lp) {
 			$lp_avg_progress = 0;
 			foreach ($a_students as $student_id => $student) {
-				// get the progress in learning pathes	
+				// get the progress in learning pathes
 				$lp_avg_progress += learnpath::get_db_progress($lp_id, $student_id);
 			}
 			if ($nbStudents > 0) {
@@ -223,11 +223,11 @@ if ($_GET['studentlist'] == 'false') {
 					<img src="../img/quiz.gif" align="absbottom">&nbsp;'.get_lang('AverageResultsToTheExercices').' &nbsp;-&nbsp;<a href="../exercice/exercice.php?'.api_get_cidreq().'&show=result">'.get_lang('SeeDetail').'</a>
 				</h4>
 			<table class="data_table">';
-			
+
 	$sql = "SELECT id, title
 			FROM $TABLEQUIZ WHERE active <> -1";
 	$rs = api_sql_query($sql, __FILE__, __LINE__);
-	
+
 	if ($export_csv) {
     	$temp = array(get_lang('AverageProgressInLearnpath'), '');
     	$csv_content[] = array('', '');
@@ -235,7 +235,7 @@ if ($_GET['studentlist'] == 'false') {
     }
 
 	if (Database::num_rows($rs) > 0) {
-		// gets course actual administrators 
+		// gets course actual administrators
 		$sql = "SELECT user.user_id FROM $table_user user, $TABLECOURSUSER course_user
 			WHERE course_user.user_id=user.user_id AND course_user.course_code='".api_get_course_id()."' AND course_user.status <> '1' ";
 		$res = api_sql_query($sql, __FILE__, __LINE__);
@@ -250,14 +250,14 @@ if ($_GET['studentlist'] == 'false') {
 			$quiz_avg_score = 0;
 			if ($count_students > 0) {
 				foreach ($student_ids as $student_id) {
-					// get the scorn in exercises	
+					// get the scorn in exercises
 					$sql = 'SELECT exe_result , exe_weighting
 						FROM '.$TABLETRACK_EXERCISES.'
 						WHERE exe_exo_id = '.$quiz['id'].'
-							AND exe_user_id = '.(int)$student_id.'		
-							AND exe_cours_id = "'.api_get_course_id().'"			
+							AND exe_user_id = '.(int)$student_id.'
+							AND exe_cours_id = "'.api_get_course_id().'"
 						AND orig_lp_id = 0
-						AND orig_lp_item_id = 0		
+						AND orig_lp_item_id = 0
 						ORDER BY exe_date DESC';
 					$rsAttempt = api_sql_query($sql, __FILE__, __LINE__);
 					$nb_attempts = 0;
@@ -272,8 +272,8 @@ if ($_GET['studentlist'] == 'false') {
 					if ($nb_attempts > 0) {
 						$avg_student_score = $avg_student_score / $nb_attempts;
 					}
-					$quiz_avg_score += $avg_student_score;										
-				}								
+					$quiz_avg_score += $avg_student_score;
+				}
 			}
             $count_students = ($count_students == 0 || is_null($count_students) || $count_students == '') ? 1 : $count_students;
 			echo '<tr><td>'.$quiz['title'].'</td><td align="right">'.round(($quiz_avg_score / $count_students), 2).'%'.'</td></tr>';
@@ -304,16 +304,16 @@ if ($_GET['studentlist'] == 'false') {
 			<table class="data_table">';
 	$count_number_of_posts_by_course = Tracking :: count_number_of_posts_by_course($_course['id']);
 	$count_number_of_forums_by_course = Tracking :: count_number_of_forums_by_course($_course['id']);
-	$count_number_of_threads_by_course = Tracking :: count_number_of_threads_by_course($_course['id']);		
-	if ($export_csv) {    	    	
+	$count_number_of_threads_by_course = Tracking :: count_number_of_threads_by_course($_course['id']);
+	if ($export_csv) {
 		$csv_content[] = array(get_lang('Forum'), '');
     	$csv_content[] = array(get_lang('ForumForumsNumber', ''), $count_number_of_forums_by_course);
     	$csv_content[] = array(get_lang('ForumThreadsNumber', ''), $count_number_of_threads_by_course);
-    	$csv_content[] = array(get_lang('ForumPostsNumber', ''), $count_number_of_posts_by_course);    	
-    }		
+    	$csv_content[] = array(get_lang('ForumPostsNumber', ''), $count_number_of_posts_by_course);
+    }
 	echo '<tr><td>'.get_lang('ForumForumsNumber').'</td><td align="right">'.$count_number_of_forums_by_course.'</td></tr>';
-	echo '<tr><td>'.get_lang('ForumThreadsNumber').'</td><td align="right">'.$count_number_of_threads_by_course.'</td></tr>'; 
-	echo '<tr><td>'.get_lang('ForumPostsNumber').'</td><td align="right">'.$count_number_of_posts_by_course.'</td></tr>';  
+	echo '<tr><td>'.get_lang('ForumThreadsNumber').'</td><td align="right">'.$count_number_of_threads_by_course.'</td></tr>';
+	echo '<tr><td>'.get_lang('ForumPostsNumber').'</td><td align="right">'.$count_number_of_posts_by_course.'</td></tr>';
 	echo '</table></div>';
 	echo '<div class="clear"></div>';
 
@@ -326,11 +326,11 @@ if ($_GET['studentlist'] == 'false') {
 					<img src="../img/chat.gif" align="absbottom">&nbsp;'.get_lang('Chat').'</a>
 				</h4>
 			<table class="data_table">';
-	$chat_connections_during_last_x_days_by_course = Tracking :: chat_connections_during_last_x_days_by_course($_course['id'], 7);	
+	$chat_connections_during_last_x_days_by_course = Tracking :: chat_connections_during_last_x_days_by_course($_course['id'], 7);
 	if ($export_csv) {
-		$csv_content[] = array(get_lang('Chat', ''), '');    	    	
-    	$csv_content[] = array(sprintf(get_lang('ChatConnectionsDuringLastXDays', ''), '7'), $chat_connections_during_last_x_days_by_course);    		
-    }		
+		$csv_content[] = array(get_lang('Chat', ''), '');
+    	$csv_content[] = array(sprintf(get_lang('ChatConnectionsDuringLastXDays', ''), '7'), $chat_connections_during_last_x_days_by_course);
+    }
 	echo '<tr><td>'.sprintf(get_lang('ChatConnectionsDuringLastXDays'), '7').'</td><td align="right">'.$chat_connections_during_last_x_days_by_course.'</td></tr>';
 
 	echo '</table></div>';
@@ -377,7 +377,7 @@ if ($_GET['studentlist'] == 'false') {
 	 * DOCUMENTS
 	 ***************************/
 	if ($_GET['num'] == 0 or empty($_GET['num'])) {
-		$num = 3;	
+		$num = 3;
 		$link = '&nbsp;-&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&studentlist=false&num=1#ancle">'.get_lang('SeeDetail').'</a>';
 	} else {
 		$num = 1000;
@@ -423,7 +423,7 @@ if ($_GET['studentlist'] == 'false') {
     	}
     }
 	echo '</table></div>';
-	
+
 	echo '<div class="clear"></div>';
 
 	/***************************
@@ -469,7 +469,7 @@ if ($_GET['studentlist'] == 'false') {
     	}
     }
 	echo '</table></div>';
-	echo '<div class="clear"></div>';	
+	echo '<div class="clear"></div>';
 
 	// send the csv file if asked
 	if ($export_csv) {
@@ -527,7 +527,7 @@ if ($_GET['studentlist'] == 'false') {
 		}
 		$table -> set_header(3, get_lang('TrainingTime'), false);
 		$table -> set_header(4, get_lang('CourseProgress'), false);
-		$table -> set_header(5, get_lang('Score'), false);	
+		$table -> set_header(5, get_lang('Score'), false);
 		$table -> set_header(6, get_lang('Student_publication'), false);
 		$table -> set_header(7, get_lang('Messages'), false);
 		$table -> set_header(8, get_lang('FirstLogin'), false, 'align="center"');
@@ -542,7 +542,7 @@ if ($_GET['studentlist'] == 'false') {
 			$avg_time_spent = $avg_student_score = $avg_student_progress = $total_assignments = $total_messages = 0;
 			$nb_courses_student = 0;
 			$avg_time_spent = Tracking :: get_time_spent_on_the_course($student_id, $course_code);
-			$avg_student_score = Tracking :: get_average_test_scorm_and_lp($student_id, $course_code);						
+			$avg_student_score = Tracking :: get_average_test_scorm_and_lp($student_id, $course_code);
 			$avg_student_progress = Tracking :: get_avg_student_progress($student_id, $course_code);
 			$total_assignments = Tracking :: count_student_assignments($student_id, $course_code);
 			$total_messages = Tracking :: count_student_messages($student_id, $course_code);
@@ -558,9 +558,9 @@ if ($_GET['studentlist'] == 'false') {
 			}
 			$row[] = api_time_to_hms($avg_time_spent);
 			if (is_null($avg_student_score)) {$avg_student_score=0;}
-			if (is_null($avg_student_progress)) {$avg_student_progress=0;}		
+			if (is_null($avg_student_progress)) {$avg_student_progress=0;}
 			$row[] = $avg_student_progress.'%';
-			$row[] = $avg_student_score.'%';		
+			$row[] = $avg_student_score.'%';
 			$row[] = $total_assignments;
 			$row[] = $total_messages;
 			$row[] = Tracking :: get_first_connection_date_on_the_course($student_id, $course_code);
@@ -576,7 +576,7 @@ if ($_GET['studentlist'] == 'false') {
 			}
 			$row[] = '<center><a href="../mySpace/myStudents.php?student='.$student_id.'&details=true&course='.$course_code.'&origin=tracking_course'.$from.'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></center>';
 
-			$all_datas[] = $row;		
+			$all_datas[] = $row;
 		}
 
 		usort($all_datas, 'sort_users');
@@ -588,7 +588,7 @@ if ($_GET['studentlist'] == 'false') {
 		}
 
 		foreach ($all_datas as $row) {
-			$table -> addRow($row,'align="right"');	
+			$table -> addRow($row,'align="right"');
 		}
 		$table -> setColAttributes(0, array('align' => 'left'));
 		$table -> setColAttributes(1, array('align' => 'left'));
@@ -605,7 +605,7 @@ if ($_GET['studentlist'] == 'false') {
 	// send the csv file if asked
 	if ($export_csv) {
 		if ($is_western_name_order) {
-			$csv_headers = array ( 
+			$csv_headers = array (
 				get_lang('OfficialCode', ''),
 				get_lang('FirstName', ''),
 				get_lang('LastName', ''),
@@ -618,7 +618,7 @@ if ($_GET['studentlist'] == 'false') {
 				get_lang('LatestLogin', '')
 			);
 		} else {
-			$csv_headers = array ( 
+			$csv_headers = array (
 				get_lang('OfficialCode', ''),
 				get_lang('LastName', ''),
 				get_lang('FirstName', ''),

+ 91 - 91
main/tracking/courseLogCSV.php

@@ -42,7 +42,7 @@
 ==============================================================================
 */
 $pathopen = isset($_REQUEST['pathopen']) ? $_REQUEST['pathopen'] : null;
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = "tracking";
 
 include('../inc/global.inc.php');
@@ -128,19 +128,19 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
     ";*/
 
     if(!isset($view)) $view ="0000000";
-	
-	
+
+
 /***************************************************************************
  *
  *		Reporting
  *
  ***************************************************************************/
-	
+
 	$tempView = $view;
     if($view[6] == '1'){
-    	
+
     	$tempView[6] = '0';
-    	
+
         //--------------------------------BEGIN users in this course
         $sql = "SELECT $TABLECOURSUSER.`user_id`, $table_user.`lastname`, $table_user.`firstname`
                     FROM $TABLECOURSUSER, $table_user
@@ -157,7 +157,7 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
         {
         	$line='';
         	$title_line = get_lang('Name').";".get_lang('FirstAccess').";".get_lang('LastAccess').";".get_lang('Visited')."\n";
-       	
+
             for($j = 0 ; $j < count($results) ; $j++)
             {
 
@@ -203,9 +203,9 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
 				$line .= $results[$j][1]." ".$results[$j][2].";".$first_access.";".$last_access.";".$lpath_pct_completed."\n";
 
 				//--------------------------------END presentation of data
-				
+
 
-				
+
             }
 
         }
@@ -213,11 +213,11 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
         {
             $line = get_lang('NoResult')."\n";
         }
-		 
+
     }
-    
-    
-    
+
+
+
 /***************************************************************************
  *
  *		Main
@@ -229,17 +229,17 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
     {
         $title[1]= $nameTools;
         $tempView[0] = '0';
-        
+
         $sql = "SELECT count(*)
                     FROM $TABLECOURSUSER
                     WHERE course_code = '".$_cid."'";
         $count = getOneResult($sql);
-        
+
 		$title_line = get_lang('CountUsers')." ; ".$count."\n";
-               
-        
-    }   
-    
+
+
+    }
+
 
 /***************************************************************************
 *
@@ -248,23 +248,23 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
 ***************************************************************************/
     $tempView = $view;
     if($view[1] == '1'){
-    	
+
         $tempView[1] = '0';
 
-        
+
         $title[1]=get_lang('ConnectionsToThisCourse');
         $title_line = '';
         $line = '';
-        
+
         //Total
         $sql = "SELECT count(*)
                     FROM $TABLETRACK_ACCESS
                     WHERE access_cours_code = '".$_cid."'
                         AND access_tool IS NULL";
         $count = getOneResult($sql);
-        
+
         $line .= get_lang('CountToolAccess')." ; ".$count."\n";
-         
+
         // last 31 days
         $sql = "SELECT count(*)
                     FROM $TABLETRACK_ACCESS
@@ -272,9 +272,9 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
                         AND (access_date > DATE_ADD(CURDATE(), INTERVAL -31 DAY))
                         AND access_tool IS NULL";
         $count = getOneResult($sql);
-        
+
         $line .= get_lang('Last31days')." ; ".$count."\n";
-        
+
         // last 7 days
         $sql = "SELECT count(*)
                     FROM $TABLETRACK_ACCESS
@@ -282,9 +282,9 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
                         AND (access_date > DATE_ADD(CURDATE(), INTERVAL -7 DAY))
                         AND access_tool IS NULL";
         $count = getOneResult($sql);
-        
+
         $line .= get_lang('Last7days')." ; ".$count."\n";
-        
+
         // today
         $sql = "SELECT count(*)
                     FROM $TABLETRACK_ACCESS
@@ -293,11 +293,11 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
                         AND access_tool IS NULL";
         $count = getOneResult($sql);
         $line .= get_lang('Thisday')." ; ".$count."\n";
-        
+
     }
-    
-    
-    
+
+
+
 /***************************************************************************
  *
  *		Tools
@@ -305,22 +305,22 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
  ***************************************************************************/
 	$tempView = $view;
 	if($view[2] == '1'){
-		
+
 	    $tempView[2] = '0';
 
 		$title[1]= $nameTools;
 		$line ='';
-	    
+
 	    $title_line = get_lang('ToolTitleToolnameColumn').";".get_lang('ToolTitleUsersColumn').";".get_lang('ToolTitleCountColumn')."\n";
-              
+
 		$sql = "SELECT `access_tool`, COUNT(DISTINCT `access_user_id`),count( `access_tool` )
                 FROM $TABLETRACK_ACCESS
                 WHERE `access_tool` IS NOT NULL
                     AND `access_cours_code` = '$_cid'
                 GROUP BY `access_tool`";
-                
+
         $results = getManyResults3Col($sql);
-        
+
         if (is_array($results))
         {
             for($j = 0 ; $j < count($results) ; $j++)
@@ -333,10 +333,10 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
         {
             $line = get_lang('NoResult')."\n";
         }
-	   	    
+
 	}
-    
-    
+
+
 /***************************************************************************
 *
 *		Links
@@ -345,21 +345,21 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
 
     $tempView = $view;
     if($view[3] == '1'){
-    	
+
         $tempView[3] = '0';
-        
+
         $sql = "SELECT `cl`.`title`, `cl`.`url`,count(DISTINCT `sl`.`links_user_id`), count(`cl`.`title`)
                     FROM $TABLETRACK_LINKS AS sl, $TABLECOURSE_LINKS AS cl
                     WHERE `sl`.`links_link_id` = `cl`.`id`
                         AND `sl`.`links_cours_id` = '$_cid'
                     GROUP BY `cl`.`title`, `cl`.`url`";
-                    
+
 		$results = getManyResultsXCol($sql,4);
-		
+
 		$title[1]= $nameTools;
-		$line='';	
+		$line='';
 		$title_line = get_lang('LinksTitleLinkColumn').";".get_lang('LinksTitleUsersColumn').";".get_lang('LinksTitleCountColumn')."\n";
-        
+
         if (is_array($results))
         {
             for($j = 0 ; $j < count($results) ; $j++)
@@ -372,7 +372,7 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
         {
             $line = get_lang('NoResult')."\n";
         }
-                
+
     }
 
 
@@ -384,18 +384,18 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
 
     $tempView = $view;
     if($view[4] == '1'){
-    	
+
         $tempView[4] = '0';
-        
+
         $sql = "SELECT `down_doc_path`, COUNT(DISTINCT `down_user_id`), COUNT(`down_doc_path`)
                     FROM $TABLETRACK_DOWNLOADS
                     WHERE `down_cours_id` = '$_cid'
                     GROUP BY `down_doc_path`";
-        
+
         $results = getManyResults3Col($sql);
-        
+
  		$title[1]= $nameTools;
-		$line='';	
+		$line='';
         $title_line = get_lang('DocumentsTitleDocumentColumn').";".get_lang('DocumentsTitleUsersColumn').";".get_lang('DocumentsTitleCountColumn')."\n";
         if (is_array($results))
         {
@@ -409,8 +409,8 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
         {
             $line=get_lang('NoResult')."\n";
         }
-              
-        
+
+
     }
 
 
@@ -421,28 +421,28 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
 ***************************************************************************/
     $tempView = $view;
     if($view[5] == '1'){
-    	
+
         $tempView[5] = '0';
-        
-        $sql = "SELECT id, name 
+
+        $sql = "SELECT id, name
 					FROM $tbl_learnpath_main";
                     //WHERE dokeosCourse='$_cid'"; we are using a table inside the course now, so no need for course id
 		$result=api_sql_query($sql,__FILE__,__LINE__);
-		
+
 	    $ar=Database::fetch_array($result);
 
 		$title[1]= $nameTools;
-		$line='';	
+		$line='';
 	    $title_line = get_lang('ScormContentColumn');
-			
+
 		$scormcontopen=$_REQUEST["scormcontopen"];
 		$scormstudentopen=$_REQUEST["scormstudentopen"];
-	    
+
 	    if (is_array($ar)){
-	    	
+
 	    	while ($ar['id'] != '') {
 				$lp_title = stripslashes($ar['name']);
-				//echo "<a href='".api_get_self()."?view=".$view."&scormcontopen=".$ar['id']."' class='specialLink'>$lp_title</a>";			
+				//echo "<a href='".api_get_self()."?view=".$view."&scormcontopen=".$ar['id']."' class='specialLink'>$lp_title</a>";
 				if ($ar['id']==$scormcontopen) { //have to list the students here
 					$contentId=$ar['id'];
 					$sql2 = "SELECT u.user_id, u.lastname, u.firstname " .
@@ -452,29 +452,29 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
 		                    "WHERE sd.lp_id=$contentId group by u.user_id";
 		            //error_log($sql2,0);
 					$result2=api_sql_query($sql2,__FILE__,__LINE__);
-					
+
 					if(mysql_num_rows($result2)>0){
-						
-						
+
+
 					    $ar2=Database::fetch_array($result2);
 						while ($ar2 != '') {
-							
+
 							if (isset($_REQUEST["scormstudentopen"]) && $ar2['user_id']==$scormstudentopen) {
-							
+
 							$line .= $ar['id']." ".$ar2['user_id']." ".$ar2['lastname']." ".$ar2['firstname'];
-							
+
 							}
-							
+
 							else{
-								
-							$line .= $ar['id']." ".$ar2['user_id']." ".$ar2['lastname']." ".$ar2['firstname'];								
-									
+
+							$line .= $ar['id']." ".$ar2['user_id']." ".$ar2['lastname']." ".$ar2['firstname'];
+
 							}
 
-							
+
 							if ($ar2['user_id']==$scormstudentopen) { //have to list the student's results
-							
-								
+
+
 								$studentId=$ar2['user_id'];
 								$sql3 = "SELECT iv.status, iv.score, i.title, iv.total_time " .
 										"FROM $tbl_learnpath_item i " .
@@ -491,43 +491,43 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
 									$line .= $title.";".$ar3['status'].";".$ar3['score'].";".$time;
 									$ar3=Database::fetch_array($result3);
 								}
-								
-								
+
+
 							}
 							$line .= "\n";
 							$ar2=Database::fetch_array($result2);
 						}
-						
+
 						$title_line .= "\n";
-						
+
 					}
 
 				}
-				
+
 				$ar=Database::fetch_array($result);
-				
+
 			}
-	    	
+
     	}
-    	
-   
+
+
     }
 	 /***************************************************************************
      *
      *		Export to a CSV file
      *		force the browser to save the file instead of opening it
      ***************************************************************************/
-			
+
 	$len = strlen($title_line.$line);
 	header('Content-type: application/octet-stream');
 	//header('Content-Type: application/force-download');
 	header('Content-length: '.$len);
-	$filename = html_entity_decode(str_replace(":","",str_replace(" ","_", $title[0].'_'.$title[1].'.csv')));	
+	$filename = html_entity_decode(str_replace(":","",str_replace(" ","_", $title[0].'_'.$title[1].'.csv')));
 	if(preg_match("/MSIE 5.5/",$_SERVER['HTTP_USER_AGENT']))
 	{
 		header('Content-Disposition: filename= '.$filename);
 	}
-	else 
+	else
 	{
 		header('Content-Disposition: attachment; filename= '.$filename);
 	}
@@ -539,13 +539,13 @@ if($is_allowedToTrack && $_configuration['tracking_enabled'])
 	}
 	header('Content-Description: '.$filename);
 	header('Content-transfer-encoding: binary');
-				
+
 	echo api_html_entity_decode($title_line, ENT_COMPAT, $charset);
 	echo api_html_entity_decode($line, ENT_COMPAT, $charset);
 	exit;
-  
+
 
-    
+
 }
 // not allowed
 else

+ 1 - 1
main/tracking/course_access_details.php

@@ -42,7 +42,7 @@
 $reqdate = $_REQUEST['reqdate'];
 $period = $_REQUEST['period'];
 $displayType = $_REQUEST['displayType'];
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = "tracking";
 include('../inc/global.inc.php');
 

+ 1 - 1
main/tracking/logins_details.php

@@ -50,7 +50,7 @@ if(!isset($_REQUEST['view']))
 else
 	$view = $_REQUEST['view'];
 
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = "tracking";
 include('../inc/global.inc.php');
 

+ 40 - 40
main/tracking/toolaccess_details.php

@@ -2,21 +2,21 @@
 /*
 ==============================================================================
 	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.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
 	Mail: info@dokeos.com
 ==============================================================================
@@ -34,17 +34,17 @@
 *	@package dokeos.tracking
 ==============================================================================
 */
- 
+
 /*
 ==============================================================================
 		INIT SECTION
 ==============================================================================
 */
- 
+
 $tool = $_REQUEST['tool'];
 $period = $_REQUEST['period'];
 $reqDate = $_REQUEST['reqDate'];
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = "tracking";
 
 include('../inc/global.inc.php');
@@ -93,11 +93,11 @@ $period=$_REQUEST['period'];
 $reqdate=$_REQUEST['reqdate'];
 ?>
 <table width="100%" cellpadding="2" cellspacing="0" border="0">
-<?php 
-    
-    
+<?php
+
+
     $TABLETRACK_ACCESS = $_configuration['statistics_database']."`.`track_e_access";
-    
+
     if(isset($_cid)) //stats for the current course
     {
         // to see stats of one course user must be courseAdmin of this course
@@ -115,12 +115,12 @@ $reqdate=$_REQUEST['reqdate'];
         // list of all tools
         if (!isset($tool))
         {
-            $sql = "SELECT `access_tool`, count( access_tool ) 
+            $sql = "SELECT `access_tool`, count( access_tool )
                         FROM `$TABLETRACK_ACCESS`
                         WHERE `access_tool` IS NOT NULL
                             ".$courseCodeEqualcidIfNeeded."
                         GROUP BY `access_tool`";
-            echo "<tr><td>";  
+            echo "<tr><td>";
             echo "<tr>
                     <td>
                     ";
@@ -129,7 +129,7 @@ $reqdate=$_REQUEST['reqdate'];
 					</td>
                 </tr>
             ";
-    
+
             $results = getManyResults2Col($sql);
             echo "<table cellpadding='0' cellspacing='0' border='0' align=center>";
             echo "<tr bgcolor='#E6E6E6'>
@@ -141,19 +141,19 @@ $reqdate=$_REQUEST['reqdate'];
                     </td>
                 </tr>";
             if (is_array($results))
-            { 
+            {
                 for($j = 0 ; $j < count($results) ; $j++)
-                { 
-                        echo "<tr>"; 
+                {
+                        echo "<tr>";
                         echo "<td><a href='toolaccess_details.php?tool=".urlencode($results[$j][0])."'>".get_lang($results[$j][0])."</a></td>";
                         echo "<td align='right'>".$results[$j][1]."</td>";
                         echo"</tr>";
                 }
-            
+
             }
             else
             {
-                echo "<tr>"; 
+                echo "<tr>";
                 echo "<td colspan='2'><center>".get_lang('NoResult')."</center></td>";
                 echo"</tr>";
             }
@@ -164,7 +164,7 @@ $reqdate=$_REQUEST['reqdate'];
             // this can prevent bug if there is special chars in $tool
             $encodedTool = urlencode($tool);
             $tool = urldecode($tool);
-            
+
             if( !isset($reqdate) )
                 $reqdate = time();
             echo "<tr>
@@ -175,16 +175,16 @@ $reqdate=$_REQUEST['reqdate'];
 					</td>
                 </tr>
             ";
-            
+
             /* ------ display ------ */
             // displayed period
             echo "<tr><td>";
             switch($period)
             {
-                case "month" : 
+                case "month" :
                     echo $MonthsLong[date("n", $reqdate)-1].date(" Y", $reqdate);
                     break;
-                case "week" : 
+                case "week" :
                     $weeklowreqdate = ($reqdate-(86400*date("w" , $reqdate)));
                     $weekhighreqdate = ($reqdate+(86400*(6-date("w" , $reqdate)) ));
                     echo "<b>".$langFrom."</b> ".date("d " , $weeklowreqdate).$MonthsLong[date("n", $weeklowreqdate)-1].date(" Y" , $weeklowreqdate);
@@ -192,8 +192,8 @@ $reqdate=$_REQUEST['reqdate'];
                     break;
                 // default == day
                 default :
-                    $period = "day";            
-                case "day" : 
+                    $period = "day";
+                case "day" :
                     echo $DaysLong[date("w" , $reqdate)].date(" d " , $reqdate).$MonthsLong[date("n", $reqdate)-1].date(" Y" , $reqdate);
                     break;
             }
@@ -202,11 +202,11 @@ $reqdate=$_REQUEST['reqdate'];
             echo "<tr>
                     <td>
                     <small>
-                    [<a href='".api_get_self()."?tool=$encodedTool&period=day&reqdate=$reqdate' class='specialLink'>$langPeriodDay</a>] 
+                    [<a href='".api_get_self()."?tool=$encodedTool&period=day&reqdate=$reqdate' class='specialLink'>$langPeriodDay</a>]
                     [<a href='".api_get_self()."?tool=$encodedTool&period=week&reqdate=$reqdate' class='specialLink'>$langPeriodWeek</a>]
                     [<a href='".api_get_self()."?tool=$encodedTool&period=month&reqdate=$reqdate' class='specialLink'>$langPeriodMonth</a>]
                     &nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;
-                    
+
                     ";
             switch($period)
             {
@@ -216,7 +216,7 @@ $reqdate=$_REQUEST['reqdate'];
                     $previousReqDate = mktime(1,1,1,date("m",$reqdate)-1,1,date("Y",$reqdate));
                     $nextReqDate = mktime(1,1,1,date("m",$reqdate)+1,1,date("Y",$reqdate));
                     echo   "
-                        [<a href='".api_get_self()."?tool=$encodedTool&period=month&reqdate=$previousReqDate' class='specialLink'>$langPreviousMonth</a>] 
+                        [<a href='".api_get_self()."?tool=$encodedTool&period=month&reqdate=$previousReqDate' class='specialLink'>$langPreviousMonth</a>]
                         [<a href='".api_get_self()."?tool=$encodedTool&period=month&reqdate=$nextReqDate' class='specialLink'>$langNextMonth</a>]
                     ";
                     break;
@@ -225,7 +225,7 @@ $reqdate=$_REQUEST['reqdate'];
                     $previousReqDate = $reqdate - 7*86400;
                     $nextReqDate = $reqdate + 7*86400;
                     echo   "
-                        [<a href='".api_get_self()."?tool=$encodedTool&period=week&reqdate=$previousReqDate' class='specialLink'>$langPreviousWeek</a>] 
+                        [<a href='".api_get_self()."?tool=$encodedTool&period=week&reqdate=$previousReqDate' class='specialLink'>$langPreviousWeek</a>]
                         [<a href='".api_get_self()."?tool=$encodedTool&period=week&reqdate=$nextReqDate' class='specialLink'>$langNextWeek</a>]
                     ";
                     break;
@@ -234,12 +234,12 @@ $reqdate=$_REQUEST['reqdate'];
                     $previousReqDate = $reqdate - 86400;
                     $nextReqDate = $reqdate + 86400;
                     echo   "
-                        [<a href='".api_get_self()."?tool=$encodedTool&period=day&reqdate=$previousReqDate' class='specialLink'>$langPreviousDay</a>] 
+                        [<a href='".api_get_self()."?tool=$encodedTool&period=day&reqdate=$previousReqDate' class='specialLink'>$langPreviousDay</a>]
                         [<a href='".api_get_self()."?tool=$encodedTool&period=day&reqdate=$nextReqDate' class='specialLink'>$langNextDay</a>]
                     ";
                     break;
             }
-            
+
             echo"   &nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;
                     [<a href='".api_get_self()."' class='specialLink'>$langViewToolList</a>]
                     </small>
@@ -253,12 +253,12 @@ $reqdate=$_REQUEST['reqdate'];
                 case "month" :
                     $sql = "SELECT UNIX_TIMESTAMP(`access_date`)
                             FROM `$TABLETRACK_ACCESS`
-                            WHERE `access_tool` = '$tool' 
+                            WHERE `access_tool` = '$tool'
                                 ".$courseCodeEqualcidIfNeeded."
                                 AND MONTH(`access_date`) = MONTH(FROM_UNIXTIME('$reqdate'))
                                 AND YEAR(`access_date`) = YEAR(FROM_UNIXTIME('$reqdate'))
                                 ORDER BY `access_date` ASC";
-                    
+
                     $days_array = daysTab($sql);
                     makeHitsTable($days_array,$langDay);
                     break;
@@ -266,12 +266,12 @@ $reqdate=$_REQUEST['reqdate'];
                 case "week" :
                     $sql = "SELECT UNIX_TIMESTAMP(`access_date`)
                             FROM `$TABLETRACK_ACCESS`
-                            WHERE `access_tool` = '$tool' 
+                            WHERE `access_tool` = '$tool'
                                 ".$courseCodeEqualcidIfNeeded."
                                 AND WEEK(`access_date`) = WEEK(FROM_UNIXTIME('$reqdate'))
                                 AND YEAR(`access_date`) = YEAR(FROM_UNIXTIME('$reqdate'))
                                 ORDER BY `access_date` ASC";
-    
+
                     $days_array = daysTab($sql);
                     makeHitsTable($days_array,$langDay);
                     break;
@@ -279,12 +279,12 @@ $reqdate=$_REQUEST['reqdate'];
                 case "day"  :
                     $sql = "SELECT UNIX_TIMESTAMP(`access_date`)
                                 FROM `$TABLETRACK_ACCESS`
-                                WHERE `access_tool` = '$tool' 
+                                WHERE `access_tool` = '$tool'
                                     ".$courseCodeEqualcidIfNeeded."
                                     AND DAYOFYEAR(`access_date`) = DAYOFYEAR(FROM_UNIXTIME('$reqdate'))
                                     AND YEAR(`access_date`) = YEAR(FROM_UNIXTIME('$reqdate'))
                                 ORDER BY `access_date` ASC";
-                    
+
                     $hours_array = hoursTab($sql,$reqdate);
                     makeHitsTable($hours_array,$langHour);
                     break;
@@ -302,8 +302,8 @@ $reqdate=$_REQUEST['reqdate'];
             echo get_lang('NotAllowed');
         }
     }
-    
-    
+
+
 ?>
 </table>
 <?php

+ 8 - 8
main/tracking/userLog.php

@@ -40,7 +40,7 @@
 $uInfo = $_REQUEST['uInfo'];
 $view  = $_REQUEST['view'];
 
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = 'tracking';
 
 // including the global Dokeos file
@@ -80,7 +80,7 @@ if (isset($_GET['scormcontopen'])) {
 		$res = api_sql_query($sql,__FILE__,__LINE__);
 		$row = Database::fetch_array($res);
 		$lp_charset = $row['default_encoding'];
-	}	
+	}
 	//header('Content-Type: text/html; charset='. $row['default_encoding']);
 }
 
@@ -199,7 +199,7 @@ function myEnc($isostring,$supposed_encoding='ISO-8859-15')
 * Displays the number of logins every month for a specific user in a specific course.
 */
 function display_login_tracking_info($view, $user_id, $course_id)
-{	
+{
 	$MonthsLong = $GLOBALS['MonthsLong'];
 	$track_access_table = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS);
 	$tempView = $view;
@@ -374,7 +374,7 @@ function display_exercise_tracking_info($view, $user_id, $course_id)
 */
 function display_student_publications_tracking_info($view, $user_id, $course_id)
 {
-	global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK, $dateTimeFormatLong, $_course; 
+	global $TABLETRACK_UPLOADS, $TABLECOURSE_WORK, $dateTimeFormatLong, $_course;
 	if(substr($view,2,1) == '1') {
 		$new_view = substr_replace($view,'0',2,1);
 		echo "<tr>
@@ -571,7 +571,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
 		*		Display list of user of this group
 		*
 		***************************************************************************/
-		
+
 		echo "<h4>".myEnc(get_lang('ListStudents'))."</h4>";
 		if( $is_allowedToTrackEverybodyInCourse ) {
 			// if user can track everybody : list user of course
@@ -659,7 +659,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
 		echo $navLink;
 	} else {
 		// if uInfo is set
-		
+
 		/***************************************************************************
 		*
 		*		Informations about student uInfo
@@ -672,7 +672,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
 			$tracking_is_accepted = $is_course_member;
 			$tracked_user_info = Database::get_user_info_from_id($uInfo);
 		} else {
-			
+
 			// check if user is in the group of this tutor
 			$sql = "SELECT u.firstname,u.lastname, u.email
 						FROM $TABLECOURSE_GROUPSUSER gu , $TABLEUSER u
@@ -745,7 +745,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
             $sql = "SELECT id, name FROM $tbl_learnpath_main";
     		$result=api_sql_query($sql,__FILE__,__LINE__);
     	    $ar=Database::fetch_array($result);
-    	    
+
 	    	echo "<tr><td style='padding-left : 40px;padding-right : 40px;'>";
             echo "<table cellpadding='2' cellspacing='1' border='0' align='center'><tr>
     				                <td class='secLine'>

+ 19 - 19
main/tracking/userlogCSV.php

@@ -1,4 +1,4 @@
-<?php 
+<?php
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
@@ -39,7 +39,7 @@
 */
 $uInfo = $_REQUEST['uInfo'];
 $view = $_REQUEST['view'];
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = 'tracking';
 
 include('../inc/global.inc.php');
@@ -198,7 +198,7 @@ function display_login_tracking_info($view, $user_id, $course_id)
 	{
 		$new_view = substr_replace($view,'0',0,1);
 		$title[1]= myEnc(get_lang('LoginsAndAccessTools')).myEnc(get_lang('LoginsDetails'));
-			
+
 		$sql = "SELECT UNIX_TIMESTAMP(`access_date`), count(`access_date`)
 					FROM $track_access_table
 					WHERE `access_user_id` = '$user_id'
@@ -224,11 +224,11 @@ function display_login_tracking_info($view, $user_id, $course_id)
 		else
 		{
 			$line= myEnc(get_lang('NoResult'))."</center></td>";
-		}		
+		}
 	}
 	else
 	{
-		$new_view = substr_replace($view,'1',0,1);		
+		$new_view = substr_replace($view,'1',0,1);
 	}
 	return array($title_line, $line);
 }
@@ -243,12 +243,12 @@ function display_exercise_tracking_info($view, $user_id, $course_id)
 	if(substr($view,1,1) == '1')
 	{
 		$new_view = substr_replace($view,'0',1,1);
-		
+
 		$title[1]= myEnc(get_lang('ExercicesDetails'));
 		$line='';
 
 		$sql = "SELECT `ce`.`title`, `te`.`exe_result` , `te`.`exe_weighting`, UNIX_TIMESTAMP(`te`.`exe_date`)
-			FROM $TABLECOURSE_EXERCICES AS ce , `$TABLETRACK_EXERCICES` AS `te` 
+			FROM $TABLECOURSE_EXERCICES AS ce , `$TABLETRACK_EXERCICES` AS `te`
 			WHERE `te`.`exe_cours_id` = '$course_id'
 				AND `te`.`exe_user_id` = '$user_id'
 				AND `te`.`exe_exo_id` = `ce`.`id`
@@ -307,7 +307,7 @@ function display_exercise_tracking_info($view, $user_id, $course_id)
 	else
 	{
 		$new_view = substr_replace($view,'1',1,1);
-		
+
 	}
 	return array($title_line, $line);
 }
@@ -333,7 +333,7 @@ function display_student_publications_tracking_info($view, $user_id, $course_id)
 		$title[1]=myEnc(get_lang('WorksDetails'));
 		$line='';
 		$title_line=myEnc(get_lang('WorkTitle')).";".myEnc(get_lang('WorkAuthors')).";".myEnc(get_lang('Date'))."\n";
-			
+
 		if (is_array($results))
 		{
 			for($j = 0 ; $j < count($results) ; $j++)
@@ -381,7 +381,7 @@ function display_links_tracking_info($view, $user_id, $course_id)
 			for($j = 0 ; $j < count($results) ; $j++)
 			{
 					$line .= $results[$j][0]."\n";
-				
+
 			}
 
 		}
@@ -562,7 +562,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
 			$query = api_sql_query($sql,__FILE__,__LINE__);
 			$tracked_user_info = @mysql_fetch_assoc($query);
 			if(is_array($tracked_user_info)) $tracking_is_accepted = true;
-			
+
        		$title[0] = $tracked_user_info['firstname'].'_'.$tracked_user_info['lastname'];
 		}
 
@@ -588,7 +588,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
 
 			//Documents downloaded
 			list($title_line5, $line5) = display_document_tracking_info($view, $uInfo, $_cid);
-			
+
 			$title_line = $title_line1.$title_line2.$title_line3.$title_line4.$title_line5;
 			$line= $line1.$line2.$line3.$line4.$line5;
 		}
@@ -603,7 +603,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
          *		Scorm contents and Learning Path
          *
          ***************************************************************************/
-         //TODO: scorm tools is in work and the logs will change in few days... 
+         //TODO: scorm tools is in work and the logs will change in few days...
         /*if(substr($view,5,1) == '1')
         {
             $new_view = substr_replace($view,'0',5,1);
@@ -631,7 +631,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
    						    $ar3=Database::fetch_array($result3);
                             if (is_array($ar3)) {
                                 $title_line=myEnc(get_lang('ScormTitleColumn')).";".myEnc(get_lang('ScormStatusColumn')).";".myEnc(get_lang('ScormScoreColumn')).";".myEnc(get_lang('ScormTimeColumn'))."\n";
-       				            
+
        							while ($ar3['status'] != '') {
 									require_once('../newscorm/learnpathItem.class.php');
 									$time = learnpathItem::get_scorm_time('php',$ar3['total_time']);
@@ -667,17 +667,17 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
      *		Export to a CSV file
      *		force the browser to save the file instead of opening it
      ***************************************************************************/
-			
+
 	$len = strlen($title_line.$line);
 	header('Content-type: application/octet-stream');
 	//header('Content-Type: application/force-download');
 	header('Content-length: '.$len);
-	$filename = html_entity_decode(str_replace(":","",str_replace(" ","_", $title[0].'_'.$title[1].'.csv')));	
+	$filename = html_entity_decode(str_replace(":","",str_replace(" ","_", $title[0].'_'.$title[1].'.csv')));
 	if(preg_match("/MSIE 5.5/",$_SERVER['HTTP_USER_AGENT']))
 	{
 		header('Content-Disposition: filename= '.$filename);
 	}
-	else 
+	else
 	{
 		header('Content-Disposition: attachment; filename= '.$filename);
 	}
@@ -689,11 +689,11 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
 	}
 	header('Content-Description: '.$filename);
 	header('Content-transfer-encoding: binary');
-				
+
 	echo api_html_entity_decode($title_line, ENT_QUOTES, $charset);
 	echo api_html_entity_decode($line, ENT_QUOTES, $charset);
 	exit;
-  
+
 
 }
 // not allowed

+ 1 - 1
main/upload/form.document.php

@@ -29,7 +29,7 @@ api_display_tool_title($nameTools.$add_group_to_title);
 	</div>
 	*/
 		?>
-	
+
 	<form method="POST" action="upload.php" id="upload_form" enctype="multipart/form-data" onsubmit="myUpload.start('dynamic_div','progressbar_green.gif','<?php echo(get_lang('Uploading'));?>','upload_form_div');">
 		<input type="hidden" name="curdirpath" value="<?php echo $path; ?>">
 		<input type="hidden" name="tool" value="<?php echo $my_tool; ?>">

+ 1 - 1
main/upload/form.scorm.php

@@ -68,7 +68,7 @@ $select_content_proximity = &$form->addElement('select','content_proximity',get_
 if(api_get_setting('search_enabled')=='true')
 {
 	$form -> addElement ('checkbox', 'index_document','', get_lang('SearchFeatureDoIndexDocument'));
-	
+
 	$specific_fields = get_specific_field_list();
 	foreach ($specific_fields as $specific_field) {
 		$form -> addElement ('text', $specific_field['code'], $specific_field['name'].' : ');

+ 1 - 1
main/upload/index.php

@@ -27,7 +27,7 @@
 * This script allows the user to manage files and directories on a remote http server.
 *
 * The user can : - upload a file
-*				 
+*
 * The script respects the strategical split between process and display, so the first
 * part is only processing code (init, process, display preparation) and the second
 * part is only display (HTML)

+ 8 - 8
main/upload/upload.document.php

@@ -70,7 +70,7 @@ if(isset($_FILES['user_upload']))
 	//echo("<pre>");
 	//print_r($_FILES['user_upload']);
 	//echo("</pre>");
-	
+
 	$upload_ok = process_uploaded_file($_FILES['user_upload']);
 	if($upload_ok)
 	{
@@ -78,7 +78,7 @@ if(isset($_FILES['user_upload']))
 		$new_path = handle_uploaded_document($_course, $_FILES['user_upload'],$base_work_dir,$_POST['curdirpath'],$_user['user_id'],$to_group_id,$to_user_id,$max_filled_space,$_POST['unzip'],$_POST['if_exists']);
     	$new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
     	$new_title = isset($_POST['title']) ? trim($_POST['title']) : '';
-		
+
     	if ($new_path && ($new_comment || $new_title))
     	if (($docid = DocumentManager::get_document_id($_course, $new_path)))
     	{
@@ -86,7 +86,7 @@ if(isset($_FILES['user_upload']))
         	$ct = '';
         	if ($new_comment) $ct .= ", comment='$new_comment'";
         	if ($new_title)   $ct .= ", title='$new_title'";
-        	api_sql_query("UPDATE $table_document SET" . substr($ct, 1) . 
+        	api_sql_query("UPDATE $table_document SET" . substr($ct, 1) .
         	    " WHERE id = '$docid'", __FILE__, __LINE__);
     	}
 		//check for missing images in html files
@@ -114,7 +114,7 @@ if(isset($_POST['submit_image']))
 		//open the html file and replace the paths
 		replace_img_path_in_html_file($_POST['img_file_path'],$paths_to_replace_in_file,$base_work_dir.$_POST['related_file']);
 		//update parent folders
-		item_property_update_on_folder($_course,$_POST['curdirpath'],$_user['user_id']);	
+		item_property_update_on_folder($_course,$_POST['curdirpath'],$_user['user_id']);
 	}
 }
 //they want to create a directory
@@ -129,7 +129,7 @@ if(isset($_POST['create_dir']) && $_POST['dirname']!='')
 		Display::display_normal_message(get_lang('DirCr'));
 		$path = $created_dir;
 	}
-	else 
+	else
 	{
 		display_error(get_lang('CannotCreateDir'));
 	}
@@ -183,7 +183,7 @@ else {	//give them a link to create a directory
 <?php echo get_lang('File'); ?>
 </td>
 <td>
-<input type="file" name="user_upload"/> 
+<input type="file" name="user_upload"/>
 </td>
 </tr>
 <?php
@@ -194,7 +194,7 @@ if(api_get_setting('use_document_title')=='true')
     <td><?php echo get_lang('Title');?></td>
     <td><input type="text" size="20" name="title" style="width:300px;"></td>
     </tr>
-	<?php 
+	<?php
 }
 ?>
     <tr>
@@ -220,7 +220,7 @@ if(api_get_setting('use_document_title')=='true')
 </form>
 <!-- end upload form -->
 
- <!-- so they can get back to the documents   --> 	 
+ <!-- so they can get back to the documents   -->
  <p><?php echo (get_lang('Back'));?> <?php echo (get_lang('To'));?> <a href="document.php?curdirpath=<?php echo $path; ?>"><?php echo (get_lang('DocumentsOverview'));?></a></p>
 
 <?php

+ 1 - 1
main/upload/upload.php

@@ -6,7 +6,7 @@
  * @author Yannick Warnier <ywarnier@beeznest.org>
  */
 /**
- * First, initialise the script 
+ * First, initialise the script
  */
 // name of the language file that needs to be included
 $language_file = 'document';

+ 1 - 1
main/upload/upload.scorm.php

@@ -22,7 +22,7 @@ if($error=='not_a_learning_path')
 	if (api_get_setting('search_enabled')=='true') {
         require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');
     	$specific_fields = get_specific_field_list();
-    
+
     	foreach ($specific_fields as $specific_field) {
     		$values = explode(',', trim($_POST[$specific_field['code']]));
     		if ( !empty($values) ) {

+ 9 - 9
main/upload/upload_ppt.php

@@ -6,7 +6,7 @@
  * @author Yannick Warnier <ywarnier@beeznest.org>
  */
 /**
- * First, initialise the script 
+ * First, initialise the script
  */
 // name of the language file which needs to be included
 // 'inc.php' is automatically appended to the file name
@@ -19,7 +19,7 @@ include("../inc/global.inc.php");
 require_once(api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php');
 require_once(api_get_path(LIBRARY_PATH) . 'document.lib.php');
 require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
-		
+
 
 $form_style= '
 <style>
@@ -58,7 +58,7 @@ if(isset($_POST['convert'])){
 			if(isset($o_ppt) && $first_item_id != 0){
 				if (api_get_setting('search_enabled')=='true') {
                     require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');
-                    $specific_fields = get_specific_field_list();                    
+                    $specific_fields = get_specific_field_list();
                     foreach ($specific_fields as $specific_field) {
     					$values = explode(',', trim($_POST[$specific_field['code']]));
     					if ( !empty($values) ) {
@@ -164,21 +164,21 @@ $renderer = & $form->defaultRenderer();
 
 
 // set template for user_file element
-$user_file_template = 
+$user_file_template =
 <<<EOT
 <div class="row" style="margin-top:10px;width:100%">
 		<!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->{label}{element}$div_upload_limit
-		<!-- BEGIN error --><br /><span class="form_error">{error}</span><!-- END error -->	
+		<!-- BEGIN error --><br /><span class="form_error">{error}</span><!-- END error -->
 </div>
 EOT;
 $renderer->setElementTemplate($user_file_template,'user_file');
 
 // set template for other elements
-$user_file_template = 
+$user_file_template =
 <<<EOT
 <div class="row" style="margin-top:10px;width:100%">
 		<!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->{label}{element}
-		<!-- BEGIN error --><br /><span class="form_error">{error}</span><!-- END error -->	
+		<!-- BEGIN error --><br /><span class="form_error">{error}</span><!-- END error -->
 </div>
 EOT;
 $renderer->setElementTemplate($user_file_template);
@@ -192,11 +192,11 @@ if (api_get_setting('search_enabled')=='true') {
     //$form -> addElement ('text', 'terms', get_lang('SearchFeatureDocumentTagsIfIndexing').': ');
     $form -> addElement ('html','<br />');
     $form -> addElement ('html', get_lang('SearchFeatureDocumentLanguage').': &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'. api_get_languages_combo());
-    $form -> addElement ('html','<div class="sub-form">');     
+    $form -> addElement ('html','<div class="sub-form">');
     foreach ($specific_fields as $specific_field) {
         $form -> addElement ('text', $specific_field['code'], $specific_field['name'].' : ');
     }
-    $form -> addElement ('html','</div>');     
+    $form -> addElement ('html','</div>');
 }
 
 $form -> addElement ('submit', 'convert', get_lang('ConvertToLP'), 'class="convert_button"');

+ 10 - 10
main/upload/upload_word.php

@@ -6,7 +6,7 @@
  * @author Yannick Warnier <ywarnier@beeznest.org>
  */
 /**
- * First, initialise the script 
+ * First, initialise the script
  */
 // name of the language file which needs to be included
 // 'inc.php' is automatically appended to the file name
@@ -19,7 +19,7 @@ include("../inc/global.inc.php");
 require_once(api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php');
 require_once(api_get_path(LIBRARY_PATH) . 'document.lib.php');
 require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
-		
+
 
 $form_style= '
 <style>
@@ -55,8 +55,8 @@ if(isset($_POST['convert'])){
 			if(isset($o_doc) && $first_item_id != 0){
                 if (api_get_setting('search_enabled')=='true') {
                     require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');
-                    $specific_fields = get_specific_field_list();                    
-                
+                    $specific_fields = get_specific_field_list();
+
     				foreach ($specific_fields as $specific_field) {
     					$values = explode(',', trim($_POST[$specific_field['code']]));
     					if ( !empty($values) ) {
@@ -154,21 +154,21 @@ $div_upload_limit = '&nbsp;&nbsp;'.get_lang('UploadMaxSize').' : '.ini_get('post
 
 $renderer = & $form->defaultRenderer();
 // set template for user_file element
-$user_file_template = 
+$user_file_template =
 <<<EOT
 <div class="row" style="margin-top:10px;width:100%">
 		<!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->{label}{element}$div_upload_limit
-		<!-- BEGIN error --><br /><span class="form_error">{error}</span><!-- END error -->	
+		<!-- BEGIN error --><br /><span class="form_error">{error}</span><!-- END error -->
 </div>
 EOT;
 $renderer->setElementTemplate($user_file_template,'user_file');
 
 // set template for other elements
-$user_file_template = 
+$user_file_template =
 <<<EOT
 <div class="row" style="margin-top:10px;width:100%">
 		<!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->{label}{element}
-		<!-- BEGIN error --><br /><span class="form_error">{error}</span><!-- END error -->	
+		<!-- BEGIN error --><br /><span class="form_error">{error}</span><!-- END error -->
 </div>
 EOT;
 $renderer->setElementTemplate($user_file_template);
@@ -179,11 +179,11 @@ if (api_get_setting('search_enabled')=='true')
     $form -> addElement ('checkbox', 'index_document','', get_lang('SearchFeatureDoIndexDocument'));
     $form -> addElement ('html','<br />');
     $form -> addElement ('html', get_lang('SearchFeatureDocumentLanguage').': &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'. api_get_languages_combo());
-    $form -> addElement ('html','<div class="sub-form">');     
+    $form -> addElement ('html','<div class="sub-form">');
     foreach ($specific_fields as $specific_field) {
         $form -> addElement ('text', $specific_field['code'], $specific_field['name'].' : ');
     }
-    $form -> addElement ('html','</div>');     
+    $form -> addElement ('html','</div>');
 }
 
 /*

+ 1 - 1
main/user/class.php

@@ -33,7 +33,7 @@
 		INIT SECTION
 ==============================================================================
 */
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = array('registration','admin');
 include ('../inc/global.inc.php');
 $this_section = SECTION_COURSES;

+ 1 - 1
main/user/subscribe_class.php

@@ -32,7 +32,7 @@
 		INIT SECTION
 ==============================================================================
 */
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = array('registration','admin');
 include ('../inc/global.inc.php');
 $this_section = SECTION_COURSES;

+ 94 - 94
main/user/subscribe_user.php

@@ -1,39 +1,39 @@
 <?php // $Id: subscribe_user.php 20412 2009-05-08 16:09:34Z herodoto $
 /*
-============================================================================== 
+==============================================================================
 	Dokeos - elearning and course management software
-	
+
 	Copyright (c) 2004-2009 Dokeos SPRL
 	Copyright (c) 2003 Ghent University (UGent)
-	
+
 	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, rue Notre Dame, 152, B-1140 Evere, Belgium, info@dokeos.com
 ==============================================================================
 */
 
 /**
-============================================================================== 
+==============================================================================
 *	This script allows teachers to subscribe existing users
 *	to their course.
 *
 *	@package dokeos.user
-============================================================================== 
+==============================================================================
 */
 /*
-============================================================================== 
+==============================================================================
 		INIT SECTION
-============================================================================== 
+==============================================================================
 */
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file = array('registration','admin');
 include ("../inc/global.inc.php");
 $this_section = SECTION_COURSES;
@@ -45,9 +45,9 @@ require_once (api_get_path(LIBRARY_PATH).'sortabletable.class.php');
 require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
 
 /*
-============================================================================== 
+==============================================================================
 		MAIN CODE
-============================================================================== 
+==============================================================================
 */
 
 /*
@@ -74,97 +74,97 @@ Display :: display_header($tool_name, "User");
 // api_display_tool_title($tool_name);
 
 /*
-============================================================================== 
+==============================================================================
 		MAIN SECTION
-============================================================================== 
+==============================================================================
 */
 
 $list_register_user='';
 $list_not_register_user='';
 
 if (isset ($_REQUEST['register'])) {
-	if (isset($_REQUEST['type']) && $_REQUEST['type']=='teacher') {		
-		$result_simple_sub=CourseManager :: subscribe_user(Database::escape_string($_REQUEST['user_id']), $_course['sysCode'],COURSEMANAGER);	
-	} else {		
+	if (isset($_REQUEST['type']) && $_REQUEST['type']=='teacher') {
+		$result_simple_sub=CourseManager :: subscribe_user(Database::escape_string($_REQUEST['user_id']), $_course['sysCode'],COURSEMANAGER);
+	} else {
 		$result_simple_sub=CourseManager :: subscribe_user(Database::escape_string($_REQUEST['user_id']), $_course['sysCode']);
 	}
-	
+
 	$user_id_temp=$_SESSION['session_user_id'];
 
 	if (is_array($user_id_temp)) {
 		$counter = count($user_id_temp);
 		for ($j=0; $j<$counter;$j++) {
-			if 	($user_id_temp[$j]==$_GET['user_id']) {	
+			if 	($user_id_temp[$j]==$_GET['user_id']) {
 				if ($result_simple_sub)	{
 					Display::display_confirmation_message($_SESSION['session_user_name'][$j].' '.get_lang('langAddedToCourse'));
-				} else {			
+				} else {
 					Display::display_error_message($_SESSION['session_user_name'][$j].' '.get_lang('langNotAddedToCourse'));
-					
+
 				}
 			}
 		}
 		unset($_SESSION['session_user_id']);
-		unset($_SESSION['session_user_name']);	
+		unset($_SESSION['session_user_name']);
 	}
 }
 
 if (isset ($_POST['action'])) {
 	switch ($_POST['action']) {
 		case 'subscribe' :
-				
+
 			if (is_array($_POST['user'])) {
-				foreach ($_POST['user'] as $index => $user_id) {	
-					$user_id=Database::escape_string($user_id);	
-					if(isset($_REQUEST['type']) && $_REQUEST['type']=='teacher') {			
+				foreach ($_POST['user'] as $index => $user_id) {
+					$user_id=Database::escape_string($user_id);
+					if(isset($_REQUEST['type']) && $_REQUEST['type']=='teacher') {
 						$is_suscribe[]=CourseManager :: subscribe_user($user_id, $_course['sysCode'],COURSEMANAGER);
 					} else {
 						$is_suscribe[]=CourseManager :: subscribe_user($user_id, $_course['sysCode']);
-					}										
-						$is_suscribe_user_id[]=$user_id;					
+					}
+						$is_suscribe_user_id[]=$user_id;
 				}
 			}
-			
+
 			$user_id_temp=$_SESSION['session_user_id'];
 			$user_name_temp=$_SESSION['session_user_name'];
-				
+
 			unset($_SESSION['session_user_id']);
  			unset($_SESSION['session_user_name']);
 			$counter=0;
 			$$is_suscribe_counter=count($is_suscribe_user_id);
-			
+
 			$list_register_user='';
-			
-			//if ($$is_suscribe_counter!=1) {			
+
+			//if ($$is_suscribe_counter!=1) {
 				for ($i=0; $i<$$is_suscribe_counter;$i++) {
 					for ($j=0; $j<count($user_id_temp);$j++) {
 						if ($is_suscribe_user_id[$i]==$user_id_temp[$j]) {
-								if ($is_suscribe[$i]) {										
-									$list_register_user.=" - ".$user_name_temp[$j].'<br/>';								
-									$temp_unique_user=$user_name_temp[$j];								
+								if ($is_suscribe[$i]) {
+									$list_register_user.=" - ".$user_name_temp[$j].'<br/>';
+									$temp_unique_user=$user_name_temp[$j];
 									$counter++;
 								} else {
-									$list_not_register_user.=" - ".$user_name_temp[$j].'<br/>';							
-								}													
+									$list_not_register_user.=" - ".$user_name_temp[$j].'<br/>';
+								}
 						}
 					}
 				}
-			//} else {			
-				//$list_register_user=$temp_unique_user; // only 1 user register 
+			//} else {
+				//$list_register_user=$temp_unique_user; // only 1 user register
 			//}
-				
+
 			if (!empty($list_register_user)) {
 				if ($$is_suscribe_counter==1) {
 					$register_user_message=$temp_unique_user.' '.get_lang('langAddedToCourse');
-					Display::display_confirmation_message($register_user_message,false);				
+					Display::display_confirmation_message($register_user_message,false);
 				} else {
 					$register_user_message='<br />'.get_lang('UsersRegistered').'<br/><br />'.$list_register_user;
-					Display::display_confirmation_message($register_user_message,false);								
-				}				
+					Display::display_confirmation_message($register_user_message,false);
+				}
 			}
-						
+
 			if (!empty($list_not_register_user)) {
-				$not_register_user_message='<br />'.get_lang('UsersNotRegistered').'<br/><br /><br />'.$list_not_register_user;			
-				Display::display_error_message($not_register_user_message,false); 
+				$not_register_user_message='<br />'.get_lang('UsersNotRegistered').'<br/><br /><br />'.$list_not_register_user;
+				Display::display_error_message($not_register_user_message,false);
 			}
 			break;
 	}
@@ -174,9 +174,9 @@ if (!empty($_SESSION['session_user_id'])) {
 	unset($_SESSION['session_user_id']);
 }
 
-if (!empty($_SESSION['session_user_name'])) {	
+if (!empty($_SESSION['session_user_name'])) {
 	unset($_SESSION['session_user_name']);
-}	
+}
 
 /*
 -----------------------------------------------------------
@@ -191,54 +191,54 @@ function get_number_of_users() {
 	$user_table = Database :: get_main_table(TABLE_MAIN_USER);
 	$course_user_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
 	if (isset($_REQUEST['type']) && $_REQUEST['type']=='teacher') {
-		$sql = "SELECT 	u.user_id  
+		$sql = "SELECT 	u.user_id
 						FROM $user_table u
 						LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'
 						WHERE cu.user_id IS NULL";
-						
+
 		global $_configuration;
 		if ($_configuration['multiple_access_urls']==true) {
 			$url_access_id = api_get_current_access_url_id();
 			if ($url_access_id !=-1) {
 				$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
-						
-				$sql = "SELECT 
-					u.user_id  
+
+				$sql = "SELECT
+					u.user_id
 					FROM $user_table u
 					LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'
-					INNER JOIN  $tbl_url_rel_user as url_rel_user 
-					ON (url_rel_user.user_id = u.user_id) 
-					WHERE cu.user_id IS NULL AND access_url_id= $url_access_id ";				
-			}		
+					INNER JOIN  $tbl_url_rel_user as url_rel_user
+					ON (url_rel_user.user_id = u.user_id)
+					WHERE cu.user_id IS NULL AND access_url_id= $url_access_id ";
+			}
 		}
-				
+
 	} else {
-		$sql = "SELECT 	u.user_id  
+		$sql = "SELECT 	u.user_id
 						FROM $user_table u
 						LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'
 						WHERE cu.user_id IS NULL";
-						
+
 		global $_configuration;
 		if ($_configuration['multiple_access_urls']==true) {
 			$url_access_id = api_get_current_access_url_id();
 			if ($url_access_id !=-1) {
 				$tbl_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
-						
-				$sql = "SELECT 
-					u.user_id  
+
+				$sql = "SELECT
+					u.user_id
 					FROM $user_table u
 					LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'
-					INNER JOIN  $tbl_url_rel_user as url_rel_user 
-					ON (url_rel_user.user_id = u.user_id) 
-					WHERE cu.user_id IS NULL AND access_url_id= $url_access_id ";				
-			}		
+					INNER JOIN  $tbl_url_rel_user as url_rel_user
+					ON (url_rel_user.user_id = u.user_id)
+					WHERE cu.user_id IS NULL AND access_url_id= $url_access_id ";
+			}
 		}
-		
-		
-		
-		
+
+
+
+
 	}
-	
+
 	if (isset ($_REQUEST['keyword'])) {
 		$keyword = Database::escape_string($_REQUEST['keyword']);
 		$sql .= " AND (firstname LIKE '%".$keyword."%' OR lastname LIKE '%".$keyword."%'   OR email LIKE '%".$keyword."%'  OR username LIKE '%".$keyword."%'  OR official_code LIKE '%".$keyword."%')";
@@ -264,14 +264,14 @@ function get_user_data($from, $number_of_items, $column, $direction) {
 					? "u.firstname AS col2,
 					u.lastname AS col3,"
 					: "u.lastname AS col2,
-					u.firstname AS col3,")." 
+					u.firstname AS col3,")."
 					u.email 	AS col4,
 					u.active 	AS col5,
 					u.user_id   AS col6
 					FROM $user_table u
 					LEFT JOIN $tbl_session_rel_course_user cu on u.user_id = cu.id_user and course_code='".$_SESSION['_course']['id']."'
-					WHERE cu.id_user IS NULL";	
-		} else {	
+					WHERE cu.id_user IS NULL";
+		} else {
 			$sql = "SELECT
 					u.user_id AS col0,
 					u.official_code AS col1,
@@ -305,11 +305,11 @@ function get_user_data($from, $number_of_items, $column, $direction) {
 						u.user_id   AS col6
 						FROM $user_table u
 						LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'
-						INNER JOIN  $tbl_url_rel_user as url_rel_user 
-						ON (url_rel_user.user_id = u.user_id) 
-						WHERE cu.user_id IS NULL AND access_url_id= $url_access_id ";				
-					}		
-				}	
+						INNER JOIN  $tbl_url_rel_user as url_rel_user
+						ON (url_rel_user.user_id = u.user_id)
+						WHERE cu.user_id IS NULL AND access_url_id= $url_access_id ";
+					}
+				}
 		}
 	} else {
 		if (!empty($_SESSION["id_session"])) {
@@ -362,10 +362,10 @@ function get_user_data($from, $number_of_items, $column, $direction) {
 					u.user_id   AS col6
 					FROM $user_table u
 					LEFT JOIN $course_user_table cu on u.user_id = cu.user_id and course_code='".$_SESSION['_course']['id']."'
-					INNER JOIN  $tbl_url_rel_user as url_rel_user 
-					ON (url_rel_user.user_id = u.user_id) 
-					WHERE cu.user_id IS NULL AND access_url_id= $url_access_id ";				
-				}		
+					INNER JOIN  $tbl_url_rel_user as url_rel_user
+					ON (url_rel_user.user_id = u.user_id)
+					WHERE cu.user_id IS NULL AND access_url_id= $url_access_id ";
+				}
 			}
 		}
 	}
@@ -398,7 +398,7 @@ function email_filter($email) {
 }
 /**
  * Build the reg-column of the table
- * @param int $user_id The user id 
+ * @param int $user_id The user id
  * @return string Some HTML-code
  */
 function reg_filter($user_id) {
@@ -417,14 +417,14 @@ function reg_filter($user_id) {
  * @param string $url_params
  * @return string Some HTML-code with the lock/unlock button
  */
- 
+
 function active_filter($active, $url_params, $row) {
 	global $_user;
 	if ($active=='1') {
 		$action='AccountActive';
 		$image='right';
 	}
-	
+
 	if ($active=='0') {
 		$action='AccountInactive';
 		$image='wrong';
@@ -460,7 +460,7 @@ echo '</div>';
 // Build table
 $table = new SortableTable('users', 'get_number_of_users', 'get_user_data', ($is_western_name_order xor $sort_by_first_name) ? 3 : 2);
 $parameters['keyword'] = $_REQUEST['keyword'];
-$parameters ['type'] = $_REQUEST['type']; 
+$parameters ['type'] = $_REQUEST['type'];
 $table->set_additional_parameters($parameters);
 $col = 0;
 $table->set_header($col ++, '', false);
@@ -482,15 +482,15 @@ $table->set_form_actions(array ('subscribe' => get_lang('reg')), 'user');
 
 if (!empty($_POST['keyword'])) {
 	$keyword_name=Security::remove_XSS($_POST['keyword']);
-	echo '<br/>'.get_lang('SearchResultsFor').' <span style="font-style: italic ;"> '.$keyword_name.' </span><br>';	
+	echo '<br/>'.get_lang('SearchResultsFor').' <span style="font-style: italic ;"> '.$keyword_name.' </span><br>';
 }
 
 // Display table
 $table->display();
 
 /*
-============================================================================== 
-		FOOTER 
-============================================================================== 
+==============================================================================
+		FOOTER
+==============================================================================
 */
 Display :: display_footer();

+ 9 - 9
main/user/user.php

@@ -117,7 +117,7 @@ if (api_is_allowed_to_edit()) {
 					}
 				}
 
-				if ($session_id == 0) {					
+				if ($session_id == 0) {
 					// users directly subscribed to the course
 					$table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
 					$sql_query = "SELECT DISTINCT user.user_id, ".($is_western_name_order ? "user.firstname, user.lastname" : "user.lastname, user.firstname").", user.email, user.official_code
@@ -159,7 +159,7 @@ if (api_is_allowed_to_edit()) {
 
 			$result = Database::query($sql, __FILE__ ,__LINE__);
 			$row = Database::fetch_array($result, 'ASSOC');
-			if ($row['user_id'] == $user_id || $row['user_id'] == "") {	
+			if ($row['user_id'] == $user_id || $row['user_id'] == "") {
 				CourseManager::unsubscribe_user($_GET['user_id'], $_SESSION['_course']['sysCode']);
 				$message = get_lang('UserUnsubscribed');
 			} else {
@@ -305,7 +305,7 @@ Display::display_introduction_section(TOOL_USER, 'left');
 
 if ( api_is_allowed_to_edit()) {
 	echo "<div class=\"actions\">";
-	
+
 	// the action links
 	$actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&amp;type=csv">'.Display::return_icon('csv.gif', get_lang('ExportAsCSV')).'&nbsp;'.get_lang('ExportAsCSV').'</a> ';
 	$actions .= '<a href="subscribe_user.php?'.api_get_cidreq().'">'.Display::return_icon('add_user_big.gif',get_lang("SubscribeUserToCourse")).'&nbsp;'.get_lang("SubscribeUserToCourse").'</a> ';
@@ -389,7 +389,7 @@ function search_keyword($firstname, $lastname, $username, $official_code, $keywo
  * Get the users to display on the current page.
  */
 function get_user_data($from, $number_of_items, $column, $direction) {
-	
+
 	global $origin;
 	global $is_western_name_order;
 	global $sort_by_first_name;
@@ -437,7 +437,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
 
 	if (!empty($_SESSION["id_session"])) {
 		$a_course_users = CourseManager :: get_user_list_from_course_code($_SESSION['_course']['id'], true, $_SESSION['id_session'], $limit, $order_by);
-	} else {		
+	} else {
 		$a_course_users = CourseManager :: get_user_list_from_course_code($_SESSION['_course']['id'], false, 0, $limit, $order_by);
 	}
 
@@ -450,7 +450,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
 				$temp = array();
 
 				$temp[] = $user_id;
-				$image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);				
+				$image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);
 				$user_profile = UserManager::get_picture_user($user_id, $image_path['file'], 22, 'small_', ' width="22" height="22" ');
 				if (!api_is_anonymous()) {
 					$photo = '<center><a href="userInfo.php?'.api_get_cidreq().'&origin='.$origin.'&amp;uInfo='.$user_id.'" title="'.get_lang('Info').'"  ><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'"  title="'.api_get_person_name($o_course_user['firstname'], $o_course_user['lastname']).'" /></a></center>';
@@ -489,7 +489,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
 			} else {
 				$temp = array();
 
-				$image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);				
+				$image_path = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);
 				$image_repository = $image_path['dir'];
 				$existing_image = $image_path['file'];
 				if (!api_is_anonymous()) {
@@ -511,7 +511,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
 				$temp[] = $o_course_user['official_code'];
 				if (api_is_allowed_to_edit()) {
 					$temp[] = $user_id;
-				}				
+				}
 			}
 			$a_users[$user_id] = $temp;
 		}
@@ -539,7 +539,7 @@ function active_filter($active, $url_params, $row) {
 		$action='AccountInactive';
 		$image='wrong';
 	}
-	if ($row['0']<>$_user['user_id']) {  // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore. 
+	if ($row['0']<>$_user['user_id']) {  // you cannot lock yourself out otherwise you could disable all the accounts including your own => everybody is locked out and nobody can change it anymore.
 		$result = '<center><img src="../img/'.$image.'.gif" border="0" style="vertical-align: middle;" alt="'.get_lang(ucfirst($action)).'" title="'.get_lang(ucfirst($action)).'"/></center>';
 	}
 	return $result;

+ 58 - 58
main/user/userInfo.php

@@ -50,17 +50,17 @@ require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'
 require_once (api_get_path(LIBRARY_PATH).'usermanager.lib.php');
 
 $htmlHeadXtra[] = '<script type="text/javascript">
-				
+
 function show_image(image,width,height) {
 	width = parseInt(width) + 20;
-	height = parseInt(height) + 20;			
-	window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \'\');		
+	height = parseInt(height) + 20;
+	window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \'\');
 }
-				
+
 </script>';
 
 $editMainUserInfo = Security::remove_XSS($_REQUEST['editMainUserInfo']);
-$uInfo = $editMainUserInfo; 
+$uInfo = $editMainUserInfo;
 $this_section = SECTION_COURSES;
 
 $nameTools = get_lang('Users');
@@ -100,7 +100,7 @@ $currentCourse = $currentCourseID;
 
 //$userIdViewed = $uInfo; // Id of the user we want to view coming from the user.php
 
-//get information about one user 
+//get information about one user
 $userIdViewed = Security::remove_XSS($_REQUEST['uInfo']);
 
 /*
@@ -136,9 +136,9 @@ include ("userInfoLib.php");
 */
 
 $displayMode = "viewContentList";
-$removeDef =  Security::remove_XSS($_GET['removeDef']); 
-$editDef = Security::remove_XSS($_GET['editDef']); 
-$moveUpDef = Security::remove_XSS($_GET['moveUpDef']); 
+$removeDef =  Security::remove_XSS($_GET['removeDef']);
+$editDef = Security::remove_XSS($_GET['editDef']);
+$moveUpDef = Security::remove_XSS($_GET['moveUpDef']);
 $moveDownDef = Security::remove_XSS($_GET['moveDownDef']);
 
 if ($allowedToEditDef)
@@ -189,24 +189,24 @@ if ($allowedToEditDef)
 		$displayMode = "viewMainInfoEdit";
 	}
 	elseif (!empty($_REQUEST['submitMainUserInfo']))
-	{	
+	{
 		/*
 		if (isset ($_REQUEST['submitMainUserInfo']))
 		{
 		*/
 			$userIdViewed = strval(intval($_REQUEST['submitMainUserInfo']));
-			
+
 			/*
-			//is teacher		
-			$promoteCourseAdmin=$_REQUEST['promoteCourseAdmin'];			
-			$userProperties['status'] = 5; 	
+			//is teacher
+			$promoteCourseAdmin=$_REQUEST['promoteCourseAdmin'];
+			$userProperties['status'] = 5;
 			if ($promoteCourseAdmin)
 			{
 				$userProperties['status'] = 1;
-			}				 	
-			
+			}
+
 			// deprecated feature
-			 
+
 			// is coach
 			if (isset ($_REQUEST['promoteTutor']))
 			{
@@ -215,35 +215,35 @@ if ($allowedToEditDef)
 				if ($promoteTutor)
 				{
 					$userProperties['tutor'] = 1;
-				}							
+				}
 			}
-			
+
 			// role is a string
 			if (isset ($_REQUEST['role']))
 			{
-				$role=$_REQUEST['role'];	 
+				$role=$_REQUEST['role'];
 				$userProperties['role'] = $role;
-			}	  		
+			}
 			*/
-			
-			//get information about one user - task #3009  
-      
+
+			//get information about one user - task #3009
+
 			if(!empty($_POST['promoteCourseAdmin']) && $_POST['promoteCourseAdmin']){
 				$userProperties['status'] = 1;
 			}else{
 				$userProperties['status'] = 5;
-			}		
-				
+			}
+
 			if(!empty($_POST['promoteTutor']) && $_POST['promoteTutor']){
 				$userProperties['tutor'] = 1;
 			}else{
 				$userProperties['tutor'] = 0;
 			}
-			
-			$userProperties['role'] = $_POST['role']; 
-				  
+
+			$userProperties['role'] = $_POST['role'];
+
 			update_user_course_properties($userIdViewed, $courseCode, $userProperties);
-			
+
 			$displayMode = "viewContentList";
 	}
 }
@@ -253,23 +253,23 @@ if ($allowedToEditDef)
 if ($allowedToEditContent)
 {
 	if (isset($_POST['submitContent']))
-	{		
+	{
 		if ($_POST['cntId']) // submit a content change
 		{
 			edit_cat_content($_POST['catId'], $userIdViewed, $_POST['content'], $_SERVER['REMOTE_ADDR']);
-	
+
 		}
 		else // submit a totally new content
 		{
 			fill_new_cat_content($_POST['catId'], $userIdViewed, $_POST['content'], $_SERVER['REMOTE_ADDR']);
-	
+
 		}
 
 		$displayMode = "viewContentList";
 	}
 	elseif (!empty($_GET['editContent']))
 	{
-		$displayMode = "viewContentEdit";	
+		$displayMode = "viewContentEdit";
 		$userIdViewed = $userIdViewed;
 	}
 }
@@ -283,7 +283,7 @@ if ($allowedToEditContent)
 echo '<div class="actions">';
 echo '<a href="user.php?'.api_get_cidreq().'&amp;origin='.$origin.'">'.Display::return_icon('back.png',get_lang('BackUser')).get_lang('BackUser').'</a>';
 if (api_is_allowed_to_edit()) {
-	if (!is_numeric($_GET['editMainUserInfo'])) {	
+	if (!is_numeric($_GET['editMainUserInfo'])) {
 		echo '<a href="userInfo.php?'.api_get_cidreq().'&amp;origin='.$origin.'&amp;editMainUserInfo='.$userIdViewed.'">'.Display::return_icon('edit.gif',get_lang('EditUser')).get_lang('EditUser').'</a>';
 	} else {
 		echo '<a href="userInfo.php?'.api_get_cidreq().'&amp;origin='.$origin.'&amp;uInfo='.$userIdViewed.'">'.Display::return_icon('members.gif',get_lang('ViewUser')).get_lang('ViewUser').'</a>';
@@ -387,29 +387,29 @@ elseif ($displayMode == "viewMainInfoEdit")
 	{
 		($mainUserInfo['status'] == 1) ? $courseAdminChecked = "checked" : $courseAdminChecked = "";
 		($mainUserInfo['tutor_id'] == 1) ? $tutorChecked = "checked" : $tutorChecked = "";
-				
-		$image_array=UserManager::get_user_picture_path_by_id($userIdViewed,'web',false,true);			
+
+		$image_array=UserManager::get_user_picture_path_by_id($userIdViewed,'web',false,true);
 		// get the path,width and height from original picture
 		$big_image = $image_array['dir'].'big_'.$image_array['file'];
 		$big_image_size = api_getimagesize($big_image);
 		$big_image_width= $big_image_size[0];
 		$big_image_height= $big_image_size[1];
 		$url_big_image = $big_image.'?rnd='.time();
-		
+
 		if ($image_array['file']=='unknown.jpg') {
 		echo '<img src="'.$image_array['dir'].$image_array['file'].'" border="1">';
 		} else {
 		echo '<input type="image" src="'.$image_array['dir'].$image_array['file'].'" onclick="return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>';
-		}						
-		 
+		}
+
 		//"<td>", get_lang('Tutor'), "</td>\n",
 		echo "<form action=\"".api_get_self()."\" method=\"post\">\n",
 				"<input type=\"hidden\" name=\"submitMainUserInfo\" value=\"$userIdViewed\" />\n",
 				"<table width=\"80%\" border=\"0\">",
 					"<tr align=\"center\" bgcolor=\"#E6E6E6\">\n",
 						"<td align=\"left\">", get_lang('Name'), "</td>\n",
-						"<td width=\"100px\" align=\"left\">", get_lang('Description'), "</td>\n",	
-						"<td>", get_lang('Tutor'), "</td>\n",					
+						"<td width=\"100px\" align=\"left\">", get_lang('Description'), "</td>\n",
+						"<td>", get_lang('Tutor'), "</td>\n",
 						"<td>", get_lang('CourseManager'), "</td>\n",
 					"</tr>\n",
 					"<tr align=\"center\">",
@@ -430,7 +430,7 @@ elseif ($displayMode == "viewMainInfoEdit")
 		echo "<td><button class=\"save\" type=\"submit\" name=\"submit\">".get_lang('SaveChanges')."</button></td>\n", "</tr>", "</table>", "</form>\n";
 
 		echo "<p>".Display :: encrypted_mailto_link($mainUserInfo['email'], $mainUserInfo['email'])."</p>";
-		
+
 				if (api_get_setting('extended_profile') == 'true')
 				{
 					echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyCompetences').'</strong></div><div>'.$mainUserInfo['competences'].'</div>';
@@ -457,36 +457,36 @@ elseif ($displayMode == "viewContentList") // default display
 		//not supported yet: editing users of virtual courses
 		$allowedToEditDef = false;
 	}
-	
+
 	$mainUserInfo = get_main_user_info($userIdViewed, $courseCode);
-	
+
 	if ($mainUserInfo)
-	{		
-		$image_array=UserManager::get_user_picture_path_by_id($userIdViewed,'web',false,true);	
+	{
+		$image_array=UserManager::get_user_picture_path_by_id($userIdViewed,'web',false,true);
 		// get the path,width and height from original picture
 		$big_image = $image_array['dir'].'big_'.$image_array['file'];
 		$big_image_size = api_getimagesize($big_image);
 		$big_image_width= $big_image_size[0];
 		$big_image_height= $big_image_size[1];
 		$url_big_image = $big_image.'?rnd='.time();
-		
+
 		if ($image_array['file']=='unknown.jpg') {
 		echo '<img src="'.$image_array['dir'].$image_array['file'].'" border="1">';
 		} else {
 		echo '<input type="image" src="'.$image_array['dir'].$image_array['file'].'" onclick="return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>';
-		}		
-		
-		
+		}
+
+
 		//DISPLAY TABLE HEADING
 		if ($origin == 'learnpath') { $allowedToEditDef=false; $is_allowedToTrack=false; }
-		
+
 				//"<td>",get_lang('Tutor'),"</td>\n",
 		echo	"<table width=\"80%\" border=\"0\">",
 
 				"<tr align=\"center\" bgcolor=\"#E6E6E6\">\n",
 				"<td align=\"left\">",get_lang('Name'),"</td>\n",
 				"<td width=\"100px\" align=\"left\">",get_lang('Description'),"</td>\n",
-				"<td>",get_lang('Tutor'),"</td>\n",				
+				"<td>",get_lang('Tutor'),"</td>\n",
 				"<td>",get_lang('CourseManager'),"</td>\n",
 				($allowedToEditDef?"<td>".get_lang('Edit')."</td>\n":""),
                 ($is_allowedToTrack?"<td>".get_lang('Tracking')."</td>\n":""),
@@ -498,7 +498,7 @@ elseif ($displayMode == "viewContentList") // default display
 				"<td  align=\"left\">",htmlize($mainUserInfo['role']),"</td>";
 
 				//DISPLAY TABLE CONTENT
-				
+
 				// deprecated feature
 				if ($mainUserInfo['tutor_id'] == 1)
 				{
@@ -507,7 +507,7 @@ elseif ($displayMode == "viewContentList") // default display
 				else
 				{
 					echo "<td> - </td>\n";
-				}				
+				}
 
 				if ($mainUserInfo['status'] == 1)
 				{
@@ -537,9 +537,9 @@ elseif ($displayMode == "viewContentList") // default display
 				echo "</tr>",
 				"</table>";
 				//"<p><a href=\"mailto:",$mainUserInfo['email'],"\">",$mainUserInfo['email'],"</a>",
-				
+
 				if (api_get_setting("show_email_addresses") == "true")
-				{				
+				{
 					echo "<p>". Display::encrypted_mailto_link($mainUserInfo['email'],$mainUserInfo['email']). "</p>";
 				}
 				else
@@ -549,7 +549,7 @@ elseif ($displayMode == "viewContentList") // default display
 						echo "<p>". Display::encrypted_mailto_link($mainUserInfo['email'],$mainUserInfo['email']). "</p>";
 					}
 				}
-								
+
 				if (api_get_setting('extended_profile') == 'true')
 				{
 					echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyCompetences').'</strong></div><div>'.$mainUserInfo['competences'].'</div>';

+ 16 - 16
main/user/userInfoLib.php

@@ -1,29 +1,29 @@
 <?php
 /*
-============================================================================== 
+==============================================================================
 	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.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 /**
-============================================================================== 
+==============================================================================
 *	@package dokeos.user
-============================================================================== 
+==============================================================================
 */
 
 
@@ -262,15 +262,15 @@ function update_user_course_properties($user_id, $course_code, $properties)
     {
     	$sqlChangeStatus = "status     = '".Database::escape_string($properties['status'])."',";
     }
-    
+
     	//feature deprecated   tutor_id      	= '".Database::escape_string($properties['tutor'])."'
     	$sql = "UPDATE $tbl_coursUser
-    					SET 	".$sqlChangeStatus."	           
+    					SET 	".$sqlChangeStatus."
 	                    role      		= '".Database::escape_string($properties['role'])."',
-	                    tutor_id      	= '".Database::escape_string($properties['tutor'])."' 	                                                     
+	                    tutor_id      	= '".Database::escape_string($properties['tutor'])."'
 	                    WHERE   user_id	    	= '".$user_id."'
 	                    AND     course_code		= '".$course_code."'";
-	                        
+
 	$result = api_sql_query($sql,__FILE__,__LINE__);
 
 	if (mysql_affected_rows() > 0)
@@ -480,7 +480,7 @@ function get_course_user_info($user_id)
 function get_main_user_info($user_id, $courseCode)
 {
 	$user_id 	= strval(intval($user_id));
-	$courseCode = Database::escape_string($courseCode); 
+	$courseCode = Database::escape_string($courseCode);
 	if (0 == $user_id)
 	{
 		return false;
@@ -489,8 +489,8 @@ function get_main_user_info($user_id, $courseCode)
 
 	$table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
 	$table_user = Database::get_main_table(TABLE_MAIN_USER);
-	$sql = "SELECT	u.*, u.lastname lastName, u.firstname firstName, 
-	                u.email, u.picture_uri picture, cu.role, 
+	$sql = "SELECT	u.*, u.lastname lastName, u.firstname firstName,
+	                u.email, u.picture_uri picture, cu.role,
 	                cu.status status, cu.tutor_id
 	        FROM    $table_user u, $table_course_user cu
 	        WHERE   u.user_id = cu.user_id

+ 15 - 15
main/user/user_add.php

@@ -1,39 +1,39 @@
 <?php
 /*
-============================================================================== 
+==============================================================================
 	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.
-	
+
 	See the GNU General Public License for more details.
-	
+
 	Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
-============================================================================== 
+==============================================================================
 */
 
 // TODO: Is this file deprecated?
 
 /**
-============================================================================== 
+==============================================================================
 *	@package dokeos.user
-============================================================================== 
+==============================================================================
 */
 
 /*==========================
             INIT
   ==========================*/
 
-// name of the language file that needs to be included 
+// name of the language file that needs to be included
 $language_file="registration";
 
 
@@ -143,7 +143,7 @@ if($register)
 		if ($_cid) $platformStatus = STUDENT;          // course registrartion context...
 		else       $platformStatus = $platformStatus; // admin section of the platform context...
 
-		//if ($userPasswordCrypted) $pw = md5($password_form);		
+		//if ($userPasswordCrypted) $pw = md5($password_form);
 		//else                      $pw = $password_form;
 		$pw = api_get_encrypted_password($password_form);
 		$result = api_sql_query("INSERT INTO $tbl_user
@@ -211,16 +211,16 @@ if($register)
 		$recipient_name = $firstname_form.' '.$lastname_form;
 		$sender_name = api_get_setting('administratorName').' '.api_get_setting('administratorSurname');
 	    $email_admin = api_get_setting('emailAdministrator');
-	    
+
 		$portal_url = $_configuration['root_web'];
 		if ($_configuration['multiple_access_urls']==true) {
-			$access_url_id = api_get_current_access_url_id();				
+			$access_url_id = api_get_current_access_url_id();
 			if ($access_url_id != -1 ){
 				$url = api_get_access_url($access_url_id);
 				$portal_url = $url['url'];
 			}
-		}					
-						
+		}
+
 		if ($courseRegSucceed)
 		{
 			$emailbody = get_lang('Dear')." ".stripslashes("$firstname_form $lastname_form").",\n".get_lang('OneResp')." $currentCourseName ".get_lang('RegYou')." ".api_get_setting('siteName')." ".get_lang('Settings')." $username_form\n".get_lang('Pass').": $password_form\n".get_lang('Address')." ".api_get_setting('siteName')." ".get_lang('Is').": ".$portal_url."\n".get_lang('Problem')."\n".get_lang('Formula').",\n".api_get_setting('administratorSurname')." ".api_get_setting('administratorName')."\n".get_lang('Manager')." ".api_get_setting('siteName')." \nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email').": ".api_get_setting('emailAdministrator')."\n";

+ 2 - 2
main/webservices/registration.soap.php

@@ -82,8 +82,8 @@ $server->wsdl->addComplexType(
 	'all',
 	'',
 	array(
-		'users' => array('name' => 'users', 'type' => 'tns:usersParamsList'),		
-		'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string')													
+		'users' => array('name' => 'users', 'type' => 'tns:usersParamsList'),
+		'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string')
 	)
 );
 

+ 43 - 43
main/wiki/diff.inc.php

@@ -1,7 +1,7 @@
 <?php // $Id: lib.diff.php,v 1.12 2005/11/18 20:25:11 zefredz Exp $
-     
+
     // vim: expandtab sw=4 ts=4 sts=4:
-     
+
     /**
      * CLAROLINE
      *
@@ -18,7 +18,7 @@
      *
      * @package Wiki
      */
-     
+
     define( "DIFF_EQUAL", "=" );
     define( "DIFF_ADDED", "+" );
     define( "DIFF_DELETED", "-" );
@@ -38,19 +38,19 @@
     {
         $oldArr = str_split_on_new_line( $old );
         $newArr = str_split_on_new_line( $new );
-         
+
         $oldCount = count ( $oldArr );
         $newCount = count ( $newArr );
-         
+
         $max = max( $oldCount, $newCount );
-         
+
         //get added and deleted lines
-         
+
         $deleted = array_diff_assoc( $oldArr, $newArr );
         $added = array_diff_assoc( $newArr, $oldArr );
-         
+
         $moved = array();
-         
+
         foreach ( $added as $key => $candidate )
         {
             foreach ( $deleted as $index => $content )
@@ -64,48 +64,48 @@
                 }
             }
         }
-         
+
         $output = '';
-         
+
         for ( $i = 0; $i < $max; $i++ )
         {
             // line changed
             if ( isset ( $deleted[$i] ) && isset( $added[$i] ) )
             {
                 $output .= $format_line_function( $i, DIFF_DELETED, $deleted[$i] );
-                $output .= $format_line_function( $i, DIFF_ADDED, $added[$i] );				
-			
+                $output .= $format_line_function( $i, DIFF_ADDED, $added[$i] );
+
             }
             // line deleted
             elseif ( isset ( $deleted[$i] ) && ! isset ( $added[$i] ) )
             {
                 $output .= $format_line_function( $i, DIFF_DELETED, $deleted[$i] );
-			
+
             }
             // line added
             elseif ( isset ( $added[$i] ) && ! isset ( $deleted[$i] ) )
             {
-                $output .= $format_line_function( $i, DIFF_ADDED, $added[$i] );		
-					
+                $output .= $format_line_function( $i, DIFF_ADDED, $added[$i] );
+
             }
             // line moved
             elseif ( isset ( $moved[$i] ) )
             {
                 $output .= $format_line_function( $i, DIFF_MOVED, $newArr[$i] );
-			
+
             }
             // line unchanged
             elseif ( $show_equals == true )
             {
                 $output .= $format_line_function( $i, DIFF_EQUAL, $newArr[$i] );
-			
+
             }
             else
             {
                 // skip
             }
         }
-        
+
         return $output;
     }
 
@@ -115,7 +115,7 @@
     function str_split_on_new_line( $str )
     {
         $content = array();
-         
+
         if ( strpos( $str, "\r\n" ) != false )
         {
             $content = explode("\r\n", $str );
@@ -132,7 +132,7 @@
         {
             $content[] = $str;
         }
-         
+
         return $content;
     }
 
@@ -162,12 +162,12 @@
             {
                // return $line. ' : ' . ' = <span class="diffEqual" >' . $value . '</span><br />' . "\n" ;
                 return '<span class="diffEqual" >' . $value . '</span><br />' . "\n" ; //juan carlos muestra solo color
-				
+
                 break;
             }
             case DIFF_MOVED:
             {
-                //return $line. ' : ' . ' M <span class="diffMoved" >' . $value . '</span><br />' . "\n" ; //juan carlos raña  la sustitye la inverior
+                //return $line. ' : ' . ' M <span class="diffMoved" >' . $value . '</span><br />' . "\n" ; //juan carlos ra�a  la sustitye la inverior
 				return '<span class="diffMoved" >' . $value . '</span><br />' . "\n" ; //juan carlos muestra solo color
 
                 break;
@@ -180,7 +180,7 @@
             }
             case DIFF_DELETED:
             {
-                //return $line . ' : ' . ' - <span class="diffDeleted" >' . $value . '</span><br />' . "\n" ; //juan carlos raña  la sustitye la inverior
+                //return $line . ' : ' . ' - <span class="diffDeleted" >' . $value . '</span><br />' . "\n" ; //juan carlos ra�a  la sustitye la inverior
                 return '<span class="diffDeleted" >' . $value . '</span><br />' . "\n" ; //juan carlos muestra solo color
                 break;
             }
@@ -201,43 +201,43 @@
         {
             $value = '&nbsp;';
         }
-         		 
+
         switch ( $type )
         {
             case DIFF_EQUAL:
             {
                 //return '<tr><td>' . $line. '&nbsp;:&nbsp;' . '&nbsp;=</td><td><span class="diffEqual" >'                    . $value . '</span></td></tr>' . "\n"; //juan carlos comentado
-				 	   return '<tr><td></td><td bgcolor="#FFFFFF">'. $value . '</td></tr>' . "\n" ; //juan carlos muestra solo color (no también la línea). Además EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que está definido en la hoja de estilos como background-color, aceptando sólo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, además los cambios de otros objetos que no sean texto no se indican por ej. añadir una imagen, por esta razón doy el color de fondo al td directamente.	
-                 
+				 	   return '<tr><td></td><td bgcolor="#FFFFFF">'. $value . '</td></tr>' . "\n" ; //juan carlos muestra solo color (no tambi�n la l�nea). Adem�s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est� definido en la hoja de estilos como background-color, aceptando s�lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem�s los cambios de otros objetos que no sean texto no se indican por ej. a�adir una imagen, por esta raz�n doy el color de fondo al td directamente.
+
                 break;
             }
             case DIFF_MOVED:
             {
                // return '<tr><td>' . $line. '&nbsp;:&nbsp;' . '&nbsp;M</td><td><span class="diffMoved" >'                    . $value . '</span></td></tr>' . "\n" //juan carlos comenta
                     ;
-				   return '<tr><td></td><td bgcolor="#FFFFAA">'. $value . '</td></tr>' . "\n" ; //juan carlos muestra solo color (no también la línea). Además EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que está definido en la hoja de estilos como background-color, aceptando sólo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, además los cambios de otros objetos que no sean texto no se indican por ej. añadir una imagen, por esta razón doy el color de fondo al td directamente.
-                 
+				   return '<tr><td></td><td bgcolor="#FFFFAA">'. $value . '</td></tr>' . "\n" ; //juan carlos muestra solo color (no tambi�n la l�nea). Adem�s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est� definido en la hoja de estilos como background-color, aceptando s�lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem�s los cambios de otros objetos que no sean texto no se indican por ej. a�adir una imagen, por esta raz�n doy el color de fondo al td directamente.
+
                 break;
             }
             case DIFF_ADDED:
             {
               // return '<tr><td>' . $line. '&nbsp;:&nbsp;' . '&nbsp;+</td><td><span class="diffAdded" >'                    . $value . '</span></td></tr>' . "\n" ; //juan carlos comentado
-                 return '<tr><td></td><td bgcolor="#CCFFCC">'. $value . '</td></tr>' . "\n" ; //juan carlos muestra solo color (no también la línea). Además EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que está definido en la hoja de estilos como background-color, aceptando sólo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, además los cambios de otros objetos que no sean texto no se indican por ej. añadir una imagen, por esta razón doy el color de fondo al td directamente.	
-				 
+                 return '<tr><td></td><td bgcolor="#CCFFCC">'. $value . '</td></tr>' . "\n" ; //juan carlos muestra solo color (no tambi�n la l�nea). Adem�s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est� definido en la hoja de estilos como background-color, aceptando s�lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem�s los cambios de otros objetos que no sean texto no se indican por ej. a�adir una imagen, por esta raz�n doy el color de fondo al td directamente.
+
                 break;
             }
             case DIFF_DELETED:
             {
                // return '<tr><td>' . $line. '&nbsp;:&nbsp;' . '&nbsp;-</td><td><span class="diffDeleted" >'                    . $value . '</span></td></tr>' . "\n" ; //juan carlos comentado
-                    return '<tr><td></td><td bgcolor="#FFAAAA">'. $value . '</td></tr>' . "\n" ; //juan carlos muestra solo color (no también la línea). Además EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que está definido en la hoja de estilos como background-color, aceptando sólo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, además los cambios de otros objetos que no sean texto no se indican por ej. añadir una imagen, por esta razón doy el color de fondo al td directamente.				
-		
+                    return '<tr><td></td><td bgcolor="#FFAAAA">'. $value . '</td></tr>' . "\n" ; //juan carlos muestra solo color (no tambi�n la l�nea). Adem�s EN IEXPLORER VA BIEN PERO EN FIREFOX 3 la etiqueta span no muestra el color de fondo que est� definido en la hoja de estilos como background-color, aceptando s�lo la propiedad color pero esta solo da color al texto con lo cual los cambios quedan poco resaltados, adem�s los cambios de otros objetos que no sean texto no se indican por ej. a�adir una imagen, por esta raz�n doy el color de fondo al td directamente.
+
             }
         }
     }
-	
-	
-	
-     
+
+
+
+
     if (! function_exists('array_diff_assoc') )
     {
         /**
@@ -258,7 +258,7 @@
                 trigger_error('Wrong parameter count for array_diff_assoc()', E_USER_WARNING );
                 return;
             }
-             
+
             // Check arrays
             for ($i = 0; $i < $count; $i++ )
             {
@@ -268,15 +268,15 @@
                     return;
                 }
             }
-             
+
             // Get the comparison array
             $array_comp = array_shift($args );
             --$count;
-             
+
             // Traverse values of the first array
             foreach ($array_comp as $key => $value )
             {
-			
+
                 // Loop through the other arrays
                 for ($i = 0; $i < $count; $i++ )
                 {
@@ -285,13 +285,13 @@
                     {
                         if ((string) $key === (string)$comp_key && (string) $value === (string) $comp_value )
                         {
-                             
+
                             unset($array_comp[$key] );
                         }
                     }
                 }
             }
-             
+
             return $array_comp;
         }
     }

+ 9 - 9
main/wiki/export_html2pdf.php

@@ -23,30 +23,30 @@
 /**
 *   Export html to pdf
 * 	@Author Juan Carlos Raña <herodoto@telefonica.net>
-* 	
+*
 */
 
- 
+
 include("../inc/global.inc.php");
 api_block_anonymous_users();
 
 require('../inc/lib/html2pdf/html2pdf.class.php');
 
-$contentPDF=stripslashes(api_html_entity_decode($_POST['contentPDF'], ENT_QUOTES, $charset)); 
-$titlePDF=stripslashes(api_html_entity_decode($_POST['titlePDF'], ENT_QUOTES, $charset)); 
+$contentPDF=stripslashes(api_html_entity_decode($_POST['contentPDF'], ENT_QUOTES, $charset));
+$titlePDF=stripslashes(api_html_entity_decode($_POST['titlePDF'], ENT_QUOTES, $charset));
 
 ob_start();//activate Output -Buffer
 ///////////////////////
 ?>
 <page backtop="10mm" backbottom="10mm" footer="page">
-      <page_header> 
+      <page_header>
            <?php echo $titlePDF.'<br/><hr/>'?>
-      </page_header> 
-      <page_footer> 
+      </page_header>
+      <page_footer>
             <?php echo '<hr/>'; ?>
-      </page_footer> 
+      </page_footer>
  </page>
- 
+
  <?php
 /////////////////////
 echo $contentPDF;

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 239 - 239
main/wiki/index.php


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 217 - 217
main/wiki/wiki.inc.php


+ 3 - 3
main/work/download.php

@@ -39,7 +39,7 @@ $doc_url = str_replace('///', '&', $doc_url);
 $doc_url = str_replace(' ', '+', $doc_url);
 $doc_url = str_replace('/..', '', $doc_url); //echo $doc_url;
 if (! isset($_course)) {
-	api_not_allowed(true);	
+	api_not_allowed(true);
 }
 
 $full_file_name = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.$doc_url;
@@ -48,12 +48,12 @@ $tbl_student_publication = Database::get_course_table(TABLE_STUDENT_PUBLICATION)
 // launch event
 event_download($doc_url);
 
-$sql='SELECT title FROM '.$tbl_student_publication.'   
+$sql='SELECT title FROM '.$tbl_student_publication.'
   	  WHERE url LIKE BINARY "'.$doc_url.'"';
 
 $result= api_sql_query($sql, __FILE__, __LINE__);
 $row= Database::fetch_array($result);
-$title = str_replace(' ','_', $row['title']); 
+$title = str_replace(' ','_', $row['title']);
 DocumentManager::file_send_for_download($full_file_name,TRUE, $title);
 
 exit;

+ 10 - 10
main/work/downloadfolder.inc.php

@@ -67,11 +67,11 @@ if (is_allowed_to_edit()) {
 		$querypath=$path;
 	}
 	//search for all files that are not deleted => visibility != 2
-	
+
 	$query = api_sql_query("SELECT url FROM $tbl_student_publication AS work,$prop_table AS props  WHERE props.tool='work' AND work.id=props.ref AND work.url LIKE 'work".$querypath."/%' AND work.filetype='file' AND props.visibility<>'2'",__FILE__,__LINE__);
 	//add tem to the zip file
-	while ($not_deleted_file = mysql_fetch_assoc($query)) {	//var_dump($sys_course_path.$_course['path']."/".$not_deleted_file['url']);exit();			
-		$zip_folder->add($sys_course_path.$_course['path']."/".$not_deleted_file['url'],PCLZIP_OPT_REMOVE_PATH, $sys_course_path.$_course['path']."/work".$remove_dir);			
+	while ($not_deleted_file = mysql_fetch_assoc($query)) {	//var_dump($sys_course_path.$_course['path']."/".$not_deleted_file['url']);exit();
+		$zip_folder->add($sys_course_path.$_course['path']."/".$not_deleted_file['url'],PCLZIP_OPT_REMOVE_PATH, $sys_course_path.$_course['path']."/work".$remove_dir);
 	}
 }
 
@@ -90,20 +90,20 @@ else
 	//add them to an array
 	$all_visible_files_path = array();
 	while ($all_visible_files = mysql_fetch_assoc($query)) {
-		$all_visible_files_path[] = $all_visible_files['url'];		
-	}	
+		$all_visible_files_path[] = $all_visible_files['url'];
+	}
 	//2nd: get all folders that are invisible in the given path
 	$query2 = api_sql_query("SELECT url FROM $tbl_student_publication AS work,$prop_table AS props  WHERE props.tool='work' AND work.id=props.ref AND work.url LIKE 'work".$querypath."/%' AND work.filetype='file' AND props.visibility<>'1' AND props.lastedit_user_id='".api_get_user_id()."'",__FILE__,__LINE__);
 	//if we get invisible folders, we have to filter out these results from all visible files we found
-	
+
 	if (Database::num_rows($query2)>0) {
 		//add tem to an array
 		while ($invisible_folders = mysql_fetch_assoc($query2)) {
-		//3rd: get all files that are in the found invisible folder (these are "invisible" too)		
+		//3rd: get all files that are in the found invisible folder (these are "invisible" too)
 			$query3 = api_sql_query("SELECT url FROM $tbl_student_publication AS work,$prop_table AS props  WHERE props.tool='work' AND work.id=props.ref AND work.url LIKE 'work".$invisible_folders['path']."/%' AND work.filetype='file' AND props.visibility='1' AND props.lastedit_user_id='".api_get_user_id()."'",__FILE__,__LINE__);
 			//add tem to an array
 			while ($files_in_invisible_folder = mysql_fetch_assoc($query3)) {
-				$files_in_invisible_folder_path[] = $files_in_invisible_folder['url'];				
+				$files_in_invisible_folder_path[] = $files_in_invisible_folder['url'];
 			}
 		}
 		//compare the array with visible files and the array with files in invisible folders
@@ -114,8 +114,8 @@ else
 		$files_for_zipfile = $all_visible_files_path;
 	}
 	//add all files in our final array to the zipfile
-	for ($i=0;$i<count($files_for_zipfile);$i++) {				
-		$zip_folder->add($sys_course_path.$_course['path']."/".$files_for_zipfile[$i],PCLZIP_OPT_REMOVE_PATH, $sys_course_path.$_course['path']."/work".$remove_dir);		
+	for ($i=0;$i<count($files_for_zipfile);$i++) {
+		$zip_folder->add($sys_course_path.$_course['path']."/".$files_for_zipfile[$i],PCLZIP_OPT_REMOVE_PATH, $sys_course_path.$_course['path']."/work".$remove_dir);
 	}
 }//end for other users
 //logging

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 233 - 233
main/work/work.lib.php


+ 229 - 229
main/work/work.php

@@ -256,7 +256,7 @@ if (!empty($_GET['gradebook']) && $_GET['gradebook']='view' ) {
 	$gradebook=	'';
 }
 
-if (!empty($gradebook) && $gradebook=='view') {	
+if (!empty($gradebook) && $gradebook=='view') {
 	$interbreadcrumb[] = array (
 		'url' => '../gradebook/' . $_SESSION['gradebook_dest'],
 		'name' => get_lang('Gradebook')
@@ -268,10 +268,10 @@ if (!empty($_SESSION['toolgroup'])){
 	$group_properties  = GroupManager :: get_group_properties($_clean['toolgroup']);
 	$interbreadcrumb[] = array ("url" => "../group/group.php", "name" => get_lang('Groups'));
 	$interbreadcrumb[] = array ("url"=>"../group/group_space.php?gidReq=".$_SESSION['toolgroup'], "name"=> get_lang('GroupSpace').' ('.$group_properties['name'].')');
-	
+
 	$url_dir ='';
 		$interbreadcrumb[] = array ('url' => $url_dir,'name' => get_lang('StudentPublications'));
-	
+
 		//if (!$display_tool_options  && !$display_upload_form)
 		//{
 		//------interbreadcrumb for the current directory root path
@@ -284,7 +284,7 @@ if (!empty($_SESSION['toolgroup'])){
 				'url' => $url_dir,
 				'name' => get_lang('HomeDirectory'));
 		}*/
-	
+
 		$dir_acum = '';
 		for ($i = 0; $i < $array_len; $i++) {
 			$url_dir = 'work.php?&curdirpath=' . $dir_acum . $dir_array[$i];
@@ -295,32 +295,32 @@ if (!empty($_SESSION['toolgroup'])){
 			$dir_acum .= $dir_array[$i] . '/';
 		}
 		//	}
-	
+
 		if ($display_upload_form) {
 			$interbreadcrumb[] = array (
 				"url" => "work.php",
 				"name" => get_lang('UploadADocument'));
 		}
-	
-		if ($display_tool_options) {		
+
+		if ($display_tool_options) {
 			$interbreadcrumb[] = array (
 				"url" => "work.php",
 				"name" => get_lang('EditToolOptions'));
 		}
-	
+
 		if ($_GET['createdir'] == 1)
 		{
 			$interbreadcrumb[] = array (
 				"url" => "work.php",
-				"name" => get_lang('CreateFolder'));			
+				"name" => get_lang('CreateFolder'));
 		}
-	
+
 	Display :: display_header(null);
-	
-	
+
+
 } else {
 
-	if (isset($origin) && $origin != 'learnpath') {	
+	if (isset($origin) && $origin != 'learnpath') {
 		$url_dir ='';
 		$interbreadcrumb[] = array ('url' => $url_dir.'?gradebook='.$gradebook,'name' => get_lang('StudentPublications'));
 		//if (!$display_tool_options  && !$display_upload_form)
@@ -328,14 +328,14 @@ if (!empty($_SESSION['toolgroup'])){
 		//------interbreadcrumb for the current directory root path
 		$dir_array = explode("/", $cur_dir_path);
 		$array_len = count($dir_array);
-	
+
 		/*if ($array_len > 0) {
 			$url_dir = 'work.php?gradebook='.$gradebook.'&curdirpath=/';
 			$interbreadcrumb[] = array (
 				'url' => $url_dir,
 				'name' => get_lang('HomeDirectory'));
 		}*/
-	
+
 		$dir_acum = '';
 		for ($i = 0; $i < $array_len; $i++) {
 			$url_dir = 'work.php?gradebook='.$gradebook.'&curdirpath=' . $dir_acum . $dir_array[$i];
@@ -346,14 +346,14 @@ if (!empty($_SESSION['toolgroup'])){
 			$dir_acum .= $dir_array[$i] . '/';
 		}
 		//	}
-	
+
 		if ($display_upload_form) {
 			$interbreadcrumb[] = array (
 				"url" => "work.php?gradebook=$gradebook",
 				"name" => get_lang('UploadADocument'));
 		}
-	
-		if ($display_tool_options) {		
+
+		if ($display_tool_options) {
 			$interbreadcrumb[] = array (
 				"url" => "work.php?gradebook=$gradebook",
 				"name" => get_lang('EditToolOptions'));
@@ -362,9 +362,9 @@ if (!empty($_SESSION['toolgroup'])){
 		{
 			$interbreadcrumb[] = array (
 				"url" => "work.php?gradebook=$gradebook",
-				"name" => get_lang('CreateDir'));			
-		}		
-		
+				"name" => get_lang('CreateDir'));
+		}
+
 		//--------------------------------------------------
 		Display :: display_header(null);
 	} else {
@@ -422,16 +422,16 @@ if (api_is_allowed_to_edit(false,true)) {
 			$queryString1 = "SELECT url FROM " . $work_table . "";
 			$queryString2 = "DELETE FROM  " . $work_table . "";
 			$queryString3 = "DELETE FROM  " . $TSTDPUBASG . "";
-						
+
 		} else {
 			$queryString1 = "SELECT url FROM  " . $work_table . "  WHERE id = '$delete'";
 			$queryString2 = "DELETE FROM  " . $work_table . "  WHERE id='$delete'";
-			$queryString3 = "DELETE FROM  " . $TSTDPUBASG . "  WHERE publication_id='$delete'";							
+			$queryString3 = "DELETE FROM  " . $TSTDPUBASG . "  WHERE publication_id='$delete'";
 		}
 
 		$result1 = api_sql_query($queryString1, __FILE__, __LINE__);
 		$result2 = api_sql_query($queryString2, __FILE__, __LINE__);
-		$result3 = api_sql_query($queryString3, __FILE__, __LINE__);	
+		$result3 = api_sql_query($queryString3, __FILE__, __LINE__);
 	}
 }
 
@@ -439,7 +439,7 @@ if (api_is_allowed_to_edit(false,true)) {
 	           EDIT COMMAND WORK COMMAND
 	  -----------------------------------------*/
 	$qualification_number=0;
-	if (!empty($edit)) {		
+	if (!empty($edit)) {
 		$sql = "SELECT * FROM  " . $work_table . "  WHERE id='" . $edit . "'";
 		$result = api_sql_query($sql, __FILE__, __LINE__);
 
@@ -468,7 +468,7 @@ if (api_is_allowed_to_edit(false,true)) {
 						        SET accepted = 0";
 
 			api_sql_query($sql, __FILE__, __LINE__);
-			
+
 			Display::display_confirmation_message(get_lang('AllFilesInvisible'));
 		} else {
 			$sql = "UPDATE  " . $work_table . "
@@ -476,16 +476,16 @@ if (api_is_allowed_to_edit(false,true)) {
 								WHERE id = '" . $make_invisible . "'";
 
 			api_sql_query($sql, __FILE__, __LINE__);
-			
+
 			Display::display_confirmation_message(get_lang('FileInvisible'));
-		}				
+		}
 	}
 
 	/*-------------------------------------------
 		MAKE VISIBLE WORK COMMAND
 	  -----------------------------------------*/
 
-	if (!empty($make_visible)) { 
+	if (!empty($make_visible)) {
 		if (isset($make_visible) && $make_visible == "all") {
 			$sql = "ALTER TABLE  " . $work_table . "
 						        CHANGE accepted accepted TINYINT(1) DEFAULT '1'";
@@ -500,56 +500,56 @@ if (api_is_allowed_to_edit(false,true)) {
 						        SET accepted = 1
 								WHERE id = '" . $make_visible . "'";
 			api_sql_query($sql, __FILE__, __LINE__);
-			
+
 			Display::display_confirmation_message(get_lang('FileVisible'));
 		}
-				
-		// update all the parents in the table item propery		
+
+		// update all the parents in the table item propery
 		$list_id=get_parent_directories($my_cur_dir_path);
 		for ($i = 0; $i < count($list_id); $i++) {
-			api_item_property_update($_course, 'work', $list_id[$i], 'FolderUpdated', $user_id);								
-		}			
+			api_item_property_update($_course, 'work', $list_id[$i], 'FolderUpdated', $user_id);
+		}
 	}
-	
+
 	/*--------------------
 	 * Create dir command
-	 ---------------------*/	 
+	 ---------------------*/
 	if (!empty ($_REQUEST['new_dir'])) {
 		function get_date_from_select($prefix) {
 				return $_POST[$prefix.'_year'].'-'.two_digits($_POST[$prefix.'_month']).'-'.two_digits($_POST[$prefix.'_day']).' '.two_digits($_POST[$prefix.'_hour']).':'.two_digits($_POST[$prefix.'_minute']).':00';
 		}
-		
+
 		$fexpire= get_date_from_select('expires');
 		$fend =  get_date_from_select('ends');
-		
+
 			include_once (api_get_path(LIBRARY_PATH) . "fileUpload.lib.php");
-			$added_slash = (substr($cur_dir_path, -1, 1) == '/') ? '' : '/';	
+			$added_slash = (substr($cur_dir_path, -1, 1) == '/') ? '' : '/';
 			$filter_directoy=Security::remove_XSS($_POST['new_dir']);
 			$directory =disable_dangerous_file($filter_directoy);
 			$directory =replace_accents($filter_directoy);
-			$dir_name = $cur_dir_path . $added_slash . replace_dangerous_char($directory);				
+			$dir_name = $cur_dir_path . $added_slash . replace_dangerous_char($directory);
 			$created_dir = create_unexisting_work_directory($base_work_dir, $dir_name);
-			
-			// we insert here the directory in the table $work_table		
-			$dir_name_sql=''; 
-			
+
+			// we insert here the directory in the table $work_table
+			$dir_name_sql='';
+
 			if ($ctok==$_POST['sec_token']) {
-				if (!empty($created_dir)) {			
-					if ($cur_dir_path=='/') {			
+				if (!empty($created_dir)) {
+					if ($cur_dir_path=='/') {
 						$dir_name_sql = $created_dir;
 					} else {
-						$dir_name_sql = '/'.$created_dir;			
+						$dir_name_sql = '/'.$created_dir;
 					}
-					
+
 					//----------------inser into agenda----------------------//
 				 	$agenda_id = 0;
 				 	if(!empty($_POST['type2']) && isset($_POST['add_to_calendar']) && $_POST['add_to_calendar']==1):
 						include_once('../calendar/agenda.inc.php');
-						include_once('../resourcelinker/resourcelinker.inc.php');						
-						isset($course_info)?$course=$course_info:$course=null;							
-						$agenda_id = agenda_add_item($course,$_POST['new_dir'],$_POST['new_dir'],date('Y-m-d H:i:s'),get_date_from_select('ends'),null,0);						 
+						include_once('../resourcelinker/resourcelinker.inc.php');
+						isset($course_info)?$course=$course_info:$course=null;
+						$agenda_id = agenda_add_item($course,$_POST['new_dir'],$_POST['new_dir'],date('Y-m-d H:i:s'),get_date_from_select('ends'),null,0);
 					endif;
-					$sql_add_publication = "INSERT INTO " . $work_table . " SET " .			
+					$sql_add_publication = "INSERT INTO " . $work_table . " SET " .
 										   "url         = '".Database::escape_string(Security::remove_XSS($dir_name_sql))."',
 									       title        = '',
 						                   description 	= '".Database::escape_string(Security::remove_XSS($_POST['description']))."',
@@ -564,99 +564,99 @@ if (api_is_allowed_to_edit(false,true)) {
 										   qualificator_id	= '',
 										   date_of_qualification	= '0000-00-00 00:00:00',
 										   session_id   = ".intval($id_session);
-		
+
 					api_sql_query($sql_add_publication, __FILE__, __LINE__);
-					
-					// add the directory	
+
+					// add the directory
 					$id = Database::insert_id();
 					//Folder created
-					api_item_property_update($_course, 'work', $id, 'DirectoryCreated', $user_id);		
-					Display :: display_confirmation_message(get_lang('DirectoryCreated'), false);	
+					api_item_property_update($_course, 'work', $id, 'DirectoryCreated', $user_id);
+					Display :: display_confirmation_message(get_lang('DirectoryCreated'), false);
 					//Database :: escape_string($_REQUEST['make_visible']);
 					//if($_POST['type1']==1)
-					//$insert_limite		 	
-				 	//----------------inser into student_publication_assignment-------------------//		
-					//return something like this: 2008-02-45 00:00:00			
-					
+					//$insert_limite
+				 	//----------------inser into student_publication_assignment-------------------//
+					//return something like this: 2008-02-45 00:00:00
+
 					if(!empty($_POST['type1']) || !empty($_POST['type2'])) {
-																											
+
 										isset($_POST['enable_calification'])?$enable_calification = (int)$_POST['enable_calification']:$enable_calification=null;
-										$sql_add_homework = "INSERT INTO $TSTDPUBASG SET " .			
+										$sql_add_homework = "INSERT INTO $TSTDPUBASG SET " .
 														   "expires_on         = '".((isset($_POST['type1']) && $_POST['type1']==1) ? get_date_from_select('expires') : '0000-00-00 00:00:00'). "',
 													        ends_on        = '".((isset($_POST['type2']) && $_POST['type2']==1) ? get_date_from_select('ends') : '0000-00-00 00:00:00')."',
 										                    add_to_calendar  = '$agenda_id',
 										                    enable_qualification = '".$enable_calification."',
 										                    publication_id = '".$id."'";
-										api_sql_query($sql_add_homework, __FILE__, __LINE__);		
+										api_sql_query($sql_add_homework, __FILE__, __LINE__);
 									    //api_sql_query($sql_add_publication, __FILE__, __LINE__);
-										
+
 										$sql_add_publication = "UPDATE ".$work_table." SET "."has_properties  = ".Database::insert_id().", view_properties = 1 ".' where id = '.$id;
 										api_sql_query($sql_add_publication, __FILE__, __LINE__);
-								
+
 					} else {
-			
-										$sql_add_homework = "INSERT INTO $TSTDPUBASG SET " .			
+
+										$sql_add_homework = "INSERT INTO $TSTDPUBASG SET " .
 														   "expires_on         = '0000-00-00 00:00:00',
 													        ends_on        = '0000-00-00 00:00:00',
 										                    add_to_calendar  = '$agenda_id',
 										                    enable_qualification = '".(isset($_POST['enable_calification'])?(int)$_POST['enable_calification']:'')."',
 										                    publication_id = '".$id."'";
-										api_sql_query($sql_add_homework, __FILE__, __LINE__);		
+										api_sql_query($sql_add_homework, __FILE__, __LINE__);
 									    //api_sql_query($sql_add_publication, __FILE__, __LINE__);
-										
+
 										$sql_add_publication = "UPDATE ".$work_table." SET "."has_properties  = ".Database::insert_id().", view_properties = 0 ".' where id = '.$id;
 										api_sql_query($sql_add_publication, __FILE__, __LINE__);
-								
+
 					}
-				 	
+
 				 	if(isset($_POST['make_calification']) && $_POST['make_calification']==1) {
-	
+
 					 	require_once('../gradebook/lib/be/gradebookitem.class.php');
 					 	require_once('../gradebook/lib/be/evaluation.class.php');
 					 	require_once('../gradebook/lib/be/abstractlink.class.php');
 					 	require_once('../gradebook/lib/gradebook_functions.inc.php');
-						
+
 						$resource_name = (empty($_POST['qualification_name'])) ? $_POST['new_dir'] : $_POST['qualification_name'];
 					 	add_resource_to_course_gradebook(api_get_course_id(), 3, $id, Database::escape_string($resource_name),$_POST['weight'], $_POST['qualification_value'], Database::escape_string($_POST['description']),time(), 1,api_get_session_id());
-		
-					 	
-				 	}				 	
-					
-					//-----------------end features---------------------------//		
-					
+
+
+				 	}
+
+					//-----------------end features---------------------------//
+
 					// update all the parents in the table item propery
 					$list_id=get_parent_directories($my_cur_dir_path);
-											
+
 					for ($i = 0; $i < count($list_id); $i++) {
-						api_item_property_update($_course, 'work', $list_id[$i], 'FolderUpdated', $user_id);								
-					}			
+						api_item_property_update($_course, 'work', $list_id[$i], 'FolderUpdated', $user_id);
+					}
 					//-------------------------------------------------------------------------------
-		
-					
+
+
 					//uncomment if you want to enter the created dir
 					//$curdirpath = $created_dir;
 					//$curdirpathurl = urlencode($curdirpath);
 				} else {
 					Display :: display_error_message(get_lang('CannotCreateDir'));
 				}
-			}	
+			}
 	}
-					
+
 	/* -------------------
 	 * Delete dir command
 	 --------------------*/
-	if (!empty ($_REQUEST['delete_dir'])) {		
+	if (!empty ($_REQUEST['delete_dir'])) {
 		$delete_directory=$_REQUEST['delete_dir'];
 		$id=$_REQUEST['delete2'];
-		del_dir($base_work_dir . '/', $delete_directory,$id);		
+		del_dir($base_work_dir . '/', $delete_directory,$id);
 		Display :: display_confirmation_message(get_lang('DirDeleted') . ': '.$delete_directory);
 	}
-	if (!empty ($_REQUEST['delete2'])) {		
+	if (!empty ($_REQUEST['delete2'])) {
 		$delete_2=$_REQUEST['delete2'];
 		// gets calendar_id from student_publication_assigment
 		$sql = "SELECT add_to_calendar FROM $TSTDPUBASG WHERE publication_id ='$delete_2'";
 		$res = api_sql_query($sql,__FILE__,__LINE__);
-		$calendar_id = Database::fetch_row($res);				
+		$calendar_id = Database::fetch_row($res);
 		// delete from agenda if it exists
 		if (!empty($calendar_id[0])) {
 		$t_agenda   = Database::get_course_table(TABLE_AGENDA);
@@ -664,21 +664,21 @@ if (api_is_allowed_to_edit(false,true)) {
 		api_sql_query($sql,__FILE__,__LINE__);
 		}
 		$sql2="DELETE FROM $TSTDPUBASG WHERE publication_id ='$delete_2'";
-		$result2 = api_sql_query($sql2, __FILE__, __LINE__);		
+		$result2 = api_sql_query($sql2, __FILE__, __LINE__);
 		$sql3="DELETE FROM $t_gradebook_link WHERE course_code='$course_code' AND ref_id='$delete_2'";
 		$result3 = api_sql_query($sql3, __FILE__, __LINE__);
 	}
-	 
+
 	/* ----------------------
 	 * Move file form request
-	 ----------------------- */	 
-	if (!empty ($_REQUEST['move'])) {		 
+	 ----------------------- */
+	if (!empty ($_REQUEST['move'])) {
 		$folders = array();
 		$sql = "SELECT url FROM $work_table  WHERE url LIKE '/%' AND post_group_id = '".(empty($_SESSION['toolgroup'])?0:$_SESSION['toolgroup'])."'";
 		$res = api_sql_query($sql,__FILE__,__LINE__);
-		while($folder = Database::fetch_array($res)) {			
+		while($folder = Database::fetch_array($res)) {
 		$folders[] = substr($folder['url'],1,(strlen($folder['url'])-1));
-		}	
+		}
 		echo build_work_move_to_selector($folders, $cur_dir_path, $_REQUEST['move']);
 	}
 	/* ------------------
@@ -703,13 +703,13 @@ if (api_is_allowed_to_edit(false,true)) {
 				//set the current path
 				$cur_dir_path = $move_to;
 				$cur_dir_path_url = urlencode($move_to);
-				
+
 				// update all the parents in the table item propery
-				$list_id=get_parent_directories($cur_dir_path);						
-				for ($i = 0; $i < count($list_id); $i++) {					
-					api_item_property_update($_course, 'work', $list_id[$i], 'FolderUpdated', $user_id);								
-				}		
-				
+				$list_id=get_parent_directories($cur_dir_path);
+				for ($i = 0; $i < count($list_id); $i++) {
+					api_item_property_update($_course, 'work', $list_id[$i], 'FolderUpdated', $user_id);
+				}
+
 				Display :: display_confirmation_message(get_lang('DirMv'));
 			} else {
 				Display :: display_error_message(get_lang('Impossible'));
@@ -726,7 +726,7 @@ if (api_is_allowed_to_edit(false,true)) {
 else {
 	$iprop_table = Database :: get_course_table(TABLE_ITEM_PROPERTY);
 	$user_id = api_get_user_id();
-	
+
 	/*-------------------------------------------
 				DELETE WORK COMMAND
 	-----------------------------------------*/
@@ -737,17 +737,17 @@ else {
 			//Get the author ID for that document from the item_property table
 			$author_sql = "SELECT * FROM $iprop_table WHERE tool = 'work' AND insert_user_id='$user_id' AND ref=" .Database::escape_string($delete);
 			$author_qry = api_sql_query($author_sql, __FILE__, __LINE__);
-			
+
 			if (Database :: num_rows($author_qry) == 1) {
 				//we found the current user is the author
 				$queryString1 = "SELECT url FROM  " . $work_table . "  WHERE id = '$delete'";
 				$queryString2 = "DELETE FROM  " . $work_table . "  WHERE id='$delete'";
 				$queryString3 = "DELETE FROM  " . $TSTDPUBASG . "  WHERE publication_id='$delete'";
-							
+
 				$result1 = api_sql_query($queryString1, __FILE__, __LINE__);
 				$result2 = api_sql_query($queryString2, __FILE__, __LINE__);
 				$result3 = api_sql_query($queryString3, __FILE__, __LINE__);
-				
+
 				if ($result1) {
 					api_item_property_update($_course, 'work', $delete, 'DocumentDeleted', $user_id);
 					while ($thisUrl = Database::fetch_array($result1)) {
@@ -764,8 +764,8 @@ else {
 	/*-------------------------------------------
 	           EDIT COMMAND WORK COMMAND
 	  -----------------------------------------*/
-	  
-	if ($edit) {		
+
+	if ($edit) {
 		//Get the author ID for that document from the item_property table
 		$author_sql = "SELECT * FROM $iprop_table WHERE tool = 'work' AND insert_user_id='$user_id' AND ref=" . $edit;
 		$author_qry = api_sql_query($author_sql, __FILE__, __LINE__);
@@ -783,7 +783,7 @@ else {
 			}
 		}
 	}
-	
+
 }
 
 /*
@@ -798,13 +798,13 @@ if ($ctok==$_POST['sec_token']) { //check the token inserted into the form
 	if (!empty($_POST['submitWork']) && !empty($is_course_member)) {
 		if (!empty($_FILES['file']['size'])) {
 			$updir = $currentCourseRepositorySys . 'work/'; //directory path to upload
-	
+
 			// Try to add an extension to the file if it has'nt one
 			$new_file_name = add_ext_on_mime(stripslashes($_FILES['file']['name']), $_FILES['file']['type']);
-	
+
 			// Replace dangerous characters
 			$new_file_name = replace_dangerous_char($new_file_name, 'strict');
-	
+
 			// Transform any .php file in .phps fo security
 			$new_file_name = php2phps($new_file_name);
 			//filter extension
@@ -829,10 +829,10 @@ if ($ctok==$_POST['sec_token']) { //check the token inserted into the form
 				@move_uploaded_file($_FILES['file']['tmp_name'], $updir . $my_cur_dir_path . $new_file_name);
 				$url = "work/" . $my_cur_dir_path . $new_file_name;
 				$result = api_sql_query("SHOW FIELDS FROM " . $work_table . " LIKE 'sent_date'", __FILE__, __LINE__);
-				
+
 				if (!Database::num_rows($result)) {
 					api_sql_query("ALTER TABLE " . $work_table . " ADD sent_date DATETIME NOT NULL");
-				}			
+				}
 				$current_date = date('Y-m-d H:i:s');
 				$parent_id = '';
 				$active = '';
@@ -840,7 +840,7 @@ if ($ctok==$_POST['sec_token']) { //check the token inserted into the form
 				if(Database::num_rows($sql) > 0 ) {
 					$dir_row = Database::fetch_array($sql);
 					$parent_id = $dir_row['id'];
-				}				
+				}
 				$sql_add_publication = "INSERT INTO " . $work_table . " SET " .
 										       "url         = '" . $url . "',
 										       title       = '" . Database::escape_string(Security::remove_XSS($title)) . "',
@@ -852,39 +852,39 @@ if ($ctok==$_POST['sec_token']) { //check the token inserted into the form
 											   sent_date	=  '".$current_date ."',
 											   parent_id 	=  '".$parent_id ."' ,
 	                                           session_id = ".intval($id_session);
-											   		
-	
+
+
 				api_sql_query($sql_add_publication, __FILE__, __LINE__);
-	
+
 				$Id = Database::insert_id();
 				api_item_property_update($_course, 'work', $Id, 'DocumentAdded', $user_id);
 				$succeed = true;
-				
+
 				// update all the parents in the table item propery
-				$list_id=get_parent_directories($my_cur_dir_path);						
+				$list_id=get_parent_directories($my_cur_dir_path);
 				for ($i = 0; $i < count($list_id); $i++) {
-					api_item_property_update($_course, 'work', $list_id[$i], 'FolderUpdated', $user_id);								
-				}	
-				
+					api_item_property_update($_course, 'work', $list_id[$i], 'FolderUpdated', $user_id);
+				}
+
 			}
-		} elseif ($newWorkUrl) {	
+		} elseif ($newWorkUrl) {
 				if (isset ($_SESSION['toolgroup'])) {
 					$post_group_id = $_SESSION['toolgroup'];
 				} else {
 					$post_group_id = '0';
 				}
-			
+
 			/*
 			 * SPECIAL CASE ! For a work coming from another area (i.e. groups)
-			 */	 
+			 */
 			$url = str_replace('../../' . $_course['path'] . '/', '', $newWorkUrl);
-	
-			if (!$title) {		
+
+			if (!$title) {
 				$title = basename($workUrl);
 			}
-	
+
 			$result = api_sql_query("SHOW FIELDS FROM " . $work_table . " LIKE 'sent_date'", __FILE__, __LINE__);
-	
+
 			if (!Database::num_rows($result)) {
 				api_sql_query("ALTER TABLE " . $work_table . " ADD sent_date DATETIME NOT NULL");
 			}
@@ -893,35 +893,35 @@ if ($ctok==$_POST['sec_token']) { //check the token inserted into the form
 					        	SET url        	= '" . $url . "',
 					            title       	= '" . Database::escape_string(Security::remove_XSS($title)) . "',
 					            description 	= '" . Database::escape_string(Security::remove_XSS($description)) . "',
-					            author      	= '" . Database::escape_string($authors) . "',					 
+					            author      	= '" . Database::escape_string($authors) . "',
 							    post_group_id = '".$post_group_id."',
 					            sent_date    	= '".$current_date."',
 					            session_id = ".intval($id_session);
-	
+
 			api_sql_query($sql, __FILE__, __LINE__);
-	
+
 			$insertId = Database::insert_id();
 			api_item_property_update($_course, 'work', $insertId, 'DocumentAdded', $user_id);
 			$succeed = true;
-			
+
 			// update all the parents in the table item propery
-			$list_id=get_parent_directories($my_cur_dir_path);						
+			$list_id=get_parent_directories($my_cur_dir_path);
 			for ($i = 0; $i < count($list_id); $i++) {
-				api_item_property_update($_course, 'work', $list_id[$i], 'FolderUpdated', $user_id);								
-			}	
+				api_item_property_update($_course, 'work', $list_id[$i], 'FolderUpdated', $user_id);
+			}
 
 		}
 
 		/*
 		 * SPECIAL CASE ! For a work edited
 		 */
-	
+
 		else {
 			//Get the author ID for that document from the item_property table
 			$is_author = false;
 			if ($id<>'') {
 				$author_sql = "SELECT * FROM $iprop_table WHERE tool = 'work' AND insert_user_id='$user_id' AND ref=" . mysql_real_escape_string($id);
-				
+
 				$author_qry = api_sql_query($author_sql, __FILE__, __LINE__);
 				if (Database :: num_rows($author_qry) == 1) {
 					$is_author = true;
@@ -933,40 +933,40 @@ if ($ctok==$_POST['sec_token']) { //check the token inserted into the form
 				if (!$title) {
 					$title = basename($newWorkUrl);
 				}
-	
+
 				if($is_allowed_to_edit && ($_POST['qualification']!='')) {
 					$add_to_update = ',qualificator_id ='."'".api_get_user_id()."',";
 					$add_to_update .= 'qualification ='."'".Database::escape_string($_POST['qualification'])."',";
 					$add_to_update .= 'date_of_qualification ='."'".date('Y-m-d H:i:s')."'";
-				} 
-				
-				if ((int)$_POST['qualification'] > (int)$_POST['qualification_over']) {				
-					Display::display_error_message(get_lang('QualificationMustNotBeMoreThanQualificationOver'));				
-				} else {			
+				}
+
+				if ((int)$_POST['qualification'] > (int)$_POST['qualification_over']) {
+					Display::display_error_message(get_lang('QualificationMustNotBeMoreThanQualificationOver'));
+				} else {
 					$sql = "UPDATE  " . $work_table . "
 					        SET	title       = '" . Database::escape_string(Security::remove_XSS($title)) . "',
 					            description = '" . Database::escape_string(Security::remove_XSS($description)) . "'
 					            ".$add_to_update."
 					        WHERE id    = '$id'";
-				api_sql_query($sql, __FILE__, __LINE__);				
-				}																									
-							        			
-				$insertId = $id;			
+				api_sql_query($sql, __FILE__, __LINE__);
+				}
+
+				$insertId = $id;
 				api_item_property_update($_course, 'work', $insertId, 'DocumentUpdated', $user_id);
-				$succeed = true;			
+				$succeed = true;
 			} else {
 				$error_message = get_lang('TooBig');
 			}
 		}
-	} 
+	}
 }
 if (!empty($_POST['submitWork']) && !empty($succeed) && !$id) {
 	//last value is to check this is not "just" an edit
 	//YW Tis part serve to send a e-mail to the tutors when a new file is sent
 	$send = api_get_course_setting('email_alert_manager_on_new_doc');
-	
+
 	if ($send > 0) {
-		// Lets predefine some variables. Be sure to change the from address!		
+		// Lets predefine some variables. Be sure to change the from address!
 
 		$emailto = array ();
 		if (empty ($id_session)) {
@@ -979,7 +979,7 @@ if (!empty($_POST['submitWork']) && !empty($succeed) && !$id) {
 			}
 		} else {
 			// coachs of the session
-			$sql_resp = 'SELECT user.email as myemail 
+			$sql_resp = 'SELECT user.email as myemail
 									FROM ' . $table_session . ' session
 									INNER JOIN ' . $table_user . ' user
 										ON user.user_id = session.id_coach
@@ -992,7 +992,7 @@ if (!empty($_POST['submitWork']) && !empty($succeed) && !$id) {
 			}
 
 			//coach of the course
-			$sql_resp = 'SELECT user.email as myemail 
+			$sql_resp = 'SELECT user.email as myemail
 									FROM ' . $table_session_course . ' session_course
 									INNER JOIN ' . $table_user . ' user
 										ON user.user_id = session_course.id_coach
@@ -1005,7 +1005,7 @@ if (!empty($_POST['submitWork']) && !empty($succeed) && !$id) {
 			}
 
 		}
-		
+
 		if (count($emailto) > 0) {
 			$emailto = implode(',', $emailto);
 			$emailfromaddr = api_get_setting('emailAdministrator');
@@ -1014,13 +1014,13 @@ if (!empty($_POST['submitWork']) && !empty($succeed) && !$id) {
 			$sender_name = api_get_setting('administratorName').' '.api_get_setting('administratorSurname');
 		    $email_admin = api_get_setting('emailAdministrator');
 			// The body can be as long as you wish, and any combination of text and variables
-						
+
 			$emailbody = get_lang('SendMailBody').' '.api_get_path(WEB_CODE_PATH)."work/work.php?".api_get_cidreq()."&amp;curdirpath=".$my_cur_dir_path." (" . stripslashes($title) . ")\n\n" . api_get_setting('administratorName') . " " . api_get_setting('administratorSurname') . "\n" . get_lang('Manager') . " " . api_get_setting('siteName') . "\n" . get_lang('Email') . " : " . api_get_setting('emailAdministrator');
 
 			// Here we are forming one large header line
-			// Every header must be followed by a \n except the last															
+			// Every header must be followed by a \n except the last
 			@api_mail('', $emailto, $emailsubject, $emailbody, $sender_name,$email_admin);
-			
+
 		}
 	}
 	$message = get_lang('DocAdd');
@@ -1052,9 +1052,9 @@ if($is_special > 0):
 	$publication = Database::fetch_array($sql);
 	$sql = api_sql_query('SELECT * FROM '.$TSTDPUBASG.' WHERE publication_id = '.(string)$publication['id'].' LIMIT 1',__FILE__,__LINE__);
 	$homework = Database::fetch_array($sql);
-	
-	if($homework['expires_on']!='0000-00-00 00:00:00' || $homework['ends_on']!='0000-00-00 00:00:00'):		
-		$time_now = convert_date_to_number(date('Y-m-d H:i:s'));	
+
+	if($homework['expires_on']!='0000-00-00 00:00:00' || $homework['ends_on']!='0000-00-00 00:00:00'):
+		$time_now = convert_date_to_number(date('Y-m-d H:i:s'));
 		$time_expires = convert_date_to_number($homework['expires_on']);
 		$time_ends = convert_date_to_number($homework['ends_on']);
 		$difference = $time_expires - $time_now;
@@ -1068,21 +1068,21 @@ if($is_special > 0):
 		if(!empty($publication['description'])){
 			Display :: display_normal_message($publication['description']);
 		}
-						
+
 		$ends_on = api_ucfirst(format_locale_date($dateFormatLong,strtotime($homework['ends_on']))).' ';
 		$ends_on .= ucfirst(strftime($timeNoSecFormat,strtotime($homework['ends_on'])));
 		$expires_on = api_ucfirst(format_locale_date($dateFormatLong,strtotime($homework['expires_on']))).' ';
-		$expires_on .= ucfirst(strftime($timeNoSecFormat,strtotime($homework['expires_on'])));		
+		$expires_on .= ucfirst(strftime($timeNoSecFormat,strtotime($homework['expires_on'])));
 		if($has_ended) {
-			Display :: display_error_message(get_lang('EndDateAlreadyPassed').' '.$ends_on);	
+			Display :: display_error_message(get_lang('EndDateAlreadyPassed').' '.$ends_on);
 			display_action_links($cur_dir_path, $always_show_tool_options,true);
 		} elseif($has_expired) {
-			Display :: display_warning_message(get_lang('ExpiryDateAlreadyPassed').' '.$expires_on);	
+			Display :: display_warning_message(get_lang('ExpiryDateAlreadyPassed').' '.$expires_on);
 			display_action_links($cur_dir_path, $always_show_tool_options,$always_show_upload_form);
 		} else {
 			if (!$not_ends_on) {
 			Display :: display_normal_message(get_lang('ExpiryDateToSendWorkIs').' '.$expires_on);
-			}			
+			}
 			display_action_links($cur_dir_path, $always_show_tool_options, $always_show_upload_form);
 		}
 	else:
@@ -1117,7 +1117,7 @@ if ($is_course_member) {
 		{
 			$form_title = get_lang('EditMedia');
 		}
-		else 
+		else
 		{
 			$form_title = get_lang('UploadADocument');
 		}
@@ -1146,7 +1146,7 @@ if ($is_course_member) {
 					</div>';
 			$form->addElement('html', $html);
 		} else {
-			// else standard upload option 
+			// else standard upload option
 			$form->addElement('file', 'file', get_lang('UploadADocument'), 'size="40" onchange="updateDocumentTitle(this.value)"');
 		}
 
@@ -1163,41 +1163,41 @@ if ($is_course_member) {
 		//$defaults["authors"] = ($edit ? stripslashes($workAuthor) : stripslashes($authors));
 		$titleAuthors = $form->addElement('textarea', 'description', get_lang("Description"), 'style="width: 350px; height: 60px;"');
 		$defaults["description"] = ($edit ? stripslashes($workDescription) : stripslashes($description));
-				
-		if($is_allowed_to_edit && !empty($edit) && !empty($parent_id)) {			
+
+		if($is_allowed_to_edit && !empty($edit) && !empty($parent_id)) {
 			// Get qualification from parent_id that'll allow the validation qualification over
-			$sql = "SELECT qualification FROM $work_table WHERE id='$parent_id'";			
+			$sql = "SELECT qualification FROM $work_table WHERE id='$parent_id'";
 			$result = api_sql_query($sql,__FILE__,__LINE__);
 			$row = Database::fetch_array($result);
 			$qualification_over = $row['qualification'];
 			$form->addElement('text', 'qualification', get_lang('Qualification'),'size="10"');
 			$form->addElement('html','<div style="margin-left:20%">'.get_lang('QualificationOver').'&nbsp;:&nbsp;'.$qualification_over.'</div>');
 			$form->addElement('hidden', 'qualification_over', $qualification_over);
-		}		
-		
-		$defaults['qualification'] = $qualification_number;//($edit ? stripslashes($qualification_number) : stripslashes($qualification_number));		
+		}
+
+		$defaults['qualification'] = $qualification_number;//($edit ? stripslashes($qualification_number) : stripslashes($qualification_number));
 		$form->addElement('hidden', 'active', 1);
 		$form->addElement('hidden', 'accepted', 1);
 		$form->addElement('hidden', 'sec_token', $stok);
-		
+
 		if (isset($_GET['edit'])) {
 			$text=get_lang('UpdateWork');
-			$class='save';	
+			$class='save';
 		} else {
 			$text=get_lang('SendWork');
-			$class='upload';			
+			$class='upload';
 		}
-		
+
 		// fix the Ok button when we see the tool in the learn path
 		if ($origin== 'learnpath') {
-			$form->addElement('html', '<div style="margin-left:137px">');		
-			$form->addElement('style_submit_button','submitWork', $text, array('class="'.$class.'"','value="submitWork"'));		
+			$form->addElement('html', '<div style="margin-left:137px">');
+			$form->addElement('style_submit_button','submitWork', $text, array('class="'.$class.'"','value="submitWork"'));
 			$form->addElement('html', '</div>');
 		} else {
 			//$form->addElement('submit','submitWork', get_lang('SendFile'));
 			$form->addElement('style_submit_button', 'submitWork', $text, array('class="'.$class.'"','value="submitWork"'));
 		}
-		
+
 		if (!empty($_POST['submitWork']) || $edit) {
 			$form->addElement('style_submit_button', 'cancelForm', get_lang('Cancel'),'class="cancel"');
 		}
@@ -1205,21 +1205,21 @@ if ($is_course_member) {
 		$form->add_real_progress_bar('uploadWork', 'DownloadFile');
 		$form->setDefaults($defaults);
 		$form->addRule('file', '<div class="required">'.get_lang('ThisFieldIsRequired'), 'required');
-		$form->display();			
-	
-			
+		$form->display();
+
+
 
 	}
-	
+
 function make_select($name,$values,$checked='') {
 	$output = '<select name="'.$name.'" id="'.$name.'">';
  	foreach($values as $key => $value) {
  		$output .= '<option value="'.$key.'" '.(($checked==$key)?'selected="selected"':'').'>'.$value.'</option>';
  	}
- 	$output .= '</select>';	
+ 	$output .= '</select>';
  	return $output;
 }
-	
+
 function make_checkbox($name,$checked='') {
 		return '' .
 			'<input type="checkbox" value="1" name="'.$name.'" '.((!empty($checked))?'checked="checked"':'').'/>';
@@ -1228,12 +1228,12 @@ function make_checkbox($name,$checked='') {
 function draw_date_picker($prefix,$default='') {
 	//$default = 2008-10-01 10:00:00
 	if(empty($default)) {
-	$default = date('Y-m-d H:i:s');	
+	$default = date('Y-m-d H:i:s');
 	}
 	$parts = split(' ',$default);
 	list($d_year,$d_month,$d_day) = split('-',$parts[0]);
 	list($d_hour,$d_minute) = split(':',$parts[1]);
-	
+
 	$month_list = array(
 	1=>get_lang('JanuaryLong'),
 	2=>get_lang('FebruaryLong'),
@@ -1248,7 +1248,7 @@ function draw_date_picker($prefix,$default='') {
 	11=>get_lang('NovemberLong'),
 	12=>get_lang('DecemberLong')
 	);
-		
+
 	$minute = range(10,59);
 	array_unshift($minute,'00','01','02','03','04','05','06','07','08','09');
 	$date_form = make_select($prefix.'_day', array_combine(range(1,31),range(1,31)), $d_day);
@@ -1289,54 +1289,54 @@ function draw_date_picker($prefix,$default='') {
 							</div>';
 
 		// Advanced parameters
-		$addtext .='<div id="options" style="display: none;">';		
-		$addtext .= '<div style="padding:10px">';		
-		$addtext .= '<b>'.get_lang('QualificationOfAssignment').'</b>';				
+		$addtext .='<div id="options" style="display: none;">';
+		$addtext .= '<div style="padding:10px">';
+		$addtext .= '<b>'.get_lang('QualificationOfAssignment').'</b>';
 		$addtext .= '<table cellspacing="0" cellpading="0" border="0"><tr>';
-		$addtext .= '<td colspan="2">&nbsp;&nbsp;'.get_lang('QualificationNumberOver').'&nbsp;';		
-		$addtext .= '<input type="text" name="qualification_value" value="" size="5"/></td><tr><td colspan="2">';		
-		$addtext .= '<input type="checkbox" value="1" name="make_calification" onclick="if(this.checked==true){document.getElementById(\'option1\').style.display=\'block\';}else{document.getElementById(\'option1\').style.display=\'none\';}"/>'.get_lang('MakeQualifiable').'</td></tr><tr>';								
+		$addtext .= '<td colspan="2">&nbsp;&nbsp;'.get_lang('QualificationNumberOver').'&nbsp;';
+		$addtext .= '<input type="text" name="qualification_value" value="" size="5"/></td><tr><td colspan="2">';
+		$addtext .= '<input type="checkbox" value="1" name="make_calification" onclick="if(this.checked==true){document.getElementById(\'option1\').style.display=\'block\';}else{document.getElementById(\'option1\').style.display=\'none\';}"/>'.get_lang('MakeQualifiable').'</td></tr><tr>';
 		$addtext .= '<td colspan="2"><div id="option1" style="display:none">';
 		$addtext .= '<div id="msg_error_weight" style="display:none;color:red"></div>';
-		$addtext .=	'&nbsp;&nbsp;'.get_lang('WeightInTheGradebook').'&nbsp;';				
+		$addtext .=	'&nbsp;&nbsp;'.get_lang('WeightInTheGradebook').'&nbsp;';
 		$addtext .= '<input type="text" name="weight" value="" size="5" onfocus="document.getElementById(\'msg_error_weight\').style.display=\'none\';"/></div></td></tr>';
-		$addtext .= '</tr></table>';				
-		$addtext .= '<br />';		
+		$addtext .= '</tr></table>';
+		$addtext .= '<br />';
 		$addtext .= '<b>'.get_lang('DatesAvailables').'</b><br>';
-		$addtext .= '<input type="checkbox" value="1" name="type1" onclick="if(this.checked==true){document.getElementById(\'option2\').style.display=\'block\';}else{document.getElementById(\'option2\').style.display=\'none\';}"/>'.get_lang('EnableExpiryDate').'';		
-		$addtext .= '&nbsp;&nbsp;&nbsp;<span id="msg_error2" style="display:none;color:red"></span>';		
-		$addtext .= '&nbsp;&nbsp;&nbsp;<span id="msg_error3" style="display:none;color:red"></span>';	
-		$addtext .= '<div id="option2" style="padding:4px;display:none">&nbsp;&nbsp;';			
-		$addtext .= draw_date_picker('expires').'</div>';				
-		$addtext .= '<br /><input type="checkbox" value="1" name="type2" onclick="if(this.checked==true){document.getElementById(\'option3\').style.display=\'block\';}else{document.getElementById(\'option3\').style.display=\'none\';}"/>'.get_lang('EnableEndDate').'';		
+		$addtext .= '<input type="checkbox" value="1" name="type1" onclick="if(this.checked==true){document.getElementById(\'option2\').style.display=\'block\';}else{document.getElementById(\'option2\').style.display=\'none\';}"/>'.get_lang('EnableExpiryDate').'';
+		$addtext .= '&nbsp;&nbsp;&nbsp;<span id="msg_error2" style="display:none;color:red"></span>';
+		$addtext .= '&nbsp;&nbsp;&nbsp;<span id="msg_error3" style="display:none;color:red"></span>';
+		$addtext .= '<div id="option2" style="padding:4px;display:none">&nbsp;&nbsp;';
+		$addtext .= draw_date_picker('expires').'</div>';
+		$addtext .= '<br /><input type="checkbox" value="1" name="type2" onclick="if(this.checked==true){document.getElementById(\'option3\').style.display=\'block\';}else{document.getElementById(\'option3\').style.display=\'none\';}"/>'.get_lang('EnableEndDate').'';
 		$addtext .= '<div id="option3" style="padding:4px;display:none">';
 		$addtext .= '&nbsp;&nbsp;&nbsp;<div id="msg_error4" style="display:none;color:red"></div>';
 		$addtext .= draw_date_picker('ends').'<br />';
 		$addtext .= '&nbsp;&nbsp;'.make_checkbox('add_to_calendar').get_lang('AddToCalendar').'</div>';
 		$addtext .= '</div>';
-		$addtext .= '</div>';		
-		
+		$addtext .= '</div>';
+
 		$new_folder_text .= '<div class="row">
-								<div class="label">									
+								<div class="label">
 								<a href="javascript: void(0);" onclick="javascript: return plus();"><span id="plus">'.Display::return_icon('div_show.gif',get_lang('AdvancedParameters'),array('style'=>'vertical-align:center')).' '.get_lang('AdvancedParameters').'</span></a><br />
-								</div> 
+								</div>
 								<div class="formw">
 									'.$addtext.'
 								</div>
-							</div>';		
+							</div>';
+
 
-	
 		endif;
-		
+
 		$new_folder_text .= '<div class="row">
 								<div class="label">
 								</div>
 								<div class="formw">
 									<button type="button" class="add" name="create_dir" onClick="validate();" value="' . addslashes(get_lang('CreateDirectory')) . '"/>' . addslashes(get_lang('ButtonCreateAssignment')) . '</button>
 								</div>
-							</div>';		
-		
-		
+							</div>';
+
+
 		$new_folder_text .= '</form>';
 		//show the form
 		echo $new_folder_text;
@@ -1367,46 +1367,46 @@ if ($cur_dir_path == '/') {
 }
 
 if (!$display_upload_form && !$display_tool_options) {
-	$add_query = '';	
+	$add_query = '';
 	$sql = "SELECT user.firstname, user.lastname FROM $table_user user, $table_course_user course_user
 			  WHERE course_user.user_id=user.user_id AND course_user.course_code='".api_get_course_id()."' AND course_user.status='1'";
 	$res = api_sql_query($sql,__FILE__,__LINE__);
 	$admin_course = '';
 	while($row = Database::fetch_row($res)) {
-		$admin_course .='\''.api_get_person_name($row[0], $row[1]).'\','; 	
+		$admin_course .='\''.api_get_person_name($row[0], $row[1]).'\',';
 	}
-	if(!$is_allowed_to_edit && $is_special==true) { 
+	if(!$is_allowed_to_edit && $is_special==true) {
 		$add_query = ' AND author IN('.$admin_course.'\''.api_get_person_name($_user['firstName'], $_user['lastName']).'\')';
 	}
-	if($is_allowed_to_edit && $is_special==true) { 	
-	
+	if($is_allowed_to_edit && $is_special==true) {
+
 		if (!empty($_REQUEST['filter'])) {
 			switch($_REQUEST['filter']) {
-			 case 1: 
+			 case 1:
 					$add_query = ' AND qualification = '."''";
 					break;
-		 	 case 2:  
+		 	 case 2:
 					$add_query = ' AND qualification != '."''";
 					break;
-			 case 3:  
+			 case 3:
 					$add_query = ' AND sent_date < '."'".$homework['expires_on']."'";
 					break;
 			 default:
 			 		$add_query = '';
-			}	
+			}
 		}
 		isset($_GET['cidreq'])?$cidreq = Security::Remove_XSS($_GET['cidreq']):$cidreq='';
 		isset($_GET['curdirpath'])?$curdirpath = Security::Remove_XSS($_GET['curdirpath']):$curdirpath='';
 		isset($_REQUEST['filter'])?$filter = (int)$_REQUEST['filter']:$filter='';
-		
+
 		if ($origin != 'learnpath') {
 			$form_filter = '<form method="post" action="'.api_get_self().'?cidReq='.$cidreq.'&curdirpath='.$curdirpath.'&gradebook='.$gradebook.'">';
 			$form_filter .= make_select('filter',array(0=>get_lang('SelectAFilter'),1=>get_lang('FilterByNotRevised'),2=>get_lang('FilterByRevised'),3=>get_lang('FilterByNotExpired')),$filter);
 			$form_filter .= '<input type="submit" value="'.get_lang('FilterAssignments').'"</form>';
 			echo $form_filter;
 		}
-		
-	} 
+
+	}
 	display_student_publications_list($base_work_dir . '/' . $my_cur_dir_path, 'work/' . $my_cur_dir_path, $currentCourseRepositoryWeb, $link_target_parameter, $dateFormatLong, $origin,$add_query);
 }
 

+ 1 - 1
plugin/date/index.act.php

@@ -11,5 +11,5 @@ if(!empty($_SESSION['user_language_choice']) && !empty($convert_lang_to_code[$_S
   $code = $convert_lang_to_code[$_SESSION['user_language_choice']];
   $locale = setlocale(LC_TIME,$code);
 }
-$date = strftime('%c'); 
+$date = strftime('%c');
 ?>

+ 2 - 2
plugin/date/plugin.php

@@ -2,11 +2,11 @@
 /**
  * This script is a configuration file for the date plugin. You can use it as a master for other plugins.
  * These settings will be used in the administration interface for plugins (Dokeos configuration settings->Plugins)
- * @package dokeos.plugin 
+ * @package dokeos.plugin
  * @author Yannick Warnier <ywarnier@beeznest.org>
  */
 /**
- * Plugin details (must be present) 
+ * Plugin details (must be present)
  */
 //the plugin title
 $plugin_info['title']='Date';

+ 7 - 7
plugin/search/client/filter_user.lib.php

@@ -10,7 +10,7 @@
  */
 /**
  * Checks if a user can access a given course
- * 
+ *
  * The function gets the course code from the course directory, then
  * checks in the course_user table if the user has access to that course.
  * @param integer User ID (inside Dokeos)
@@ -29,8 +29,8 @@ function get_boolean_user_access_to_course_dir($user_id,$course_dir){
     $row = Database::fetch_array($res);
     $course_code = $row['code'];
     //Check user permissions
-    $sql = "SELECT * FROM $course_user 
-    	WHERE course_code = '$course_code' 
+    $sql = "SELECT * FROM $course_user
+    	WHERE course_code = '$course_code'
 	AND user_id = '$user_id'";
     $res = api_sql_query($sql);
     if(Database::num_rows($res)>0){
@@ -59,13 +59,13 @@ function get_boolean_user_access_to_course_dir($user_id,$course_dir){
  * Make this function always return true when no check is to be done
  * @param	string	URL to check
  * @return	boolean	True on user having access to the course or course not found, false otherwise
- 
+
  */
 function access_check($url,$default=true){
-  $matches = array(); 
+  $matches = array();
   $match1 = preg_match('/courses\/([^\/]*)\//',$url,$matches);
   if(!$match1){
-    $match2 = preg_match('/cidReq=([^&]*)/',$url,$matches); 
+    $match2 = preg_match('/cidReq=([^&]*)/',$url,$matches);
   }
   if($match1 or $match2){
     $has_access = get_boolean_user_access_to_course_dir($_SESSION['_user']['user_id'],$matches[1]);
@@ -82,7 +82,7 @@ function access_check($url,$default=true){
 }
 /**
  * Translates a course code into a course name into a string
- * 
+ *
  * This function should only be used if needed by a funny course-name rule
  * @param	string	The string to transform
  * @result	string	The transformed string

+ 11 - 11
plugin/search/client/searchit.php

@@ -46,7 +46,7 @@ else
  * @param	string	Result title
  * @param	string	Result URL
  * @param	string	Short excerpt of the result document
- * @param	
+ * @param
  */
 function result_output($id,$title,$url='',$excerpt='',$date='',$rating=''){
 	if(empty($id) OR empty($title)){return false;}
@@ -66,15 +66,15 @@ function result_output($id,$title,$url='',$excerpt='',$date='',$rating=''){
 include('../../../main/inc/header.inc.php');
 ?>
 
-<form method="get" action="<?php echo $search_url; ?>"><input 
-type="hidden" name="ps" value="1000"/><input 
-type="hidden" name="o" value="0"/><input 
-type="hidden" name="m" value="any"/><input 
-type="hidden" name="wm" value="sub"/><input 
-type="hidden" name="wf" value="2221"/><input 
-type="hidden" name="s" value="RDP"/><input 
-type="hidden" name="sy" value="1"/><input 
-type="text" name="q" value="<?php echo urldecode($my_query);?>" size="10" style="margin: 4px 6px; border: 1px solid #B6BB8C; color:#4D4F3A; height: 15px;padding:0px;"><input 
+<form method="get" action="<?php echo $search_url; ?>"><input
+type="hidden" name="ps" value="1000"/><input
+type="hidden" name="o" value="0"/><input
+type="hidden" name="m" value="any"/><input
+type="hidden" name="wm" value="sub"/><input
+type="hidden" name="wf" value="2221"/><input
+type="hidden" name="s" value="RDP"/><input
+type="hidden" name="sy" value="1"/><input
+type="text" name="q" value="<?php echo urldecode($my_query);?>" size="10" style="margin: 4px 6px; border: 1px solid #B6BB8C; color:#4D4F3A; height: 15px;padding:0px;"><input
 type="submit" name="submit" value="<?php echo $lang_search_button; ?>" style="margin: 4px 6px; border: 1px solid #B6BB8C; color:#4D4F3A; height:17px;vertical-align:top;padding:0px"></form>
 <?php
 $i = 1;
@@ -93,7 +93,7 @@ if($to_print != ''){
 	echo "<div class='search_info'>".$i.' '.$lang_search_found."</div><br/>\n";
 	echo $to_print;
 }else{
-	echo "<div class='search_info'>".$lang_no_result_found."</div><br/>\n"; 
+	echo "<div class='search_info'>".$lang_no_result_found."</div><br/>\n";
 }
 include('../../../main/inc/footer.inc.php');
 ?>

+ 5 - 5
plugin/search/client/www/indexer_login.php

@@ -14,13 +14,13 @@ $domain_name_of_search_server = 'your.domain.com';
 // the indexing server to crawl your portal
 $indexing_user_id = 'xxx';
 
-if($_SERVER['REMOTE_ADDR']==$ip_address_of_search_server 
+if($_SERVER['REMOTE_ADDR']==$ip_address_of_search_server
 	or $_SERVER['REMOTE_HOST'] == $domain_name_of_search_server){
-  
+
   //make sure we don't display errors if the authentication does not work
   ini_set('display_errors','Off');
   require_once('main/inc/global.inc.php');
-  
+
   $id = $indexing_user_id;
   //subscribe user to all courses
   $course_rel_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
@@ -37,8 +37,8 @@ if($_SERVER['REMOTE_ADDR']==$ip_address_of_search_server
       $res2 = @api_sql_query($sql2,__FILE__,__LINE__);
     }
   }
-  //now login the user to the platform (put everything needed inside the 
-  // session) and then redirect the search engine to the courses list 
+  //now login the user to the platform (put everything needed inside the
+  // session) and then redirect the search engine to the courses list
   $_SESSION['_user']['user_id'] = $id;
   define('DOKEOS_HOMEPAGE', true);
   require('main/inc/global.inc.php');

+ 10 - 10
plugin/search/index.php

@@ -2,7 +2,7 @@
 /**
  * This script is used as the entrance to the search plugin page. Due to its short form,
  * it can be included as a plugin in the Dokeos menu bar.
- * No process is operated here. Just displaying the HTML form. 
+ * No process is operated here. Just displaying the HTML form.
  * @package dokeos.search
  * @author Yannick Warnier <yannick.warnier@dokeos.com>
  */
@@ -11,13 +11,13 @@
  */
 include('client/client.conf.php');
 ?>
-<form method="get" style='margin:0px;padding:0px;width:70px;background-color:transparent;height:20px;display:inline;margin-left: 20px;' action="<?php echo $search_url; ?>"><input 
-type="hidden" name="ps" value="1000"/><input 
-type="hidden" name="o" value="0"/><input 
-type="hidden" name="m" value="any"/><input 
-type="hidden" name="wm" value="sub"/><input 
-type="hidden" name="wf" value="2221"/><input 
-type="hidden" name="s" value="RDP"/><input 
-type="hidden" name="sy" value="1"/><input 
-type="text" name="q" value="<?php echo $lang_search_button; ?>..." size="10" style="margin: 0px; border: 1px solid #B6BB8C; color:#4D4F3A; height: 15px;padding:0px;" onclick="javascript:this.value='';"><!--input 
+<form method="get" style='margin:0px;padding:0px;width:70px;background-color:transparent;height:20px;display:inline;margin-left: 20px;' action="<?php echo $search_url; ?>"><input
+type="hidden" name="ps" value="1000"/><input
+type="hidden" name="o" value="0"/><input
+type="hidden" name="m" value="any"/><input
+type="hidden" name="wm" value="sub"/><input
+type="hidden" name="wf" value="2221"/><input
+type="hidden" name="s" value="RDP"/><input
+type="hidden" name="sy" value="1"/><input
+type="text" name="q" value="<?php echo $lang_search_button; ?>..." size="10" style="margin: 0px; border: 1px solid #B6BB8C; color:#4D4F3A; height: 15px;padding:0px;" onclick="javascript:this.value='';"><!--input
 type="submit" name="submit" value="<?php echo $lang_search_button; ?>" style="margin: 4px 6px; border: 1px solid #B6BB8C; color:#4D4F3A; height:17px;vertical-align:top;padding:0px"--></form>

+ 4 - 4
plugin/search/plugin.php

@@ -1,15 +1,15 @@
 <?php //$id: $
 /**
- * This script is a configuration file for the search plugin. 
+ * This script is a configuration file for the search plugin.
  * You can use it as a master for other plugins.
- * These settings will be used in the administration interface for 
+ * These settings will be used in the administration interface for
  * plugins (Dokeos configuration settings->Plugins)
  * Make sure your read the README.txt file to understand how to use this plugin!
- * @package dokeos.plugin 
+ * @package dokeos.plugin
  * @author Yannick Warnier <yannick.warnier@dokeos.com>
  */
 /**
- * Plugin details (must be present) 
+ * Plugin details (must be present)
  */
 //the plugin title
 $plugin_info['title']='Search';

+ 2 - 2
plugin/search/server/www/search.php

@@ -33,7 +33,7 @@ if ($lang_content_negotiation == 'yes') {
 }
 
 // -----------------------------------------------
-//  M A I N 
+//  M A I N
 // -----------------------------------------------
 
 if (!$cc) {
@@ -110,7 +110,7 @@ if (!$cc) {
 						if (($cl_origin_id) && ($cl_origin_id == $rec_id)) {
 							$url = udm_get_res_field($res, $j, UDM_FIELD_URL);
 							//YW
-							
+
 							/*if (!access_check($url)) {
 								$my_skip ++;
 								continue;

+ 13 - 13
plugin/search/server/www/search.xml.php

@@ -40,7 +40,7 @@ BrowserCharset	iso-8859-1
 #LocalCharset   koi8-r
 #BrowserCharset koi8-r
 
-# For cache mode and built-in database 
+# For cache mode and built-in database
 # you may choose alternative working directory
 #VarDir /usr/local/mnogosearch/var
 
@@ -68,7 +68,7 @@ MaxWordLength 32
 #
 #HlBeg	<font color="000088"><b>
 #HlEnd	</b></font>
-HlBeg <hl> 
+HlBeg <hl>
 HlEnd </hl>
 
 # Load synonyms file.  File name is either absolute
@@ -87,17 +87,17 @@ HlEnd </hl>
 # Uncoment this line to change default maximal excerpt size. Default value is 256
 # (requires mnogosearch-3.2.16+)
 ExcerptSize 512
-#                                                                               
+#
 
 # Uncomment this line to change number of characters before and after search words
-# in excerpts. Default value is 40. 
+# in excerpts. Default value is 40.
 # (requires mnogosearch-3.2.16+)
 ExcerptPadding 128
 #
-                                                                                
-# Uncomment this line to change Last-Modified format output                     
-# Use strftime function meta variables                                          
-#DateFormat %d %b %Y %X %Z                                                      
+
+# Uncomment this line to change Last-Modified format output
+# Use strftime function meta variables
+#DateFormat %d %b %Y %X %Z
 
 # Uncomment to limit maximum number of results
 ResultsLimit 1000
@@ -136,7 +136,7 @@ ResultsLimit 1000
 #Spell en /opt/udm/ispell/en.dict
 #Spell ru /opt/udm/ispell/ru.dict
 
-# Searchd address - only for mnogosearch - 3.2.3 or earlier ! 
+# Searchd address - only for mnogosearch - 3.2.3 or earlier !
 #SearchdAddr localhost
 
 # Uncomment this line to enable document presence check at stored
@@ -197,7 +197,7 @@ ResultsLimit 1000
 	<result_cl>$CL</result_cl>
 	<result_stored>$(STORED)</result_stored>
 	<result_sitelimit>$(SITELIMIT)</result_sitelimit>
-</result>	
+</result>
 <!--/res-->
 
 <!--ftpres-->
@@ -216,7 +216,7 @@ ResultsLimit 1000
 	<result_cl>$CL</result_cl>
 	<result_stored>$(STORED)</result_stored>
 	<result_sitelimit>$(SITELIMIT)</result_sitelimit>
-</result>	
+</result>
 <!--/ftpres-->
 
 <!--resbot-->
@@ -250,7 +250,7 @@ ResultsLimit 1000
 	<result_cl>$CL</result_cl>
 	<result_stored>$(STORED)</result_stored>
 	<result_sitelimit>$(SITELIMIT)</result_sitelimit>
-</result>	
+</result>
 <!--/res-->
 <!--resbot-->
 <result_v>$V</result_v>
@@ -281,7 +281,7 @@ ResultsLimit 1000
 	<result_cl>$CL</result_cl>
 	<result_stored>$(STORED)</result_stored>
 	<result_sitelimit>$(SITELIMIT)</result_sitelimit>
-</result>	
+</result>
 <!--/res-->
 <!--resbot-->
 <result_v>$V</result_v>

+ 1 - 1
tests/all.test1.php

@@ -11,7 +11,7 @@ require_once('simpletest/autorun.php');
 class AllTests1 extends TestSuite {
     function AllTests1() {
     	$this->TestSuite('All tests1');
-        
+
         $this->addTestFile(dirname(__FILE__).'/main/inc/banner.inc.test.php');
         /**
          * Problemas con la funcion prueba, no se ejecuta de manera adecuada.

+ 3 - 3
tests/all.test2.php

@@ -34,7 +34,7 @@ class AllTests2 extends TestSuite {
         //$this->addTestFile(dirname(__FILE__).'/main/webservices/user_import/import.lib.test.php');
         //$this->addTestFile(dirname(__FILE__).'/main/work/work.lib.test.php');
 
-		
+
     	$this->addTestFile(dirname(__FILE__).'/main/admin/calendar.lib.test.php');
     	$this->addTestFile(dirname(__FILE__).'/main/admin/statistics/statistics.lib.test.php');
         $this->addTestFile(dirname(__FILE__).'/main/auth/lost_password.lib.test.php');
@@ -48,8 +48,8 @@ class AllTests2 extends TestSuite {
         $this->addTestFile(dirname(__FILE__).'/main/survey/survey.lib.test.php');
         $this->addTestFile(dirname(__FILE__).'/main/user/userInfoLib.test.php');
         $this->addTestFile(dirname(__FILE__).'/main/webservices/user_import/import.lib.test.php');
-        $this->addTestFile(dirname(__FILE__).'/main/work/work.lib.test.php');        
-       
+        $this->addTestFile(dirname(__FILE__).'/main/work/work.lib.test.php');
+
     }
 }
 $test = &new AllTests2();

+ 2 - 2
tests/all.test3.php

@@ -12,12 +12,12 @@ $_user= 1;
 class AllTests3 extends TestSuite {
     function AllTests3() {
     	$this->TestSuite('All tests3');
-    	
+
 	$this->addTestFile(dirname(__FILE__).'/main/admin/sub_language.class.test.php');
 	//$this->addTestFile(dirname(__FILE__).'/main//class.test.php');
 	//$this->addTestFile(dirname(__FILE__).'/main//class.test.php');
 	//$this->addTestFile(dirname(__FILE__).'/main//class.test.php');
-	
+
 	}
 }
 $test = &new AllTests3();

+ 1 - 1
tests/datafiller/data_users.php

@@ -3,7 +3,7 @@
  * This script contains the data to fill (or empty) the database with using
  * the fillers in this directory.
  * @author Yannick Warnier <yannick.warnier@dokeos.com>
- * 
+ *
  */
 /**
  * Initialisation section

+ 2 - 2
tests/datafiller/fill_users.php

@@ -2,7 +2,7 @@
 /**
  * This script contains a data filling procedure for users
  * @author Yannick Warnier <yannick.warnier@dokeos.com>
- * 
+ *
  */
 /**
  * Initialisation section
@@ -12,7 +12,7 @@ require_once '../../main/inc/lib/usermanager.lib.php';
 /**
  * Loads the data and injects it into the Dokeos database, using the Dokeos
  * internal functions.
- * @return  array  List of user IDs for the users that have just been inserted 
+ * @return  array  List of user IDs for the users that have just been inserted
  */
 function fill_users() {
     $users = array(); //declare only to avoid parsing notice

+ 2 - 2
tests/dokeostest.php

@@ -1,6 +1,6 @@
-<?php require_once('../main/inc/global.inc.php'); 
+<?php require_once('../main/inc/global.inc.php');
 
 var_dump(api_is_windows_os());
 
-//echo (api_is_windows_os()?'true':'false'); 
+//echo (api_is_windows_os()?'true':'false');
 ?>

+ 1 - 1
tests/dummy.test.php

@@ -1,7 +1,7 @@
 <?php //$id$
 //require_once('simpletest/autorun.php');
 
-class TestDummy extends UnitTestCase 
+class TestDummy extends UnitTestCase
 {
     function testDummyValues()
     {

+ 1 - 1
tests/dummy2.test.php

@@ -1,7 +1,7 @@
 <?php //$id$
 //require_once('simpletest/autorun.php');
 
-class TestDummy2 extends UnitTestCase 
+class TestDummy2 extends UnitTestCase
 {
     function testDummy2Values()
     {

+ 73 - 73
tests/main/admin/calendar.lib.test.php

@@ -6,17 +6,17 @@ require_once(api_get_path(LIBRARY_PATH).'icalcreator/iCalcreator.class.php');
 Mock::generate('Database');
 Mock::generate('Display');
 class TestCalendar extends UnitTestCase {
-	
+
 	function TestCalendar() {
         $this->UnitTestCase('testing the file about calendar/agenda');
-        
+
     }
-	
+
  	public function testDisplayMinimonthcalendar(){
  		ob_start();
  		global $DaysShort;
  		$agendaitems=array('abc','cde');
- 		$month=11; 
+ 		$month=11;
  		$year=2008;
  		$monthName='';
  		$res = display_minimonthcalendar($agendaitems, $month, $year, $monthName);
@@ -24,21 +24,21 @@ class TestCalendar extends UnitTestCase {
  		$this->assertTrue(is_null($res));
  		//var_dump($res);
  	}
- 	
+
  	public function testToJavascript(){
  		$res = to_javascript();
  		$this->assertTrue($res);
  		$this->assertTrue(is_string($res));
  		//var_dump($res);
  	}
- 	
+
  	public function testUserGroupFilterJavascript(){
  		$res = user_group_filter_javascript();
  		$this->assertTrue($res);
  		$this->assertTrue(is_string($res));
  		//var_dump($res);
  	}
- 	
+
  	public function testDisplayMonthcalendar(){
  		ob_start();
  		global $MonthsLong;
@@ -52,7 +52,7 @@ class TestCalendar extends UnitTestCase {
 		$this->assertNull($res);
 		//var_dump($res);
  	}
- 	
+
  	public function testStoreNewAgendaItem(){
  		global $_user;
  		$res = store_new_agenda_item();
@@ -61,7 +61,7 @@ class TestCalendar extends UnitTestCase {
  		$this->assertNull($res);
  		//var_dump($res);
  	}
- 	
+
  	public function testDisplayCourseadminLinks(){
  		ob_start();
  		$res = display_courseadmin_links();
@@ -69,7 +69,7 @@ class TestCalendar extends UnitTestCase {
  		$this->assertTrue(is_null($res));
  		//var_dump($res);
  	}
- 	
+
  	public function testDisplayStudentLinks(){
  		ob_start();
  		global $show;
@@ -78,7 +78,7 @@ class TestCalendar extends UnitTestCase {
  		$this->assertTrue(is_null($res));
  		//var_dump($res);
  	}
- 	
+
  	public function testGetAgendaItem(){
  		$realgrouplist= new MockDatabase();
  		$id=1;
@@ -89,7 +89,7 @@ class TestCalendar extends UnitTestCase {
  		$real_list[] = $result;
  		$res = get_agenda_item($id);
  		if(is_array($real_list))
- 			$this->assertTrue(is_array($real_list));	
+ 			$this->assertTrue(is_array($real_list));
  			else{
  			$this->assertTrue(is_null($real_list));
  			$this->assertTrue($real_list === true || $real_list === false);
@@ -99,7 +99,7 @@ class TestCalendar extends UnitTestCase {
  		//var_dump($real_list);
  		//var_dump($res);
  	}
- 	
+
  	public function testStoreEditedAgendaItem(){
  		ob_start();
  		$instans = new MockDisplay();
@@ -117,7 +117,7 @@ class TestCalendar extends UnitTestCase {
  		//var_dump($instans);
  		//var_dump($edit_result);
  	}
- 	
+
  	public function testSaveEditAgendaItem(){
 	 	$TABLEAGENDA = Database::get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
 	 	$id=Database::escape_string($id);
@@ -125,14 +125,14 @@ class TestCalendar extends UnitTestCase {
 		$content=Database::escape_string($content);
 		$start_date=Database::escape_string($start_date);
 		$end_date=Database::escape_string($end_date);
-	 	$res = save_edit_agenda_item($id,$title,$content,$start_date,$end_date); 
+	 	$res = save_edit_agenda_item($id,$title,$content,$start_date,$end_date);
  		$this->assertTrue($res);
  		$this->assertTrue($TABLEAGENDA);
  		$this->assertTrue(is_bool($res));
  		//var_dump($res);
  		//var_dump($TABLEAGENDA);
  	}
- 	
+
  	public function testDeleteAgendaItem(){
  		$realagenda= new MockDatabase();
  		$realagenda1 = new MockDisplay();
@@ -140,7 +140,7 @@ class TestCalendar extends UnitTestCase {
 		$id=Database::escape_string($id);
 		$res = delete_agenda_item($id);
 		$sql = "SELECT * FROM $t_agenda WHERE id = $id";
-		$sql_result = Database::query($sql,__FILE__,__LINE__);	
+		$sql_result = Database::query($sql,__FILE__,__LINE__);
  		$result = Database::fetch_array($sql_result);
  		$real_agenda[] = $result;
  		$res= delete_agenda_item($id);
@@ -151,7 +151,7 @@ class TestCalendar extends UnitTestCase {
  		//var_dump($res);
  		//var_dump($real_agenda);
  	}
- 	
+
  	public function testShowhideAgendaItem(){
 		ob_start();
 		$instans = new MockDisplay();
@@ -221,17 +221,17 @@ class TestCalendar extends UnitTestCase {
  		//var_dump($res);
  		//var_dump($realdisplayone);
  		//var_dump($real_display_one);
-  	} 
- 	
+  	}
+
  	/*public function testShowGroupFilterForm(){
  		$group_list=get_course_groups();
  		$res = show_group_filter_form();
  		$this->assertTrue($res);
  		//var_dump($res);
  	}
- 	
+
  	public function testShowUserFilterForm(){
- 		
+
  		$res = show_user_filter_form();
  		$this->assertTrue($res);
  		//var_dump($res);
@@ -246,7 +246,7 @@ class TestCalendar extends UnitTestCase {
  		$this->assertTrue(is_null($res));
  		//var_dump($res);
  	}
- 	
+
  	public function testGetAgendaitems(){
  		$realgetagenda = new MockDatabase();
  		$$TABLEAGENDA = Database :: get_course_table(TABLE_MAIN_SYSTEM_CALENDAR);
@@ -257,8 +257,8 @@ class TestCalendar extends UnitTestCase {
 		$year=Database::escape_string($year);
 		$sqlquery = "SELECT
 						DISTINCT *
-						FROM ".$TABLEAGENDA."							 
-						WHERE 
+						FROM ".$TABLEAGENDA."
+						WHERE
 						MONTH(start_date)='".$month."'
 						AND YEAR(start_date)='".$year."'
 						GROUP BY id
@@ -274,7 +274,7 @@ class TestCalendar extends UnitTestCase {
  		 //var_dump($real_get_agenda);
  		 //var_dump($realgetagenda);
  	}
- 	
+
  	public function testDisplayUpcomingEvents(){
  		 ob_start();
  		 $realdisplay = new MockDatabase();
@@ -293,9 +293,9 @@ class TestCalendar extends UnitTestCase {
 		 $this->assertTrue(is_null($res));
 		 //var_dump($real_display);
 		 //var_dump($realdisplay);
-		 //var_dump($res);					
- 	} 
- 	
+		 //var_dump($res);
+ 	}
+
  	public function testCalculateStartEndOfWeek(){
  		$week_number=4;
  		$year=2011;
@@ -304,7 +304,7 @@ class TestCalendar extends UnitTestCase {
  		$this->assertTrue($res);
  		//var_dump($res);
  	}
- 	
+
  	public function testDisplayDaycalendar(){
  		ob_start();
  		$agendaitems='';
@@ -318,7 +318,7 @@ class TestCalendar extends UnitTestCase {
  		$this->assertTrue(is_null($res));
  		//var_dump($res);
  	}
- 	
+
  	public function testDisplayWeekcalendar(){
  		ob_start();
  		$agendaitems='';
@@ -331,7 +331,7 @@ class TestCalendar extends UnitTestCase {
  		$this->assertTrue(is_null($res));
  		//var_dump($res);
  	}
- 	
+
  	public function testGetDayAgendaitems(){
 		$realgetday = new MockDatabase();
 		$TABLEAGENDA = Database :: get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
@@ -343,8 +343,8 @@ class TestCalendar extends UnitTestCase {
  		$year=2009;
  		$day='';
  		$sqlquery = "SELECT DISTINCT *
-										FROM ".$TABLEAGENDA." 
-										WHERE 
+										FROM ".$TABLEAGENDA."
+										WHERE
 										DAYOFMONTH(start_date)='".$day."' AND MONTH(start_date)='".$month."' AND YEAR(start_date)='".$year."'
 										GROUP BY agenda.id
 										ORDER BY start_date ";
@@ -359,7 +359,7 @@ class TestCalendar extends UnitTestCase {
  		//var_dump($real_get_day);
  		//var_dump($$realgetday);
  	}
- 	
+
  	public function testGetWeekAgendaitems(){
  		$realgetweek = new MockDatabase();
  		$TABLEAGENDA = Database :: get_main_table(TABLE_MAIN_SYSTEM_CALENDAR);
@@ -382,7 +382,7 @@ class TestCalendar extends UnitTestCase {
  		//var_dump($real_get_week);
  		//var_dump($realgetweek);
  	}
- 	
+
  	public function testGetRepeatedEventsDayView(){
  		$realgetrepeat = new MockDatabase();
  		$course_info='';
@@ -414,7 +414,7 @@ class TestCalendar extends UnitTestCase {
  		//var_dump($realgetrepeat);
  		//var_dump($real_get_repeat);
  	}
- 	
+
  	public function testget_repeated_events_week_view(){
  		$realgetrepeated = new MockDatabase();
  		$course_info='';
@@ -440,7 +440,7 @@ class TestCalendar extends UnitTestCase {
  		//var_dump($real_get_repeated);
  		//var_dump($realgetrepeated);
  	}
- 	
+
  	public function testGetRepeatedEventsMonthView(){
  		$realgetrepeated= new MockDatabase();
  		$course_info='';
@@ -473,7 +473,7 @@ class TestCalendar extends UnitTestCase {
 		//var_dump($real_get_repeated);
 		//var_dump($realgetrepeated);
 	}
-	
+
 	public function testGetRepeatedEventsListView(){
 		$realgetrepeatedevents = new MockDatabase();
 		$course_info='';
@@ -505,7 +505,7 @@ class TestCalendar extends UnitTestCase {
 		//var_dump($real_get_repeated_events);
 		//var_dump($realgetrepeatedevents);
 	}
- 	
+
  	public function testIsRepeatedEvent() {
  		$realrepetead = new MockDatabase();
  		$id=1;
@@ -519,12 +519,12 @@ class TestCalendar extends UnitTestCase {
  		$this->assertTrue(is_bool($resu));
  		$this->assertTrue($resu === true || $resu === false);
  		$this->assertTrue($real_repetead);
- 		$this->assertTrue($realrepetead); 
+ 		$this->assertTrue($realrepetead);
  		//var_dump($resu);
  		//var_dump($real_repetead);
  		//var_dump($realrepetead);
  	}
- 	
+
  	public function testAddWeek(){
  		$timestamp=12;
  		$num=1;
@@ -532,7 +532,7 @@ class TestCalendar extends UnitTestCase {
  		$this->assertTrue(is_numeric($res));
  		//var_dump($res);
  	}
- 	
+
  	public function testAddMonth(){
  		$timestamp=5;
  		$num=1;
@@ -540,7 +540,7 @@ class TestCalendar extends UnitTestCase {
  		$this->assertTrue(is_numeric($res));
  		//var_dump($res);
  	}
- 	
+
  	public function testAddYear(){
  		$timestamp=9999;
  		$num=1;
@@ -553,7 +553,7 @@ class TestCalendar extends UnitTestCase {
   * linea 2877 para que la prueba pudiera ejecutarse de manera exitosa.
   */
  	public function testAgendaAddItem(){
- 		
+
  		$realagenda = new MockDatabase();
  		global $_course;
  		$course_info='null';
@@ -586,7 +586,7 @@ class TestCalendar extends UnitTestCase {
  		//var_dump($real_agenda);
  		//var_dump($real_agenda1);
  	}
- 	
+
  	public function testGetCalendarItems(){
  		$realgetcalendar = new MockDatabase();
  		global $_user, $_course;
@@ -613,7 +613,7 @@ class TestCalendar extends UnitTestCase {
  		//var_dump($row);
  		//var_dump($res);
  	}
- 	
+
  	public function testAgendaAddRepeatItem(){
  		$realagenda = new MockDatabase();
  		$course_info='course of test';
@@ -646,7 +646,7 @@ class TestCalendar extends UnitTestCase {
  		//var_dump($res1);
  		//var_dump($real_agenda);
  	}
- 	
+
  	public function testAgendaImportIcal(){
  		$course_info='course_test';
  		$file='';
@@ -659,30 +659,30 @@ class TestCalendar extends UnitTestCase {
  		}
  		//var_dump($res);
  	}
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
- 	
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 }
 ?>

+ 42 - 42
tests/main/admin/statistics/statistics.lib.test.php

@@ -8,16 +8,16 @@ Mock::generate('Display');
 Mock::generate('DocumentManager');
 
 class TestStatistics extends UnitTestCase{
-	
+
 	public $statisc;
 	public function TestStatistics(){
 		$this->UnitTestCase('this File test the provides some function for statistics ');
 	}
-	
+
 	public function setUp(){
 		$this-> statisc = new Statistics();
 	}
-	
+
 	public function tearDown(){
 		$this->statisc = null;
 	}
@@ -28,10 +28,10 @@ class TestStatistics extends UnitTestCase{
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	public function testCountCourse(){
 		$instans = new MockDatabase();
-		
+
 		$course_code = 'ABC';
 		$course_code2 = 'ABCD';
 		$category_code = NULL;
@@ -41,7 +41,7 @@ class TestStatistics extends UnitTestCase{
 		$this->assertTrue(count($res) !== 0);
 		//var_dump($res);
 	}
-	
+
 	public function testCountCourse2(){
 		$instans = new MockDatabase();
 		$user_id=1;
@@ -57,7 +57,7 @@ class TestStatistics extends UnitTestCase{
 		CourseManager::delete_course($course_code);
 		//var_dump($res);
 	}
-	
+
 	public function testCountCourse3(){
 		$user_id=1;
 		$course_code = 'ABC';
@@ -70,7 +70,7 @@ class TestStatistics extends UnitTestCase{
 		$this->assertTrue(count($res)!==0);
 	 	//var_dump($res);
 	}
-	
+
 	public function testCountCourse4(){
 		$user_id=1;
 		$course_code = 'ABC';
@@ -89,12 +89,12 @@ class TestStatistics extends UnitTestCase{
 	 	//ob_end_clean();
 	 	//var_dump($res);
 	}
-	
+
 	public function testCountUsers(){
 		$user_id =001;
 		$category_code = NULL;
 		$course_code='ABC';
-		$firstName='adam'; $lastName='ivan'; $status='01'; $email='ricardo.rodriguez@dokeos.com'; $loginName='adam'; $password='1234';	
+		$firstName='adam'; $lastName='ivan'; $status='01'; $email='ricardo.rodriguez@dokeos.com'; $loginName='adam'; $password='1234';
 		$count_invisible_courses = true;
 		$session_id = SessionManager::create_session($course_code,2009,07,20,2010,07,20,0,0,1,'coach');
 		SessionManager::suscribe_users_to_session($session_id,array($user_id+3));
@@ -104,10 +104,10 @@ class TestStatistics extends UnitTestCase{
 		SessionManager::delete_session($session_id);
 		//var_dump($res);
 	}
-	
+
 	public function testGetNumberOfActivities(){
 		$activitis = new MockDatabase();
-		$sql = "SELECT count(default_id) AS total_number_of_items FROM $track_e_default ";				
+		$sql = "SELECT count(default_id) AS total_number_of_items FROM $track_e_default ";
 		$res = api_sql_query($sql, __FILE__, __LINE__);
 		$obj = Database::fetch_object($res);
 		$resu = Statistics::get_number_of_activities();
@@ -116,22 +116,22 @@ class TestStatistics extends UnitTestCase{
 		//var_dump($resu);
 		//var_dump($res);
 	}
-	
+
 	public function testGetActivitiesData(){
 		$instans = new MockDatabase();
 		global $dateTimeFormatLong;
 		$from='';
-		$number_of_items=10; 
-		$column=''; 
+		$number_of_items=10;
+		$column='';
 		$direction='';
 		$track_e_default = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
 		$table_user = Database::get_main_table(TABLE_MAIN_USER);
 		$sql = "SELECT
 				 	default_event_type  as col0,
 					default_value_type	as col1,
-					default_value		as col2,																
-					user.username 	as col3, 					
-					default_date 	as col4									
+					default_value		as col2,
+					user.username 	as col3,
+					default_date 	as col4
 				FROM $track_e_default track_default, $table_user user
 				WHERE track_default.default_user_id = user.user_id ";
 		$res = api_sql_query($sql, __FILE__, __LINE__);
@@ -143,15 +143,15 @@ class TestStatistics extends UnitTestCase{
     	//var_dump($row);
     	//var_dump($res);
     }
-    
+
     public function testGetCourseCategories(){
     	$user_id =002;
 		$category_code = NULL;
 		$course_code='ABCDE';
 		$real_course_code='00001';
-		$course_title='test1'; 
-		$wanted_course_code='test2'; 
-		$course_language='es'; 
+		$course_title='test1';
+		$wanted_course_code='test2';
+		$course_language='es';
 		$course_category='primary';
 		$code='00001';
 		$session_id = SessionManager::create_session($course_code,2009,07,20,2010,07,20,0,0,1,'coach');
@@ -161,7 +161,7 @@ class TestStatistics extends UnitTestCase{
     	CourseManager::delete_course($code);
     	//var_dump($res);
     }
-    
+
     public function testRescale(){
     	$data=array('aas','aaa'.'aab');
     	$max = 500;
@@ -170,19 +170,19 @@ class TestStatistics extends UnitTestCase{
     	$this->assertTrue(is_array($res));
     	//var_dump($res);
     }
-    
+
     public function testPrintStats(){
     	ob_start();
     	$title='testing';
-    	$stats=array('aa','bb','cc'); 
-    	$show_total = true; 
+    	$stats=array('aa','bb','cc');
+    	$show_total = true;
     	$is_file_size = false;
     	$res = Statistics::print_stats($title, $stats, $show_total = true, $is_file_size = false);
     	ob_end_clean();
     	$this->assertTrue(is_null($res));
     	//var_dump($res);
     }
-    
+
     public function testPrintLoginStats(){
     	ob_start();
     	$instans = new MockDatabase();
@@ -207,7 +207,7 @@ class TestStatistics extends UnitTestCase{
     	//var_dump($resu);
     	//var_dump($result);
     }
-    
+
     public function testPrintRecenLoginStats(){
 		ob_start();
 		$instans = new MockDatabase();
@@ -225,7 +225,7 @@ class TestStatistics extends UnitTestCase{
     	//var_dump($res);
     	//var_dump($total_logins);
     }
-    
+
     public function testPrintToolStats(){
     	ob_start();
     	$instans = new MockDatabase();
@@ -241,9 +241,9 @@ class TestStatistics extends UnitTestCase{
     	$instans->expectCallCount($result);
     	$this->assertTrue(is_null($resu));
     	//var_dump($resu);
-    	//var_dump($result);	
+    	//var_dump($result);
     }
-    
+
     public function testPrintCourseByLanguageStats(){
     	ob_start();
     	$instans = new MockDatabase();
@@ -261,7 +261,7 @@ class TestStatistics extends UnitTestCase{
     	//var_dump($resu);
     	//var_dump($result);
     }
-    
+
     public function testPrintUserPicturesStats(){
     	ob_start();
     	$instans = new MockDatabase();
@@ -272,14 +272,14 @@ class TestStatistics extends UnitTestCase{
     	$instans_print[]= $count1;
     	$instans->expectOnce($instans_print);
     	$instans->expectCallCount($instans_print);
-    	$resu = Statistics::print_user_pictures_stats();	
+    	$resu = Statistics::print_user_pictures_stats();
     	ob_end_clean();
     	$this->assertTrue(is_null($resu));
     	$this->assertTrue($instans_print);
     	//var_dump($resu);
     	//var_dump($instans_print);
     }
-    
+
     public function testPrintActivitiesStats(){
     	ob_start();
     	$res = Statistics::print_activities_stats();
@@ -287,7 +287,7 @@ class TestStatistics extends UnitTestCase{
    		$this->assertTrue(is_null($res));
    		//var_dump($res);
     }
-    
+
     public function testPrintCourseLastVisit(){
     	ob_start();
     	$instans = new MockDatabase();
@@ -305,12 +305,12 @@ class TestStatistics extends UnitTestCase{
     	$this->assertTrue(is_null($res));
     	//var_dump($res);
     }
-    
-    
-    
-    
-    
-    
-    
+
+
+
+
+
+
+
 }
 ?>

+ 8 - 8
tests/main/admin/sub_language.class.test.php

@@ -2,22 +2,22 @@
 require_once(api_get_path(SYS_CODE_PATH).'admin/sub_language.class.php');
 
 class TestSubLanguageManager extends UnitTestCase {
-	
-	   
+
+
     /**
-     * Add directory for sub-language 
+     * Add directory for sub-language
      * @param String The sub-language path directory ( /var/www/my_dokeos/main/lang/spanish_corporate )
      * @return boolean
-     */	 
+     */
      public static function testadd_directory_of_sub_language() {
      	$path_sub_language='/var/www/nose';
      	$res=SubLanguageManager::add_directory_of_sub_language($path_sub_language);
      	$this->assertTrue(is_bool($path_sub_language));
      	var_dump($res);
      }
-    
-    
-		
-	
+
+
+
+
 }
 ?>

+ 8 - 8
tests/main/auth/lost_password.lib.test.php

@@ -11,7 +11,7 @@ class TestLostPassword extends UnitTestCase {
  		$this->assertTrue(is_string($res));
  		//var_dump($res);
 	}
-	
+
 	function testget_secret_word(){
 		global $_configuration;
 		$add='';
@@ -20,7 +20,7 @@ class TestLostPassword extends UnitTestCase {
  		$this->assertTrue(is_string($res));
  		//var_dump($res);
 	}
-	
+
 	function testget_user_account_list(){
 		global $_configuration;
 		$user='';
@@ -33,9 +33,9 @@ class TestLostPassword extends UnitTestCase {
  		$this->assertTrue(is_array($userAccountList));
  		//var_dump($userAccountList);
 	}
-	
+
 	function testhandle_encrypted_password() {
-		require_once api_get_path (LIBRARY_PATH).'mail.lib.inc.php'; 
+		require_once api_get_path (LIBRARY_PATH).'mail.lib.inc.php';
 		global $charset;
 		global $_configuration;
 		ob_start();
@@ -44,7 +44,7 @@ class TestLostPassword extends UnitTestCase {
 		$emailSubject = "[".api_get_setting('siteName')."] ".get_lang('LoginRequest'); // SUBJECT
 		$userAccountList = get_user_account_list($user, true); // BODY
 		$emailTo = $user[0]["email"];
-		$secretword = get_secret_word($emailTo);	
+		$secretword = get_secret_word($emailTo);
 		$emailBody = get_lang('DearUser')." :\n".get_lang("password_request")."\n\n";
 		$emailBody .= "-----------------------------------------------\n".$userAccountList."\n-----------------------------------------------\n\n";
 		$emailBody .=get_lang('PasswordEncryptedForSecurity');
@@ -54,9 +54,9 @@ class TestLostPassword extends UnitTestCase {
 		$res=handle_encrypted_password($user);
 		if(!is_array($res))$this->assertTrue(is_null($res));
 		ob_end_clean();
-		//var_dump($res);	
+		//var_dump($res);
 	}
-	
+
 	function testreset_password(){
 		$secret='1234567891011';
 		$id=5;
@@ -65,7 +65,7 @@ class TestLostPassword extends UnitTestCase {
  		$this->assertTrue(is_string($res));
  		//var_dump($res);
 	}
-	
+
 	function testsend_password_to_user() {
 		$user=array();
 		ob_start();

+ 24 - 24
tests/main/auth/openid/openid.lib.test.php

@@ -21,7 +21,7 @@ define('OPENID_NS_1_0', 'http://openid.net/signon/1.0');
 
 
 class TestOpenId extends UnitTestCase {
-	
+
 	function test_openid_create_message() {
 		$data='';
 		$serialized .= "$key:$value\n";
@@ -30,7 +30,7 @@ class TestOpenId extends UnitTestCase {
 		$this->assertTrue(is_string($serialized));
 		//var_dump($serialized);
 	}
-	
+
 	function test_openid_dh_base64_to_long() {
 		$str='';
 	    $b64 = base64_decode($str);
@@ -39,7 +39,7 @@ class TestOpenId extends UnitTestCase {
 		$this->assertTrue(is_string($b64));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_dh_binary_to_long() {
 		$str='';
 		$bytes = array_merge(unpack('C*', $str));
@@ -48,21 +48,21 @@ class TestOpenId extends UnitTestCase {
 		$this->assertTrue(is_array($bytes));
 		//var_dump($bytes);
 	}
-	
+
 	function test_openid_dh_long_to_base64() {
 		$str='';
 		$res=_openid_dh_long_to_base64($str);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_dh_long_to_binary() {
 		$long='';
 		$res=_openid_dh_long_to_binary($long);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_dh_rand() {
 		$stop='';
 		$rbytes = _openid_dh_long_to_binary($stop);
@@ -77,7 +77,7 @@ class TestOpenId extends UnitTestCase {
 		//var_dump($res);
 		//var_dump($duplicate_cache);
 	}
-	
+
 	function test_openid_dh_xorsecret() {
 		$shared='';
 		$secret='';
@@ -85,21 +85,21 @@ class TestOpenId extends UnitTestCase {
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_encode_message() {
 		$message='';
 		$res=_openid_encode_message($message);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_fix_post() {
 		$post='';
 		$res=_openid_fix_post($post);
 		$this->assertTrue(is_null($res));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_get_bytes() {
 		static $f = null;
 		$num_bytes='';
@@ -107,7 +107,7 @@ class TestOpenId extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_hmac() {
 		$key='';
 		$text='';
@@ -115,14 +115,14 @@ class TestOpenId extends UnitTestCase {
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_is_xri() {
 		$identifier='';
 		$res=_openid_is_xri($identifier);
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_link_href() {
 		$rel='';
 		$html='';
@@ -130,7 +130,7 @@ class TestOpenId extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_meta_httpequiv() {
 		$equiv='';
 		$html='';
@@ -138,34 +138,34 @@ class TestOpenId extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_nonce() {
 		$res=_openid_nonce();
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_normalize() {
 		$identifier='';
 		$res=_openid_normalize($identifier);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_normalize_url() {
 		$url='';
 		$res=_openid_normalize_url($url);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_normalize_xri() {
 		$xri='';
 		$res=_openid_normalize_xri($xri);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_parse_message() {
 		$message='';
 		$parsed_message = array();
@@ -173,14 +173,14 @@ class TestOpenId extends UnitTestCase {
 		$this->assertTrue(is_array($res));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_sha1() {
 		$text='';
 		$res=_openid_sha1($text);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function test_openid_signature() {
 		$association='';
 		$message_array='';
@@ -189,7 +189,7 @@ class TestOpenId extends UnitTestCase {
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function testbcpowmod() {
 		$base='';
 		$exp='';
@@ -198,7 +198,7 @@ class TestOpenId extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	function testopenid_redirect() {
 		$url='http://localhost/dokeossvn186/tests/all.test2.php';
 		$message='';
@@ -208,7 +208,7 @@ class TestOpenId extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	function testopenid_redirect_http() {
 		$url='http://localhost/dokeossvn186/tests/all.test2.php';
 		$message='';

+ 5 - 5
tests/main/auth/openid/xrds.lib.test.php

@@ -2,7 +2,7 @@
 require_once(api_get_path(SYS_CODE_PATH).'auth/openid/xrds.lib.php');
 
 class TestXrds extends UnitTestCase {
-	
+
 	function testxrds_cdata() {
 		global $xrds_open_elements, $xrds_services, $xrds_current_service;
 		$parser='';
@@ -11,7 +11,7 @@ class TestXrds extends UnitTestCase {
 		$this->assertTrue(is_null($res));
 		//var_dump($res);
 	}
-	
+
 	function test_xrds_element_end() {
 		 global $xrds_open_elements, $xrds_services, $xrds_current_service;
 		 $parser='';
@@ -24,7 +24,7 @@ class TestXrds extends UnitTestCase {
 		 $this->assertTrue(is_null($res));
 		 //var_dump($xrds_current_service);
 	}
-	
+
 	function test_xrds_element_start() {
 		global $xrds_open_elements;
 		$parser='';
@@ -35,12 +35,12 @@ class TestXrds extends UnitTestCase {
 		$this->assertTrue(is_null($res));
 		//var_dump($res);
 	}
-	
+
 	function test_xrds_strip_namespace() {
 		$name='';
 		$res=_xrds_strip_namespace($name);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
-	}		
+	}
 }
 ?>

+ 5 - 5
tests/main/chat/chat_functions.lib.test.php

@@ -1,16 +1,16 @@
 <?php
 require_once(api_get_path(SYS_CODE_PATH).'chat/chat_functions.lib.php');
-require_once(api_get_path(LIBRARY_PATH).'course.lib.php'); 
+require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
 
 Mock::generate('CourseManager');
 class TestChatFunctions extends UnitTestCase {
-	
+
 	function testdisconnect_user_of_chat() {
 		$res = disconnect_user_of_chat();
  		$this->assertTrue(is_null($res));
  		//var_dump($res);
 	}
-	
+
 	function testexit_of_chat () {
 		$docu = new MockCourseManager();
 		$user_id=1;
@@ -20,7 +20,7 @@ class TestChatFunctions extends UnitTestCase {
  		$this->assertTrue(is_null($res));
  		//var_dump($res);
 	}
-	
+
 	function testuser_connected_in_chat () {
 		$user_id=1;
 		$database_name='';
@@ -28,7 +28,7 @@ class TestChatFunctions extends UnitTestCase {
  		$this->assertTrue(is_bool($res));
  		//var_dump($res);
 	}
-	
+
 	function testusers_list_in_chat () {
 		$res = users_list_in_chat();
  		$this->assertTrue(is_array($res));

+ 1 - 1
tests/main/conference/get_translation.lib.test.php

@@ -2,7 +2,7 @@
 require_once(api_get_path(SYS_CODE_PATH).'conference/get_translation.lib.php');
 
 class TestGetTranslation extends UnitTestCase {
-	
+
 	function testget_language_file_as_xml(){
 		$res=get_language_file_as_xml($language='english');
 		$this->assertTrue(($res));

+ 32 - 32
tests/main/exercice/hotpotatoes.lib.test.php

@@ -2,7 +2,7 @@
 require_once(api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php');
 
 class TestHotpotatoes extends UnitTestCase {
-	
+
 	function testCheckImageName() {
 		$imgparams=array();
 		$string='';
@@ -12,14 +12,14 @@ class TestHotpotatoes extends UnitTestCase {
 		$this->assertTrue(is_bool($checked));
 		//var_dump($res);
 	}
-	
+
 	function testCheckSubFolder() {
 		$path='Location: /main/exercice/';
 		$res=CheckSubFolder($path);
 		$this->assertTrue(is_numeric($res));
 		//var_dump($res);
 	}
-	
+
 	function testFillFolderName() {
 		$name='12doceletras';
 		$nsize=12;
@@ -27,21 +27,21 @@ class TestHotpotatoes extends UnitTestCase {
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function testGenerateHiddenList() {
 		$imgparams=array('abc');
 		$res=GenerateHiddenList($imgparams);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function testGenerateHpFolder() {
 		$folder='main/exercice/hotpotatoes.lib.php';
 		$res=GenerateHpFolder($folder);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
-	} 
-	 
+	}
+
 	function testGetComment() {
 		global $dbTable;
 		$path = 'test';
@@ -51,69 +51,69 @@ class TestHotpotatoes extends UnitTestCase {
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
-	/*  Deprecated 
+
+	/*  Deprecated
 	function testGetFileName() {
 		$fname='main/exercice/hotpotatoes.lib.php';
 		$res=GetFileName($fname);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}*/
-	 
+
 	function testGetFolderName() {
 		$fname='main/exercice/hotpotatoes.lib.php';
 		$res=GetFolderName($fname);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function testGetFolderPath() {
 		$fname='main/exercice/hotpotatoes.lib.php';
 		$res=GetFolderPath($fname);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function testGetImgName() {
 		$imgtag='<img src="example.jpg">';
 		$res=GetImgName($imgtag);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
-	}	
-	
+	}
+
 	function testGetImgParams() {
 		$fname='/main/css/academica/images/bg.jpg';
 		$fpath='main/css/academica/images/';
 		$imgparams= array();
-		$imgcount='';	
+		$imgcount='';
 		$res=GetImgParams($fname,$fpath,&$imgparams,&$imgcount);
 		$this->assertTrue(is_null($res));
 		//var_dump($res);
 	}
-	
+
 	function testGetQuizName() {
 		$fname='exercice_submit.php';
 		$fpath='main/exercice/exercice_submit.php';
 		$res=GetQuizName($fname,$fpath);
 		$this->assertTrue(is_string($res));
-		//var_dump($e_contents);	
+		//var_dump($e_contents);
 	}
-	
-	function testGetSrcName() {	
+
+	function testGetSrcName() {
 		$imgtag='src="test.jpg""';
 		$res=GetSrcName($imgtag);
 		if(!is_string($res))$this->assertTrue(is_bool($res));
-		//var_dump($res);	
+		//var_dump($res);
 	}
-	
+
 	function testhotpotatoes_init() {
 		$base = api_get_path(SYS_CODE_PATH);
 		$baseWorkDir=$base.'exercice/';
 		$res=hotpotatoes_init($baseWorkDir);
 		$this->assertFalse($res);
-		//var_dump($res);	
+		//var_dump($res);
 	}
-	
+
 	function testhotpotatoes_initWithRemoveFolder() {
 		$base = '/tmp/';
 		$baseWorkDir=$base.'test123/';
@@ -122,38 +122,38 @@ class TestHotpotatoes extends UnitTestCase {
 		rmdir($baseWorkDir);
 		//var_dump($res);
 	}
-	
-	function testHotPotGCt() { 
+
+	function testHotPotGCt() {
 		$folder='/main/exercice';
 		$flag=4;
 		$userID=1;
 		$res=HotPotGCt($folder,$flag,$userID);
 		$this->assertTrue(is_null($res));
-		//var_dump($res);	
+		//var_dump($res);
 	}
-	
+
 	function testmyarraysearch() {
 		$array=array();
 		$node='';
 		$res=myarraysearch($array,$node);
 		if(!is_bool($res))$this->assertTrue(is_null($res));
-		//var_dump($res);	
+		//var_dump($res);
 	}
-	
+
 	function testReadFileCont() {
 		$full_file_path='';
 		$res=ReadFileCont($full_file_path);
 		if(!is_bool($res))$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function testReplaceImgTag() {
 		$content='src="test2.jpg"';
 		$res=ReplaceImgTag($content);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	function testSetComment() {
 		global $dbTable;
 		$path='/main/exercice';
@@ -165,7 +165,7 @@ class TestHotpotatoes extends UnitTestCase {
 		$this->assertTrue(is_string($res));
 		//var_dump($resu);
 	}
-	
+
 	function testWriteFileCont() {
 		$full_file_path='/main/exercice/';
 		$content='test test test';

+ 5 - 5
tests/main/inc/banner.inc.test.php

@@ -1,11 +1,11 @@
 <?php
 
 class TestBanner extends UnitTestCase{
-	
+
 	public function TestBanner(){
-		
+
 		$this->UnitTestCase('Determine the tabs function tests');
-	
+
 	}
 	public function testGetTabs(){
 		global $_course, $rootAdminWeb, $_user;
@@ -16,7 +16,7 @@ class TestBanner extends UnitTestCase{
 		$this->assertTrue(is_array($res));
 		$this->assertTrue($res);
 		//var_dump($res);
-	}	
-	
+	}
+
 }
 ?>

+ 9 - 9
tests/main/inc/course_document.inc.test.php

@@ -1,13 +1,13 @@
 <?php
 
 class Testcdocu extends UnitTestCase{
-	
+
 	public function Testcdocu(){
-		
+
 		$this->UnitTestCase('Determine the course of document function tests');
-	
+
 	}
-	
+
 	public function testGetlist(){
 		$directory='';
 		$res = getlist($directory);
@@ -19,7 +19,7 @@ class Testcdocu extends UnitTestCase{
 		}
 		//var_dump($res);
 	}
-	
+
 	public function testCheckAndCreateResourceDirectory(){
 		global $_course, $_user;
 		global $group_properties, $to_group_id;
@@ -33,11 +33,11 @@ class Testcdocu extends UnitTestCase{
 		$res = check_and_create_resource_directory($repository_path, $resource_directory, $resource_directory_name);
 		$this->assertTrue(is_bool($res));
 		$this->assertTrue($res === true || $res === false);
-		var_dump($res);		
+		var_dump($res);
 	}
-	
-	
-	
+
+
+
 }
 
 

+ 48 - 48
tests/main/inc/lib/add_course.lib.inc.test.php

@@ -2,22 +2,22 @@
 require_once(api_get_path(LIBRARY_PATH).'add_course.lib.inc.php');
 
 class TestAddCourse extends UnitTestCase {
-	
+
 	function TestAddCourse() {
         $this->UnitTestCase('Courses creation tests');
     }
-	
+
     function testRegisterCourse() {
-        //($courseSysCode, $courseScreenCode, $courseRepository, $courseDbName, 
+        //($courseSysCode, $courseScreenCode, $courseRepository, $courseDbName,
 		//$titular, $category, $title, $course_language, $uidCreator, $expiration_date = "", $teachers=array())
 	    $course = array(
-		    'courseSysCode'=> 'COD12', 
-		    'courseScreenCode' =>'221', 
-		    'courseRepository' =>'21', 
-		    'courseDbName' =>'ARITM', 
-		    'titular' =>'R. Wofgar', 
-		    'category' =>'Math', 
-		    'title' =>'metodologia de calculo diferencial',  
+		    'courseSysCode'=> 'COD12',
+		    'courseScreenCode' =>'221',
+		    'courseRepository' =>'21',
+		    'courseDbName' =>'ARITM',
+		    'titular' =>'R. Wofgar',
+		    'category' =>'Math',
+		    'title' =>'metodologia de calculo diferencial',
 		    'course_language' =>'English',
 		    'uidCreator'=> '212',
 			 	);
@@ -26,12 +26,12 @@ class TestAddCourse extends UnitTestCase {
 	 						   $course['category'],$course['title'],$course['course_language'],
 	 						   $course['uidCreator'],null,null);
 	 	$this->assertPattern('/\d/',$res);
-	 
+
 	}
-	
+
     function TestCreateCourse(){
-		//$wanted_code, $title, $tutor_name, $category_code, 
-		//$course_language, $course_admin_id, $db_prefix, 
+		//$wanted_code, $title, $tutor_name, $category_code,
+		//$course_language, $course_admin_id, $db_prefix,
 		//$firstExpirationDelay
 		$course_datos = array(
 				'wanted_code'=> 'COD12',
@@ -48,38 +48,38 @@ class TestAddCourse extends UnitTestCase {
 							 $course_datos['tutor_name'], $course_datos['category_code'],
 							 $course_datos['course_language'],$course_datos['course_admin_id'],
 							 $course_datos['db_prefix'], $course_datos['firstExpirationDelay']);
-							 
+
 		$this->assertFalse($res===0);
-		
+
     }
-   
+
     function TestGenerateCourseCode(){
     	global $charset;
     	$course_title = 'matemáticas';
     	$res = generate_course_code($course_title);
     	$this->assertTrue($res);
-      				
+
 	}
-	
+
 	function TestDefineCourseKeys(){
-		//$wantedCode, $prefix4all = "", $prefix4baseName = "", 
+		//$wantedCode, $prefix4all = "", $prefix4baseName = "",
 		//$prefix4path = "", $addUniquePrefix = false, $useCodeInDepedentKeys = true
 		global $prefixAntiNumber, $_configuration;
 		$wantedCode = generate_course_code($wantedCode);
 		$res = define_course_keys(generate_course_code($wantedCode), null, null, null,null, null);
 		$this->assertTrue($res);
-		
+
 	}
-	
+
 	function TestPrepareCourseRepository(){
 		$courseRepository = '';
 		$courseId = '';
 		$res = prepare_course_repository($courseRepository, $courseId);
 		$this->assertTrue($res===0);
 	}
-	
+
 	/**
-	 * Function not implemented with test, because the functionality 
+	 * Function not implemented with test, because the functionality
 	 * is very complex.
 	 */
 	/*
@@ -88,38 +88,38 @@ class TestAddCourse extends UnitTestCase {
 		$dbcourse = array('courseDbName'=> 'curso');
 		$res = update_Db_course($dbcourse['courseDbName']);
 		$this->assertFalse($res===0);
-	
+
 	}*/
-	
+
 	function TestBrowseFolders(){
 		$browse = array('path'=>'','file'=>'','media'=>'');
 		$res = browse_folders($browse['path'], $browse['files'],$browse['media']);
 		$this->assertFalse($res);
-		
+
 	}
-	
+
 	function TestSortPictures(){
 		$files ='121212';
 		$type='asasasasa';
 		$res = sort_pictures($files, $type);
 		$this->assertFalse($res);
-		
+
 	}
-	
+
 	function TestFillCourseRepository(){
 		$courseRepository = '1212sder';
 		$res = fill_course_repository($courseRepository);
 		$this->assertTrue($res);
-		
+
 	}
-	
+
 	function TestLang2db(){
 		$string = 'dsdzxcwqd';
 		$res = lang2db($string);
 		$this->assertTrue($res);
-	
+
 	}
-	
+
 	function TestFillDbCourse(){
 		global $_configuration, $clarolineRepositoryWeb, $_user;
 		$courseDbName = $_configuration['table_prefix'].$courseDbName.$_configuration['db_glue'];
@@ -128,27 +128,27 @@ class TestAddCourse extends UnitTestCase {
 		$default_document_array ='1212121';
 		$res = fill_Db_course($courseDbName, $courseRepository, $language,$default_document_array);
 		$this->assertTrue($res === 0);
-		
+
 	}
-	
+
 	function TestString2Binary(){
 		$variable = true;
 		$res = string2binary($variable);
 		$this->assertTrue($res);
-		
-		
+
+
 	}
-	
+
 	function TestCheckArchive(){
 		$pathToArchive ='';
 		$res = checkArchive($pathToArchive);
 		$this->assertTrue($res === TRUE);
-	
+
 	}
-	
+
 	/**
-	 * Fatal Error at the call to undefined function printVar() Line 2404 in the 
-	 * add_course.lib.inc.php 
+	 * Fatal Error at the call to undefined function printVar() Line 2404 in the
+	 * add_course.lib.inc.php
 	 */
 	/*
 	function TestReadPropertiesInArchive(){
@@ -157,8 +157,8 @@ class TestAddCourse extends UnitTestCase {
 		printVar(dirname($archive), "Zip : ");
 		$res = readPropertiesInArchive($archive, $isCompressed = TRUE);
 		$this->assertTrue($res);
-	 	
-	  	
+
+
 	 	ob_start();
 	 	//readPropertiesInArchive($archive, $isCompressed = TRUE);
 		$res = ob_get_contents(readPropertiesInArchive);
@@ -166,7 +166,7 @@ class TestAddCourse extends UnitTestCase {
 		$this->assertFalse($res);
 		}
 		*/
-	
-	
-	
+
+
+
 }

+ 109 - 109
tests/main/inc/lib/blog.lib.test.php

@@ -3,28 +3,28 @@ require_once(api_get_path(LIBRARY_PATH).'blog.lib.php');
 //require_once(api_get_path(SYS_CODE_PATH).'permissions/blog_permissions.inc.php');
 
 
-class TestBlog extends UnitTestCase 
+class TestBlog extends UnitTestCase
 
 {
 	 public $oblog;
-	 public function TestBlog() 
-	 
+	 public function TestBlog()
+
 	 {
-	 	
+
 	 	$this->UnitTestCase('Blog Manipulation tests');
-	 	
+
 	 }
-	 
+
 	 public function setUp()
 	 {
  	 	$this-> oblog = new Blog();
 	 }
-	 
+
 	 public function tearDown()
 	 {
 	 	$this->oblog = null;
 	 }
-	 	
+
 	 /*
 	 * todo public function testGetBlobTitle()
 	 * todo public function testGetBlogSubtitle()
@@ -73,42 +73,42 @@ class TestBlog extends UnitTestCase
 	 * todo public function testDisplayBlogList()
 	 * todo public function testDisplayBlogList()
 	 */
-	 
+
 	 /**
 	  * Test about get Title to a Blog
 	 */
-		
+
 	 public function testGetBlogTitle(){
 	 	$res = $this->oblog->get_Blog_title(11);
 	 	$this->assertFalse($this->oblog->get_Blog_title(11)===String);
 	 	$this->assertTrue(is_String($res));
-	 		 
+
 	 }
-	 
+
 	 public function testGetBlogSubtitle(){
 	  	$res = $this->oblog->get_Blog_subtitle(0);
 	 	$this->assertFalse($this->oblog->get_Blog_subtitle(0)=== null);
 	 	$this->assertTrue(is_String($res));
 	 	$this->assertNotNull($res);
-	 	
+
 	 }
-	 
+
 	 public function testGetBlogUsers(){
 	 	$res = $this->oblog->get_Blog_users(11);
 	 	$this->assertTrue($this->oblog->get_Blog_users(1110)===array());
 	 	$this->assertTrue(is_array($res));
-	 	
+
 	 }
-	 
+
 	 public function testCreateBlog(){
 	 	global $_user;
 	 	$res = $this->oblog->create_Blog('testingBlog','pass');
 	 	$this->assertFalse(is_null($res));
 	 	$this->assertNotNull($res);
 		$this->assertTrue($res);
-			 	
+
 	 }
-	 
+
 	 public function testEditBlog(){
 	 	global $_user;
 	 	$_user = array('Blog_id'=>1,'title'=>'TestBlog','subtitle'=>'testing');
@@ -117,19 +117,19 @@ class TestBlog extends UnitTestCase
 	 	$this->assertTrue($this->oblog->edit_Blog($_user)=== $res);
 		$this->assertTrue($res);
 	 }
-	 
+
 	 public function testDeleteBlog(){
 	 	$res = $this->oblog->delete_Blog(1);
 	 	$this->assertTrue(is_string($res));
 	 	$this->assertNotNull($this->oblog->edit_Blog(1)===null);
 	 	$this->assertFalse(is_array($res));
 	 	$this->assertTrue($res);
-		 
+
 	 }
 	 public function testCreatePost(){
 	 	global $_user, $_course, $Blog_table_attachment;
-	 	$Blog_table_attachment = array('title' => 'xxxxtestxxxx', 
-	 								   'full_text'=>'xxxxx', 
+	 	$Blog_table_attachment = array('title' => 'xxxxtestxxxx',
+	 								   'full_text'=>'xxxxx',
  	 	  						       'file_comment'=>'xxxxx',
 	 								   'Blog_id'=>11
 	 								  );
@@ -137,9 +137,9 @@ class TestBlog extends UnitTestCase
 	 	$this->assertFalse($this->oblog->create_post($Blog_table_attachment)=== null);
 	 	$this->assertNotNull(is_null,$res);
 	 	$this->assertTrue($res);
-	 		   
+
 	 }
-	 
+
 	 public function testEditPost(){
 	 	$post_id =3;
 	 	$title = 'xxTestxx';
@@ -149,9 +149,9 @@ class TestBlog extends UnitTestCase
 		$this->assertNotNull($this->oblog->edit_post(3, 'xtestx','test',11)===null);
 		$this->assertTrue($res);
 		$this->assertTrue(is_string($res));
-		 	
+
 	 }
-	 
+
 	 public function testDeletePost(){
 	 	$Blog_id = 11;
 	 	$post_id = 21;
@@ -159,33 +159,33 @@ class TestBlog extends UnitTestCase
 	 	$this->assertFalse($this->oblog->delete_post(11,21)===null);
 	 	$this->assertNull(null,$res);
 	 	$this->assertTrue(is_string($res));
-	 	
+
 	 }
-	 
+
 	 public function testCreateComment(){
 	 	global $_user, $_course, $Blog_table_attachment;
 	 	$res = $this->oblog->create_comment('tesingBlog','xxxxxxx','xxx',12,1,null);
 	 	$this->assertNotNull($this->oblog->create_comment('tesingBlog','xxxxxxx','xxx',12,1,null)===null);
 	 	$this->assertFalse(is_null($res));
 	 	$this->assertTrue($res);
-	 
+
 	 }
-	 
+
 	 public function testDeleteComment(){
 	 	$res = $this->oblog->delete_comment(11,12,2);
 	 	$this->assertNotNull($this->oblog->delete_comment(11,12,2)===null);
 	 	$this->assertNull(null,$res);
 	 }
-	 
+
 	 public function testCreateTask(){
 		$res = $this->oblog->create_task(1,'xxx','xxxxxxx','xxxx','zzzzz','xxzz','blue');
 		$this->assertNotNull($this->oblog->create_task(1,'xxx','xxxxxxx','xxxx','zzzzz','xxzz','blue')=== null);
 		$this->assertFalse(is_null($res));
 		$this->assertTrue($res);
 		$this->assertFalse(null,$res);
-	 
+
 	 }
-	 
+
 	 public function testEditTask() {
 	 	$res = $this->oblog->edit_task();
 	 	//$res = Blog::edit_task();
@@ -193,24 +193,24 @@ class TestBlog extends UnitTestCase
 	 	$this->assertFalse(is_null($res));
 	 	$this->assertTrue(is_string($res));
 	 	$this->assertNotNull($res);
-	 	
+
 	 }
-	 
+
 	 public function testDeleteTask(){
 	 	$res = $this->oblog->delete_task();
 	 	$this->assertFalse($this->oblog->delete_task()===null);
 	 	$this->assertTrue(is_string($res));
-	 	
+
 	 }
-	
+
 	 public function testDeleteAssignedTask(){
 	 	$res = $this->oblog->delete_assigned_task();
 	 	$this->assertFalse($this->oblog->delete_assigned_task()===null);
 	 	$this->assertNotNull(is_null($res));
 	 	$this->assertTrue($res);
-	 	
-	 }		
-	 
+
+	 }
+
 	 public function testGetPersonalTaskList(){
 	 	global $_user;
 	 	ob_start();
@@ -219,14 +219,14 @@ class TestBlog extends UnitTestCase
 	 	$this->assertFalse($res);
 	 	ob_end_clean();
 	 }
-	 
+
 	 public function testChangeBlogVisibility(){
 	 	$res = $this->oblog->change_blog_visibility();
 	 	$this->assertFalse($this->oblog->change_blog_visibility()=== null);
-	 	$this->assertTrue(is_string($res));	 	
-	 	
+	 	$this->assertTrue(is_string($res));
+
 	 }
-	 
+
 	 public function testDisplayBlogPosts(){
 	 	ob_start();
 	 	$res = $this->oblog->display_blog_posts(10,null,null);
@@ -235,17 +235,17 @@ class TestBlog extends UnitTestCase
 	 	$this->assertTrue(is_null($res));
 	 	$this->assertFalse(null, $res);
 	 	ob_end_clean();
-	 	
+
 	 }
-	 
+
 	 public function testDisplaySearchResults(){
 	 	ob_start();
 		$res = $this->oblog->display_search_results(11,null);
 		$this->assertTrue($this->oblog->display_search_results(11,null)===null);
 		ob_end_clean();
-			 	
+
 	 }
-	 
+
 	 public function testDisplayDayResults(){
 	 	ob_start();
 	 	$res = $this->oblog->display_day_results(12,null);
@@ -253,9 +253,9 @@ class TestBlog extends UnitTestCase
 	 	$this->assertFalse($res);
 	 	$this->assertNull(null,$res);
 	 	ob_end_clean();
-	 	
+
 	 }
-	 
+
 	 public function testDisplayPost(){
 	 	ob_start();
 	 	$res = $this->oblog->display_post(12,11);
@@ -263,7 +263,7 @@ class TestBlog extends UnitTestCase
 	 	$this->assertFalse($res);
 	 	$this->assertTrue(is_null($res));
 	 	ob_end_clean();
-	 	
+
 	 }
 
 	 public function testAddRating(){
@@ -272,9 +272,9 @@ class TestBlog extends UnitTestCase
 	 	$this->assertFalse($this->oblog->add_rating(null,11,2,5)=== bool);
 	 	$this->assertTrue(is_bool($res));
 	 	$this->assertFalse(null,$res);
-	 	
+
 	 }
-	 
+
 	 public function testDisplayRating(){
 	 	ob_start();
 	 	$res = $this->oblog->display_rating('xxx',11,1);
@@ -282,19 +282,19 @@ class TestBlog extends UnitTestCase
 	 	$this->assertTrue(is_numeric($res));
 	 	$this->assertFalse($res);
 	 	ob_end_clean();
-	 	
+
 	 }
-	 
+
 	 public function testDisplayRatingForm(){
 	 	global $_user;
 	 	$res = $this->oblog->display_rating_form('xxx',11,1,null);
 	 	$this->assertFalse($this->oblog->display_rating_form('xxx',11,1,null)===null);
 	 	$this->assertTrue(is_string($res));
 	 	$this->assertNotNull($res,null);
-	 	
-	 	
+
+
 	 }
-	 
+
 	 public function testGetThreadedComments(){
 	 	ob_start();
 	 	global $charset, $dataFormatLong;
@@ -302,7 +302,7 @@ class TestBlog extends UnitTestCase
 	 	$this->assertFalse($res);
 	 	$this->assertTrue($this->oblog->get_threaded_comments(null,null,11,2,null)===null);
 	 	ob_end_clean();
-	 		 	
+
 	 }
 	 /**
 	  * this function have will be testing with mocks
@@ -317,27 +317,27 @@ class TestBlog extends UnitTestCase
 	 	$this->assertTrue(is_string($res));
 	 	$this->assertNotNull($res);
 	 	ob_end_clean();
-	 	
+
 	 } */
 	/* usando mock
 	 public function testDisplayFormEditPost(){
 	 	ob_start();
 	 	$res = $this->oblog->display_form_edit_post(11,12);
-	 	
+
 	 	$this->assertNotNull(is_null($res));
 	 	$this->assertFalse($res);
 	 	ob_end_clean();
-	 
+
 	 }	*/
-	 
+
 	 public function testDisplayTaskList(){
 	 	ob_start();
 	 	$res = $this->oblog->display_task_list(11);
 	 	$this->assertTrue($this->oblog->display_task_list(11)===null);
 	 	ob_end_clean();
-	 	
+
 	 }
-	 
+
 	 public function testDisplayAssignedTaskList(){
 	 	ob_start();
 	 	global $charset, $color2;
@@ -345,18 +345,18 @@ class TestBlog extends UnitTestCase
 	 	$this->assertTrue($this->oblog->display_assigned_task_list(11)===null);
 	 	$this->assertFalse($res);
 	 	ob_end_clean();
-	  	
+
 	 }
-	 
+
 	 public function testDisplayNewTaskForm(){
 	 	ob_start();
 	 	$res = $this->oblog->display_new_task_form(11);
 	 	$this->assertTrue($this->oblog->display_new_task_form(11)===null);
 	 	$this->assertFalse($res);
 	 	ob_end_clean();
-	 	
+
 	 }
-	 
+
 	 public function testDisplayEditTaskForm(){
 	 	ob_start();
 	 	$res = $this->oblog->display_edit_task_form(11,12);
@@ -364,9 +364,9 @@ class TestBlog extends UnitTestCase
 	 	ob_end_clean();
 	 	$this->assertTrue(is_null($res));
 	 	$this->assertFalse($res);
-	 	
+
 	 }
-	
+
 	 public function testDisplayAssignTaskForm(){
 	 	ob_start();
 	 	$res = $this->oblog->display_assign_task_form(11);
@@ -374,8 +374,8 @@ class TestBlog extends UnitTestCase
 	 	$this->assertFalse($res);
 	 	$this->assertTrue(is_null($res));
 	 	ob_end_clean();
-	 } 	
-	 
+	 }
+
 	 public function testDisplayEditAssignedTaskForm(){
 	 	global $MonthsLong;
 	 	ob_start();
@@ -383,24 +383,24 @@ class TestBlog extends UnitTestCase
 	 	$this->assertTrue($this->oblog->display_edit_assigned_task_form(11,12,1)===null);
 	 	ob_end_clean();
 	 	$this->assertFalse($res);
-	 	
+
 	 }
-	 
+
 	 public function testAssignTask(){
 	 	ob_start();
 	 	$res = $this->oblog->assign_task(11,1,12,null);
 	 	$this->assertTrue($this->oblog->assign_task(11,1,12,null)===null);
-	 	$this->assertFalse(is_numeric($res)); 	
+	 	$this->assertFalse(is_numeric($res));
 	 	$this->assertNull(null,$res);
 	 	ob_end_clean();
-	 		
+
 	 }
 
 	 public function testEditAssignedTask(){
-	 	$task = array('blog_id'=>11, 
-					  'user_id'=>1, 
-                      'task_id'=>12,  
-                      'target_date'=>'xxxxxxx',  
+	 	$task = array('blog_id'=>11,
+					  'user_id'=>1,
+                      'task_id'=>12,
+                      'target_date'=>'xxxxxxx',
                  	  'old_user_id'=>10,
                  	  'old_task_id'=>11,
                  	  'old_target_date'=>'xxxzxxx'
@@ -408,9 +408,9 @@ class TestBlog extends UnitTestCase
         $res = $this->oblog->edit_assigned_task();
         $this->assertTrue($this->oblog->edit_assigned_task()===null);
         $this->assertTrue(is_null($res));
-	 	
+
 	 }
-	 
+
 	 public function testDisplaySelectTaskPost(){
 	 	ob_start();
 	 	$res = $this->oblog->display_select_task_post(11,12);
@@ -418,25 +418,25 @@ class TestBlog extends UnitTestCase
 	 	$this->assertTrue(is_null($res));
 	 	$this->assertFalse($res);
 	 	ob_end_clean();
-			
+
 	 }
-	 
+
 	 public function testSetUserSubscribed(){
 	 	$res = $this->oblog->set_user_subscribed(11,12);
 	 	$this->assertTrue($this->oblog->set_user_subscribed(11,12)===null);
 	 	$this->assertFalse($res);
 	 	$this->assertTrue(is_null($res));
-	 	
+
 	 }
-	 
+
 	 public function testUserUnsubscribed(){
 	 	$res = $this->oblog->set_user_unsubscribed(11,12);
 	 	$this->assertTrue($this->oblog->set_user_unsubscribed(11,12)===null);
 	 	$this->assertFalse($res);
 	 	$this->assertTrue(is_null($res));
-	 	
+
 	 }
-	 
+
 	 public function testDisplayFormUserSubscribe(){
 	 	ob_start();
 	 	$res = $this->oblog->display_form_user_subscribe(12);
@@ -446,11 +446,11 @@ class TestBlog extends UnitTestCase
 	 	ob_end_clean();
 	}
 /**
- * this function have been tested modified the function 
+ * this function have been tested modified the function
  * display_form_user_unsubscribe in the blog.lib.php
  * main_table and course_table.
- * 
- */ /* usando mocks 
+ *
+ */ /* usando mocks
 	public function testDisplayFormUserUnsubscribe(){
 		ob_start();
 		global $_user;
@@ -460,9 +460,9 @@ class TestBlog extends UnitTestCase
 		$this->assertFalse($this->oblog->display_form_user_unsubscribe($blog_id,$course_id)==='');
 		$this->assertTrue(is_null($res));
 		ob_end_clean();
-		
+
 	}*/
-	
+
 	public function testDisplayFormUserRights(){
 		ob_start();
 		$res = $this->oblog->display_form_user_rights(12);
@@ -470,7 +470,7 @@ class TestBlog extends UnitTestCase
 		$this->assertFalse($res);
 		ob_end_clean();
 	}
-	/* usando mocks 
+	/* usando mocks
 	public function testDisplayNewCommentForm(){
 		$blog_id = '12';
 		$post_id='1';
@@ -484,7 +484,7 @@ class TestBlog extends UnitTestCase
 		ob_end_clean();
 		var_dump($res);
 	}*/
-	
+
 	public function testDisplayMinimonthcalendar(){
 		global $_user,$DaysShort, $MonthsLong;
 		ob_start();
@@ -492,9 +492,9 @@ class TestBlog extends UnitTestCase
 		$this->assertTrue($this->oblog->display_minimonthcalendar()=== null);
 		$this->assertTrue(is_null($res));
 		ob_end_clean();
-		
+
 	}
-		
+
 	public function testDisplayNewBlogForm(){
 		ob_start();
 		$res = $this->oblog->display_new_blog_form();
@@ -502,18 +502,18 @@ class TestBlog extends UnitTestCase
 		$this->assertTrue(is_null($res));
 		$this->assertTrue($this->oblog->display_new_blog_form()===null);
 		ob_end_clean();
-		
+
 	}
-	
+
 	public function testDisplayEditBlogForm(){
 		ob_start();
 		$res = $this->oblog->display_edit_blog_form(12);
 		$this->assertTrue($this->oblog->display_edit_blog_form(12)===null);
 		$this->assertTrue(is_null($res));
 		ob_end_clean();
-		
+
 	}
-	
+
 	public function testDisplayBlogList(){
 		ob_start();
 		$res = $this->oblog->display_blog_list();
@@ -521,7 +521,7 @@ class TestBlog extends UnitTestCase
 		$this->assertTrue(is_null($res));
 		ob_end_clean();
 	}
-	
+
 	public function testGetBlogAttachment(){
 		ob_start();
 		global $blog_table_attachment;
@@ -530,24 +530,24 @@ class TestBlog extends UnitTestCase
 		$this->assertFalse($res);
 		$this->assertTrue(is_array($res));
 		ob_end_clean();
-		
+
 	}
-	
+
 	public function testDeleteAllBlogAttachment(){
 		global $blog_table_attachment, $_course;
 		$res = delete_all_blog_attachment(12,null,null);
 		$this->assertFalse($res);
 		$this->assertNull($res);
-		
+
 	}
-	
+
 	public function testGetBlogPostFromUser(){
 		$res = get_blog_post_from_user('mate',2);
 		$this->assertFalse($res);
 		$this->assertTrue(is_string($res));
-		
+
 	}
-	
+
 	public function testGetBlogCOmmentFromUser(){
 		$res = get_blog_comment_from_user('mate',2);
 		$this->assertFalse($res);

+ 25 - 25
tests/main/inc/lib/classmanager.lib.test.php

@@ -2,90 +2,90 @@
 require_once(api_get_path(LIBRARY_PATH).'classmanager.lib.php');
 
 class TestClassManager extends UnitTestCase {
-	
+
 	function testAddUser() {
 		$user_id='1';
 		$class_id='1';
 		$res=ClassManager::add_user($user_id, $class_id);
 		$this->assertNull($res);
-		$this->assertTrue(is_null($res));	
+		$this->assertTrue(is_null($res));
 	}
-	
+
 	function testclass_name_exists() {
 		$name='arthur';
 		$res=ClassManager::class_name_exists($name);
-		$this->assertTrue(is_bool($res));	
+		$this->assertTrue(is_bool($res));
 	}
-	
+
 	function testCreateClass() {
 		$name='new class';
 		$res=ClassManager::create_class($name);
-		$this->assertTrue(is_bool($res));	
+		$this->assertTrue(is_bool($res));
 	}
-	
+
 	function testDeleteClass() {
 		$class_id='new class';
 		$res=ClassManager::delete_class($class_id);
-		$this->assertTrue(is_null($res));	
+		$this->assertTrue(is_null($res));
 	}
-	
+
 	function testGetClassId() {
 		$name='new class';
 		$res=ClassManager::get_class_id($name);
 		$this->assertTrue(is_numeric($res));
 	}
-	
+
 	function testGetClassInfo() {
 		$class_id='1';
 		$res=ClassManager::get_class_info($class_id);
-		$this->assertTrue(is_array($res));		
+		$this->assertTrue(is_array($res));
 	}
-	
+
 	function testGetClassesInCourse() {
 		$course_code='FDI';
 		$res=ClassManager::get_classes_in_course($course_code);
-		$this->assertTrue(is_array($res));		
+		$this->assertTrue(is_array($res));
 	}
-	
+
 	function testGetCourses() {
 		$class_id='1';
 		$res=ClassManager::get_courses($class_id);
-		$this->assertTrue(is_array($res));	
+		$this->assertTrue(is_array($res));
 	}
-	
+
 	function testGetUsers() {
 		$class_id='1';
 		$res=ClassManager::get_users($class_id);
-		$this->assertTrue(is_array($res));			
+		$this->assertTrue(is_array($res));
 	}
-	
+
 	function testSetName() {
 		$name='new class';
 		$class_id='1';
 		$res=ClassManager::set_name($name, $class_id);
-		$this->assertTrue(is_null($res));		
+		$this->assertTrue(is_null($res));
 	}
-	
+
 	function testSubscribeToCourse() {
 		$class_id='1';
 		$course_code='FDI';
 		$res=ClassManager::subscribe_to_course($class_id,$course_code);
-		$this->assertTrue(is_null($res));	
+		$this->assertTrue(is_null($res));
 	}
-	
+
 	function testUnsubscribeFromCourse() {
 		$class_id='1';
 		$course_code='FDI';
 		$res=ClassManager::unsubscribe_from_course($class_id, $course_code);
-		$this->assertTrue(is_null($res));		
+		$this->assertTrue(is_null($res));
 	}
-	
+
 	function testUnsubscribeUser() {
 		$user_id='1';
 		$class_id='1';
 		$res=ClassManager::unsubscribe_user($user_id, $class_id);
 		$this->assertTrue(is_null($res));
 	}
-	
+
 }
 ?>

+ 78 - 78
tests/main/inc/lib/course.lib.test.php

@@ -3,8 +3,8 @@
  * To can run this test you need comment this line or "die(mysql_error())" in 1345 course.lib.php
  *
  */
-require_once(api_get_path(LIBRARY_PATH).'course.lib.php'); 
-require_once(api_get_path(LIBRARY_PATH).'mail.lib.inc.php'); 
+require_once(api_get_path(LIBRARY_PATH).'course.lib.php');
+require_once(api_get_path(LIBRARY_PATH).'mail.lib.inc.php');
 require_once(api_get_path(LIBRARY_PATH).'database.lib.php');
 require_once(api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
 
@@ -13,24 +13,24 @@ Mock::generate('CourseManager');
 Mock::generate('Display');
 
 class TestCourse extends UnitTestCase{
-	
+
 	public $tcourse;
 	public function TestCourse(){
-		
+
 		$this->UnitTestCase('All main course function tests');
-		
+
 	}
-	
+
 	public function setUp(){
-		
+
 		$this->tcourse = new CourseManager();
 	}
-	
+
 	public function tearDown(){
 		$this->tcourse = null;
-		
+
 	}
-	
+
 	/*
 	 *todo public function testGetCourseInformation()
 	 *todo public function testGetCoursesList()
@@ -81,64 +81,64 @@ class TestCourse extends UnitTestCase{
 	 *todo public function testCreateCourseExtrField()
 	 *todo public function testUpdateCourseExtraFieldValue()
 	 */
-	
+
 	 public function testGetCourseInformation(){
 	  	$res = $this->tcourse->get_course_information(1211);
 	 	$this->assertFalse($res);
 		$this->assertTrue(is_bool($res));
-	 	$this->assertTrue($this->tcourse->get_course_information(1211)=== is_array($res));	 	
-	 	
+	 	$this->assertTrue($this->tcourse->get_course_information(1211)=== is_array($res));
+
 	 }
-	 
+
 	 public function testGetCoursesList(){
 	 	$res = $this->tcourse->get_courses_list();
 	 	$this->assertTrue(is_array($res));
-	 	//var_dump($res);	
+	 	//var_dump($res);
 	 }
-	 
+
 	 public function testGetAccessSettings(){
 	 	$res = $this->tcourse->get_access_settings(0001);
 	 	$this->assertFalse($res);
 	 	$this->assertTrue($this->tcourse->get_access_settings(0001)===is_array($res));
 	 	$this->assertFalse(is_null($res));
 	 }
-	 
+
 	 public function testGetUserInCourseStatus(){
 	 	$res = $this->tcourse->get_user_in_course_status(01,0001);
 		$this->assertFalse($res);
 		$this->assertTrue($this->tcourse->get_user_in_course_status(01,0001)===null);
 		$this->assertTrue(is_null($res));
 	 }
-	 
+
 	 public function testUnsubscribeUser(){
 	 	$res = $this->tcourse->unsubscribe_user();
 	 	$this->assertTrue($this->tcourse->unsubscribe_user()===null);
 	 	$this->assertNull($res);
-	 	$this->assertFalse(is_string($res));	
+	 	$this->assertFalse(is_string($res));
 	 }
-	 
+
 	 public function testSubscribeUser(){
 	 	$res = $this->tcourse->subscribe_user();
 	 	$this->assertFalse($res);
 	 	$this->assertTrue(is_bool($res));
-	 	$this->assertTrue($this->tcourse->subscribe_user()===false);	
+	 	$this->assertTrue($this->tcourse->subscribe_user()===false);
 	 }
-	 
+
 	public function testAddUserToCourse(){
 		$res = $this->tcourse->add_user_to_course();
 		$this->assertFalse($res);
 		$this->assertTrue($this->tcourse->add_user_to_course()=== false);
 		$this->assertTrue(is_bool($res));
 	}
-	
+
 	//function deprecated public function testGetRealCourseCodeSelectHtml(){}
-		
+
 	public function testCheckParameter(){
 		$res = $this->tcourse->check_parameter();
 		$this->assertFalse($res);
 		$this->assertFalse($this->tcourse->check_parameter()===bool);
 	}
-	
+
 	public function testCheckParameterOrFail(){
 		$parameter = 'course';
 		$error_message = 'upps';
@@ -146,19 +146,19 @@ class TestCourse extends UnitTestCase{
 		$this->assertTrue(is_null($res));
 		$this->assertFalse($res);
 		$this->assertTrue($res=== null);
-		$this->assertEqual($res,null);		
+		$this->assertEqual($res,null);
 	}
-	
+
 	public function testIsExistingCourseCode() {
 		$res = $this->tcourse->is_existing_course_code();
 		$this->assertTrue($this->tcourse->is_existing_course_code()===false);
 		$this->assertTrue(is_bool($res));
 	}
-	
+
 	/** Return a array() but now its empty, with this test is cheking is get the list course
 	 * @author Arthur Portugal <arthur.portugal@dokeos.com>
 	 */
-	
+
 	public function testGetRealCourseList(){
 		$realgrouplist = new MockDatabase();
 		$course_table = Database :: get_main_table(TABLE_MAIN_COURSE);
@@ -170,7 +170,7 @@ class TestCourse extends UnitTestCase{
 		$res=$this->courseManager->get_real_course_list();
 		$realgrouplist->expectOnce($real_course_list);
 		$this->assertTrue(is_array($real_course_list));
-		//var_dump($real_course_list);	
+		//var_dump($real_course_list);
 	}
 
 	public function testGetVirtualCourseList(){
@@ -180,56 +180,56 @@ class TestCourse extends UnitTestCase{
 		$result = Database::fetch_array($sql_result);
 		$virtual_course_list[] = $result;
 		$res=$this->tcourse->get_virtual_course_list();
-		
+
 		if (!empty($res)) {
 			$this->assertTrue(is_array($res));
 		} else {
 			$this->assertTrue(is_null($res));
 		}
-		
+
 	}
-	
+
 	public function testGetRealCourseListOfUserAsCourseAdmin(){
 		$res = $this->tcourse->get_real_course_list_of_user_as_course_admin();
 		$this->assertFalse($res);
 		$this->assertTrue(is_array($res));
-		$this->assertTrue($this->tcourse->get_real_course_list_of_user_as_course_admin()===array());			
+		$this->assertTrue($this->tcourse->get_real_course_list_of_user_as_course_admin()===array());
 	}
-	
+
 	public function testGetCourseListOfUserAsCourseAdmin(){
 		$res = $this->tcourse->get_course_list_of_user_as_course_admin();
 		$this->assertFalse($res);
 		$this->assertTrue(is_array($res));
 	}
-	
+
 	public function testDetermineCourseTitleFromCourseInfo(){
 		$res = $this->tcourse->determine_course_title_from_course_info();
 		$this->assertFalse($res);
 		$this->assertTrue(is_array($res));
-		$this->assertTrue($this->tcourse->determine_course_title_from_course_info()=== array());	
+		$this->assertTrue($this->tcourse->determine_course_title_from_course_info()=== array());
 	}
-	
+
 	public function testCreateCombinedName(){
 		$res = $this->tcourse->create_combined_name();
 		$this->assertFalse($res);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	public function testCreateCombinedCode(){
 		$res = $this->tcourse->create_combined_code();
 		$this->assertFalse($res);
 		$this->assertTrue(is_null($res));
 		$this->assertTrue($this->tcourse->create_combined_code()===null);
 	}
-	
+
 	public function testGetVirtualCourseInfo(){
 		$res = $this->tcourse->get_virtual_course_info();
 		$this->assertFalse($res);
 		$this->assertTrue(is_array($res));
-		$this->assertTrue($this->tcourse->get_virtual_course_info()===array());	
+		$this->assertTrue($this->tcourse->get_virtual_course_info()===array());
 	}
-	
+
 	public function testIsVirtualCourseFromSystemCode(){
 		$res = $this->tcourse->is_virtual_course_from_system_code();
 		$this->assertFalse($res);
@@ -237,28 +237,28 @@ class TestCourse extends UnitTestCase{
 		$this->assertTrue(is_bool($res));
 		$this->assertFalse($res,null);
 	}
-	
+
 	public function testIsVirtualCourseFromVisualCode(){
 		$res = $this->tcourse->is_virtual_course_from_visual_code();
 		$this->assertFalse($res);
 		$this->assertTrue(is_bool($res));
 		$this->assertFalse($this->tcourse->is_virtual_course_from_visual_code()===null);
 	}
-		
+
 	public function testHasVirtualCourseFromCode(){
 		$res = $this->tcourse->has_virtual_courses_from_code();
 		$this->assertFalse($res);
 		$this->assertTrue(is_bool($res));
-		$this->assertFalse(is_null($res));		
+		$this->assertFalse(is_null($res));
 	}
-	
+
 	public function testGetVirtualCourseLinkedToRealCourse(){
 		$res = $this->tcourse->get_virtual_courses_linked_to_real_course();
 		$this->assertFalse($res);
 		$this->assertTrue(is_array($res));
-		$this->assertFalse(is_null($res));		
+		$this->assertFalse(is_null($res));
 	}
-	
+
 	public function testGetTargetOfLinkedCourse(){
 		$res = $this->tcourse->get_target_of_linked_course();
 		$this->assertFalse($res);
@@ -266,67 +266,67 @@ class TestCourse extends UnitTestCase{
 		$this->assertTrue($this->tcourse->get_target_of_linked_course()===null);
 		$this->assertNull($res,true);
 	}
-	
+
 	public function testIsUserSubscribedInCourse(){
 		$res = $this->tcourse->is_user_subscribed_in_course();
 		$this->assertFalse($res);
 		$this->assertTrue(is_bool($res));
 		$this->assertTrue($this->tcourse->is_user_subscribed_in_course()===is_bool());
 	}
-	
+
 	public function testIsCourseTeacher(){
 		$res = $this->tcourse->is_course_teacher();
 		$this->assertTrue(is_bool($res));
 		$this->assertTrue($this->tcourse->is_course_teacher()===is_bool());
 		$this->assertFalse($res);
 	}
-	
+
 	public function testIsUserSubscribedInRealOrLinkedCourse(){
 		$res = $this->tcourse->is_user_subscribed_in_real_or_linked_course();
 		$this-> assertTrue(is_bool($res));
 		$this->assertFalse($this->tcourse->is_user_subscribed_in_real_or_linked_course()=== null);
-		$this->assertFalse($res);		
+		$this->assertFalse($res);
 	}
-	
+
 	public function testGetUserListFromCourseCode(){
 		$res = $this->tcourse->get_user_list_from_course_code();
 		$this->assertFalse($res);
 		$this->assertTrue(is_array($res));
 	}
-	
+
 	public function testGetCoachListFromCourseCode(){
 		$res = $this->tcourse->get_coach_list_from_course_code();
 		$this->assertFalse($res);
 		$this->assertTrue(is_array($res));
 		$this->assertTrue($this->tcourse->get_coach_list_from_course_code()===array());
 	}
-	
+
 	public function testGetStudentListFromCourseCode(){
 		$res = $this->tcourse->get_coach_list_from_course_code();
 		$this->assertFalse($res);
 		$this->assertTrue(is_array($res));
 	}
-	
+
 	public function testGetTeacherListFromCourseCode(){
 		$res = $this->tcourse->get_teacher_list_from_course_code();
 		$this->assertFalse($res);
 		$this->assertTrue(is_null($res));
 		$this->assertTrue($this->tcourse->get_teacher_list_from_course_code()===null);
 	}
-	
+
 	public function testGetRealAndLinkedUserList(){
 		$res = $this->tcourse->get_real_and_linked_user_list();
 		$this->assertFalse($res);
 		$this->assertTrue(is_null($res));
 		$this->assertTrue($this->tcourse->get_real_and_linked_user_list()===null);
 	}
-	
+
 	public function testGetListOfVirtualCoursesForSpecificUserAndRealCourse(){
 		$res = $this->tcourse->get_list_of_virtual_courses_for_specific_user_and_real_course();
 		$this->assertFalse($res);
 		$this->assertTrue(is_array($res));
 	}
-	
+
 	public function testGetGroupListOfCourse(){
 		$grouplist = new MockDatabase();
 		$course_code = 'TEST';
@@ -340,8 +340,8 @@ class TestCourse extends UnitTestCase{
 		$this->assertTrue(is_object($this->courseManager));
 		//var_dump($res);
 	}
-	
-	
+
+
 	public function testAttemptCreateVirtualCourse(){
 	     $createvirtual = new MockDisplay();
 	     $real_course_code = 'TEST';
@@ -357,7 +357,7 @@ class TestCourse extends UnitTestCase{
 		 $this->assertTrue(is_bool($res));
 		 //var_dump($res);
 	}
-	
+
 	public function testCreateVirtualCourse(){
 		$createvirtualcourse = new MockDisplay();
 		global $firsExpirationDelay;
@@ -388,7 +388,7 @@ class TestCourse extends UnitTestCase{
 		//print_r($createvirtualcourse);
 		//var_dump($createvirtualcourse);
 	}
-	
+
 	public function testDeleteCourse(){
 		global $_configuration;
 		$code = '01';
@@ -396,7 +396,7 @@ class TestCourse extends UnitTestCase{
 		$this->assertTrue($this->tcourse->delete_course()===null);
 		$this->assertTrue(is_null($res));
 	}
-	
+
 	public function testCreateDatabaseDump(){
 		global $_configuration;
 		$course_code='COD12';
@@ -414,23 +414,23 @@ class TestCourse extends UnitTestCase{
 		$this->assertTrue(is_numeric($res));
 		$this->assertFalse($this->tcourse->UserCourseSort()=== null);
 	}
-	
+
 	public function testSelectAndSortCategories(){
 		$form = new FormValidator('add_course');
 		$categories = array('name' => 'prueba');
         $categories_select = $form->addElement('select', 'category_code', get_lang('Fac'), $categories);
 		$res = $this->tcourse->select_and_sort_categories($categories_select);
 		$this->assertFalse($res);
-		$this->assertTrue(is_null($res));			
+		$this->assertTrue(is_null($res));
 	}
-	
+
 	public function testCourseExists(){
 		$course_code='COD12';
 		$res=$this->tcourse->course_exists($course_code);
 		$this->assertTrue(is_numeric($res));
-		$this->assertTrue($this->tcourse->course_exists()===0);	
+		$this->assertTrue($this->tcourse->course_exists()===0);
 	}
-	
+
 	public function testEmailToTutor() {
 		$user_id= '';
 		$course_code= 'test';
@@ -438,14 +438,14 @@ class TestCourse extends UnitTestCase{
 		$this->assertTrue(is_string($course_code));
 		//var_dump($res);
 	}
-	
+
 	public function testGetCoursesListByUserId(){
 		$user_id = '';
 		$res = $this->tcourse->get_courses_list_by_user_id($user_id);
 		$this->assertTrue(is_array($res));
 		//var_dump($res);
 	}
-	
+
 	public function testGetCourseIdFromPath(){
 		$path = '/var/www/path';
 		$res = $this->tcourse->get_course_id_from_path($path);
@@ -453,21 +453,21 @@ class TestCourse extends UnitTestCase{
 		$this->assertTrue($res === false);
 		$this->assertTrue( $this->tcourse->get_course_id_from_path()===false);
 	}
-	
+
 	public function testGetCoursesInfoFromVisualCode(){
 		$code = '0001';
 		$res=$this->tcourse->get_courses_info_from_visual_code($code);
 		$this->assertTrue(is_array($res));
 		//var_dump($res);
 	}
-	
+
 	public function testGetEmailsOfTutorsToCourse(){
 		$code = '';
 		$res= $this->tcourse->get_emails_of_tutors_to_course($code);
 		$this->assertTrue(is_array($res));
 		//var_dump($res);
 	}
-	
+
 	public function testGetEmailOfTutorToSession(){
 		$session = '';
 		ob_start();
@@ -477,7 +477,7 @@ class TestCourse extends UnitTestCase{
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	public function testCreateCourseExtraField(){
 		$fieldvarname = '';
 		$fieldtype = '5';
@@ -486,7 +486,7 @@ class TestCourse extends UnitTestCase{
 		$this->assertTrue(is_numeric($res));
 		$this->assertTrue($res);
 	}
-	
+
 	public function testUpdateCourseExtraFieldValue(){
 		$course_code = '0001';
 		$fname = '';
@@ -495,8 +495,8 @@ class TestCourse extends UnitTestCase{
 		$this->assertTrue($res);
 		$this->assertTrue(is_bool($res));
 		$this->assertFalse(is_null($res));
-	
+
 	}
-} 
+}
 
 ?>

+ 51 - 51
tests/main/inc/lib/database.lib.test.php

@@ -2,43 +2,43 @@
 require_once(api_get_path(LIBRARY_PATH).'database.lib.php');
 
 class TestDatabase extends UnitTestCase {
-	
+
 	 public $dbase;
 	 public function TestDatabase() {
 	 	$this->UnitTestCase('data base test');
 	 }
-	 
+
 	 public function setUp() {
  	 	$this->dbase = new Database();
 	 }
-	 
+
 	 public function tearDown() {
 	 	$this->dbase = null;
 	 }
-	
+
 	public function testAffectedRows() {
 		$res=$this->dbase->affected_rows();
 		$this->assertTrue(is_numeric($res));
 	}
-	
+
 	public function testCountRows() {
 		$table='class';
 		$res=$this->dbase->count_rows($table);
 		$this->assertTrue(is_numeric($res));
-	} 
-	
+	}
+
 	public function testError() {
 		$res=$this->dbase->error();
 		$this->assertTrue(is_string($res));
 	}
-	
+
 	public function testEscapeString() {
 		$string='Lore"May';
 		$res=$this->dbase->escape_string($string);
 		//print_r($string);
 		$this->assertTrue(is_string($res));
 	}
-	
+
 	public function testFetchArray() {
 		$sql = 'select 1';
 		$res=api_sql_query($sql,__FILE__,__LINE__);
@@ -46,28 +46,28 @@ class TestDatabase extends UnitTestCase {
 		$this->assertTrue(is_array($resu));
 		$this->assertFalse(is_null($resu));
 	}
-	
+
 	public function testFetchArrayError() {
 		$sql ="SELECT  1";
 		$res=api_sql_query($sql,__FILE__,__LINE__);
 		$resu=$this->dbase->fetch_array($res);
 		$this->assertTrue(is_array($resu));
 	}
-	
+
 	function testFetchObject() {
 		$sql ="SELECT  1";
 		$res=api_sql_query($sql,__FILE__,__LINE__);
 		$resu=$this->dbase->fetch_object($res);
 		$this->assertTrue(is_object($resu));
 	}
-	
+
 	function testFetchRow() {
 		$sql ="SELECT  1";
 		$res=api_sql_query($sql,__FILE__,__LINE__);
 		$resu=$this->dbase->fetch_row($res);
 		$this->assertTrue(is_array($resu));
 	}
-	
+
 	function testFixDatabaseParameterEmpty() {
 		$course_info = api_get_course_info();
 		$database_name= $course_info[""];
@@ -77,71 +77,71 @@ class TestDatabase extends UnitTestCase {
 		endif;
 		//var_dump($res);
 	}
-	
+
 	function testFixDatabaseParameterReturnString() {
 		$course_info = api_get_course_info();
 		$database_name= $course_info["dbName"];
 		$res=$this->dbase->fix_database_parameter($course_info);
 		$this->assertTrue(is_string($res));
 	}
-	
+
 	function testFormatGluedCourseTableName()  {
 		$database_name_with_glue='';
 		$table='';
 		$res=$this->dbase->format_glued_course_table_name($database_name_with_glue, $table);
 		$this->assertTrue(is_string($res));
 	}
-	
+
 	function testFormatTableName() {
 		$database='';
 		$table='';
 		$res=$this->dbase->format_table_name($database, $table);
 		$this->assertTrue(is_string($res));
 	}
-	
+
 	function testGenerateAbstractCourseFieldNames() {
 		$result_array='';
 		$res=$this->dbase->generate_abstract_course_field_names($result_array);
 		$this->assertTrue(is_array($res));
 	}
-	
-	function testGenerateAbstractUserFieldNames() { 
+
+	function testGenerateAbstractUserFieldNames() {
 		$result_array='';
 		$res=$this->dbase->generate_abstract_user_field_names($result_array);
 		$this->assertTrue(is_array($res));
 	}
-	
+
 	function get_course_by_category() {
 		$category_id='1';
 		$res=$this->dbase->get_course_by_category($category_id);
-		$this->assertTrue(is_string($res));	
+		$this->assertTrue(is_string($res));
 	}
-	
+
 	function testGetCourseChatConnectedTable() {
 		$database_name='dokeosla';
 		$res=$this->dbase->get_course_chat_connected_table($database_name);
 		$this->assertTrue(is_string($res));
 	}
-	
+
 	function testGetCourseInfo() {
 		$course_code='AYDD';
 		$res=$this->dbase->get_course_info($course_code);
 		$this->assertTrue(is_array($res));
 	}
-	
+
 	function testGetCourseList() {
 		$sql_query = "SELECT * FROM $table";
 		$res=$this->dbase->get_course_list($sql_query);
 		$this->assertTrue(is_array($res));
 	}
-	
+
 	function testGetCourseTable() {
 		$short_table_name='';
 		$database_name='';
 		$res=$this->dbase->get_course_table($short_table_name,$database_name);
 		$this->assertTrue(is_string($res));
 	}
-	
+
 	function testGetCourseTableFromCode() {
 		$course_code='AYDD';
 		$table='course';
@@ -149,21 +149,21 @@ class TestDatabase extends UnitTestCase {
 		$res=$this->dbase->get_course_table_from_code($course_code, $table);
 		$this->assertTrue(is_string($res));
 	}
-	
+
 	function testGetCourseTablePrefix() {
 		global $_configuration;
 		$res=$this->dbase->get_course_table_prefix($_configuration);
 		$this->assertTrue(is_string($res));
-	} 
-	  
+	}
+
 	function testGetCurrentCourseDatabase() {
 		$res=$this->dbase->get_current_course_database();
 		if(!is_null($res)) :
 		$this->assertTrue(is_string($res));
 		endif;
 		//var_dump($res);
-	}  
-	
+	}
+
 	function testGetCurrentCourseGluedDatabase() {
 		$res=$this->dbase->get_current_course_glued_database();
 		if(!is_null($res)):
@@ -171,121 +171,121 @@ class TestDatabase extends UnitTestCase {
 		endif;
 		//var_dump($res);
 	}
-	
+
 	function testGetDatabaseGlue()
 	{
 		global $_configuration;
 		$res=$this->dbase->get_database_glue($_configuration);
 		$this->assertTrue(is_string($res));
 	}
-	
+
 	function testGetDatabaseNamePrefix() {
 		global $_configuration;
 		$res=$this->dbase->get_database_name_prefix($_configuration);
 		$this->assertTrue(is_string($res));
 	}
-	
+
 	function testGetLanguageIsocode() {
 		$lang_folder='arabic';
 		$res=$this->dbase->get_language_isocode($lang_folder);
 		$this->assertTrue(is_string($res));
 	}
-		
+
 	function testGetLastInsertId() {
 		$res=$this->dbase->get_last_insert_id();
 		$this->assertTrue(is_numeric($res));
 	}
-	
+
 	function testGetMainDatabase() {
 		global $_configuration;
 		$res=$this->dbase->get_main_database();
 		$this->assertTrue(is_string($res));
 	}
-	
+
 	function testGetMainTable() {
 		$short_table_name='';
 		$res=$this->dbase->get_main_table($short_table_name);
 		$this->assertTrue(is_string($res));
 	}
-	
+
 	function testGetScormDatabase() {
 		global $_configuration;
 		$res=$this->dbase->get_scorm_database();
 		$this->assertTrue(is_string($res));
 	}
-	
+
 		function testGetScorm_table() {
 		$short_table_name='';
 		$res=$this->dbase->get_scorm_table();
 		$this->assertTrue(is_string($res));
 		$this->assertTrue($res);
 	}
-	
+
 	function testGetStatisticDatabase() {
 		global $_configuration;
 		$res=$this->dbase->get_statistic_database($_configuration);
 		$this->assertTrue(is_string($res));
 		$this->assertTrue($res);
 	}
-	
+
 	function testGetStatisticTable() {
 		$short_table_name='';
 		$res=$this->dbase->get_statistic_table($short_table_name);
 		$this->assertTrue(is_string($res));
 		$this->assertTrue($res);
 	}
-	
+
 	function testGetUserInfoFromId() {
 		$user_id = '';
 		$res=$this->dbase->get_user_info_from_id($user_id);
 		$this->assertTrue(is_array($res));
 		$this->assertTrue($res);
 	}
-	
+
 	function testGetUserPersonalDatabase() {
 		global $_configuration;
 		$res=$this->dbase->get_user_personal_database($_configuration);
 		$this->assertTrue(is_string($res));
 		$this->assertTrue($res);
 	}
-	
+
 	function testGetUserPersonalTable(){
 		$short_table_name='';
 		$res=$this->dbase->	get_user_personal_table();
 		$this->assertTrue(is_string($res));
-		$this->assertTrue($res);	
+		$this->assertTrue($res);
 	}
-	
+
 	function testGlueCourseDatabaseName() {
 		$database_name='';
 		$res=$this->dbase->glue_course_database_name($database_name);
 		$this->assertTrue(is_string($res));
 		$this->assertTrue($res);
 	}
-	
+
 	function testInsertId() {
 		$res=$this->dbase->insert_id();
 		$this->assertTrue(is_numeric($res));
 	}
-	
+
 	function testNumRows() {
 		$res='';
 		$resul=$this->dbase->num_rows($res);
 		$this->assertTrue(is_string($res));
 	}
-	
+
 	function testQuery() {
 		$sql ="SELECT 1";
 		$res=$this->dbase->query($sql,__FILE__,__LINE__);
 		$this->assertTrue(is_resource($res));
 	}
-	
+
 	function testResult() {
 		$sql="SELECT 1";
 		$resource=$this->dbase->query($sql,__FILE__,__LINE__);
 		$rows='1';
 		$res=$this->dbase->result($resource,$rows);
-		//var_dump($res);		
+		//var_dump($res);
 		$this->assertTrue(is_bool($res));
 	}
 }

+ 9 - 9
tests/main/inc/lib/debug.lib.inc.test.php

@@ -3,7 +3,7 @@ require_once(api_get_path(LIBRARY_PATH).'debug.lib.inc.php');
 
 
 class TestDebug extends UnitTestCase {
-	
+
 	function testDebugFunction() {
 		$variable='br';
 		ob_start();
@@ -11,10 +11,10 @@ class TestDebug extends UnitTestCase {
 		$res=ob_get_contents();
 		ob_end_clean();
 		//print_r($res);
-		$this->assertTrue(is_string($res));	
+		$this->assertTrue(is_string($res));
 		$this->assertTrue(is_scalar($res));
 	}
-	
+
 	function testDebugCourse() {
 		global $_course;
 		ob_start();
@@ -24,9 +24,9 @@ class TestDebug extends UnitTestCase {
 		//print_r($res);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
-		
+
 	}
-	
+
 	function testDebugPaths() {
 		ob_start();
 		debug_paths();
@@ -36,7 +36,7 @@ class TestDebug extends UnitTestCase {
 		$this->assertTrue(is_string($res));
 		$this->assertTrue(is_scalar($res));
 	}
-	
+
 	function testDebugUser() {
 		global $_user;
 		ob_start();
@@ -44,9 +44,9 @@ class TestDebug extends UnitTestCase {
 		$res=ob_get_contents();
 		ob_end_clean();
 		//print_r($res);
-		$this->assertTrue(is_array($_user));		
+		$this->assertTrue(is_array($_user));
 	}
-	
+
 	function testPrintVar() {
 		$var='';
 		GLOBAL $DEBUG;
@@ -57,5 +57,5 @@ class TestDebug extends UnitTestCase {
 		//print_r($res);
 		$this->assertTrue(is_string($res));
 	}
-} 
+}
 ?>

+ 31 - 31
tests/main/inc/lib/display.lib.test.php

@@ -3,7 +3,7 @@ require_once(api_get_path(LIBRARY_PATH).'display.lib.php');
 
 
 class TestDisplay extends UnitTestCase {
-	
+
 	public function testdisplay_introduction_section() {
 		$tool=api_get_tools_lists($my_tool=null);
 		ob_start();
@@ -13,7 +13,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($tool);
 	}
-	
+
 	public function testdisplay_localised_html_file(){
 		global $language_interface;
 		$doc_url = str_replace('/..', '', $doc_url);
@@ -25,7 +25,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($full_file_name);
 	}
-	
+
 	public function testdisplay_table_header() {
 		ob_start();
 		Display::display_table_header();
@@ -34,7 +34,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 		/**
 	*	Display html header of table with several options.
 	*
@@ -53,7 +53,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	/**
 	*	Displays a table row.
 	*
@@ -72,7 +72,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	public function testdisplay_complex_table_row() {
 		$properties='';
 		$table_row='';
@@ -83,7 +83,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	/**
 	*	display html footer of table
 	*/
@@ -95,7 +95,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	public function testdisplay_sortable_table() {
 		$header='';
 		$content='';
@@ -107,7 +107,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 		/**
 	 * Display a table with a special configuration
 	 * @param array $header Titles for the table header
@@ -118,7 +118,7 @@ class TestDisplay extends UnitTestCase {
 	 *  						th-tag (eg for column-width)
 	 * 						- 4the element: additional attributes for the td-tags
 	 * @param array $content 2D-array with the tables content
-	 * @return void String about header 
+	 * @return void String about header
 	 */
 	public function testdisplay_sortable_config_table() {
 		$header='';
@@ -131,7 +131,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 		/**
 	* Displays a normal message. It is recommended to use this public function
 	* to display any normal information messages.
@@ -139,7 +139,7 @@ class TestDisplay extends UnitTestCase {
 	* @param string $message - include any additional html
 	*                          tags if you need them
 	* @param bool	Filter (true) or not (false)
-	* @return void String message 
+	* @return void String message
 	*/
 	public function testdisplay_normal_message() {
 		global $charset;
@@ -151,7 +151,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	/**
 	 * Display the reduced page header (without banner)
 	 */
@@ -166,7 +166,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	/**
 	* Displays an confirmation message. Use this if something has been done successfully
 	*
@@ -174,7 +174,7 @@ class TestDisplay extends UnitTestCase {
 	* @param bool	Filter (true) or not (false)
 	* @return void String message
 	*/
-	public function testdisplay_confirmation_message() {		
+	public function testdisplay_confirmation_message() {
 		global $charset;
 		$message=api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : $charset);
 		ob_start();
@@ -184,13 +184,13 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($message);
 	}
-	
+
 	/**
 	* Displays an error message.
 	* @author Arthur Portugal
 	* @param string $message - include any additional html tags if you need them
 	* @param bool	Filter (true) or not (false)
-	* @param object Not display the object in the test browser 
+	* @param object Not display the object in the test browser
 	* @return string Code HTML
 	*/
 	public function testdisplay_error_message() {
@@ -203,7 +203,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($message);
 	}
-	
+
 	/**
 	 * Display the page footer
 	 * @author Arthur Portugal
@@ -219,14 +219,14 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	/**
 	 * Display the page header
 	 * @param string The name of the page (will be showed in the page title)
 	 * @param string Optional help file name
 	 * @return string Display the hearders messages
 	 */
-	 
+
 	public function testdisplay_header() {
 		global $_plugins,$lp_theme_css,$mycoursetheme,$user_theme,$platform_theme;
 		global $httpHeadXtra, $htmlHeadXtra, $htmlIncHeadXtra, $_course, $_user, $clarolineRepositoryWeb, $text_dir, $plugins, $_user, $rootAdminWeb, $_cid, $interbreadcrumb, $charset, $language_file, $noPHP_SELF;
@@ -240,7 +240,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	/**
 	 * This public function displays an icon
 	 * @param string $image the filename of the file (in the main/img/ folder
@@ -257,7 +257,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	/**
 	* Displays an warning message. Use this if you want to draw attention to something
 	*
@@ -275,7 +275,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	/**
 	 * Return an encrypted mailto hyperlink
 	 * @author Arthur Portugal
@@ -291,7 +291,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	/**
 	 * Print an <option>-list with all letters (A-Z).
 	 * @param char $selected_letter The letter that should be selected
@@ -302,10 +302,10 @@ class TestDisplay extends UnitTestCase {
 		Display::get_alphabet_options();
 		$res=ob_get_contents();
 		$this->assertTrue(is_string($res));
-		ob_end_clean();		
+		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	public function testget_numeric_options() {
 		$min='';
 		$max='';
@@ -316,7 +316,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	/**
 	*	Create a hyperlink to the platform homepage.
 	*	@param string $name, the visible name of the hyperlink, default is sitename
@@ -330,7 +330,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	/**
 	 * This public function returns the htmlcode for an icon
 	 *
@@ -348,7 +348,7 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	/**
 	* Show the so-called "left" menu for navigating
 	*/
@@ -362,10 +362,10 @@ class TestDisplay extends UnitTestCase {
 		ob_end_clean();
 		//var_dump($res);
 	}
-	
+
 	/**
 	 * Display name and lastname in a specific order
-	 * @param string Firstname 
+	 * @param string Firstname
 	 * @param string Lastname
 	 */
 	public function testuser_name() {

+ 23 - 23
tests/main/inc/lib/document.lib.test.php

@@ -2,16 +2,16 @@
 require_once(api_get_path(LIBRARY_PATH).'document.lib.php');
 
 class TestDocumentManager extends UnitTestCase {
-	
+
 	/**
 	 * This check if a document has the readonly property checked, then see if the user
 	 * is the owner of this file, if all this is true then return true.
-	 * 
+	 *
 	 * @param array  $_course
 	 * @param int    $user_id id of the current user
 	 * @param string $file path stored in the database
 	 * @param int    $document_id in case you dont have the file path ,insert the id of the file here and leave $file in blank ''
-	 * @return boolean true/false	 
+	 * @return boolean true/false
 	 **/
 	public function testcheck_readonly() {
 		$_course='';
@@ -21,7 +21,7 @@ class TestDocumentManager extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	/**
 	 * This deletes a document by changing visibility to 2, renaming it to filename_DELETED_#id
 	 * Files/folders that are inside a deleted folder get visibility 2
@@ -34,13 +34,13 @@ class TestDocumentManager extends UnitTestCase {
 	 */
 	function testdelete_document() {
 		$_course['dbName']='';
-		$path=''; 
+		$path='';
 		$base_work_dir='';
 		$res=DocumentManager::delete_document($_course, $path, $base_work_dir);
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	/**
 	 * Removes documents from search engine database
 	 *
@@ -55,7 +55,7 @@ class TestDocumentManager extends UnitTestCase {
 		$this->assertTrue(is_null($res));
 		//var_dump($res);
 	}
-	
+
 	/**
 	*	Get the content type of a file by checking the extension
 	*	We could use mime_content_type() with php-versions > 4.3,
@@ -70,7 +70,7 @@ class TestDocumentManager extends UnitTestCase {
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	/**
 	* This function streams a file to the client
 	*
@@ -85,7 +85,7 @@ class TestDocumentManager extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	/**
 	*   @todo ??not only check if a file is visible, but also check if the user is allowed to see the file??
 	*   @return true if the user is allowed to see the document, false otherwise (bool)
@@ -97,7 +97,7 @@ class TestDocumentManager extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	/**
 	* Fetches all document data for the given user/group
 	*
@@ -106,15 +106,15 @@ class TestDocumentManager extends UnitTestCase {
 	* @param int $to_group_id
 	* @param int $to_user_id
 	* @param boolean $can_see_invisible
-	* @return array with all document data 
+	* @return array with all document data
 	*/
 	function testget_all_document_data() {
 		$_course['dbName']='';
 		$res=DocumentManager::get_all_document_data();
 		$this->assertTrue(is_array($_course));
 		//var_dump($_course);
-	} 
-	
+	}
+
 	/**
 	 * Gets the paths of all folders in a course
 	 * can show all folders (exept for the deleted ones) or only visible ones
@@ -129,7 +129,7 @@ class TestDocumentManager extends UnitTestCase {
 		$this->assertTrue(is_array($_course));
 		//var_dump($_course);
 	}
-	
+
 	/**
 	* @return the document folder quuta of the current course, in bytes
 	*/
@@ -139,7 +139,7 @@ class TestDocumentManager extends UnitTestCase {
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	/** Gets the id of a document with a given path
 	 *
 	 * @param array $_course
@@ -153,11 +153,11 @@ class TestDocumentManager extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
-	/** This check if a document is a folder or not	 
+
+	/** This check if a document is a folder or not
 	 * @param array  $_course
 	 * @param int    $document_id of the item
-	 * @return boolean true/false	 
+	 * @return boolean true/false
 	 **/
 	function testis_folder() {
 		$_course['dbName']='';
@@ -165,7 +165,7 @@ class TestDocumentManager extends UnitTestCase {
 		$res=DocumentManager::is_folder($_course, $document_id);
 		$this->assertTrue(is_bool($res));
 	}
-	
+
 	/**
 	 * return true if the documentpath have visibility=1 as item_property
 	 *
@@ -178,7 +178,7 @@ class TestDocumentManager extends UnitTestCase {
 		$res=DocumentManager::is_visible($doc_path, $course);
 		$this->assertTrue(is_bool($res));
 	}
-	
+
 	/**
 	 * Allow to set a specific document as a new template for FCKEditor for a particular user in a particular course
 	 *
@@ -193,18 +193,18 @@ class TestDocumentManager extends UnitTestCase {
 		$description='';
 		$document_id_for_template='';
 		$couse_code='';
-		$user_id=''; 
+		$user_id='';
 		$image='';
 		$res=DocumentManager::set_document_as_template($title, $description, $document_id_for_template, $couse_code, $user_id, $image);
 		$this->assertTrue(is_bool($res));
 	}
-	
+
 	function teststring_send_for_download() {
 		$full_string='';
 		$res=DocumentManager::string_send_for_download($full_string);
 		$this->assertTrue(is_bool($res));
 	}
-	
+
 	/**
 	 * Unset a document as template
 	 *

+ 13 - 13
tests/main/inc/lib/events.lib.inc.test.php

@@ -2,7 +2,7 @@
 require_once(api_get_path(LIBRARY_PATH).'events.lib.inc.php');
 
 class TestEvents extends UnitTestCase {
-	
+
 	function testCreateEventExercice() {
 		global $_user, $_cid, $_configuration;
 		$exo_id='';
@@ -10,7 +10,7 @@ class TestEvents extends UnitTestCase {
 		$this->assertTrue(is_numeric($res));
 		//var_dump($res);
 	}
-	
+
 	function testEventAccessCourse() {
 		global $_configuration;
 		global $_user;
@@ -21,7 +21,7 @@ class TestEvents extends UnitTestCase {
 		$this->assertTrue(is_numeric($res));
 		//var_dump($res);
 	}
-	
+
 	function testEventAccessTool() {
 		global $_configuration;
 		global $_cid;
@@ -33,12 +33,12 @@ class TestEvents extends UnitTestCase {
 		$this->assertTrue(is_numeric($res));
 		//var_dump($res);
 	}
-	
+
 	function testEventDownload() {
 		global $_configuration;
 		global $_user;
 		global $_cid;
-		global $TABLETRACK_DOWNLOADS;	
+		global $TABLETRACK_DOWNLOADS;
 		$doc_url='';
 		$res=event_download();
 		$this->assertTrue(is_numeric($res));
@@ -55,7 +55,7 @@ class TestEvents extends UnitTestCase {
 		$this->assertTrue(is_numeric($res));
 		//var_dump($res);
 	}
-		
+
 	function testEventLogin() {
 		global $_configuration;
 		global $_user;
@@ -64,7 +64,7 @@ class TestEvents extends UnitTestCase {
 		$this->assertTrue(is_null($res));
 		//var_dump($res);
 	}
-	
+
 	function testEventOpen() {
 		global $_configuration;
 		global $TABLETRACK_OPEN;
@@ -72,7 +72,7 @@ class TestEvents extends UnitTestCase {
 		$this->assertTrue(is_numeric($res));
 		//var_dump($res);
 	}
-	
+
 	function testEventSystem() {
 		global $_configuration;
 		global $_user;
@@ -84,8 +84,8 @@ class TestEvents extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
-	
+
+
 	function testEventUpload() {
 		global $_configuration;
 		global $_user;
@@ -96,7 +96,7 @@ class TestEvents extends UnitTestCase {
 		$this->assertTrue(is_numeric($res));
 		//var_dump($res);
 	}
-	
+
 	function testExerciseAttempt() {
 		$score = Database::escape_string($score);
 		$answer = Database::escape_string($answer);
@@ -108,7 +108,7 @@ class TestEvents extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	function testExerciseAttemptHotspot() {
 		global $_configuration, $_user, $_cid;
 		$exe_id='';
@@ -120,7 +120,7 @@ class TestEvents extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	function testUpdateEventExercice() {
 		$exeid='';
 		$exo_id='';

+ 13 - 13
tests/main/inc/lib/export.lib.inc.test.php

@@ -5,11 +5,11 @@ require_once(api_get_path(LIBRARY_PATH).'document.lib.php');
 Mock::generate('DocumentManager');
 
 class TestExport extends UnitTestCase {
-	
-	/** Test about export csv using class document manager 
+
+	/** Test about export csv using class document manager
 	 * @author Arthur portugal
-	 * To can test and show the var_dump is necesary comment inside the class DocumentManager in the file document.lib.php the word "exit()", 
-	 * because "exit" not permit show the result.  
+	 * To can test and show the var_dump is necesary comment inside the class DocumentManager in the file document.lib.php the word "exit()",
+	 * because "exit" not permit show the result.
 	 */
     function testExportTableCsv() {
         $docman = new MockDocumentManager();
@@ -21,7 +21,7 @@ class TestExport extends UnitTestCase {
         //var_dump($docman);
         //var_dump($res);
     }
- 
+
  	function testExportTableXls() {
  		$docman = new MockDocumentManager();
 		$data = array();
@@ -32,7 +32,7 @@ class TestExport extends UnitTestCase {
         //var_dump($docman);
         //var_dump($export);
  	}
- 
+
  	function testExportTableXml() {
  		$docman = new MockDocumentManager();
 		$data = array();
@@ -46,7 +46,7 @@ class TestExport extends UnitTestCase {
 		//var_dump($docman);
         //var_dump($export);
  	}
- 
+
  	function testExportComplexTableXml() {
  		$docman = new MockDocumentManager();
 		$data = array();
@@ -58,7 +58,7 @@ class TestExport extends UnitTestCase {
 		$this->assertTrue(is_null($res));
 		//var_dump($docman);
  	}
- 
+
   	function testExportComplexTableXmlHelper() {
   		$data = array();
 		$level=1;
@@ -66,7 +66,7 @@ class TestExport extends UnitTestCase {
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
  	}
- 
+
  	function testBackupDatabase() {
  		$link='';
  		$db_name='';
@@ -90,15 +90,15 @@ class TestExport extends UnitTestCase {
  		$this->assertTrue($res);
  		var_dump($verbose);
  	}*/
- 	
+
  	function testmakeTheBackup() {
  		global $error_msg, $error_no, $db, $archiveRepositorySys, $archiveRepositoryWeb, $appendCourse, $appendMainDb, $archiveName,
  				 $_configuration, $_course, $TABLEUSER, $TABLECOURSUSER, $TABLECOURS, $TABLEANNOUNCEMENT;
- 		
+
 		$exportedCourseId='';
 		$res=makeTheBackup($exportedCourseId);
 		$this->assertTrue(is_bool($res));
-		//var_dump($res);		
+		//var_dump($res);
  	}
-}	
+}
 ?>

+ 20 - 20
tests/main/inc/lib/fileDisplay.lib.test.php

@@ -1,12 +1,12 @@
 <?php
 require_once(api_get_path(LIBRARY_PATH).'fileDisplay.lib.php');
 class TestFileDisplay extends UnitTestCase {
-	
+
 	public function TestFileDisplay(){
 		$this->UnitTestCase('File Display tests');
-		
+
 	}
-	
+
 	//todo public function testArraySearch()
 	//todo public function testChooseImage()
 	//todo public function testFormatFileSize()
@@ -15,7 +15,7 @@ class TestFileDisplay extends UnitTestCase {
 	//todo public function testRecentModifiedFileTime()
 	//todo public function testFolderSize()
 	//todo public function testGetTotalFolderSize()
-	
+
 	public function testArraySearch(){
 		$needle = '';
 		$haystack = '';
@@ -24,65 +24,65 @@ class TestFileDisplay extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	public function testChooseImage(){
 		static $type, $image;
 		$file_name = '';
 		$res = choose_image($file_name);
 		$this->assertEqual($res,'defaut.gif');
 		$this->assertTrue(is_string($res));
-		//var_dump($file_name);		
+		//var_dump($file_name);
 	}
-	
+
 	public function testFormatFileSize(){
 		$file_size = '100';
 		$res = format_file_size($file_size);
 		$this->assertTrue($res);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
-		
+
 	}
-	
+
 	public function testFormatDate(){
 		$date = '11/02/2009';
 		$res = format_date($date);
 		$this->assertTrue($res);
 		//var_dump($res);
-		
+
 	}
-	
+
 	public function testFormatUrl(){
 		$file_path ='/var/www/path/';
 		$res = format_url($file_path);
 		$this->assertTrue($res);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
-		
+
 	}
-	
+
 	/*
-	 * Fatal error: Call to a member function read() on a non-object in 
+	 * Fatal error: Call to a member function read() on a non-object in
 	 * /var/www/dokeossvn186/main/inc/lib/fileDisplay.lib.php on line 207
 	 *
-	 ** / 
+	 ** /
 	public function testRecentModifiedFileTime(){
 		$dir_name ='';
 		$$do_recursive =true;
 		$res = recent_modified_file_time($dir_name, $do_recursive = true);
 		$this->assertTrue($res);
-			
+
 	}*/
-	
+
 	public function testFolderSize(){
 		$dir_name ='';
 		$res = folder_size($dir_name);
 		$this->assertFalse($res);
 		$this->assertTrue(is_numeric($res));
 		//var_dump($res);
-	
-		
+
+
 	}
-	
+
 }
 
 

+ 30 - 30
tests/main/inc/lib/fileManager.lib.test.php

@@ -3,25 +3,25 @@
 
 
 class TestFileManager extends UnitTestCase {
-	
+
 	public $fmanager;
 	public function TestFileManager(){
-		
+
 		$this->UnitTestCase ('File Display Manager');
-		
-		
+
+
 	}
-	
+
 	public function setUp(){
-		
+
 		$this->fmanager = new FileManager();
 	}
-	
+
 	public function tearDown(){
-		
+
 		$this->fmanager = null;
 	}
-	
+
 	//todo public function testUpdatedbInfo
 	//todo public function testCheckNameExist
 	//todo public function testMyDelete
@@ -40,7 +40,7 @@ class TestFileManager extends UnitTestCase {
 	//todo public function testCompatLoadFile
 	//todo public function testSetDefaultSettings
 	//todo public function testMkdirs
-	
+
 	public function testUpdatedbInfo(){
 		$action ='';
 		$oldPath ='';
@@ -48,7 +48,7 @@ class TestFileManager extends UnitTestCase {
 		$this->assertTrue(is_null($res));
 		//var_dump($res);
 	}
-	
+
 	public function testCheckNameExist(){
 		$filePath ='';
 		$res = check_name_exist($filePath);
@@ -57,16 +57,16 @@ class TestFileManager extends UnitTestCase {
 		$this->assertTrue($res === false);
 		//var_dump($res);
 	}
-	
+
 	public function testMyDelete(){
 		$file='';
 		$res = my_delete($file);
-		$this->assertFalse($res); 
+		$this->assertFalse($res);
 		$this->assertTrue(is_bool($res));
 		$this->assertTrue($res===false);
 		//var_dump($res);
 	}
-	
+
 	public function testRemoveDir(){
 		$dir='';
 		$res = removeDir($dir);
@@ -74,7 +74,7 @@ class TestFileManager extends UnitTestCase {
 		$this->assertFalse($res === true);
 		//var_dump($res);
 	}
-	
+
 	public function testMyRename(){
 		$filePath ='documents';
 		$newFileName='';
@@ -83,7 +83,7 @@ class TestFileManager extends UnitTestCase {
 		$this->assertTrue($res === false);
 		//var_dump($res);
 	}
-	
+
 	public function testMove(){
 		$source ='';
 		$target ='';
@@ -93,7 +93,7 @@ class TestFileManager extends UnitTestCase {
 		$this->assertFalse($res);
 		//var_dump($res);
 	}
-	
+
 	public function testCopyDirTo(){
 		$origDirPath='';
 		$destination='';
@@ -101,15 +101,15 @@ class TestFileManager extends UnitTestCase {
 		$this->assertTrue($res===null);
 		$this->assertNull($res);
 	}
-	
-	public function testIndexDir(){ 
+
+	public function testIndexDir(){
 		$path='/var/www/path/';
 	  	$res = index_dir($path);
 		$this->assertFalse(is_array($res));
 		$this->assertNull($res);
 		//var_dump($res);
 	}
-	
+
 	public function testIndexAndSortDir(){
 		$path='/var/www/path/';
 		$res = index_and_sort_dir($path);
@@ -119,7 +119,7 @@ class TestFileManager extends UnitTestCase {
 		$this->assertTrue($res === false);
 		//var_dump($res);
 	}
-	
+
 	public function testFormDirList(){
 		$sourceType='';
 		$sourceComponent='';
@@ -129,8 +129,8 @@ class TestFileManager extends UnitTestCase {
 		$this->assertTrue($res);
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
-	} 
-	
+	}
+
 	public function testMkpath(){
 		$path='/var/www/path/';
 		$res =mkpath($path, $verbose=false);
@@ -139,14 +139,14 @@ class TestFileManager extends UnitTestCase {
 		$this->assertTrue($res === null);
 		//var_dump($res);
 	}
-	
+
 	public function testGetextension(){
 		$filename='documents';
 		$res =getextension($filename);
 		$this->assertTrue($res);
 		$this->assertTrue(is_array($res));
 	}
-	
+
 	public function testDirsize(){
 		$root='';
 		$res =dirsize($root,$recursive=true);
@@ -155,7 +155,7 @@ class TestFileManager extends UnitTestCase {
 		$this->assertTrue($res ===0);
 		//var_dump($res);
 	}
-	
+
 	public function testListAllDirectories(){
 		$path='/var/www/path/';
 		$res = $this->fmanager->list_all_directories($path);
@@ -163,7 +163,7 @@ class TestFileManager extends UnitTestCase {
 		$this->assertTrue(is_null($res));
 		//var_dump($res);
 	}
-	
+
 	public function testListAllFiles(){
 		$dirArray='documents';
 		$res = $this->fmanager->list_all_files($dirArray);
@@ -172,7 +172,7 @@ class TestFileManager extends UnitTestCase {
 		$this->assertTrue($res ===null);
 		//var_dump($res);
 	}
-	
+
 	public function testCompatLoadFile(){
 		$file_name='images';
 		$res = $this->fmanager->compat_load_file($file_name);
@@ -180,7 +180,7 @@ class TestFileManager extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	public function testSetDefaultSettings(){
 		$upload_path='/var/www/path/ruta';
 		$filename='doc';
@@ -189,7 +189,7 @@ class TestFileManager extends UnitTestCase {
 		$this->assertTrue(is_null($res));
 		//var_dump($res);
 	}
-	
+
 	public function testMkdirs(){
 		$path='/var/www/path/ruta';
 		$res = $this->fmanager->mkdirs($path);

+ 72 - 72
tests/main/inc/lib/fileUpload.lib.test.php

@@ -1,5 +1,5 @@
 <?php
-/** To can run this test you need comment "die() This code is in the line 278,1377,1386,1389,1542,1547,1571 file fileUpload.lib.php 
+/** To can run this test you need comment "die() This code is in the line 278,1377,1386,1389,1542,1547,1571 file fileUpload.lib.php
  *  @author aportugal arthur.portugal@dokeos.com
  */
 require_once(api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
@@ -10,7 +10,7 @@ Mock::generate('Display');
 Mock::generate('Database');
 
 class TestFileUpload extends UnitTestCase {
-	
+
 		function testAddAllDocumentsInFolderToDatabase() {
 			$docman = new MockDocumentManager();
 			$_course='';
@@ -25,7 +25,7 @@ class TestFileUpload extends UnitTestCase {
 			$this->assertTrue(is_object($docman));
 	        //var_dump($docman);
 		}
-		
+
 		function testAddDocument() {
 			global $charset;
 			$_course['dbName']='';
@@ -39,7 +39,7 @@ class TestFileUpload extends UnitTestCase {
 			endif;
 			//var_dump($res);
 		}
-		
+
 		function testAddExtOnMime() {
 			$fileName='';
 			$fileType='';
@@ -47,7 +47,7 @@ class TestFileUpload extends UnitTestCase {
 			$this->assertTrue(is_string($res));
 			//var_dump($res);
 		}
-		
+
 		function testApiReplaceLinksInHtml() {
 			$upload_path='';
 			$doc_url = $_GET['file'];
@@ -56,7 +56,7 @@ class TestFileUpload extends UnitTestCase {
 			$this->assertTrue(is_null($res));
 			//var_dump($res);
 		}
-		
+
 		function testApiReplaceLinksInString() {
 			$upload_path='';
 			$buffer=ob_get_contents();
@@ -64,7 +64,7 @@ class TestFileUpload extends UnitTestCase {
 			$this->assertTrue(is_string($res));
 			//var_dump($res);
 		}
-		
+
 		function testApiReplaceParameter() {
 			$count = 0;
 			$matches = array();
@@ -72,7 +72,7 @@ class TestFileUpload extends UnitTestCase {
 			$file_path_list[] = $matches[1];
 			$upload_path='';
 			$replaceWhat[$count] = $href_list[$count];
-			/** To can test this function you need to comment "die ('can not create file')" 
+			/** To can test this function you need to comment "die ('can not create file')"
 			 *  $res return void
 		 	 */
 		 	$replaceBy[$count] = " $param_name=\"" . $file_path_list[$count] . "\" target =\"_top\"";
@@ -83,9 +83,9 @@ class TestFileUpload extends UnitTestCase {
 			$this->assertTrue(is_string($res));
 			//var_dump($res);
 		}
-	
+
 		function testBuildMissingFilesForm() {
-			
+
 			$_course['path']='';
 			$courseDir   = $_course['path']."/document";
 			$sys_course_path = api_get_path(SYS_COURSE_PATH);
@@ -97,13 +97,13 @@ class TestFileUpload extends UnitTestCase {
 			$this->assertTrue(is_string($res));
 			//var_dump($res);
 		}
-		
+
 		function testCheckForMissingFiles() {
 			$file='';
 			$res=check_for_missing_files($file);
 			$this->assertTrue(is_bool($res));
 		}
-		
+
 		function testCleanUpFilesInZip() {
 			$p_event='';
 			$p_header['filename']='';
@@ -111,7 +111,7 @@ class TestFileUpload extends UnitTestCase {
 			$this->assertTrue(is_numeric($res));
 			//var_dump($res);
 		}
-		
+
 		function testCleanUpPath(&$path) {
 			$path_array = explode('/',$path);
 			$path = implode('/',$path_array);
@@ -119,20 +119,20 @@ class TestFileUpload extends UnitTestCase {
 			$this->assertTrue(is_numeric($res));
 			//var_dump($res);
 		}
-		
-		/** To can test this function you need to comment "die ('can not create file')" 
+
+		/** To can test this function you need to comment "die ('can not create file')"
 		 *  $res return void/
-		 * 
+		 *
 		 */
-		 
+
 		function testCreateLinkFile() {
 			$filePath='';
 			$url='';
-			$res= create_link_file($filePath, $url);			
+			$res= create_link_file($filePath, $url);
 			$this->assertTrue(is_null($res));
 			//var_dump($res);
 		}
-		
+
 		function testCreateUnexistingDirectory()  {
 			$_course='';
 			$user_id='';
@@ -140,73 +140,73 @@ class TestFileUpload extends UnitTestCase {
 			$to_user_id='';
 			$base_work_dir='';
 			$desired_dir_name='';
-			$res= create_unexisting_directory($_course,$user_id,$to_group_id,$to_user_id,$base_work_dir,$desired_dir_name);		
+			$res= create_unexisting_directory($_course,$user_id,$to_group_id,$to_user_id,$base_work_dir,$desired_dir_name);
 			$this->assertTrue(is_bool($res));
 		}
-		
+
 		function testDirTotalSpace() {
 			$dirPath='/var/www/path';
-			$res= dir_total_space($dirPath);			
+			$res= dir_total_space($dirPath);
 			$this->assertTrue(is_numeric($res));
 			//var_dump($res);
 		}
-		
+
 		function testDisableDangerousFile($filename) {
 			$filename = php2phps($filename);
 			$filename = htaccess2txt($filename);
-			$res= disable_dangerous_file($filename);			
+			$res= disable_dangerous_file($filename);
 			$this->assertTrue(is_string($res));
 			//var_dump($res);
 		}
-		
-		
+
+
 		function testdocuments_total_space() {
 			$to_group_id='0';
 			$res= documents_total_space($to_group_id);
-			if(!is_null($res)):			
+			if(!is_null($res)):
 			$this->assertTrue(is_numeric($res));
 			endif;
 			//var_dump($res);
 		}
-		
+
 		function testenough_size() {
 			$fileSize='';
 			$dir='';
 			$maxDirSpace='';
-			$res= enough_size($fileSize, $dir, $maxDirSpace);			
+			$res= enough_size($fileSize, $dir, $maxDirSpace);
 			$this->assertTrue(is_bool($res));
 			//var_dump($res);
-		}  
-		
+		}
+
 		function enough_space() {
 			$file_size='';
 			$max_dir_space='';
-			$res= enough_space($file_size, $max_dir_space);			
+			$res= enough_space($file_size, $max_dir_space);
 			$this->assertTrue(is_bool($res));
 			//var_dump($res);
 		}
-		
+
 		function testfilter_extension() {
 			$filename='';
-			$res= filter_extension($filename);			
+			$res= filter_extension($filename);
 			$this->assertTrue(is_numeric($res));
 			//var_dump($res);
 		}
-		
+
 		function testget_document_title() {
 			$name='';
-			$res= get_document_title($name);		
+			$res= get_document_title($name);
 			$this->assertTrue(is_string($res));
 			//var_dump($res);
 		}
-		
+
 		function testget_levels() {
 			$filename='';
-			$res= get_levels($filename);		
+			$res= get_levels($filename);
 			$this->assertTrue(is_numeric($res));
 			//var_dump($res);
 		}
-		
+
 		function testhandle_uploaded_document() {
 			$docman = new MockDisplay();
 			$_course='';
@@ -228,7 +228,7 @@ class TestFileUpload extends UnitTestCase {
 			$file_path = $upload_path.$clean_name;
 			ob_start();
 			$res= handle_uploaded_document($_course,$uploaded_file,$base_work_dir,$upload_path,$user_id,$to_group_id=0,$to_user_id=NULL,$maxFilledSpace='',$unzip=0,$what_if_file_exists='',$output=true);
-			$docman->expectOnce(Display::display_error_message(get_lang('UplNotEnoughSpace')));		
+			$docman->expectOnce(Display::display_error_message(get_lang('UplNotEnoughSpace')));
 			$docman->expectOnce(Display::display_error_message(get_lang('UplNotAZip')." ".get_lang('PleaseTryAgain')));
 			$docman->expectOnce(Display::display_error_message(get_lang('UplUnableToSaveFileFilteredExtension')));
 			$docman->expectOnce(Display::display_error_message(get_lang('DestDirectoryDoesntExist').' ('.$upload_path.')'));
@@ -245,24 +245,24 @@ class TestFileUpload extends UnitTestCase {
 			ob_end_clean();
 			//var_dump($res);
 		}
-		
+
 		function testhtaccess2txt() {
 			$filename = str_replace('.htaccess', 'htaccess.txt', $filename);
 			$filename = str_replace('.HTACCESS', 'htaccess.txt', $filename);
-			$res= htaccess2txt($filename);		
+			$res= htaccess2txt($filename);
 			$this->assertTrue(is_string($res));
 			//var_dump($res);
 		}
-		
+
 		function testitem_property_update_on_folder() {
 			$path='/main/document/document.php';
 			$_course='';
 			$user_id='';
-			$res= item_property_update_on_folder($_course,$path,$user_id);		
+			$res= item_property_update_on_folder($_course,$path,$user_id);
 			$this->assertTrue(is_null($res));
 			//var_dump($res);
-		}		
-		
+		}
+
 		function testmove_uploaded_file_collection_into_directory() {
 			$_course=array();
 			$uploaded_file_collection=array();
@@ -272,23 +272,23 @@ class TestFileUpload extends UnitTestCase {
 			$to_group_id='';
 			$to_user_id='';
 			$max_filled_space='';
-			$res= move_uploaded_file_collection_into_directory($_course, $uploaded_file_collection, $base_work_dir, $missing_files_dir,$user_id,$to_group_id,$to_user_id,$max_filled_space);		
+			$res= move_uploaded_file_collection_into_directory($_course, $uploaded_file_collection, $base_work_dir, $missing_files_dir,$user_id,$to_group_id,$to_user_id,$max_filled_space);
 			$this->assertTrue(is_null($res));
 			//var_dump($res);
 		}
-		
+
 		function testphp2phps () {
 			$fileName = preg_replace('/\.(php.?|phtml.?)(\.){0,1}.*$/i', '.phps', $fileName);
-			$res= php2phps($fileName);		
+			$res= php2phps($fileName);
 			$this->assertTrue(is_string($res));
 			//var_dump($res);
 		}
-		
+
 		function testprocess_uploaded_file() {
 			$docman = new MockDisplay();
 			$uploaded_file='';
 			ob_start();
-			$res= process_uploaded_file($uploaded_file);		
+			$res= process_uploaded_file($uploaded_file);
 			$docman->expectOnce(Display::display_error_message(get_lang('UplExceedMaxServerUpload'). ini_get('upload_max_filesize')));
 			$docman->expectOnce(Display::display_error_message(get_lang('UplExceedMaxPostSize'). round($_POST['MAX_FILE_SIZE']/1024) ." KB"));
 			$docman->expectOnce(Display::display_error_message(get_lang('$UplPartialUpload')." ".get_lang('PleaseTryAgain')));
@@ -299,50 +299,50 @@ class TestFileUpload extends UnitTestCase {
 			$this->assertTrue(is_bool($res));
 			ob_end_clean();
 		}
-		
+
 		function testremove_accents() {
 			$string = strtr ( $string, "�����������������������������������������������������", "AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn");
-			$res= remove_accents($string);		
+			$res= remove_accents($string);
 			$this->assertTrue(is_string($res));
 			//var_dump($res);
 		}
-		
+
 		function testreplace_accents() {
 			global $charset;
 			$string = api_htmlentities($string,ENT_QUOTES,$charset);
-			$res= replace_accents($string);		
+			$res= replace_accents($string);
 			$this->assertTrue(is_string($res));
 			//var_dump($res);
 		}
-		
+
 		function testreplace_img_path_in_html_file() {
 			global $_course;
 			$originalImgPath='';
 			$newImgPath='';
 			$htmlFile='';
-			$res= replace_img_path_in_html_file($originalImgPath, $newImgPath, $htmlFile);		
+			$res= replace_img_path_in_html_file($originalImgPath, $newImgPath, $htmlFile);
 			$this->assertTrue(is_null($res));
 			//var_dump($res);
 		}
-		
+
 		function testsearch_img_from_html() {
 			$htmlFile='';
-			$res= search_img_from_html($htmlFile);		
+			$res= search_img_from_html($htmlFile);
 			$this->assertTrue(is_null($res));
 			//var_dump($res);
 		}
-		
+
 		function testset_default_settings() {
 			global $dbTable,$_configuration;
 			global $default_visibility;
 			$upload_path=str_replace('\\','/',$upload_path);
 			$upload_path=str_replace("//","/",$upload_path);
 			$filename=substr($filename,0,-1);
-			$res= set_default_settings($upload_path,$filename,$filetype="file");		
+			$res= set_default_settings($upload_path,$filename,$filetype="file");
 			$this->assertTrue(is_null($res));
 			//var_dump($res);
 		}
-		
+
 		function testtreat_uploaded_file() {
 			$uploadedFile['name']=stripslashes($uploadedFile['name']);
 			$uploadedFile='';
@@ -350,19 +350,19 @@ class TestFileUpload extends UnitTestCase {
 			$uploadPath='';
 			$maxFilledSpace='';
 			$uncompress= '';
-			$res= treat_uploaded_file($uploadedFile, $baseWorkDir, $uploadPath, $maxFilledSpace, $uncompress= '');		
+			$res= treat_uploaded_file($uploadedFile, $baseWorkDir, $uploadPath, $maxFilledSpace, $uncompress= '');
 			$this->assertTrue(is_bool($res));
 			//var_dump($res);
 		}
-		
+
 		function testunique_name() {
 			$path='';
 			$name='';
-			$res= unique_name($path,$name);		
+			$res= unique_name($path,$name);
 			$this->assertTrue(is_string($res));
 			//var_dump($res);
 		}
-		
+
 		function testunzip_uploaded_document() {
 			$docman = new MockDisplay();
 			require_once(api_get_path(LIBRARY_PATH).'/pclzip/pclzip.lib.php');
@@ -375,23 +375,23 @@ class TestFileUpload extends UnitTestCase {
 			$base_work_dir='';
 			$max_filled_space='';
 			ob_start();
-			$res= unzip_uploaded_document($uploaded_file, $upload_path, $base_work_dir, $max_filled_space, $output = true, $to_group_id=0);		
+			$res= unzip_uploaded_document($uploaded_file, $upload_path, $base_work_dir, $max_filled_space, $output = true, $to_group_id=0);
 			$docman->expectOnce(Display::display_error_message(get_lang('UplNotEnoughSpace')));
 			$this->assertTrue(is_bool($res));
-			ob_end_clean();		
+			ob_end_clean();
 			//var_dump($res);
 		}
-		
+
 		function testunzip_uploaded_file() {
 			$uploadedFile='';
 			$uploadPath='';
 			$baseWorkDir='';
 			$maxFilledSpace='';
-			$res= unzip_uploaded_file($uploadedFile, $uploadPath, $baseWorkDir, $maxFilledSpace);		
+			$res= unzip_uploaded_file($uploadedFile, $uploadPath, $baseWorkDir, $maxFilledSpace);
 			$this->assertTrue(is_bool($res));
 			//var_dump($res);
 		}
-		
+
 		function testupdate_existing_document() {
 			$docman = new MockDatabase();
 			$_course='';
@@ -401,6 +401,6 @@ class TestFileUpload extends UnitTestCase {
 			$docman->expectOnce(Database::get_course_table(TABLE_DOCUMENT,$_course['dbName']));
 			$this->assertTrue(is_bool($res));
 			//var_dump($res);
-		} 
+		}
 }
 ?>

+ 23 - 23
tests/main/inc/lib/geometry.lib.test.php

@@ -2,13 +2,13 @@
 require_once(api_get_path(LIBRARY_PATH).'geometry.lib.php');
 
 class TestGeometry extends UnitTestCase {
-	
+
 	public function TestGeometry(){
-		
+
 		$this->UnitTestCase('calculate and return the area of an irregular polygon');
-		
+
 	}
-	
+
 	public function testCalculateArea(){
 		$xs = 12;
 		$ys = 11;
@@ -16,7 +16,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	public function testSubCalculation(){
 		$a='88';
 		$b='23';
@@ -24,7 +24,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertTrue(is_numeric($res));
 		//var_dump($res);
 	}
-	
+
 	public function testLinesIntersect(){
 		$line1 = '2';
 		$line2 = '4';
@@ -34,7 +34,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertFalse($res);
 		//var_dump($res);
 	}
-	
+
 	public function testIsInSegment(){
 		$p= 16;
 		$a= 22;
@@ -45,7 +45,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertTrue($res);
 		//var_dump($res);
 	}
-	
+
 	public function testIsInLine(){
 		$p=221;
 		$a=11;
@@ -56,7 +56,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertTrue($res);
 		//var_dump($res);
 	}
-	
+
 	public function testGetSlope(){
 		$p=33;
 		$q=23;
@@ -66,7 +66,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertFalse($res);
 		//var_dump($res);
 	}
-	
+
 	public function testCheckPolygon(){
 		$xs=32;
 		$ys=13;
@@ -76,7 +76,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertFalse($res);
 		//var_dump($res);
 	}
-	
+
 	public function testPolygon2String(){
 		$xs=42;
 		$ys=62;
@@ -85,7 +85,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertTrue($res);
 		//var_dump($res);
 	}
-	
+
 	public function testIsInsidePolygon(){
 		$p=43;
 		$xs=11;
@@ -95,7 +95,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertTrue($res === false);
 		//var_dump($res);
 	}
-	
+
 	public function testGetInsideConditionals(){
 		$xs=11;
 		$ys=23;
@@ -104,7 +104,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertTrue($res);
 		//var_dump($res);
 	}
-	
+
 	public function testGetIntersectionData(){
 		$rxs=56;
 		$rys=11;
@@ -115,7 +115,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertTrue($res);
 		//var_dump($res);
 	}
-	
+
 	public function testGetIntersectionPolygon(){
 		$rxs='11';
 		$rys='23';
@@ -127,7 +127,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertFalse($res);
 		//var_dump($res);
 	}
-	
+
 	public function testGetIntersectionPolygonData(){
 		$rxs=34;
 		$rys=22;
@@ -138,7 +138,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertTrue($res);
 		//var_dump($res);
 	}
-	
+
 	public function testFUllyInside(){
 		$axs=12;
 		$ays=33;
@@ -150,7 +150,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertFalse($res);
 		//var_dump($res);
 	}
-	
+
 	public function testIsNextTo(){
 		$point=32;
 		$last_point=11;
@@ -162,7 +162,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertFalse($res);
 		//var_dump($res);
 	}
-	
+
 	public function testGetRightPoint(){
 		$point=44;
 		$polygon=0;
@@ -172,7 +172,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertFalse($res);
 		//var_dump($res);
 	}
-	
+
 	public function testGetLeftPoint(){
 		$point=44;
 		$polygon=01;
@@ -182,7 +182,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertFalse($res);
 		//var_dump($res);
 	}
-	
+
 	public function testToPointsArray(){
 		$xs=22;
 		$ys=33;
@@ -192,7 +192,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertFalse($res);
 		//var_dump($res);
 	}
-	
+
 	public function testToPointsIntersection(){
 		$xs=14;
 		$ys=14;
@@ -202,7 +202,7 @@ class TestGeometry extends UnitTestCase {
 		$this->assertFalse($res);
 		//var_dump($res);
 	}
-	
+
 	public function testInInternArray(){
 		$oint=34;
 		$intern_points=13;

+ 82 - 82
tests/main/inc/lib/groupmanager.lib.test.php

@@ -41,7 +41,7 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue(is_array($res));
 		//var_dump($res);
 	}
-	
+
 	public function testCreateGroup(){
 		$name='1';
 		$category_id='1';
@@ -53,7 +53,7 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue($res);
 		//var_dump($res);
 	}
-	
+
 	public function testCreateSubgroups(){
 		$group_id = 2;
 		$number_of_groups=3;
@@ -62,14 +62,14 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue(GroupManager::create_subgroups($res)===null);
 		//var_dump($res);
 	}
-	
+
 	public function testCreateGroupsFromVirtualCourses(){
 		$res = GroupManager::create_groups_from_virtual_courses();
 		$this->assertTrue($res);
 		$this->assertTrue(is_array($res));
 		//var_dump($res);
 	}
-	
+
 	public function testCreateClassGroups(){
 		$category_id=2;
 		$res =GroupManager::create_class_groups($category_id);
@@ -77,7 +77,7 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue(GroupManager::create_class_groups($category_id) === array());
 		//var_dump($res);
 	}
-	
+
 	public function testDeleteGroups(){
 		$fmanager = new MockFileManager();
 		$dbase = new MockDatabase();
@@ -89,7 +89,7 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue(is_numeric($res));
 		//var_dump($res);
 	}
-	
+
 	public function testGetGroupProperties(){
 		$group_id=01;
 		$res = GroupManager::get_group_properties($group_id);
@@ -99,10 +99,10 @@ class TestGroupManager extends UnitTestCase {
 	}
 
 	public function testSetGroupProperties(){
-		$group= array('group_id'=>'01', 
+		$group= array('group_id'=>'01',
 					  'name'=>'1',
 					  'description'=>'',
-					  'maximum_number_of_students'=>'2', 
+					  'maximum_number_of_students'=>'2',
  					  'doc_state' =>'',
                       'work_state' =>'',
 					  'calendar_state' =>'',
@@ -111,15 +111,15 @@ class TestGroupManager extends UnitTestCase {
 					  'wiki_state'=>'',
 					  'self_registration_allowed'=>'',
 					  'self_unregistration_allowed'=>'');
-		$res = GroupManager::set_group_properties($group['group_id'], $group['name'], $group['description'], 
-													  $group['maximum_number_of_students'], $group['doc_state'], 
-													  $group['work_state'], $group['calendar_state'], $group['announcements_state'], 
-													  $group['forum_state'],$group['wiki_state'], $group['self_registration_allowed'], 
+		$res = GroupManager::set_group_properties($group['group_id'], $group['name'], $group['description'],
+													  $group['maximum_number_of_students'], $group['doc_state'],
+													  $group['work_state'], $group['calendar_state'], $group['announcements_state'],
+													  $group['forum_state'],$group['wiki_state'], $group['self_registration_allowed'],
 													  $group['self_unregistration_allowed']);
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	public function testGetNumberOfGroups(){
 		$dbase = new MockDataBase();
 		$res = GroupManager::get_number_of_groups();
@@ -130,7 +130,7 @@ class TestGroupManager extends UnitTestCase {
 		//$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	public function testGetCategories(){
 		$course_code ='COD128983';
 		$course_db = '';
@@ -138,7 +138,7 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue(is_array($res));
 		//var_dump($res);
 	}
-	
+
 	public function testGetCategory(){
 		$dbase = new MockDataBase();
 		$id =2;
@@ -148,7 +148,7 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	public function testGetCategoryFromGroup(){
 		$course_code='';
 		$group_id='';
@@ -162,7 +162,7 @@ class TestGroupManager extends UnitTestCase {
 		//var_dump($res);
 		//var_dump($cat);
 	}
-	
+
 	public function testDeleteCategory(){
 		$cat_id=1;
 		$course_code =null;
@@ -172,54 +172,54 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertNull($res);
 		//var_dump($res);
 	}
-	
+
 	public function testCreateCategory(){
 		$categ = array(
-		'title'=>'DefaultGroupCategory', 
-		'description'=>'xxxxx', 
-		'doc_state'=>'xxxx', 
+		'title'=>'DefaultGroupCategory',
+		'description'=>'xxxxx',
+		'doc_state'=>'xxxx',
 		'work_state'=>'xxxxx',
-		'calendar_state'=>'', 
-		'announcements_state'=>'', 
-		'forum_state'=>'', 
-		'wiki_state'=>'', 
-		'self_registration_allowed'=>'', 
-		'self_unregistration_allowed'=>'', 
-		'maximum_number_of_students'=>'', 
+		'calendar_state'=>'',
+		'announcements_state'=>'',
+		'forum_state'=>'',
+		'wiki_state'=>'',
+		'self_registration_allowed'=>'',
+		'self_unregistration_allowed'=>'',
+		'maximum_number_of_students'=>'',
 		'groups_per_user'=>'0');
-		$res = GroupManager::create_category($categ['title'], $categ['description'], 
-		$categ['doc_state'], $categ['work_state'], $categ['calendar_state'], $categ['announcements_state'], 
+		$res = GroupManager::create_category($categ['title'], $categ['description'],
+		$categ['doc_state'], $categ['work_state'], $categ['calendar_state'], $categ['announcements_state'],
 		$categ['forum_state'],$categ['wiki_state'],$categ['self_registration_allowed'],$categ['self_unregistration_allowed'],
 		$categ['maximum_number_of_students'],$categ['groups_per_user']);
 		$this->assertTrue(is_numeric($res));
 		//var_dump($res);
-		
+
 	}
-	
+
 	public function testUpdateCategory(){
 		$categ = array(
 		'id'=>'1',
-		'title'=>'DefaultGroupCategory', 
-		'description'=>'xxxxx', 
-		'doc_state'=>'xxxx', 
+		'title'=>'DefaultGroupCategory',
+		'description'=>'xxxxx',
+		'doc_state'=>'xxxx',
 		'work_state'=>'xxxxx',
-		'calendar_state'=>'', 
-		'announcements_state'=>'', 
-		'forum_state'=>'', 
-		'wiki_state'=>'', 
-		'self_registration_allowed'=>'', 
-		'self_unregistration_allowed'=>'', 
-		'maximum_number_of_students'=>'', 
+		'calendar_state'=>'',
+		'announcements_state'=>'',
+		'forum_state'=>'',
+		'wiki_state'=>'',
+		'self_registration_allowed'=>'',
+		'self_unregistration_allowed'=>'',
+		'maximum_number_of_students'=>'',
 		'groups_per_user'=>'0');
-		$res = GroupManager::update_category($categ['id'], $categ['title'], $categ['description'], 
-		$categ['doc_state'], $categ['work_state'], $categ['calendar_state'], $categ['announcements_state'], 
+		$res = GroupManager::update_category($categ['id'], $categ['title'], $categ['description'],
+		$categ['doc_state'], $categ['work_state'], $categ['calendar_state'], $categ['announcements_state'],
 		$categ['forum_state'],$categ['wiki_state'],$categ['self_registration_allowed'],$categ['self_unregistration_allowed'],
 		$categ['maximum_number_of_students'],$categ['groups_per_user']);
 		$this->assertTrue(is_null($res));
 		$this->assertTrue($res ===null);
 		//var_dump($res);
 	}
-	
+
 	public function testGetCurrenMaxGroupsPerUser(){
 		$category_id = null;
 		$course_code = null;
@@ -228,16 +228,16 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue(is_Null($res));
 		//var_dump($res);
 	}
-	
+
 	public function testSwapCategoryOrder(){
 		$id1='2';
 		$id2=null;
 		$res = GroupManager::swap_category_order($id1,$id2);
 		$this->assertFalse($res);
 		$this->assertNull($res,true);
-		//var_dump($res); 
+		//var_dump($res);
 	}
-	
+
 	public function testGetUsers(){
 		$group_id='1';
 		$res =GroupManager::get_users($group_id);
@@ -245,7 +245,7 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue($res ===array());
 		//var_dump($res);
 	}
-	
+
 	public function testFillGroups(){
 		$group_ids='2';
 		global $_course;
@@ -258,11 +258,11 @@ class TestGroupManager extends UnitTestCase {
 	public function testNumberOfStudents(){
 				/*
 		$connection = &new MockDatabase($this);
-        $connection->setReturnValue('get_course_table', 'dokeos_0001.group_rel_user');        
+        $connection->setReturnValue('get_course_table', 'dokeos_0001.group_rel_user');
         $connection->get_course_table();
-        
-            
-		$group_id='2';	
+
+
+		$group_id='2';
 		$_course = api_get_course_info('0001');
 		$res = $this->gManager->number_of_students($group_id);
 		$this->assertTrue($res);
@@ -270,7 +270,7 @@ class TestGroupManager extends UnitTestCase {
 		var_dump($res);
 	}
 	*/
-	
+
 	public function testMaximumNumberOfStudents(){
 		$group_id ='2';
 		$_course = api_get_course_info('0001');
@@ -279,7 +279,7 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue(is_string($res));
 		//var_dump($res);
 	}
-	
+
 	public function testUserInNumberOfGroups(){
 		$user_id='1';
 		$cat_id = '6';
@@ -289,7 +289,7 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue(is_null($res));
 		//var_dump($res);
 	}
-	
+
 	public function testIsSelfRegistrationAllowed(){
 		$user_id='1';
 		$group_id='6';
@@ -298,7 +298,7 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue($res === false);
 		//var_dump($res);
 	}
-	
+
 	public function testIsSelfUnregistrationAllowed(){
 		$user_id='2';
 		$group_id='6';
@@ -307,7 +307,7 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue($res === false);
 		//var_dump($res);
 	}
-	
+
 	public function testIsSubscribed(){
 		$dbase = new MockDataBase();
 		$db_result ='2';
@@ -317,8 +317,8 @@ class TestGroupManager extends UnitTestCase {
 		$dbase->expectOnce('Database::fetch_array($res)');
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
-	} 
-	
+	}
+
 	public function testCanUserSubscribe(){
 		$user_id='2';
 		$group_id='2';
@@ -327,7 +327,7 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue(is_numeric($res));
 		//var_dump($res);
 	}
-	
+
 	public function testCanUserUnsubscribe(){
 		$user_id ='6';
 		$group_id='6';
@@ -336,21 +336,21 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue($res === false);
 		//var_dump($res);
 	}
-	
+
 	public function testGetSubscribedUsers(){
 		$group_id='2';
 		$res = GroupManager::get_subscribed_users($group_id);
 		$this->assertTrue(is_array($res));
 		//var_dump($res);
 	}
-	
+
 	public function testGetSubscribedTutors(){
 		$group_id='2';
 		$res = GroupManager::get_subscribed_tutors($group_id);
 		$this->assertTrue(is_array($res));
 		//var_dump($res);
 	}
-	
+
 	public function testSubscribeUsers(){
 		$user_ids = '2';
 		$group_id= '2';
@@ -358,15 +358,15 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue(is_numeric($res));
 		//var_dump($res);
 	}
-	
+
 	public function testSubscribeTutors(){
-		$user_ids='2'; 
+		$user_ids='2';
 		$group_id='6';
 		$res &= GroupManager::subscribe_tutors($user_ids, $group_id);
 		$this->assertTrue(is_numeric($res));
 		//var_dump($res);
 	}
-	
+
 	public function testUnsubscribeUsers(){
 		$user_ids = array(5);
 		$group_id = 5;
@@ -374,21 +374,21 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue(is_numeric($res));
 		//var_dump($res);
 	}
-	
+
 	public function testUnsubscribeAllUsers(){
 		$group_ids=array(2,);
 		$res = GroupManager::unsubscribe_all_users($group_ids);
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	public function testUnsubscribeAllTutors(){
 		$group_ids =array(6,9,10,11,14,15,16,19);
 		$res = GroupManager::unsubscribe_all_tutors($group_ids);
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	public function testIsTutorOfGroup(){
 		$user_id=2;
 		$group_id=2;
@@ -396,7 +396,7 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		//var_dump($res);
 	}
-	
+
 	public function testIsUserInGroup(){
 		$user_id=  2;
 		$group_id= 4;
@@ -406,13 +406,13 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertFalse($res);
 		//var_dump($res);
 	}
-	
+
 	public function testGetAllTutors(){
 		$res =GroupManager::get_all_tutors();
 		$this->assertTrue(is_array($res));
 		//var_dump($res);
 	}
-	
+
 	public function testIsTutor(){
 		$user_id = 2;
 		global $_course;
@@ -420,9 +420,9 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue(is_bool($res));
 		$this->assertTrue($res === false);
 		//var_dump($res);
-		
+
 	}
-	
+
 	public function testGetGroupIds(){
 		$course_db='';
 		$user_id=2;
@@ -430,7 +430,7 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue(is_array($res));
 		//var_dump($res);
 	}
-	
+
 	public function testGetCompleteListOfUsersThatCanBeAddedToGroup(){
 		global $_course, $_user;
 		$course_code=0001;
@@ -439,7 +439,7 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue(is_null($res));
 		//var_dump($res);
 	}
-	
+
 	public function testfilter_duplicates(){
 		$user_array_in='';
 		$compare_field='';
@@ -453,18 +453,18 @@ class TestGroupManager extends UnitTestCase {
 		$group_id=2;
 		$res = $this->gManager->filter_users_already_in_group($user_array_in, $group_id);
 		$this->assertTrue(is_array($res));
-		//var_dump($res);	
+		//var_dump($res);
 	}*/
-	
+
 	public function testFilterOnlyStudents(){
 		$user_array_in='';
 		$res= GroupManager::filter_only_students($user_array_in);
 		$this->assertTrue(is_array($res));
 		//var_dump($res);
 	}
-	
+
 	public function testUserHasAccess(){
-		$user_id='2'; 
+		$user_id='2';
 		$group_id='5';
 		$tool='wiki_state';
 		$res = GroupManager::user_has_access($user_id, $group_id, $tool);
@@ -472,7 +472,7 @@ class TestGroupManager extends UnitTestCase {
 		$this->assertTrue($res === false);
 		//var_dump($res);
 	}
-	
+
 	public function testGetUserGroupName(){
 		$user_id='';
 		$res=GroupManager::get_user_group_name($user_id);

+ 15 - 15
tests/main/inc/lib/image.lib.test.php

@@ -2,16 +2,16 @@
 require_once(api_get_path(LIBRARY_PATH).'image.lib.php');
 
 class TestImage extends UnitTestCase {
-	
+
 	public $timage;
 	public function TestImage(){
 		$this->UnitTestCase('All main image function tests');
 	}
-	
+
 	public function setUp(){
 		$this->timage = new image();
 	}
-	
+
 	public function tearDown(){
 		$this->timage = null;
 	}
@@ -19,21 +19,21 @@ class TestImage extends UnitTestCase {
 	public function testAddBackGround() {
 			$bgfile='';
 			$res=$this->timage->addbackground($bgfile);
-			$this->assertTrue(is_null($res)); 
+			$this->assertTrue(is_null($res));
 			//var_dump($bgfile);
 		}
 
 	public function testAddLogo() {
 			$file='';
 			$res=$this->timage->addlogo($file);
-			$this->assertTrue(is_null($res)); 
+			$this->assertTrue(is_null($res));
 			//var_dump($res);
 	}
 
 	public function testaddtext() {
 			$text='';
 			$res=$this->timage->addtext($text);
-			$this->assertTrue(is_null($res)); 
+			$this->assertTrue(is_null($res));
 			//var_dump($res);
 	}
 
@@ -41,27 +41,27 @@ class TestImage extends UnitTestCase {
 			$file='';
 			$handler='';
 			$res=$this->timage->createimagefromtype($file,$handler);
-			$this->assertTrue(is_null($res)); 		
+			$this->assertTrue(is_null($res));
 			//var_dump($res);
 	}
-	
+
 	public function testimagenaddback() {
 			$bgfile='';
 			$res=$this->timage->image($bgfile);
-			$this->assertTrue(is_null($res)); 		
+			$this->assertTrue(is_null($res));
 			//var_dump($res);
-		
+
 	}
-	
+
 	public function testmakecolor() {
 	 		$red='';
 	 		$green='';
 	 		$blue='';
 	 		$res=$this->timage->makecolor($red, $green, $blue);
-			$this->assertTrue(is_null($res)); 		
+			$this->assertTrue(is_null($res));
 			//var_dump($res);
 	 }
-	
+
 	public function testmergelogo() {
 	 		$x='';
 	 		$y='';
@@ -85,7 +85,7 @@ class TestImage extends UnitTestCase {
 			$this->assertTrue(is_numeric($res));
 			//var_dump($res);
 	 }
-	
+
 
 	public function testsetfont() {
 			$fontfile=$this->fontfile;
@@ -105,6 +105,6 @@ class TestImage extends UnitTestCase {
 
 
 
-	
+
 }
 ?>

+ 1 - 1
tests/main/inc/lib/import.lib.test.php

@@ -2,7 +2,7 @@
 require_once(api_get_path(LIBRARY_PATH).'import.lib.php');
 
 class TestImport extends UnitTestCase {
-	
+
 	function testCsvToArray(){
 		$filename='';
 		$res=Import::csv_to_array($filename);

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov