Juan Carlos Raña 15 years ago
parent
commit
43814df9be

+ 26 - 0
dokeos_license.txt

@@ -0,0 +1,26 @@
+===============================================================================
+	Dokeos - elearning and course management software
+
+	Copyright (c) 2004-2009 Dokeos SPRL
+    Copyright (c) 2009 Dokeos Latinoamérica SAC
+	Copyright (c) 2003-2007 Ghent University (UGent)
+	Copyright (c) 2001 Universite catholique de Louvain (UCL)
+	Copyright (c) 2003-2008 Vrije Universiteit Brussel (VUB)
+	Copyright (c) 2004-2008 Hoogeschool Gent (HoGent)
+	Copyright (c) Denes Nagy (darkden@freemail.hu)
+	For a full list of contributors detaining copyrights over parts of
+	the Dokeos software, see "documentation/credits.html".
+	The full license can be read in "documentation/license.html".
+
+	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, Rue du Corbeau, 108, B-1030 Brussels, Belgium
+	Mail: info@dokeos.com
+===============================================================================
+This license is referenced throughout the code using the following header line:
+/* For licensing terms, see /dokeos_license.txt */

+ 43 - 12
main/admin/add_users_to_group.php

@@ -163,7 +163,7 @@ function search_users($needle,$type,$relation_type) {
 					}
 				}
 				$rs_multiple = Database::query($sql, __FILE__, __LINE__);
-				$return_origin .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">';
+				$return_origin .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">';				
 				while ($user = Database :: fetch_array($rs_multiple)) {
 					$person_name = api_get_person_name($user['firstname'], $user['lastname']);
 		            $return_origin .= '<option value="'.$user['user_id'].'">'.$person_name.' ('.$user['username'].')</option>';
@@ -223,7 +223,9 @@ $users=$sessions=array();
 $noPHP_SELF=true;
 
 $group_info = GroupPortalManager::get_group_data($group_id);
-Display::display_header($tool_name);
+$group_name = $group_info['name']; 
+
+Display::display_header($group_name);
 
 if($_POST['form_sent']) {
 	
@@ -236,8 +238,18 @@ if($_POST['form_sent']) {
 	if(!is_array($UserList)) {
 		$UserList=array();
 	}
-	if ($form_sent == 1) {		
-		GroupPortalManager::delete_users($group_id, $relation_type);
+	if ($form_sent == 1) {
+		if ($relation_type == GROUP_USER_PERMISSION_PENDING_INVITATION) {	
+			$relations = array(GROUP_USER_PERMISSION_PENDING_INVITATION,GROUP_USER_PERMISSION_READER);
+			$users_by_group = GroupPortalManager::get_users_by_group($group_id,null,$relations);
+			$user_id_relation = array_keys($users_by_group);		
+			$user_relation_diff = array_diff($user_id_relation,$UserList);
+			foreach ($user_relation_diff as $user_id) {
+				GroupPortalManager::delete_user_rel_group($user_id,$group_id);
+			}
+		} else {
+			GroupPortalManager::delete_users($group_id, $relation_type);			
+		}		
 		$result = GroupPortalManager::add_users_to_groups($UserList, array($group_id), $relation_type);
 		Display :: display_confirmation_message(get_lang('UsersEdited'));
 	}
@@ -277,8 +289,25 @@ if ($ajax_search) {
 
 } else {
 	
+	$many_users = false;	
+	$sql = "SELECT count(user_id) FROM $tbl_user user
+			WHERE ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%' AND user_id<>'$user_anonymous' $without_user_id ";
+	if ($_configuration['multiple_access_urls']==true) {			
+		$access_url_id = api_get_current_access_url_id();
+		if ($access_url_id != -1) {
+			$sql = "SELECT count(user.user_id) FROM $tbl_user user
+					INNER JOIN $tbl_user_rel_access_url url_user ON (url_user.user_id=user.user_id)
+					WHERE access_url_id = '$access_url_id'
+					AND ".(api_sort_by_first_name() ? 'firstname' : 'lastname')." LIKE '$needle%' 
+					AND user.user_id<>'$user_anonymous' $without_user_id ";
+		}
+	}				
+	$rs_count  = Database::query($sql,__FILE__,__LINE__);
+	$row_count = Database::fetch_row($rs_count);	
+	if ($row_count > 2) $many_users = true;
+		
 	// data for origin list	
-	if (isset($_POST['id']) && isset($_POST['firstLetterUser'])) {					
+	if (isset($_POST['id']) && isset($_POST['firstLetterUser'])) {				
 		$id = intval($_POST['id']);
 		$needle = Database::escape_string($_POST['firstLetterUser']);
 		$needle = api_convert_encoding($needle, $charset, 'utf-8');
@@ -420,13 +449,15 @@ if(!empty($errorMsg)) {
 <td align="center">
 
 <?php echo get_lang('FirstLetterUser'); ?> :
-     <select name="firstLetterUser" id="firstLetterUser" onchange = "xajax_search_users(this.value,'multiple',document.getElementById('relation').value)" >
-      <option value = "%">--</option>
-      <?php
-      	$selected_letter = isset($_POST['firstLetterUser'])?$_POST['firstLetterUser']:'';      	
-        echo Display :: get_alphabet_options($selected_letter);
-      ?>
-     </select>
+	<div id="firstLetter">
+	     <select name="firstLetterUser" id="firstLetterUser" onchange = "xajax_search_users(this.value,'multiple',document.getElementById('relation').value)" >
+	      <option value = "%"><?php echo get_lang('All') ?></option>
+	      <?php
+	      	$selected_letter = isset($_POST['firstLetterUser'])?$_POST['firstLetterUser']:'';      	
+	        echo Display :: get_alphabet_options($selected_letter);
+	      ?>
+	     </select>
+     </div>
 </td>
 <td align="center">&nbsp;</td>
 </tr>

+ 8 - 1
main/admin/group_list.php

@@ -105,7 +105,14 @@ function get_group_data($from, $number_of_items, $column, $direction)
 
 	$users = array ();
     $t = time();
-	while ($group = Database::fetch_row($res)) {		
+    
+    // Status
+	$status = array();
+	$status[GROUP_PERMISSION_OPEN] 		= get_lang('Open');
+	$status[GROUP_PERMISSION_CLOSED]	= get_lang('Closed');
+	
+	while ($group = Database::fetch_row($res)) {
+		$group[3] = $status[$group[3]];	
 		$group['1'] = '<a href="/main/social/groups.php?id='.$group['0'].'">'.$group['1'].'</a>';      
         $groups[] = $group;
 	}

+ 18 - 0
main/css/blue_lagoon/default.css

@@ -2843,6 +2843,24 @@ a.unread {
 .groups_grid_element_2 { width:150px; float:left;}
 
 
+/* Groups boxes */
+.group_invitation_grid_container { width:100%;}
+.group_invitation_grid_item {
+	border:1px dotted #CCCCCC;
+	float:left;
+	height:85px;
+	margin:8px;
+	padding:5px;
+	width:300px;
+}
+.group_invitation_grid_element_0 { width:100px; float:left; text-align:center; margin-bottom:5px;}
+.group_invitation_grid_element_1 { width:100px; float:left; text-align:left;margin-bottom:5px;}
+.group_invitation_grid_element_2 { width:150px; float:left;}
+
+
+
+
+
 /* User boxes */
 .search_users_grid_container { width:100%;}
 .search_users_grid_item { width:400px;  height: 90px;  border:1px dotted #ccc; float:left; padding:5px; margin:8px;}

+ 8 - 9
main/exercice/exercice_submit.php

@@ -1,5 +1,5 @@
 <?php
-/* For licensing terms, see /dokeos_license.txt */
+/* For licensing terms, see /chamilo_license.txt */
 
 /**
 *	Exercise submission
@@ -47,10 +47,9 @@ $this_section = SECTION_COURSES;
 $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
 $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.corners.min.js" type="text/javascript"></script>';
 
-if (api_get_setting('show_glossary_in_extra_tools') == 'true') { 
-  	$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/glossary.js" type="text/javascript" language="javascript"></script>'; //Glossary
-  	$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
-   
+if (api_get_setting('show_glossary_in_extra_tools') == 'true') {
+	$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/glossary.js" type="text/javascript" language="javascript"></script>'; //Glossary
+	$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>'; 
 }
 //This library is necessary for the time control feature
 $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.epiclock.min.js" type="text/javascript" language="javascript"></script>'; //jQuery
@@ -124,7 +123,6 @@ $error = '';
 if (!isset ($exerciseType)) {
 	$exe_start_date = time();
 	$_SESSION['exercice_start_date'] = $exe_start_date;
-	error_log($_SESSION['exercice_start_date']);	
 }
 // if the user has clicked on the "Cancel" button
 if ($buttonCancel) {
@@ -1227,19 +1225,20 @@ if ($_configuration['live_exercise_tracking'] == true && $exerciseFeedbackType !
 	    } else {
 	      $sql_fields = "";
 	      $sql_fields_values = "";
-	    } error_log($exerciseType);   
+	    }  
 	
 		if ($exerciseType == 2) {
 	    	$sql = "INSERT INTO $stat_table($sql_fields exe_exo_id,exe_user_id,exe_cours_id,status,session_id,data_tracking,start_date,orig_lp_id,orig_lp_item_id)
 	      			VALUES($sql_fields_values '$exerciseId','" . api_get_user_id() . "','" . $_course['id'] . "','incomplete','" . api_get_session_id() . "','" . implode(',', $questionList) . "','" . date('Y-m-d H:i:s') . "',$safe_lp_id,$safe_lp_item_id)";
-	      error_log($sql);      
+     
 			Database::query($sql, __FILE__, __LINE__);      
 		} else {
 	    	$sql = "INSERT INTO $stat_table ($sql_fields exe_exo_id,exe_user_id,exe_cours_id,status,session_id,start_date,orig_lp_id,orig_lp_item_id)
 	       			VALUES($sql_fields_values '$exerciseId','" . api_get_user_id() . "','" . $_course['id'] . "','incomplete','" . api_get_session_id() . "','" . date('Y-m-d H:i:s') . "',$safe_lp_id,$safe_lp_item_id)";
-	       			error_log($sql);  
+	   
 			Database::query($sql, __FILE__, __LINE__);
 		}
+
 	}
 }
 

+ 5 - 4
main/inc/lib/group_portal_manager.lib.php

@@ -1164,9 +1164,9 @@ class GroupPortalManager
 			case GROUP_USER_PERMISSION_READER:
 				// I'm just a reader
 				echo get_lang('IamAReader');
-				echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?view_panel=1&height=400&width=610&&user_friend='.api_get_user_id().'&group_id='.$group_id.'" class="thickbox" title="'.get_lang('ComposeMessage').'">'.Display::return_icon('message_new.png', get_lang('NewTopic')).'&nbsp;'.get_lang('NewTopic').'</a></li>';
-				echo '<li><a href="groups.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'.get_lang('LeaveGroup').'</a></li>';
+				echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?view_panel=1&height=400&width=610&&user_friend='.api_get_user_id().'&group_id='.$group_id.'" class="thickbox" title="'.get_lang('ComposeMessage').'">'.Display::return_icon('message_new.png', get_lang('NewTopic')).'&nbsp;'.get_lang('NewTopic').'</a></li>';				
 				echo '<li><a href="group_invitation.php?id='.$group_id.'">'.get_lang('InviteFriends').'</a></li>';
+				echo '<li><a href="groups.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'.get_lang('LeaveGroup').'</a></li>';
 					
 				break;
 			case GROUP_USER_PERMISSION_ADMIN:
@@ -1190,6 +1190,7 @@ class GroupPortalManager
 				echo '<li><a href="group_members.php?id='.$group_id.'">'.get_lang('MemberList').'</a></li>';
 				echo '<li><a href="group_waiting_list.php?id='.$group_id.'">'.get_lang('WaitingList').'</a></li>';
 				echo '<li><a href="group_invitation.php?id='.$group_id.'">'.get_lang('InviteFriends').'</a></li>';
+				echo '<li><a href="groups.php?id='.$group_id.'&action=leave&u='.api_get_user_id().'">'.get_lang('LeaveGroup').'</a></li>';
 				break;
 			case GROUP_USER_PERMISSION_ANONYMOUS:
 				echo '<li><a href="groups.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('JoinGroup').'</a></li>';
@@ -1211,8 +1212,8 @@ class GroupPortalManager
 					}
 					
 					echo '<div class="group_member_item"><a href="profile.php?u='.$user['user_id'].'">';
-						echo '<div class="group_member_picture">'.$user['image'].'</div>';
-						echo api_get_person_name($user['firstname'], $user['lastname']).'</a></div>';
+					echo '<div class="group_member_picture">'.$user['image'].'</div>';
+					echo api_get_person_name($user['firstname'], $user['lastname']).'</a></div>';
 				}
 			}
 		echo '</div>';

+ 1 - 1
main/inc/lib/javascript/tag/style.css

@@ -1,5 +1,5 @@
 /* TextboxList sample CSS */
-ul.holder { margin: 0; border: 1px solid #999; overflow: hidden; height: auto !important; height: 1%; padding: 4px 5px 0; }
+ul.holder { margin: 0; border: 1px solid #ccc; overflow: hidden; height: auto !important; height: 1%; padding: 4px 5px 0; }
 *:first-child+html ul.holder { padding-bottom: 2px; } * html ul.holder { padding-bottom: 2px; } /* ie7 and below */
 ul.holder li { float: left; list-style-type: none; margin: 0 5px 4px 0; white-space:nowrap;}
 ul.holder li.bit-box, ul.holder li.bit-input input { font: 11px "Lucida Grande", "Verdana"; }

+ 16 - 8
main/install/dokeos_main.sql

@@ -741,7 +741,10 @@ VALUES
 ('youtube_for_students',NULL,'radio','Editor','true','YoutubeForStudentsTitle','YoutubeForStudentsComment',NULL,NULL, 0),
 ('block_copy_paste_for_students',NULL,'radio','Editor','false','BlockCopyPasteForStudentsTitle','BlockCopyPasteForStudentsComment',NULL,NULL, 0),
 ('more_buttons_maximized_mode',NULL,'radio','Editor','false','MoreButtonsForMaximizedModeTitle','MoreButtonsForMaximizedModeComment',NULL,NULL, 0),
-('students_download_folders',NULL,'radio','Tools','true','AllowStudentsDownloadFoldersTitle','AllowStudentsDownloadFoldersComment',NULL,NULL, 0);
+('students_download_folders',NULL,'radio','Tools','true','AllowStudentsDownloadFoldersTitle','AllowStudentsDownloadFoldersComment',NULL,NULL, 0),
+('show_tabs', 'social', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsSocial', 0),
+('allow_students_to_create_groups_in_social',NULL,'radio','Tools','false','AllowStudentsToCreateGroupsInSocialTitle','AllowStudentsToCreateGroupsInSocialComment',NULL,NULL, 0),
+('allow_send_message_to_all_platform_users',NULL,'radio','Tools','false','AllowSendMessageToAllPlatformUsersTitle','AllowSendMessageToAllPlatformUsersComment',NULL,NULL, 0);
 
 UNLOCK TABLES;
 /*!40000 ALTER TABLE settings_current ENABLE KEYS */;
@@ -943,8 +946,11 @@ VALUES
 ('more_buttons_maximized_mode','true','Yes'),
 ('more_buttons_maximized_mode','false','No'),
 ('students_download_folders','true','Yes'),
-('students_download_folders','false','No');
-
+('students_download_folders','false','No'),
+('allow_students_to_create_groups_in_social','true','Yes'),
+('allow_students_to_create_groups_in_social','false','No'),
+('allow_send_message_to_all_platform_users','true','Yes'),
+('allow_send_message_to_all_platform_users','false','No');
 UNLOCK TABLES;
 
 /*!40000 ALTER TABLE settings_options ENABLE KEYS */;
@@ -2331,6 +2337,8 @@ CREATE TABLE group_rel_tag (
   group_id int NOT NULL,
   PRIMARY KEY (id)
 );
+ALTER TABLE `group_rel_tag` ADD INDEX ( group_id );
+ALTER TABLE `group_rel_tag` ADD INDEX ( tag_id );
 
 CREATE TABLE group_rel_user (
   id int NOT NULL AUTO_INCREMENT,
@@ -2339,7 +2347,9 @@ CREATE TABLE group_rel_user (
   relation_type int NOT NULL,
   PRIMARY KEY (id)
 );
-
+ALTER TABLE `group_rel_user` ADD INDEX ( group_id );
+ALTER TABLE `group_rel_user` ADD INDEX ( user_id );
+ALTER TABLE `group_rel_user` ADD INDEX ( relation_type );
 --
 -- Table structure for table message attachment
 --
@@ -2352,9 +2362,7 @@ CREATE TABLE IF NOT EXISTS message_attachment (
   message_id int NOT NULL,
   filename varchar(255) NOT NULL,
   PRIMARY KEY  (id)
-)
-
+);
 
 INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) values (10, 'tags','tags',0,0);
-INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) values (9, 'rssfeeds','RSS',0,0);
-
+INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) values (9, 'rssfeeds','RSS',0,0);

+ 17 - 1
main/install/migrate-db-1.8.6.1-1.8.6.2-pre.sql

@@ -69,6 +69,22 @@ UPDATE TABLE settings_current SET selected_value = '1.8.6.2.9070' WHERE variable
 
 INSERT INTO course_field (field_type, field_variable, field_display_text, field_default_value, field_visible, field_changeable) values (10, 'special_course','SpecialCourse', 'Yes', 1 , 1);
 
+ALTER TABLE `group_rel_user` ADD INDEX ( group_id );
+ALTER TABLE `group_rel_user` ADD INDEX ( user_id );
+ALTER TABLE `group_rel_user` ADD INDEX ( relation_type );
+ALTER TABLE `group_rel_tag`  ADD INDEX ( group_id );
+ALTER TABLE `group_rel_tag`  ADD INDEX ( tag_id );
+
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_students_to_create_groups_in_social', NULL, 'radio', 'Tools', 'false', 'AllowStudentsToCreateGroupsInSocialTitle', 'AllowStudentsToCreateGroupsInSocialComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_students_to_create_groups_in_social', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_students_to_create_groups_in_social', 'false', 'No');
+
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_send_message_to_all_platform_users', NULL, 'radio', 'Tools', 'false', 'AllowSendMessageToAllPlatformUsersTitle', 'AllowSendMessageToAllPlatformUsersComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_send_message_to_all_platform_users', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_send_message_to_all_platform_users', 'false', 'No');
+
+
 -- xxSTATSxx
 ALTER TABLE track_e_exercices ADD COLUMN expired_time_control datetime NOT NULL DEFAULT '0000-00-00 00:00:00';
 ALTER TABLE track_e_online ADD INDEX (course);
@@ -94,4 +110,4 @@ ALTER TABLE student_publication ADD COLUMN weight float(6,2) UNSIGNED NOT NULL D
 ALTER TABLE course_description ADD COLUMN description_type TINYINT NOT NULL DEFAULT 0;
 ALTER TABLE dropbox_category ADD COLUMN session_id smallint NOT NULL DEFAULT 0, ADD INDEX (session_id);
 ALTER TABLE quiz ADD COLUMN random_answers TINYINT UNSIGNED NOT NULL DEFAULT 0 AFTER random;
-ALTER TABLE quiz_answer ADD COLUMN id_auto INT NOT NULL AUTO_INCREMENT, ADD UNIQUE INDEX (id_auto);
+ALTER TABLE quiz_answer ADD COLUMN id_auto INT NOT NULL AUTO_INCREMENT, ADD UNIQUE INDEX (id_auto);

+ 2 - 5
main/messages/find_users.php

@@ -21,15 +21,12 @@ $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') {
-	//if (api_get_setting('allow_social_tool')=='true')) {
 	
 	//all users 
-	//@todo implement an api_get_setting() funcionality
-	if (1) {
+	if (api_get_setting('display_all_platform_users_in_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
 		FROM '.$tbl_user.' u  	
- 		WHERE u.user_id <>'.(int)$user_id.' AND '.($is_western_name_order ? 'concat(u.firstname, " ", u.lastname)' : 'concat(u.lastname, " ", u.firstname)').' like CONCAT("%","'.$search.'","%") LIMIT 15';
-		
+ 		WHERE u.user_id <>'.(int)$user_id.' AND '.($is_western_name_order ? 'concat(u.firstname, " ", u.lastname)' : 'concat(u.lastname, " ", u.firstname)').' like CONCAT("%","'.$search.'","%") LIMIT 15';		
 	} else {
 		//only my contacts
 		$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

+ 2 - 2
main/messages/inbox.php

@@ -117,11 +117,11 @@ $table_message = Database::get_main_table(TABLE_MESSAGE);
 //api_display_tool_title(api_xml_http_response_encode(get_lang('Inbox')));
 if ($_GET['f']=='social') {
 	$this_section = SECTION_SOCIAL;
-	$interbreadcrumb[]= array ('url' => '#','name' => get_lang('Profile'));
+	$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/profile.php','name' => get_lang('Profile'));
 	$interbreadcrumb[]= array ('url' => 'outbox.php','name' => get_lang('Inbox'));	
 } else {
 	$this_section = SECTION_MYPROFILE;
-	$interbreadcrumb[]= array ('url' => '#','name' => get_lang('Profile'));
+	$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile'));
 	$interbreadcrumb[]= array ('url' => 'outbox.php','name' => get_lang('Inbox'));
 }
 

+ 4 - 4
main/messages/new_message.php

@@ -174,10 +174,10 @@ function manage_form ($default, $select_from_user_list = null) {
 		$form->addElement('hidden','group_id',$group_id);
 		$form->addElement('hidden','parent_id',$message_id);		
 	}
-	$form->add_textfield('title', get_lang('Title'),true ,array('size' => 75));
+	$form->add_textfield('title', get_lang('Title'),true ,array('size' => 77));
 		
 	//$form->add_html_editor('content', '', false, false, array('ToolbarSet' => 'Messages', 'Width' => '95%', 'Height' => '250'));
-	$form->addElement('textarea','content', get_lang('Message'), array('cols' => 75,'rows'=>5));
+	$form->addElement('textarea','content', get_lang('Message'), array('cols' => 75,'rows'=>8));
 	
 	if (isset($_GET['re_id'])) {
 		$form->addElement('hidden','re_id',Security::remove_XSS($_GET['re_id']));
@@ -227,11 +227,11 @@ function manage_form ($default, $select_from_user_list = null) {
 */
 if ($_GET['f']=='social') {
 	$this_section = SECTION_SOCIAL;
-	$interbreadcrumb[]= array ('url' => '#','name' => get_lang('Profile'));
+	$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/profile.php','name' => get_lang('Profile'));
 	$interbreadcrumb[]= array ('url' => 'outbox.php','name' => get_lang('Inbox'));	
 } else {
 	$this_section = SECTION_MYPROFILE;
-	$interbreadcrumb[]= array ('url' => '#','name' => get_lang('Profile'));
+	$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile'));
 	$interbreadcrumb[]= array ('url' => 'outbox.php','name' => get_lang('Inbox'));
 }
 

+ 2 - 2
main/messages/outbox.php

@@ -59,11 +59,11 @@ function deselect_all(formita)
 //api_display_tool_title(api_xml_http_response_encode(get_lang('Inbox')));
 if ($_GET['f']=='social') {
 	$this_section = SECTION_SOCIAL;
-	$interbreadcrumb[]= array ('url' => '#','name' => get_lang('Profile'));
+	$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/profile.php','name' => get_lang('Profile'));
 	$interbreadcrumb[]= array ('url' => 'outbox.php','name' => get_lang('Inbox'));	
 } else {
 	$this_section = SECTION_MYPROFILE;
-	$interbreadcrumb[]= array ('url' => '#','name' => get_lang('Profile'));
+	$interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile'));
 	$interbreadcrumb[]= array ('url' => 'outbox.php','name' => get_lang('Inbox'));
 }
 

+ 27 - 69
main/newscorm/learnpath.class.php

@@ -1786,9 +1786,9 @@ class learnpath {
 
 			'        <a href="lp_controller.php?action=stats" onclick="window.parent.API.save_asset();return true;" target="content_name_blank" title="stats" id="stats_link"><img border="0" src="../img/lp_stats.gif" title="' . get_lang('Reporting') . '"></a>' . "\n" .
 
-			'        <a href="" onclick="dokeos_xajax_handler.switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous"><img border="0" src="../img/lp_leftarrow.gif" title="' . get_lang('ScormPrevious') . '"></a>' . "\n" .
+			'        <a href="" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous"><img border="0" src="../img/lp_leftarrow.gif" title="' . get_lang('ScormPrevious') . '"></a>' . "\n" .
 
-			'        <a href="" onclick="dokeos_xajax_handler.switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next"  ><img border="0" src="../img/lp_rightarrow.gif" title="' . get_lang('ScormNext') . '"></a>' . "\n" .
+			'        <a href="" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next"  ><img border="0" src="../img/lp_rightarrow.gif" title="' . get_lang('ScormNext') . '"></a>' . "\n" .
 
 			//'        <a href="lp_controller.php?action=mode&mode=embedded" target="_top" title="embedded mode"><img border="0" src="../img/view_choose.gif" title="'.get_lang('ScormExitFullScreen').'"></a>'."\n" .
 
@@ -1814,9 +1814,9 @@ class learnpath {
 
 			'        <a href="lp_controller.php?action=stats" onclick="window.parent.API.save_asset();return true;" target="content_name" title="stats" id="stats_link"><img border="0" src="../img/lp_stats.gif" title="' . get_lang('Reporting') . '"></a>' . "\n" .
 
-			'        <a href="" onclick="dokeos_xajax_handler.switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous"><img border="0" src="../img/lp_leftarrow.gif" title="' . get_lang('ScormPrevious') . '"></a>' . "\n" .
+			'        <a href="" onclick="switch_item(' . $mycurrentitemid . ',\'previous\');return false;" title="previous"><img border="0" src="../img/lp_leftarrow.gif" title="' . get_lang('ScormPrevious') . '"></a>' . "\n" .
 
-			'        <a href="" onclick="dokeos_xajax_handler.switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next"  ><img border="0" src="../img/lp_rightarrow.gif" title="' . get_lang('ScormNext') . '"></a>' . "\n" .
+			'        <a href="" onclick="switch_item(' . $mycurrentitemid . ',\'next\');return false;" title="next"  ><img border="0" src="../img/lp_rightarrow.gif" title="' . get_lang('ScormNext') . '"></a>' . "\n" .
 
 			// '        <a href="lp_controller.php?action=mode&mode=fullscreen" target="_top" title="fullscreen"><img border="0" src="../img/view_fullscreen.gif" width="18" height="18" title="'.get_lang('ScormFullScreen').'"></a>'."\n" .
 
@@ -2648,6 +2648,28 @@ class learnpath {
 		}
 		return $toc;
 	}
+    /**
+     * Generate and return the table of contents for this learnpath. The JS
+     * table returned is used inside of scorm_api.php
+     * @return  string  A JS array vairiable construction
+     */
+    function get_items_details_as_js($varname='olms.lms_item_types') {
+        if ($this->debug > 0) {
+            error_log('New LP - In learnpath::get_items_details_as_js()', 0);
+        }
+        $toc = $varname.' = new Array();';
+        //echo "<pre>".print_r($this->items,true)."</pre>";
+        foreach ($this->ordered_items as $item_id) {
+            if ($this->debug > 2) {
+                error_log('New LP - learnpath::get_items_details_as_js(): getting info for item ' . $item_id, 0);
+            }
+            $toc.= $varname."['i$item_id'] = '".$this->items[$item_id]->get_type()."';";
+        }
+        if ($this->debug > 2) {
+            error_log('New LP - In learnpath::get_items_details_as_js() - TOC array: ' . print_r($toc, true), 0);
+        }
+        return $toc;
+    }
 	/**
 	 * Gets the learning path type
 	 * @param	boolean		Return the name? If false, return the ID. Default is false.
@@ -2714,70 +2736,6 @@ class learnpath {
 		}
 		return $list;
 	}
-	/**
-	 * Uses the table generated by get_toc() and returns an HTML-formatted string ready to display
-	 * @return	string	HTML TOC ready to display
-	 */
-	/*function get_html_toc()
-	{
-		if($this->debug>0){error_log('New LP - In learnpath::get_html_toc()',0);}
-		$list = $this->get_toc();
-		//echo $this->current;
-		//$parent = $this->items[$this->current]->get_parent();
-		//if(empty($parent)){$parent = $this->ordered_items[$this->items[$this->current]->get_previous_index()];}
-		$html = '<div class="inner_lp_toc">'."\n" ;
-		//		" onchange=\"javascript:document.getElementById('toc_$parent').focus();\">\n";
-		require_once('resourcelinker.inc.php');
-
-		//temp variables
-		$mycurrentitemid = $this->get_current_item_id();
-
-		foreach($list as $item)
-		{
-			if($this->debug>2){error_log('New LP - learnpath::get_html_toc(): using item '.$item['id'],0);}
-			//TODO complete this
-			$icon_name = array('not attempted' => '../img/notattempted.gif',
-								'incomplete'   => '../img/incomplete.gif',
-								'failed'       => '../img/failed.gif',
-								'completed'    => '../img/completed.gif',
-								'passed'	   => '../img/passed.gif',
-								'succeeded'    => '../img/succeeded.gif',
-								'browsed'      => '../img/completed.gif');
-
-			$style = 'scorm_item';
-			if($item['id'] == $this->current){
-				$style = 'scorm_item_highlight';
-			}
-			//the anchor will let us center the TOC on the currently viewed item &^D
-			$html .= '<a name="atoc_'.$item['id'].'" /><div class="'.$style.'" style="padding-left: '.($item['level']/2).'em; padding-right:'.($item['level']/2).'em" id="toc_'.$item['id'].'" >' .
-					'<img id="toc_img_'.$item['id'].'" class="scorm_status_img" src="'.$icon_name[$item['status']].'" alt="'.substr($item['status'],0,1).'" />';
-
-			//$title = htmlspecialchars($item['title'],ENT_QUOTES,$this->encoding);
-			$title = $item['title'];
-			if(empty($title)){
-				$title = rl_get_resource_name(api_get_course_id(),$this->get_id(),$item['id']);
-				$title = htmlspecialchars($title,ENT_QUOTES,$this->encoding);
-			}
-			if(empty($title))$title = '-';
-
-			if($item['type']!='dokeos_chapter' and $item['type']!='dir'){
-					//$html .= "<a href='lp_controller.php?".api_get_cidReq()."&action=content&lp_id=".$this->get_id()."&item_id=".$item['id']."' target='lp_content_frame_name'>".$title."</a>" ;
-					$url = $this->get_link('http',$item['id']);
-					//$html .= '<a href="'.$url.'" target="content_name" onclick="top.load_item('.$item['id'].',\''.$url.'\');">'.$title.'</a>' ;
-					//$html .= '<a href="" onclick="top.load_item('.$item['id'].',\''.$url.'\');return false;">'.$title.'</a>' ;
-					$html .= '<a href="" onclick="dokeos_xajax_handler.switch_item(' .
-							$mycurrentitemid.',' .
-							$item['id'].');' .
-							'return false;" >'.$title.'</a>' ;
-			}else{
-					$html .= $title;
-			}
-			$html .= "</div>\n";
-		}
-		$html .= "</div>\n";
-		return $html;
-	}*/
-
 	/**
 	 * Uses the table generated by get_toc() and returns an HTML-formatted string ready to display
 	 * @return	string	HTML TOC ready to display
@@ -2880,7 +2838,7 @@ class learnpath {
 				//$html .= '<a href="" onclick="top.load_item('.$item['id'].',\''.$url.'\');return false;">'.$title.'</a>' ;
 
 				//<img align="absbottom" width="13" height="13" src="../img/lp_document.png">&nbsp;background:#aaa;
-				$html .= '<a href="" onclick="dokeos_xajax_handler.switch_item(' .
+				$html .= '<a href="" onclick="switch_item(' .
 				$mycurrentitemid . ',' .
 				$item['id'] . ');' .
 				'return false;" >' . stripslashes($title) . '</a>';

+ 173 - 0
main/newscorm/lp_ajax_initialize.php

@@ -0,0 +1,173 @@
+<?php //$id$
+/**
+ * This script contains the server part of the xajax interaction process. The client part is located
+ * in lp_api.php or other api's.
+ * This script, in particular, enables the process of SCO's initialization. It
+ * resets the JavaScript values for each SCO to the current LMS status.
+ * @package dokeos.learnpath
+ * @author Yannick Warnier <ywarnier@beeznest.org>
+ */
+/**
+ * Script
+ */
+//flag to allow for anonymous user - needs to be set before global.inc.php
+$use_anonymous = true;
+// name of the language file that needs to be included
+$language_file[] = 'learnpath';
+require_once('back_compat.inc.php');
+/**
+ * Get one item's details
+ * @param   integer LP ID
+ * @param   integer user ID
+ * @param   integer View ID
+ * @param   integer Current item ID
+ * @param   integer New item ID
+ */
+function initialize_item($lp_id,$user_id,$view_id,$next_item)
+{
+    $debug=0;
+    $return = '';
+    if($debug>0){error_log('In initialize_item('.$lp_id.','.$user_id.','.$view_id.','.$next_item.')',0);}
+    //$objResponse = new xajaxResponse();
+    /*$item_id may be one of:
+     * -'next'
+     * -'previous'
+     * -'first'
+     * -'last'
+     * - a real item ID
+     */
+    require_once('learnpath.class.php');
+    require_once('scorm.class.php');
+    require_once('aicc.class.php');
+    require_once('learnpathItem.class.php');
+    require_once('scormItem.class.php');
+    require_once('aiccItem.class.php');
+    $mylp = '';
+    if (isset($_SESSION['lpobject'])) {
+        if ($debug>1) {error_log('////$_SESSION[lpobject] is set',0);}
+        $oLP =& unserialize($_SESSION['lpobject']);
+        if (!is_object($oLP)) {
+            if($debug>1){error_log(print_r($oLP,true),0);}
+            if($debug>2){error_log('////Building new lp',0);}
+            unset($oLP);
+            $code = api_get_course_id();
+            $mylp = & new learnpath($code,$lp_id,$user_id);
+        } else {
+            if($debug>1){error_log('////Reusing session lp',0);}
+            $mylp = & $oLP;
+        }
+    }
+    $mylp->set_current_item($next_item);
+    if ($debug>1) {error_log('In {default} - item is '.$new_item_id,0);}
+    $mylp->start_current_item(true);
+    /*
+    if ($mylp->force_commit) {
+        $mylp->save_current();
+    }
+    */
+    //$objResponse->addAlert(api_get_path(REL_CODE_PATH).'newscorm/learnpathItem.class.php');
+    if (is_object($mylp->items[$next_item])) {
+        $mylpi = & $mylp->items[$next_item];
+    } else {
+        if($debug>1){error_log('In switch_item_details - generating new item object',0);}
+        $mylpi =& new learnpathItem($next_item,$user_id);
+        $mylpi->set_lp_view($view_id);
+    }
+    /*
+     * now get what's needed by the SCORM API:
+     * -score
+     * -max
+     * -min
+     * -lesson_status
+     * -session_time
+     * -suspend_data
+     */
+    $myscore = $mylpi->get_score();
+    $mymax = $mylpi->get_max();
+    if($mymax===''){$mymax="''";}
+    $mymin = $mylpi->get_min();
+    $mylesson_status = $mylpi->get_status();
+    $mylesson_location = $mylpi->get_lesson_location();
+    $mytotal_time = $mylpi->get_scorm_time('js');
+    $mymastery_score = $mylpi->get_mastery_score();
+    $mymax_time_allowed = $mylpi->get_max_time_allowed();
+    $mylaunch_data = $mylpi->get_launch_data();
+    $mysession_time = $mylpi->get_total_time();
+    $mysuspend_data = $mylpi->get_suspend_data();
+    $mylesson_location = $mylpi->get_lesson_location();
+    $myic = $mylpi->get_interactions_count();
+    $myistring = '';
+    for ($i=0;$i<$myic;$i++) {
+    	$myistring .= ",[".$i.",'','','','','','','']";
+    }
+    if (!empty($myistring)) {
+        $myistring = substr($myistring,1);
+    }
+    $return .=
+            "olms.score=".$myscore.";" .
+            "olms.max=".$mymax.";" .
+            "olms.min=".$mymin.";" .
+            "olms.lesson_status='".$mylesson_status."';" .
+            "olms.lesson_location='".$mylesson_location."';" .
+            "olms.session_time='".$mysession_time."';" .
+            "olms.suspend_data='".$mysuspend_data."';" .
+            "olms.total_time = '".$mytotal_time."';" .
+            "olms.mastery_score = '".$mymastery_score."';" .
+            "olms.max_time_allowed = '".$mymax_time_allowed."';" .
+            "olms.launch_data = '".$mylaunch_data."';" .
+            "olms.interactions = new Array(".$myistring.");" .
+            "olms.item_objectives = new Array();" .
+            "olms.G_lastError = 0;" .
+            "olms.G_LastErrorMessage = 'No error';" ;
+    /*
+     * and re-initialise the rest (proper to the LMS)
+     * -lms_lp_id
+     * -lms_item_id
+     * -lms_old_item_id
+     * -lms_new_item_id
+     * -lms_initialized
+     * -lms_progress_bar_mode
+     * -lms_view_id
+     * -lms_user_id
+     */
+    $mytotal = $mylp->get_total_items_count_without_chapters();
+    $mycomplete = $mylp->get_complete_items_count();
+    $myprogress_mode = $mylp->get_progress_bar_mode();
+    $myprogress_mode = ($myprogress_mode==''?'%':$myprogress_mode);
+    $mynext = $mylp->get_next_item_id();
+    $myprevious = $mylp->get_previous_item_id();
+    $myitemtype = $mylpi->get_type();
+    $mylesson_mode = $mylpi->get_lesson_mode();
+    $mycredit = $mylpi->get_credit();
+    $mylaunch_data = $mylpi->get_launch_data();
+    $myinteractions_count = $mylpi->get_interactions_count();
+    $myobjectives_count = $mylpi->get_objectives_count();
+    $mycore_exit = $mylpi->get_core_exit();
+
+    $return .=
+            "olms.lms_lp_id=".$lp_id.";" .
+            "olms.lms_item_id=".$next_item.";" .
+            "olms.lms_old_item_id=0;" .
+            "olms.lms_initialized=0;" .
+            "olms.lms_view_id=".$view_id.";" .
+            "olms.lms_user_id=".$user_id.";" .
+            "olms.next_item=".$next_item.";" . //this one is very important to replace possible literal strings
+            "olms.lms_next_item=".$mynext.";" .
+            "olms.lms_previous_item=".$myprevious.";" .
+            "olms.lms_item_type = '".$myitemtype."';" .
+            "olms.lms_item_credit = '".$mycredit."';" .
+            "olms.lms_item_lesson_mode = '".$mylesson_mode."';" .
+            "olms.lms_item_launch_data = '".$mylaunch_data."';" .
+            "olms.lms_item_interactions_count = '".$myinteractions_count."';" .
+            "olms.lms_item_objectives_count = '".$myinteractions_count."';" .
+            "olms.lms_item_core_exit = '".$mycore_exit."';" .
+            "olms.asset_timer = 0;";
+
+    $mylp->set_error_msg('');
+    $mylp->prerequisites_match(); //check the prerequisites are all complete
+    if($debug>1){error_log('Prereq_match() returned '.htmlentities($mylp->error),0);}
+    //$_SESSION['scorm_item_id'] = $new_item_id;//Save the new item ID for the exercise tool to use
+    //$_SESSION['lpobject'] = serialize($mylp);
+    return $return;
+}
+echo initialize_item($_POST['lid'],$_POST['uid'],$_POST['vid'],$_POST['iid']);

+ 1 - 1
main/newscorm/lp_ajax_save_item.php

@@ -141,7 +141,7 @@ function save_item($lp_id,$user_id,$view_id,$item_id,$score=-1,$max=-1,$min=-1,$
     if($mylpi->get_type()!='sco')
     { //if this object's JS status has not been updated by the SCORM API, update now
         //$objResponse->addScript("lesson_status='".$mystatus."';");
-        $return .= "lesson_status='".$mystatus."';";
+        $return .= "olms.lesson_status='".$mystatus."';";
     }
     //$objResponse->addScript("update_toc('".$mystatus."','".$item_id."');");
     $return .= "update_toc('".$mystatus."','".$item_id."');";

+ 1 - 1
main/newscorm/lp_ajax_start_timer.php

@@ -16,6 +16,6 @@ function start_timer()
     $time = time();
     //$objResponse->addScript("asset_timer='$time';asset_timer_total=0;");
     //return $objResponse;
-    return "asset_timer='$time';asset_timer_total=0;";
+    return "olms.asset_timer='$time';olms.asset_timer_total=0;";
 }
 echo start_timer();

+ 50 - 54
main/newscorm/lp_ajax_switch_item.php

@@ -140,35 +140,38 @@ function switch_item_details($lp_id,$user_id,$view_id,$current_item,$next_item)
     if (!empty($myistring)) {
         $myistring = substr($myistring,1);
     }
-    //$objResponse->addScript(
+    /*
+     * The following lines should reinitialize the values for the SCO
+     * However, due to many complications, we are now relying more on the
+     * LMSInitialize() call and its underlying lp_ajax_initialize.php call
+     * so this code is technically deprecated (but the change of item_id should
+     * remain). However, due to numerous technical issues with SCORM, we prefer
+     * leaving it as a double-lock security. If removing, please test carefully
+     * with both SCORM and dokeos learning path tracking.
+     */ 
     $return .=
-            "score=".$myscore.";" .
-            "max=".$mymax.";" .
-            "min=".$mymin.";" .
-            "lesson_status='".$mylesson_status."';" .
-            "lesson_location='".$mylesson_location."';" .
-            "session_time='".$mysession_time."';" .
-            "suspend_data='".$mysuspend_data."';" .
-            "total_time = '".$mytotal_time."';" .
-            "mastery_score = '".$mymastery_score."';" .
-            "max_time_allowed = '".$mymax_time_allowed."';" .
-            "launch_data = '".$mylaunch_data."';" .
-            "interactions = new Array(".$myistring.");" .
-            "item_objectives = new Array();" .
-            "G_lastError = 0;" .
-            "G_LastErrorMessage = 'No error';";
-            //);
+            "olms.score=".$myscore.";" .
+            "olms.max=".$mymax.";" .
+            "olms.min=".$mymin.";" .
+            "olms.lesson_status='".$mylesson_status."';" .
+            "olms.lesson_location='".$mylesson_location."';" .
+            "olms.session_time='".$mysession_time."';" .
+            "olms.suspend_data='".$mysuspend_data."';" .
+            "olms.total_time = '".$mytotal_time."';" .
+            "olms.mastery_score = '".$mymastery_score."';" .
+            "olms.max_time_allowed = '".$mymax_time_allowed."';" .
+            "olms.launch_data = '".$mylaunch_data."';" .
+            "olms.interactions = new Array(".$myistring.");" .
+            "olms.item_objectives = new Array();" .
+            "olms.G_lastError = 0;" .
+            "olms.G_LastErrorMessage = 'No error';" ;
     /*
      * and re-initialise the rest
-     * -saved_lesson_status = 'not attempted'
      * -lms_lp_id
      * -lms_item_id
      * -lms_old_item_id
      * -lms_new_item_id
-     * -lms_been_synchronized
      * -lms_initialized
-     * -lms_total_lessons
-     * -lms_complete_lessons
      * -lms_progress_bar_mode
      * -lms_view_id
      * -lms_user_id
@@ -187,48 +190,41 @@ function switch_item_details($lp_id,$user_id,$view_id,$current_item,$next_item)
     $myobjectives_count = $mylpi->get_objectives_count();
     $mycore_exit = $mylpi->get_core_exit();
 
-    //$objResponse->addScript(
     $return .=
-            "saved_lesson_status='not attempted';" .
-            "lms_lp_id=".$lp_id.";" .
-            "lms_item_id=".$new_item_id.";" .
-            "lms_old_item_id=0;" .
-            "lms_been_synchronized=0;" .
-            "lms_initialized=0;" .
-            "lms_total_lessons=".$mytotal.";" .
-            "lms_complete_lessons=".$mycomplete.";" .
-            "lms_progress_bar_mod='".$myprogress_mode."';" .
-            "lms_view_id=".$view_id.";" .
-            "lms_user_id=".$user_id.";" .
-            "next_item=".$new_item_id.";" . //this one is very important to replace possible literal strings
-            "lms_next_item=".$mynext.";" .
-            "lms_previous_item=".$myprevious.";" .
-            "lms_item_type = '".$myitemtype."';" .
-            "lms_item_credit = '".$mycredit."';" .
-            "lms_item_lesson_mode = '".$mylesson_mode."';" .
-            "lms_item_launch_data = '".$mylaunch_data."';" .
-            "lms_item_interactions_count = '".$myinteractions_count."';" .
-            "lms_item_objectives_count = '".$myinteractions_count."';" .
-            "lms_item_core_exit = '".$mycore_exit."';" .
-            "asset_timer = 0;";
+            //"saved_lesson_status='not attempted';" .
+            "olms.lms_lp_id=".$lp_id.";" .
+            "olms.lms_item_id=".$new_item_id.";" .
+            "olms.lms_old_item_id=0;" .
+            //"lms_been_synchronized=0;" .
+            "olms.lms_initialized=0;" .
+            //"lms_total_lessons=".$mytotal.";" .
+            //"lms_complete_lessons=".$mycomplete.";" .
+            //"lms_progress_bar_mode='".$myprogress_mode."';" .
+            "olms.lms_view_id=".$view_id.";" .
+            "olms.lms_user_id=".$user_id.";" .
+            "olms.next_item=".$new_item_id.";" . //this one is very important to replace possible literal strings
+            "olms.lms_next_item=".$mynext.";" .
+            "olms.lms_previous_item=".$myprevious.";" .
+            "olms.lms_item_type = '".$myitemtype."';" .
+            "olms.lms_item_credit = '".$mycredit."';" .
+            "olms.lms_item_lesson_mode = '".$mylesson_mode."';" .
+            "olms.lms_item_launch_data = '".$mylaunch_data."';" .
+            "olms.lms_item_interactions_count = '".$myinteractions_count."';" .
+            "olms.lms_item_objectives_count = '".$myinteractions_count."';" .
+            "olms.lms_item_core_exit = '".$mycore_exit."';" .
+            "olms.asset_timer = 0;";
             //);
-    //$objResponse->addScript("update_toc('unhighlight','".$current_item."');");
-    //$objResponse->addScript("update_toc('highlight','".$new_item_id."');");
-    //$objResponse->addScript("update_toc('$mylesson_status','".$new_item_id."');");
-    //$objResponse->addScript("update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');");
     $return .= "update_toc('unhighlight','".$current_item."');".
-            "update_toc('highlight','".$new_item_id."');".
-            "update_toc('$mylesson_status','".$new_item_id."');".
-            "update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
+                "update_toc('highlight','".$new_item_id."');".
+                "update_toc('$mylesson_status','".$new_item_id."');".
+                "update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
 
     $mylp->set_error_msg('');
     $mylp->prerequisites_match(); //check the prerequisites are all complete
     if($debug>1){error_log('Prereq_match() returned '.htmlentities($mylp->error),0);}
-    //$objResponse->addScript("update_message_frame('".str_replace("'","\'",htmlentities($mylp->error))."');");
-    $return .= "update_message_frame('".str_replace("'","\'",api_htmlentities($mylp->error, ENT_QUOTES, api_get_system_encoding()))."');";
     $_SESSION['scorm_item_id'] = $new_item_id;//Save the new item ID for the exercise tool to use
     $_SESSION['lpobject'] = serialize($mylp);
     return $return;
     //return $objResponse;
 }
-echo switch_item_details($_GET['lid'],$_GET['uid'],$_GET['vid'],$_GET['iid'],$_GET['next']);
+echo switch_item_details($_POST['lid'],$_POST['uid'],$_POST['vid'],$_POST['iid'],$_POST['next']);

+ 186 - 0
main/newscorm/lp_ajax_switch_item_toc.php

@@ -0,0 +1,186 @@
+<?php //$id$
+/**
+ * This script contains the server part of the xajax interaction process. The client part is located
+ * in lp_api.php or other api's.
+ * This script updated the TOC of the SCORM without updating the SCO's attributes 
+ * @package dokeos.learnpath
+ * @author Yannick Warnier <ywarnier@beeznest.org>
+ */
+/**
+ * Script
+ */
+//flag to allow for anonymous user - needs to be set before global.inc.php
+$use_anonymous = true;
+// name of the language file that needs to be included
+$language_file[] = 'learnpath';
+require_once('back_compat.inc.php');
+/**
+ * Get one item's details
+ * @param   integer LP ID
+ * @param   integer user ID
+ * @param   integer View ID
+ * @param   integer Current item ID
+ * @param   integer New item ID
+ */
+function switch_item_toc($lp_id,$user_id,$view_id,$current_item,$next_item)
+{
+    $debug=0;
+    $return = '';
+    if($debug>0){error_log('In xajax_switch_item_toc('.$lp_id.','.$user_id.','.$view_id.','.$current_item.','.$next_item.')',0);}
+    require_once('learnpath.class.php');
+    require_once('scorm.class.php');
+    require_once('aicc.class.php');
+    require_once('learnpathItem.class.php');
+    require_once('scormItem.class.php');
+    require_once('aiccItem.class.php');
+    $mylp = '';
+    if(isset($_SESSION['lpobject']))
+    {
+        if($debug>1){error_log('////$_SESSION[lpobject] is set',0);}
+        $oLP =& unserialize($_SESSION['lpobject']);
+        if(!is_object($oLP)){
+            if($debug>1){error_log(print_r($oLP,true),0);}
+            if($debug>2){error_log('////Building new lp',0);}
+            unset($oLP);
+            $code = api_get_course_id();
+            $mylp = & new learnpath($code,$lp_id,$user_id);
+        }else{
+            if($debug>1){error_log('////Reusing session lp',0);}
+            $mylp = & $oLP;
+        }
+    }
+    $new_item_id = 0;
+    switch($next_item){
+        case 'next':
+            $mylp->set_current_item($current_item);
+            $mylp->next();
+            $new_item_id = $mylp->get_current_item_id();
+            if($debug>1){error_log('In {next} - next item is '.$new_item_id.'(current: '.$current_item.')',0);}
+            break;
+        case 'previous':
+            $mylp->set_current_item($current_item);
+            $mylp->previous();
+            $new_item_id = $mylp->get_current_item_id();
+            if($debug>1){error_log('In {previous} - next item is '.$new_item_id.'(current: '.$current_item.')',0);}
+            break;
+        case 'first':
+            $mylp->set_current_item($current_item);
+            $mylp->first();
+            $new_item_id = $mylp->get_current_item_id();
+            if($debug>1){error_log('In {first} - next item is '.$new_item_id.'(current: '.$current_item.')',0);}
+            break;
+        case 'last':
+            break;
+        default:
+            //should be filtered to check it's not hacked
+            if($next_item == $current_item){
+                //if we're opening the same item again
+                $mylp->items[$current_item]->restart();
+            }
+            $new_item_id = $next_item;
+            $mylp->set_current_item($new_item_id);
+            if($debug>1){error_log('In {default} - next item is '.$new_item_id.'(current: '.$current_item.')',0);}
+            break;
+    }
+    $mylp->start_current_item(true);
+    if($mylp->force_commit){
+        $mylp->save_current();
+    }
+    //$objResponse->addAlert(api_get_path(REL_CODE_PATH).'newscorm/learnpathItem.class.php');
+    if(is_object($mylp->items[$new_item_id])){
+        $mylpi = & $mylp->items[$new_item_id];
+    }else{
+        if($debug>1){error_log('In switch_item_details - generating new item object',0);}
+        $mylpi =& new learnpathItem($new_item_id,$user_id);
+        $mylpi->set_lp_view($view_id);
+    }
+    /*
+     * now get what's needed by the SCORM API:
+     * -score
+     * -max
+     * -min
+     * -lesson_status
+     * -session_time
+     * -suspend_data
+     */
+    $myscore = $mylpi->get_score();
+    $mymax = $mylpi->get_max();
+    if($mymax===''){$mymax="''";}
+    $mymin = $mylpi->get_min();
+    $mylesson_status = $mylpi->get_status();
+    $mylesson_location = $mylpi->get_lesson_location();
+    $mytotal_time = $mylpi->get_scorm_time('js');
+    $mymastery_score = $mylpi->get_mastery_score();
+    $mymax_time_allowed = $mylpi->get_max_time_allowed();
+    $mylaunch_data = $mylpi->get_launch_data();
+    /*
+    if($mylpi->get_type() == 'asset'){
+        //temporary measure to save completion of an asset. Later on, Dokeos should trigger something on unload, maybe... (even though that would mean the last item cannot be completed)
+        $mylesson_status = 'completed';
+        $mylpi->set_status('completed');
+        $mylpi->save();
+    }
+    */
+    $mysession_time = $mylpi->get_total_time();
+    $mysuspend_data = $mylpi->get_suspend_data();
+    $mylesson_location = $mylpi->get_lesson_location();
+    $myic = $mylpi->get_interactions_count();
+    $myistring = '';
+    for ($i=0;$i<$myic;$i++) {
+        $myistring .= ",[".$i.",'','','','','','','']";
+    }
+    if (!empty($myistring)) {
+        $myistring = substr($myistring,1);
+    }
+    $mytotal = $mylp->get_total_items_count_without_chapters();
+    $mycomplete = $mylp->get_complete_items_count();
+    $myprogress_mode = $mylp->get_progress_bar_mode();
+    $myprogress_mode = ($myprogress_mode==''?'%':$myprogress_mode);
+    $mynext = $mylp->get_next_item_id();
+    $myprevious = $mylp->get_previous_item_id();
+    $myitemtype = $mylpi->get_type();
+    $mylesson_mode = $mylpi->get_lesson_mode();
+    $mycredit = $mylpi->get_credit();
+    $mylaunch_data = $mylpi->get_launch_data();
+    $myinteractions_count = $mylpi->get_interactions_count();
+    $myobjectives_count = $mylpi->get_objectives_count();
+    $mycore_exit = $mylpi->get_core_exit();
+
+    $return .=
+            //"saved_lesson_status='not attempted';" .
+            "olms.lms_lp_id=".$lp_id.";" .
+            "olms.lms_item_id=".$new_item_id.";" .
+            "olms.lms_old_item_id=0;" .
+            //"lms_been_synchronized=0;" .
+            "olms.lms_initialized=0;" .
+            //"lms_total_lessons=".$mytotal.";" .
+            //"lms_complete_lessons=".$mycomplete.";" .
+            //"lms_progress_bar_mode='".$myprogress_mode."';" .
+            "olms.lms_view_id=".$view_id.";" .
+            "olms.lms_user_id=".$user_id.";" .
+            "olms.next_item=".$new_item_id.";" . //this one is very important to replace possible literal strings
+            "olms.lms_next_item=".$mynext.";" .
+            "olms.lms_previous_item=".$myprevious.";" .
+            "olms.lms_item_type = '".$myitemtype."';" .
+            "olms.lms_item_credit = '".$mycredit."';" .
+            "olms.lms_item_lesson_mode = '".$mylesson_mode."';" .
+            "olms.lms_item_launch_data = '".$mylaunch_data."';" .
+            "olms.lms_item_interactions_count = '".$myinteractions_count."';" .
+            "olms.lms_item_objectives_count = '".$myinteractions_count."';" .
+            "olms.lms_item_core_exit = '".$mycore_exit."';" .
+            "olms.asset_timer = 0;";
+            //);
+    $return .= "update_toc('unhighlight','".$current_item."');".
+                "update_toc('highlight','".$new_item_id."');".
+                "update_toc('$mylesson_status','".$new_item_id."');".
+                "update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
+
+    $mylp->set_error_msg('');
+    $mylp->prerequisites_match(); //check the prerequisites are all complete
+    if($debug>1){error_log('Prereq_match() returned '.htmlentities($mylp->error),0);}
+    $_SESSION['scorm_item_id'] = $new_item_id;//Save the new item ID for the exercise tool to use
+    $_SESSION['lpobject'] = serialize($mylp);
+    return $return;
+    //return $objResponse;
+    }
+echo switch_item_toc($_POST['lid'],$_POST['uid'],$_POST['vid'],$_POST['iid'],$_POST['next']);

+ 263 - 287
main/newscorm/lp_view.php

@@ -71,17 +71,15 @@ $my_style=$platform_theme;
 	Header
 -----------------------------------------------------------
 */
-//$htmlHeadXtra[] = '<script type="text/javascript" src="lp_view.lib.js"></script>';
-//$htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/')."\n";
 $htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
 $htmlHeadXtra[] = '<script src="../inc/lib/javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>'; //jQuery
 
-$htmlHeadXtra[] = '<script language="javascript">
-function cleanlog(){
-  if(document.getElementById){
-  	document.getElementById("log_content").innerHTML = "";
-  }
-}
+$htmlHeadXtra[] = '<script language="javascript" type="text/javascript">
+$(document).ready(function (){
+    $("div#log_content_cleaner").bind("click", function(){
+      $("div#log_content").empty();
+    });
+});
 </script>';
 
 $htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
@@ -228,44 +226,42 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
 
 	//set flag to ensure lp_header.php is loaded by this script (flag is unset in lp_header.php)
 	$_SESSION['loaded_lp_view'] = true;
-	?>
-<input type="hidden" id="old_item" name ="old_item" value="0"/>
-<input type="hidden" id="current_item_id" name ="current_item_id" value="0" />
-
-<div id="learningPathMain"  style="width:100%;height:100%;" >
-	<div id="learningPathLeftZone" style="float:left;width:280px;height:100%">
+    ?>
+<body>
+<div id="learning_path_main"  style="width:100%;height:100%;" >
+	<div id="learning_path_left_zone" style="float:left;width:280px;height:100%">
 		<!-- header -->
 		<div id="header">
-		        <div id="learningPathHeader" style="font-size:14px;">
-		            <table>
-		                <tr>
-		                    <td>
-		                        <a href="lp_controller.php?action=return_to_course_homepage" target="_self" onclick="window.parent.API.save_asset();">
-		                        	<img src="../img/lp_arrow.gif" />
-		                        </a>
-		                    </td>
-		                    <td>
-		                        <a class="link" href="lp_controller.php?action=return_to_course_homepage" target="_self" onclick="window.parent.API.save_asset();">
-		                        <?php echo api_convert_encoding(get_lang('CourseHomepageLink'), $charset, api_get_system_encoding()); ?></a>
-		                    </td>
-		                </tr>
-		            </table>
-		        </div>
+            <div id="learning_path_header" style="font-size:14px;">
+	            <table>
+	                <tr>
+	                    <td>
+	                        <a href="lp_controller.php?action=return_to_course_homepage" target="_self" onclick="window.parent.API.save_asset();">
+	                        <img src="../img/lp_arrow.gif" />
+	                        </a>
+	                    </td>
+	                    <td>
+	                        <a class="link" href="lp_controller.php?action=return_to_course_homepage" target="_self" onclick="window.parent.API.save_asset();">
+	                        <?php echo api_convert_encoding(get_lang('CourseHomepageLink'), $charset, api_get_system_encoding()); ?></a>
+	                    </td>
+	                </tr>
+	            </table>
+	        </div>
 		</div>
 		<!-- end header -->
 
-<!-- Image preview Layout -->
-	<div id="author_image" name="author_image" class="lp_author_image" style="height:23%; width:100%;margin-left:5px">
+        <!-- Image preview Layout -->
+        <div id="author_image" name="author_image" class="lp_author_image" style="height:23%; width:100%;margin-left:5px">
 		<?php $image = '../img/lp_author_background.gif'; ?>
 			<div id="preview_image" style="padding:5px;background-image: url('../img/lp_author_background.gif');background-repeat:no-repeat;height:110px">
 		       	<div style="width:100; float:left;height:105;margin:5px">
 		       		<span>
-			        <?php if ($_SESSION['oLP']->get_preview_image()!=''): ?>
-			        <img width="115" height="100" src="<?php echo api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image(); ?>">
-			        <?php
-						else : echo Display :: display_icon('unknown_250_100.jpg', ' ');
-						endif;
-						?>
+			        <?php 
+			        if ($_SESSION['oLP']->get_preview_image()!='') {
+			            echo '<img width="115px" height="100px" src="'.api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image().'">';
+			        } else {
+                        echo Display :: display_icon('unknown_250_100.jpg', ' ');
+			        }; ?>
 					</span>
 		       	</div>
 
@@ -293,9 +289,9 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
 						$sql = "SELECT audio FROM " . $tbl_lp_item . " WHERE lp_id = '" . $_SESSION['oLP']->lp_id."'";
 						$res_media= Database::query($sql, __FILE__, __LINE__);
 
-						if(Database::num_rows($res_media) > 0){
-							while($row_media= Database::fetch_array($res_media)) {
-							     if(!empty($row_media['audio'])) {$show_audioplayer = true; break;}
+						if (Database::num_rows($res_media) > 0) {
+							while ($row_media= Database::fetch_array($res_media)) {
+							     if (!empty($row_media['audio'])) {$show_audioplayer = true; break;}
 							}
 						}
 					?>
@@ -309,9 +305,9 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
 
 	</div>
 	<!-- end image preview Layout -->
-				<div id="author_name" style="position:relative;top:2px;left:0px;margin:0;padding:0;text-align:center;width:100%">
-					<?php echo $_SESSION['oLP']->get_author() ?>
-				</div>
+	<div id="author_name" style="position:relative;top:2px;left:0px;margin:0;padding:0;text-align:center;width:100%">
+		<?php echo $_SESSION['oLP']->get_author() ?>
+	</div>
 
 	<!-- media player layaout -->
 	<?php $style_media = (($show_audioplayer)?' style= "position:relative;top:10px;left:10px;margin:8px;font-size:32pt;height:20px;"':'style="height:15px"'); ?>
@@ -322,154 +318,143 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
 
 	<!-- toc layout -->
 	<div id="toc_id" name="toc_name"  style="padding:0;margin-top:20px;height:60%;width:100%">
-		<div id="learningPathToc" style="font-size:9pt;margin:0;"><?php echo $_SESSION['oLP']->get_html_toc(); ?>
-		<!-- log message layout -->
-
-		<div id="lp_log_name" name="lp_log_name" class="lp_log" style="height:50px;overflow:auto;margin:15px">
-			<div id="log_content"></div>
-			<div style="color: white;" onClick="cleanlog();">.</div>
-		</div>
-	<!-- end log message layout -->
-		</div>
-
+		<div id="learning_path_toc" style="font-size:9pt;margin:0;"><?php echo $_SESSION['oLP']->get_html_toc(); ?>
+			<!-- log message layout -->
+	
+			<div id="lp_log_name" name="lp_log_name" class="lp_log" style="height:50px;overflow:auto;margin:15px">
+				<div id="log_content"></div>
+				<div id="log_content_cleaner" style="color: white;">.</div>
+			</div>
+    		<!-- end log message layout -->
+        </div>
 	</div>
 	<!-- end toc layout -->
-
-
-	</div>
+</div>
 <!-- end left Zone -->
 
 <!-- right Zone -->
-	<div id="learningPathRightZone" style="margin-left:282px;border : 0pt solid blue;height:100%">
-		<iframe id="content_id_blank" name="content_name_blank" src="blank.php" border="0" frameborder="0"  style="width:100%;height:600px" ></iframe>
-	</div>
+<div id="learning_path_right_zone" style="margin-left:282px;border : 0pt solid blue;height:100%">
+    <iframe id="content_id_blank" name="content_name_blank" src="blank.php" border="0" frameborder="0"  style="width:100%;height:600px" ></iframe>
+</div>
 <!-- end right Zone -->
 
 </div>
 
-	<script language="JavaScript" type="text/javascript">
-	// Need to be called after the <head> to be sure window.oxajax is defined
-  	var dokeos_xajax_handler = window.oxajax;
-	</script>
-    <script language="JavaScript" type="text/javascript">
-	<!--
-	var leftZoneHeightOccupied = 0;
-	var rightZoneHeightOccupied = 0;
-	var initialLeftZoneHeight = 0;
-	var initialRightZoneHeight = 0;
-
-	var updateContentHeight = function() {
-		winHeight = (window.innerHeight != undefined ? window.innerHeight : document.documentElement.clientHeight);
-		newLeftZoneHeight = winHeight - leftZoneHeightOccupied;
-		newRightZoneHeight = winHeight - rightZoneHeightOccupied;
-		if (newLeftZoneHeight <= initialLeftZoneHeight) {
-			newLeftZoneHeight = initialLeftZoneHeight;
-			newRightZoneHeight = newLeftZoneHeight + leftZoneHeightOccupied - rightZoneHeightOccupied;
-		}
-		if (newRightZoneHeight <= initialRightZoneHeight) {
-			newRightZoneHeight = initialRightZoneHeight;
-			newLeftZoneHeight = newRightZoneHeight + rightZoneHeightOccupied - leftZoneHeightOccupied;
-		}
-		document.getElementById('learningPathToc').style.height = newLeftZoneHeight + 'px';
-		document.getElementById('learningPathRightZone').style.height = newRightZoneHeight + 'px';
-		document.getElementById('content_id_blank').style.height = newRightZoneHeight + 'px';
-		if (document.body.clientHeight > winHeight) {
-			document.body.style.overflow = 'auto';
-		} else {
-			document.body.style.overflow = 'hidden';
-		}
-	};
-
-	window.onload = function() {
+<script language="JavaScript" type="text/javascript">
+<!--
+var leftZoneHeightOccupied = 0;
+var rightZoneHeightOccupied = 0;
+var initialLeftZoneHeight = 0;
+var initialRightZoneHeight = 0;
+
+var updateContentHeight = function() {
+	winHeight = (window.innerHeight != undefined ? window.innerHeight : document.documentElement.clientHeight);
+	newLeftZoneHeight = winHeight - leftZoneHeightOccupied;
+	newRightZoneHeight = winHeight - rightZoneHeightOccupied;
+	if (newLeftZoneHeight <= initialLeftZoneHeight) {
+		newLeftZoneHeight = initialLeftZoneHeight;
+		newRightZoneHeight = newLeftZoneHeight + leftZoneHeightOccupied - rightZoneHeightOccupied;
+	}
+	if (newRightZoneHeight <= initialRightZoneHeight) {
+		newRightZoneHeight = initialRightZoneHeight;
+		newLeftZoneHeight = newRightZoneHeight + rightZoneHeightOccupied - leftZoneHeightOccupied;
+	}
+	document.getElementById('learning_path_toc').style.height = newLeftZoneHeight + 'px';
+	document.getElementById('learning_path_right_zone').style.height = newRightZoneHeight + 'px';
+	document.getElementById('content_id_blank').style.height = newRightZoneHeight + 'px';
+	if (document.body.clientHeight > winHeight) {
+		document.body.style.overflow = 'auto';
+	} else {
+		document.body.style.overflow = 'hidden';
+	}
+};
 
-		screen_height = screen.height;
-		screen_width = screen.height;
+window.onload = function() {
 
-		document.getElementById('learningPathLeftZone').style.height = "100%";
-		document.getElementById('learningPathToc').style.height = "60%";
-		document.getElementById('learningPathToc').style.width = "100%";
-		document.getElementById('learningPathRightZone').style.height = "100%"
-		document.getElementById('content_id').style.height = "100%" ;
+	screen_height = screen.height;
+	screen_width = screen.height;
 
-		if (screen_height <= 600) {
-			document.getElementById('inner_lp_toc').style.height = "100px" ;
-			document.getElementById('learningPathLeftZone').style.height = "415px";
-		}
+	document.getElementById('learning_path_left_zone').style.height = "100%";
+	document.getElementById('learning_path_toc').style.height = "60%";
+	document.getElementById('learning_path_toc').style.width = "100%";
+	document.getElementById('learning_path_right_zone').style.height = "100%"
+	document.getElementById('content_id').style.height = "100%" ;
 
-		initialLeftZoneHeight = document.getElementById('learningPathToc').offsetHeight;
-		initialRightZoneHeight = document.getElementById('learningPathRightZone').offsetHeight;
-		docHeight = document.body.clientHeight;
-		leftZoneHeightOccupied = docHeight - initialLeftZoneHeight;
-		rightZoneHeightOccupied = docHeight - initialRightZoneHeight;
-		document.body.style.overflow = 'hidden';
-		updateContentHeight();
+	if (screen_height <= 600) {
+		document.getElementById('inner_lp_toc').style.height = "100px" ;
+		document.getElementById('learning_path_left_zone').style.height = "415px";
 	}
 
-	window.onresize = updateContentHeight;
-	-->
-	</script>
+	initialLeftZoneHeight = document.getElementById('learning_path_toc').offsetHeight;
+	initialRightZoneHeight = document.getElementById('learning_path_right_zone').offsetHeight;
+	docHeight = document.body.clientHeight;
+	leftZoneHeightOccupied = docHeight - initialLeftZoneHeight;
+	rightZoneHeightOccupied = docHeight - initialRightZoneHeight;
+	document.body.style.overflow = 'hidden';
+	updateContentHeight();
+}
 
+window.onresize = updateContentHeight;
+-->
+</script>
+</body>
 <?php
 } else {
+	//not fullscreen mode
 	include_once('../inc/reduced_header.inc.php');
 	//$displayAudioRecorder = (api_get_setting('service_visio','active')=='true') ? true : false;
 	//check if audio recorder needs to be in studentview
 	$course_id=$_SESSION["_course"]["id"];
-	if($_SESSION["status"][$course_id]==5) {
+	if ($_SESSION["status"][$course_id]==5) {
 		$audio_recorder_studentview = true;
 	} else {
 		$audio_recorder_studentview = false;
 	}
 	//set flag to ensure lp_header.php is loaded by this script (flag is unset in lp_header.php)
 	$_SESSION['loaded_lp_view'] = true;
-	?>
-
-	<input type="hidden" id="old_item" name ="old_item" value="0"/>
-	<input type="hidden" id="current_item_id" name ="current_item_id" value="0" />
-
-<div id="learningPathMain"  style="width:100%;height:100%;" >
-	<div id="learningPathLeftZone" style="float:left;width:280px;height:100%">
+?>
+<body>
+<div id="learning_path_main"  style="width:100%;height:100%;" >
+    <div id="learning_path_left_zone" style="float:left;width:280px;height:100%">
 
 		<!-- header -->
 		<div id="header">
-		        <div id="learningPathHeader" style="font-size:14px;">
-		            <table>
-		                <tr>
-		                    <td>
-		                        <a href="lp_controller.php?action=return_to_course_homepage" target="_self" onclick="window.parent.API.save_asset();"><img src="../img/lp_arrow.gif" /></a>
-		                    </td>
-		                    <td>
-		                        <a class="link" href="lp_controller.php?action=return_to_course_homepage" target="_self" onclick="window.parent.API.save_asset();">
-		                        <?php echo api_convert_encoding(get_lang('CourseHomepageLink'), $charset, api_get_system_encoding()); ?></a>
-		                    </td>
-		                </tr>
-		            </table>
-		        </div>
+	        <div id="learning_path_header" style="font-size:14px;">
+	            <table>
+	                <tr>
+	                    <td>
+	                        <a href="lp_controller.php?action=return_to_course_homepage" target="_self" onclick="window.parent.API.save_asset();"><img src="../img/lp_arrow.gif" /></a>
+	                    </td>
+	                    <td>
+	                        <a class="link" href="lp_controller.php?action=return_to_course_homepage" target="_self" onclick="window.parent.API.save_asset();">
+	                        <?php echo api_convert_encoding(get_lang('CourseHomepageLink'), $charset, api_get_system_encoding()); ?></a>
+	                    </td>
+	                </tr>
+	            </table>
+	        </div>
 		</div>
 		<!-- end header -->
 
-<!-- Image preview Layout -->
-	<div id="author_image" name="author_image" class="lp_author_image" style="height:23%; width:100%;margin-left:5px;">
-		<?php $image = '../img/lp_author_background.gif'; ?>
-
+        <!-- Image preview Layout -->
+        <div id="author_image" name="author_image" class="lp_author_image" style="height:23%; width:100%;margin-left:5px;">
+		    <?php $image = '../img/lp_author_background.gif'; ?>
 			<div id="preview_image" style="padding:5px;background-image: url('../img/lp_author_background.gif');background-repeat:no-repeat;height:110px">
-
 		       	<div style="width:100; float:left;height:105;margin:5px">
 		       		<span style="width:104px; height:96px; float:left; vertical-align:bottom;">
-			        <center><?php if ($_SESSION['oLP']->get_preview_image()!=''): ?>
-			        <?php
+			        <center>
+			        <?php 
+			        if ($_SESSION['oLP']->get_preview_image()!='') {
 			        	$picture = getimagesize(api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image());
-			        	if($picture['1'] < 96) $style = ' style="padding-top:'.((94 -$picture['1'])/2).'px;" ';
+			        	if($picture['1'] < 96) { $style = ' style="padding-top:'.((94 -$picture['1'])/2).'px;" '; }
 			        	$size = ($picture['0'] > 104 && $picture['1'] > 96 )? ' width="104" height="96" ': $style;
-			        	$flie = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image();
-			        	echo '<img '.$size.' src="'.$flie.'">';
-			        ?>
-			        <?php
-						else
-						: echo Display :: display_icon('unknown_250_100.jpg', ' ');
-						endif;
-						?></center>
-					</span>
+			        	$my_path = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/learning_path/images/'.$_SESSION['oLP']->get_preview_image();
+			        	echo '<img '.$size.' src="'.$my_path.'">';
+			        } else {
+						echo Display :: display_icon('unknown_250_100.jpg', ' ');
+					}
+					?>
+				    </center>
+				    </span>
 		       	</div>
 
 				<div id="nav_id" name="nav_name" class="lp_nav" style="margin-left:105;height:90">
@@ -495,9 +480,9 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
 						$sql = "SELECT audio FROM " . $tbl_lp_item . " WHERE lp_id = '" . $_SESSION['oLP']->lp_id."'";
 						$res_media= Database::query($sql, __FILE__, __LINE__);
 
-						if(Database::num_rows($res_media) > 0){
-							while($row_media= Database::fetch_array($res_media)) {
-							     if(!empty($row_media['audio'])) {$show_audioplayer = true; break;}
+						if (Database::num_rows($res_media) > 0) {
+							while ($row_media= Database::fetch_array($res_media)) {
+							     if (!empty($row_media['audio'])) {$show_audioplayer = true; break;}
 							}
 						}
 					?>
@@ -507,151 +492,143 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
 						<div style="height:20px"><?php echo $progress_bar; ?></div>
 					</div>
 				</div>
+    		</div>
+	   </div>
+	   <!-- end image preview Layout -->
+		<div id="author_name" style="position:relative;top:2px;left:0px;margin:0;padding:0;text-align:center;width:100%">
+			<?php echo $_SESSION['oLP']->get_author() ?>
 		</div>
 
-	</div>
-	<!-- end image preview Layout -->
-				<div id="author_name" style="position:relative;top:2px;left:0px;margin:0;padding:0;text-align:center;width:100%">
-					<?php echo $_SESSION['oLP']->get_author() ?>
-				</div>
-
-	<!-- media player layaout -->
-	<?php $style_media = (($show_audioplayer)?' style= "position:relative;top:10px;left:10px;margin:8px;font-size:32pt;height:20px;"':'style="height:15px"'); ?>
-	<div id="media"  <?php echo $style_media ?>>
-		<?php echo (!empty($mediaplayer))?$mediaplayer:'&nbsp;' ?>
-	</div>
-	<!-- end media player layaout -->
-
-	<!-- toc layout -->
-	<div id="toc_id" name="toc_name"  style="padding:0;margin-top:20px;height:60%;width:100%">
-		<div id="learningPathToc" style="font-size:9pt;margin:0;"><?php echo $_SESSION['oLP']->get_html_toc(); ?>
-		<!-- log message layout -->
-
-		<div id="lp_log_name" name="lp_log_name" class="lp_log" style="height:50px;overflow:auto;margin:15px">
-			<div id="log_content"></div>
-			<div style="color: white;" onClick="cleanlog();">.</div>
+		<!-- media player layaout -->
+		<?php $style_media = (($show_audioplayer)?' style= "position:relative;top:10px;left:10px;margin:8px;font-size:32pt;height:20px;"':'style="height:15px"'); ?>
+		<div id="media"  <?php echo $style_media ?>>
+			<?php echo (!empty($mediaplayer))?$mediaplayer:'&nbsp;' ?>
 		</div>
-	<!-- end log message layout -->
+		<!-- end media player layaout -->
+
+		<!-- toc layout -->
+		<div id="toc_id" name="toc_name"  style="padding:0;margin-top:20px;height:60%;width:100%">
+			<div id="learning_path_toc" style="font-size:9pt;margin:0;"><?php echo $_SESSION['oLP']->get_html_toc(); ?>
+	
+    	<?php if (!empty($_SESSION['oLP']->scorm_debug)) { //only show log  ?>
+	        <!-- log message layout -->
+			<div id="lp_log_name" name="lp_log_name" class="lp_log" style="height:150px;overflow:auto;margin:4px">
+				<div id="log_content"></div>
+				<div id="log_content_cleaner" style="color: white;">.</div>
+			</div>
+	        <!-- end log message layout -->
+	   <?php } ?>
+			</div>
 		</div>
+		<!-- end toc layout -->
+	</div>
+    <!-- end left Zone -->
 
+    <!-- right Zone -->
+	<div id="learning_path_right_zone" style="margin-left:282px;height:100%">
+		<iframe id="content_id" name="content_name" src="<?php echo $src; ?>" border="0" frameborder="0"  style="width:100%;height:600px" ></iframe>
 	</div>
-	<!-- end toc layout -->
+    <!-- end right Zone -->
+</div>
+<script language="JavaScript" type="text/javascript">
+<!--
+var leftZoneHeightOccupied = 0;
+var rightZoneHeightOccupied = 0;
+var initialLeftZoneHeight = 0;
+var initialRightZoneHeight = 0;
+
+var updateContentHeight = function() {
+	winHeight = (window.innerHeight != undefined ? window.innerHeight : document.documentElement.clientHeight);
+	newLeftZoneHeight = winHeight - leftZoneHeightOccupied;
+	newRightZoneHeight = winHeight - rightZoneHeightOccupied;
+	if (newLeftZoneHeight <= initialLeftZoneHeight) {
+		newLeftZoneHeight = initialLeftZoneHeight;
+		newRightZoneHeight = newLeftZoneHeight + leftZoneHeightOccupied - rightZoneHeightOccupied;
+	}
+	if (newRightZoneHeight <= initialRightZoneHeight) {
+		newRightZoneHeight = initialRightZoneHeight;
+		newLeftZoneHeight = newRightZoneHeight + rightZoneHeightOccupied - leftZoneHeightOccupied;
+	}
+	document.getElementById('learning_path_toc').style.height = newLeftZoneHeight + 'px';
+	document.getElementById('learning_path_right_zone').style.height = newRightZoneHeight + 'px';
+	document.getElementById('content_id').style.height = newRightZoneHeight + 'px';
+	if (document.body.clientHeight > winHeight) {
+		document.body.style.overflow = 'auto';
+	} else {
+		document.body.style.overflow = 'hidden';
+	}
+};
 
+window.onload = function() {
 
-	</div>
-<!-- end left Zone -->
+	screen_height = screen.height;
+	screen_width = screen.height;
 
-<!-- right Zone -->
-	<div id="learningPathRightZone" style="margin-left:282px;height:100%">
-		<iframe id="content_id" name="content_name" src="<?php echo $src; ?>" border="0" frameborder="0"  style="width:100%;height:600px" ></iframe>
-	</div>
-<!-- end right Zone -->
+	document.getElementById('learning_path_left_zone').style.height = "100%";
+	document.getElementById('learning_path_toc').style.height = "60%";
+	document.getElementById('learning_path_toc').style.width = "100%";
+	document.getElementById('learning_path_right_zone').style.height = "100%"
+	document.getElementById('content_id').style.height = "100%" ;
 
-</div>
+	if (screen_height <= 600) {
+		document.getElementById('inner_lp_toc').style.height = "100px" ;
+		document.getElementById('learning_path_left_zone').style.height = "415px";
+	}
 
-    <script language="JavaScript" type="text/javascript">
-	// Need to be called after the <head> to be sure window.oxajax is defined
-  	var dokeos_xajax_handler = window.oxajax;
-	</script>
-    <script language="JavaScript" type="text/javascript">
-	<!--
-	var leftZoneHeightOccupied = 0;
-	var rightZoneHeightOccupied = 0;
-	var initialLeftZoneHeight = 0;
-	var initialRightZoneHeight = 0;
-
-	// Fixes the content height of the frame
+	initialLeftZoneHeight = document.getElementById('learning_path_toc').offsetHeight;
+	initialRightZoneHeight = document.getElementById('learning_path_right_zone').offsetHeight;
+	docHeight = document.body.clientHeight;
+	leftZoneHeightOccupied = docHeight - initialLeftZoneHeight;
+	rightZoneHeightOccupied = docHeight - initialRightZoneHeight;
+	document.body.style.overflow = 'hidden';
+	updateContentHeight();
 	
-	var updateContentHeight = function() {
-		winHeight = (window.innerHeight != undefined ? window.innerHeight : document.documentElement.clientHeight);
-		newLeftZoneHeight = winHeight - leftZoneHeightOccupied;
-		newRightZoneHeight = winHeight - rightZoneHeightOccupied;
-		if (newLeftZoneHeight <= initialLeftZoneHeight) {
-			newLeftZoneHeight = initialLeftZoneHeight;
-			newRightZoneHeight = newLeftZoneHeight + leftZoneHeightOccupied - rightZoneHeightOccupied;
-		}
-		if (newRightZoneHeight <= initialRightZoneHeight) {
-			newRightZoneHeight = initialRightZoneHeight;
-			newLeftZoneHeight = newRightZoneHeight + rightZoneHeightOccupied - leftZoneHeightOccupied;
-		}
-		document.getElementById('learningPathToc').style.height = newLeftZoneHeight + 'px';
-		document.getElementById('learningPathRightZone').style.height = newRightZoneHeight + 'px';
-		document.getElementById('content_id').style.height = newRightZoneHeight + 'px';
-		if (document.body.clientHeight > winHeight) {
-			document.body.style.overflow = 'auto';
-		} else {
-			document.body.style.overflow = 'hidden';
-		}		
-	};
-
-	window.onload = function() {
-
-		screen_height = screen.height;
-		screen_width = screen.height;
-
-		document.getElementById('learningPathLeftZone').style.height = "100%";
-		document.getElementById('learningPathToc').style.height = "60%";
-		document.getElementById('learningPathToc').style.width = "100%";
-		document.getElementById('learningPathRightZone').style.height = "100%"
-		document.getElementById('content_id').style.height = "100%" ;
-
-		if (screen_height <= 600) {
-			document.getElementById('inner_lp_toc').style.height = "100px" ;
-			document.getElementById('learningPathLeftZone').style.height = "415px";
-		}
-
-		initialLeftZoneHeight = document.getElementById('learningPathToc').offsetHeight;
-		initialRightZoneHeight = document.getElementById('learningPathRightZone').offsetHeight;
-		docHeight = document.body.clientHeight;
-		leftZoneHeightOccupied = docHeight - initialLeftZoneHeight;
-		rightZoneHeightOccupied = docHeight - initialRightZoneHeight;
-		document.body.style.overflow = 'hidden';
-		updateContentHeight();
-		
-		//loads the glossary library
+	//loads the glossary library	
 		
-		<?php
-		if (api_get_setting('show_glossary_in_extra_tools') == 'true') {  	
-			if (api_get_setting('show_glossary_in_documents') == 'ismanual') {  	  	 	
-		  	 	?>		  	 	
-		    $(document).ready(function() {   
-		      $.frameReady(function(){   
-		       //  $("<div>I am a div courses</div>").prependTo("body");		     
-		      }, "top.content_name",   
-		      { load: [   
-		      		{type:"script", id:"_fr1", src:"<?= api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.js"},
-		            {type:"script", id:"_fr2", src:"<?= api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.highlight.js"},
-		            {type:"script", id:"_fr3", src:"<?= api_get_path(WEB_LIBRARY_PATH); ?>fckeditor/editor/plugins/glossary/fck_glossary_manual.js"}
-		      	 ] 
-		      }		   
-		      );
-		   });		   		  	 	
-		<?php
-		  	 } elseif(api_get_setting('show_glossary_in_documents') == 'isautomatic') {
-		?>		
-		    $(document).ready(function() {   
-		      $.frameReady(function(){   
-		       //  $("<div>I am a div courses</div>").prependTo("body");
-		     
-		      }, "top.content_name",   
-		      { load: [   
-		      		{type:"script", id:"_fr1", src:"<?= api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.js"},
-		            {type:"script", id:"_fr2", src:"<?= api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.highlight.js"},
-		            {type:"script", id:"_fr3", src:"<?= api_get_path(WEB_LIBRARY_PATH); ?>fckeditor/editor/plugins/glossary/fck_glossary_automatic.js"}
-		      	 ] 
-		      }
-		   
-		      );
-		   });
-		<?php
-		  	 }
-		  }
-		?>
+	<?php
+	if (api_get_setting('show_glossary_in_extra_tools') == 'true') {  	
+		if (api_get_setting('show_glossary_in_documents') == 'ismanual') {  	  	 	
+	  	 	?>		  	 	
+	    $(document).ready(function() {   
+	      $.frameReady(function(){   
+	       //  $("<div>I am a div courses</div>").prependTo("body");		     
+	      }, "top.content_name",   
+	      { load: [   
+	      		{type:"script", id:"_fr1", src:"<?= api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.js"},
+	            {type:"script", id:"_fr2", src:"<?= api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.highlight.js"},
+	            {type:"script", id:"_fr3", src:"<?= api_get_path(WEB_LIBRARY_PATH); ?>fckeditor/editor/plugins/glossary/fck_glossary_manual.js"}
+	      	 ] 
+	      }		   
+	      );
+	   });		   		  	 	
+	<?php
+	  	 } elseif(api_get_setting('show_glossary_in_documents') == 'isautomatic') {
+	?>		
+	    $(document).ready(function() {   
+	      $.frameReady(function(){   
+	       //  $("<div>I am a div courses</div>").prependTo("body");
+	     
+	      }, "top.content_name",   
+	      { load: [   
+	      		{type:"script", id:"_fr1", src:"<?= api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.js"},
+	            {type:"script", id:"_fr2", src:"<?= api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.highlight.js"},
+	            {type:"script", id:"_fr3", src:"<?= api_get_path(WEB_LIBRARY_PATH); ?>fckeditor/editor/plugins/glossary/fck_glossary_automatic.js"}
+	      	 ] 
+	      }
+	   
+	      );
+	   });
+	<?php
+	  	 }
+	  }
+	?>
 	}
-	window.onresize = updateContentHeight;
-	-->
-	</script>
+}
 
+window.onresize = updateContentHeight;
+-->
+</script>
+</body>
 <?php
 	/*
 	==============================================================================
@@ -661,5 +638,4 @@ if($_SESSION['oLP']->mode == 'fullscreen') {
 	//Display::display_footer();
 }
 //restore global setting
-$_setting['show_navigation_menu'] = $save_setting;
-?>
+$_setting['show_navigation_menu'] = $save_setting;

File diff suppressed because it is too large
+ 432 - 397
main/newscorm/scorm_api.php


+ 3 - 3
main/social/group_add.php

@@ -21,19 +21,19 @@ $table_message = Database::get_main_table(TABLE_MESSAGE);
 $form = new FormValidator('add_group');
 
 // name
-$form->addElement('text', 'name', get_lang('Name'));
+$form->addElement('text', 'name', get_lang('Name'), array('size'=>30));
 $form->applyFilter('name', 'html_filter');
 $form->applyFilter('name', 'trim');
 $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
 
 // Description
-$form->addElement('textarea', 'description', get_lang('Description'));
+$form->addElement('textarea', 'description', get_lang('Description'), array('rows'=>5, 'cols'=>50));
 $form->applyFilter('description', 'html_filter');
 $form->applyFilter('description', 'trim');
 
 
 // url
-$form->addElement('text', 'url', get_lang('URL'));
+$form->addElement('text', 'url', get_lang('URL'), array('size'=>30));
 $form->applyFilter('url', 'html_filter');
 $form->applyFilter('url', 'trim');
 

+ 3 - 3
main/social/group_edit.php

@@ -43,18 +43,18 @@ $form = new FormValidator('group_edit', 'post', '', '', array('style' => 'width:
 $form->addElement('hidden', 'id', $group_id);
 
 // name
-$form->addElement('text', 'name', get_lang('Name'));
+$form->addElement('text', 'name', get_lang('Name'), array('size'=>30));
 $form->applyFilter('name', 'html_filter');
 $form->applyFilter('name', 'trim');
 $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
 
 // Description
-$form->addElement('textarea', 'description', get_lang('Description'));
+$form->addElement('textarea', 'description', get_lang('Description'), array('rows'=>5, 'cols'=>50));
 $form->applyFilter('description', 'html_filter');
 $form->applyFilter('description', 'trim');
 
 // url
-$form->addElement('text', 'url', get_lang('URL'));
+$form->addElement('text', 'url', get_lang('URL'), array('size'=>30));
 $form->applyFilter('url', 'html_filter');
 $form->applyFilter('url', 'trim');
 

+ 1 - 1
main/social/group_invitation.php

@@ -560,7 +560,7 @@ function makepost(select){
 $members = GroupPortalManager::get_users_by_group($group_id, true, array(GROUP_USER_PERMISSION_PENDING_INVITATION));
 if (is_array($members) && count($members)>0) {
 	echo get_lang('UsersAlreadyInvited');
-	Display::display_sortable_grid('search_users', array(), $members, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true,true));
+	Display::display_sortable_grid('group_invitation', array(), $members, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, false, true,true));
 }
 
 

+ 22 - 9
main/social/groups.php

@@ -177,18 +177,31 @@ if ($group_id != 0 ) {
 	$results = GroupPortalManager::get_groups_by_user(api_get_user_id(), 0, true);
 	
 	$groups = array();
-
-	foreach ($results as $result) {
-		$id = $result['id'];
-		$url_open  = '<a href="groups.php?id='.$id.'">';
-		$url_close = '</a>';
-		if ($result['relation_type'] == GROUP_USER_PERMISSION_ADMIN) {			
-			$result['name'].= Display::return_icon('admin_star.png', get_lang('Admin'));
+	if (is_array($results) && count($results) > 0) {
+		foreach ($results as $result) {
+			$id = $result['id'];
+			$url_open  = '<a href="groups.php?id='.$id.'">';
+			$url_close = '</a>';
+			if ($result['relation_type'] == GROUP_USER_PERMISSION_ADMIN) {			
+				$result['name'].= Display::return_icon('admin_star.png', get_lang('Admin'));
+			}
+			if ($result['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) {			
+				$result['name'].= Display::return_icon('moderator_star.png', get_lang('Moderator'));
+			}
+			
+			$groups[]= array($url_open.$result['picture_uri'].$url_close, $url_open.$result['name'].$url_close,cut($result['description'],140));
 		}
-		$groups[]= array($url_open.$result['picture_uri'].$url_close, $url_open.$result['name'].$url_close,cut($result['description'],140));
 	}
 	echo '<h1>'.get_lang('MyGroups').'</h1>';
-	echo '<a href="group_add.php">'.get_lang('CreateAgroup').'</a>';
+
+	if (api_get_setting('allow_students_to_create_groups_in_social') == 'true') {
+		echo '<a href="group_add.php">'.get_lang('CreateAgroup').'</a>';	
+	} else {
+		if (api_is_allowed_to_edit(null,true)) {
+			echo '<a href="group_add.php">'.get_lang('CreateAgroup').'</a>';
+		}
+	}
+	
 	if (count($groups) > 0) {		
 		Display::display_sortable_grid('groups', array(), $groups, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, true, true,false));
 	}

+ 2 - 120
main/social/index.php

@@ -1,124 +1,6 @@
 <?php
 /* For licensing terms, see /chamilo_license.txt */
-/**
- * @package dokeos.social
- * @author Julio Montoya <gugli100@gmail.com>
- */
- 
-$cidReset = true;
-$language_file = array('registration','messages','userInfo','admin');
-require '../inc/global.inc.php';
-require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
-require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
 
-$this_section = SECTION_MYPROFILE;
-$_SESSION['this_section']=$this_section;
-api_block_anonymous_users();
-$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.js" type="text/javascript" language="javascript"></script>'; //jQuery
-$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-1.1.3.1.pack.js" type="text/javascript"></script>';
-$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.history_remote.pack.js" type="text/javascript"></script>';
-$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.tabs.pack.js" type="text/javascript"></script>';
-$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.js" type="text/javascript" language="javascript"></script>';
-//$htmlHeadXtra[] = '<style rel="stylesheet" href="../inc/lib/javascript/thickbox.css" type="text/css" media="projection, screen">';
-$htmlHeadXtra[]='<style type="text/css" media="all">@import "'.api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.css";</style>';
-
-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");
-		}
-	</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">';
-$htmlHeadXtra[] = '
-        <!-- Additional IE/Win specific style sheet (Conditional Comments) -->
-        <!--[if lte IE 7]>
-        <link rel="stylesheet" href="../inc/lib/javascript/jquery.tabs-ie.css" type="text/css" media="projection, screen">
-        <![endif]-->';
-$_SESSION['social_exist']=true;
-$_SESSION['social_dest'] = 'index.php';
-$interbreadcrumb[]= array (
-	'url' => '#',
-	'name' => get_lang('ModifyProfile')
-);
-if ((api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') ||(api_get_setting('allow_social_tool')=='true') && api_get_user_id()<>2 && api_get_user_id()<>0) {
-	$interbreadcrumb[]= array (
-	'url' => 'index.php?#remote-tab-1',
-	'name' => get_lang('SocialNetwork')
-	);
-} elseif ((api_get_setting('allow_social_tool')=='false' && api_get_setting('allow_message_tool')=='true')) {
-	$interbreadcrumb[]= array (
-	'url' => 'index.php?#remote-tab-1',
-	'name' => get_lang('MessageTool')
-	);
-}
-
-Display :: display_header('');
-if (isset($_GET['sendform'])) {
-	$form_reply=array();
-	$form_reply[]=urlencode($_POST['title']);
-	$form_reply[]=urlencode(api_html_entity_decode($_POST['content']));
-	$form_reply[]=$_POST['user_list'];
-	$form_reply[]=$_POST['re_id'];
-	$form_reply[]=urlencode($_POST['compose']);
-	$form_reply[]=urlencode($_POST['id_text_name']);
-	$form_reply[]=urlencode($_POST['save_form']);
-	$form_info=implode(base64_encode('&%ff..x'),$form_reply);	
-	$form_send_data_message='?form_reply='.$form_info;
-} elseif (isset($_GET['inbox'])) {
-	$form_delete=array();
-	$form_delete[]=$_POST['action'];
-	for ($i=0;$i<count($_POST['id']);$i++) {
-		$form_delete[]=$_POST['id'][$i];
-	}
-	$form_info=implode(',',$form_delete);
-	$form_send_data_message='?form_delete='.($form_info);
-} elseif (isset($_GET['outbox'])) {
-	$form_delete_outbox=array();
-	$form_delete_outbox[]=$_POST['action'];
-	for ($i=0;$i<count($_POST['out']);$i++) {
-		$form_delete_outbox[]=$_POST['out'][$i];
-	}
-	$form_info_outbox=implode(',',$form_delete_outbox);
-	$form_send_data_message='?form_delete_outbox='.($form_info_outbox);
-} 
-$form_url_send=isset($form_send_data_message) ? $form_send_data_message :'';
-
-if(isset($_GET['add_group'])) {	
-	$form_reply=array();
-	$form_reply['name']			= urlencode($_POST['name']);
-	$form_reply['description']	= urlencode(api_html_entity_decode($_POST['description']));
-	$form_reply['url']			= $_POST['url'];
-	$form_reply['picture']		= $_POST['picture'];
-	$form_reply['add_group']	= $_POST['add_group'];	
-	$form_info					= implode(base64_encode('&%ff..x'),$form_reply);	
-	$form_send_data_message		= '?add_group='.$form_info;
-}
-$_GET['add_group'] = null;
-$form_group_send=isset($form_send_data_message) ? $form_send_data_message :'';
-
-//var_dump($form_group_send);
-
-/* Social menu */
-
-UserManager::show_menu();
-
-?>
-<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') {
-	       	?>
-	        <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 
-	    }  	 	
-        ?>
-    </ul>    
-</div>
-<?php
-Display :: display_footer();
+header('Location: profile.php');
+exit();		
 ?>

+ 25 - 20
main/social/profile.php

@@ -453,42 +453,47 @@ echo '<div id="social-profile-container">';
 			//--- User image
 			echo '<div class="social-content-image">';
 			echo '<div class="social-background-content" style="width:95%;" align="center">';
-			echo '<br/>';
-			
-			if ($img_array['file'] != 'unknown.jpg') {
-    	  		echo '<a class="thickbox" href="'.$big_image.'"><img src='.$img_array['dir'].$img_array['file'].' /> </a><br /><br />';
-			} else {
-				echo '<img src='.$img_array['dir'].$img_array['file'].' /><br /><br />';
-			}
-    	  	echo '</div>';
+				echo '<br/>';
+				
+				if ($img_array['file'] != 'unknown.jpg') {
+	    	  		echo '<a class="thickbox" href="'.$big_image.'"><img src='.$img_array['dir'].$img_array['file'].' /> </a><br /><br />';
+				} else {
+					echo '<img src='.$img_array['dir'].$img_array['file'].' /><br /><br />';
+				}
     	  	echo '</div>';
-    	  	   	  	
-	  		echo '<br/>';
-	  		echo '<div class="actions" style="margin-right:5px;">';
-	  		echo '&nbsp;<a href="'.api_get_path(WEB_PATH).'main/messages/send_message_to_userfriend.inc.php?height=300&width=610&user_friend='.$user_id.'&view=profile&view_panel=1" class="thickbox" title="'.get_lang('SendMessage').'">';
-	  		echo Display::return_icon('message_new.png').'&nbsp;&nbsp;'.get_lang('SendMessage').'</a><br />';
+    	  	echo '</div>';    	  	   	  	
+	  		echo '<br/>';  		
 	  		
+	  		$html_actions = '';
+	  		if ($user_id != api_get_user_id()) {
+	  			$html_actions =  '&nbsp;<a href="'.api_get_path(WEB_PATH).'main/messages/send_message_to_userfriend.inc.php?height=300&width=610&user_friend='.$user_id.'&view=profile&view_panel=1" class="thickbox" title="'.get_lang('SendMessage').'">';
+	  			$html_actions .= Display::return_icon('message_new.png').'&nbsp;&nbsp;'.get_lang('SendMessage').'</a><br />';
+	  		}	  		
 	  		//check if I already sent an invitation message
 	  		$invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id());
 	  		
 	  		if (is_array($invitation_sent_list) && is_array($invitation_sent_list[$user_id]) && count($invitation_sent_list[$user_id]) >0 ) {  	  		
-	  			echo '<a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.get_lang('YouAlreadySentAnInvitation').'</a>';
+	  			$html_actions .= '<a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.get_lang('YouAlreadySentAnInvitation').'</a>';
 	  		} else {
 	  			if (!$show_full_profile) {
-	  				echo '&nbsp;<a href="'.api_get_path(WEB_PATH).'main/messages/send_message_to_userfriend.inc.php?view_panel=2&height=260&width=610&user_friend='.$user_id.'" class="thickbox" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('add_multiple_users.gif', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').'</a>';
+	  				$html_actions .=  '&nbsp;<a href="'.api_get_path(WEB_PATH).'main/messages/send_message_to_userfriend.inc.php?view_panel=2&height=260&width=610&user_friend='.$user_id.'" class="thickbox" title="'.get_lang('SendInvitation').'">'.Display :: return_icon('add_multiple_users.gif', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').'</a>';
 	  			}
 	  		}
 			
+    	 
+    	  	if (!empty($html_actions )) {
+    	  		echo '<div class="actions" style="margin-right:5px;">';
+    	  		echo $html_actions; 
     	  		echo '</div>';
-     	  	
-    	  	echo '<br />';
-
+    	  		echo '<br />';
+    	  	}
+     	 
 			// Extra information
 
     	  	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);
+				$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);
 				$extra_information = '';
 				if (is_array($extra_user_data) && count($extra_user_data)>0 ) {

+ 2 - 1
main/tracking/courseLog.php

@@ -930,7 +930,7 @@ function get_number_of_users() {
  */
 function get_user_data($from, $number_of_items, $column, $direction) {
 	
-	global $user_ids, $course_code, $additional_user_profile_info, $export_csv, $is_western_name_order;
+	global $user_ids, $course_code, $additional_user_profile_info, $export_csv, $is_western_name_order, $csv_content;
 	
 	$course_code = Database::escape_string($course_code);
 	$course_info = CourseManager :: get_course_information($course_code);
@@ -1002,6 +1002,7 @@ function get_user_data($from, $number_of_items, $column, $direction) {
 			$row[8] = strip_tags($row[8]);
 			$row[9] = strip_tags($row[9]);
 			unset($row[10]);
+			unset($row[11]);
 			$csv_content[] = $row;
 		}
         // store columns in array $users

+ 1 - 2
user_portal.php

@@ -863,8 +863,7 @@ if (!empty ($_GET['include']) && preg_match('/^[a-zA-Z0-9_-]*\.html$/',$_GET['in
 	}
 	foreach ($courses_tree as $cat => $sessions) {
 		$courses_tree[$cat]['details'] = SessionManager::get_session_category($cat);
-
-		if ($cat == 0) {						
+		if ($cat == 0) {
 			$courses_tree[$cat]['courses'] = CourseManager::get_courses_list_by_user_id($_user['user_id'],false);											
 		}
 		$courses_tree[$cat]['sessions'] = array_flip(array_flip($sessions));

+ 1 - 2
whoisonline.php

@@ -147,8 +147,7 @@ if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) ||
 	if ($user_list) {
 		if (!isset($_GET['id'])) {
 			if (!api_is_anonymous())
-				echo UserManager::get_search_form($_GET['q']);
-				
+				echo UserManager::get_search_form($_GET['q']);				
 			SocialManager::display_user_list($user_list, $_plugins);
 		} else {
 			//individual user information - also displays header info

Some files were not shown because too many files changed in this diff