Преглед изворни кода

More improvements to the group feature see #5611

Julio Montoya пре 15 година
родитељ
комит
583513230c

+ 9 - 7
main/auth/profile.php

@@ -800,6 +800,7 @@ if ($image == 'unknown.jpg') {
 } else {
 	echo '<input type="image" '.$img_attributes.' onclick="javascript: return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');"/>';
 }
+/* This was moved to user_portal.php
 if (api_get_setting('allow_message_tool') == 'true') {
 	include api_get_path(LIBRARY_PATH).'message.lib.php';
 	$number_of_new_messages = MessageManager::get_new_messages();
@@ -815,19 +816,20 @@ if (api_get_setting('allow_message_tool') == 'true') {
 				<a href="../social/index.php#remote-tab-3" class="message-body">'.get_lang('Outbox').$cant_out_box.'</a><br />
 			</p>';
 
-	/*if (api_get_setting('allow_social_tool') == 'true') {
-		 if ($number_of_new_messages_of_friend > 0) {
-			echo '<div class="message-content-internal">';
-			echo '<a href="../social/index.php#remote-tab-4" style="color:#000000">'. Display::return_icon('info3.gif', get_lang('NewMessage'), 'align="absmiddle"').'&nbsp;'.get_lang('Invitation ').'('.$number_of_new_messages_of_friend.')'.'</a>';
-			echo '</div><br />';
-		 }
-	 }*/
+	//if (api_get_setting('allow_social_tool') == 'true') {
+	//	 if ($number_of_new_messages_of_friend > 0) {
+	//		echo '<div class="message-content-internal">';
+	//		echo '<a href="../social/index.php#remote-tab-4" style="color:#000000">'. Display::return_icon('info3.gif', get_lang('NewMessage'), 'align="absmiddle"').'&nbsp;'.get_lang('Invitation ').'('.$number_of_new_messages_of_friend.')'.'</a>';
+	//		echo '</div><br />';
+	//	 }
+	// }
 	echo '<img src="'.api_get_path(WEB_IMG_PATH).'delete.gif" alt="'.get_lang('Close').'" title="'.get_lang('Close').'"  class="message-delete" />';
 	if ($number_of_new_messages_of_friend > 0) {
 		echo '<br />';
 	}
 	echo '</div>';
 }
+*/
 echo '</div>';
 $form->display();
 Display :: display_footer();

+ 6 - 6
main/css/blue_lagoon/default.css

@@ -2182,11 +2182,11 @@ div.comments {
 /* styles from the my.profile.php file */
 .message-content {
 	float:right;
-	margin:20px auto;
-	background:#F5E38E;
-	border:2px solid #EBCA4F;
+	margin:5px auto;
+	background:#FFF;
+	border:1px dotted #ccc;
 	padding:10px;
-	width:200px;
+	width:50%;
 	position:relative;
 }
 .message-content .message-delete {
@@ -2207,8 +2207,8 @@ div.comments {
 	margin-right:-100px;
 }
 .message-title {
-	color:#ff0000;
-	font-size:15px;
+	/* color:#ff0000;*/
+	font-size:12px;
 }
 .message-body {
 	font-size:11px;

+ 3 - 2
main/inc/lib/group_portal_manager.lib.php

@@ -14,8 +14,9 @@ define('GROUP_PERMISSION_CLOSED', '2');
 
 // Group user permissions
 define('GROUP_USER_PERMISSION_ADMIN'	,'1'); // the admin of a group 
-define('GROUP_USER_PERMISSION_READER'	,'2'); // a normal user 
-define('GROUP_USER_PERMISSION_PENDING_INVITATION'	,'3'); // user pending invitation to a group
+define('GROUP_USER_PERMISSION_READER'	,'2'); // a normal user
+define('GROUP_USER_PERMISSION_READER'	,'3'); // a moderator of a group
+define('GROUP_USER_PERMISSION_PENDING_INVITATION'	,'4'); // user pending invitation to a group
 
 class GroupPortalManager
 {

+ 38 - 27
main/inc/lib/social.lib.php

@@ -35,7 +35,7 @@ class SocialManager extends UserManager {
 		$relation_type = intval($relation_type);
 		
 		$sql = 'SELECT COUNT(*) as count FROM ' . $tbl_my_friend . ' WHERE friend_user_id=' .$friend_id.' AND user_id='.$my_user_id;
-		error_log($sql);
+		
 		$result = Database::query($sql, __FILE__, __LINE__);
 		$row = Database :: fetch_array($result, 'ASSOC');
 		if ($row['count'] == 0) {
@@ -54,33 +54,48 @@ class SocialManager extends UserManager {
 	}
 
 	/**
-	 * Allow to delete contact to social network
-	 *@author isaac flores paz <isaac.flores@dokeos.com>
-	 *@author Julio Montoya <gugli100@gmail.com> Cleaning code
-	 *@param int user friend id
+	 * Deletes a contact	  
+	 * @param int user friend id
+	 * @param bool true will delete ALL friends relationship from $friend_id
+	 * @author isaac flores paz <isaac.flores@dokeos.com>
+	 * @author Julio Montoya <gugli100@gmail.com> Cleaning code
 	 */
-	public static function removed_friend ($friend_id) {
+	public static function removed_friend ($friend_id, $real_removed = false) {
 		$tbl_my_friend  = Database :: get_main_table(TABLE_MAIN_USER_FRIEND);
 		$tbl_my_message = Database :: get_main_table(TABLE_MAIN_MESSAGE);
-		
-		$user_id=api_get_user_id();
 		$friend_id = intval($friend_id);
 		
-		$sql = 'SELECT COUNT(*) as count FROM ' . $tbl_my_friend . ' WHERE user_id=' . $user_id . ' AND relation_type<>6 AND friend_user_id='.$friend_id;
-		$result = Database::query($sql, __FILE__, __LINE__);
-		$row = Database :: fetch_array($result, 'ASSOC');
-		if ($row['count'] == 1) {
+		if ($real_removed == true) {
+			
 			//Delete user friend
-			$sql_i = 'UPDATE ' . $tbl_my_friend .' SET relation_type='.SOCIALDELETED.' WHERE user_id=' . $user_id.' AND friend_user_id='.$friend_id;
-			$sql_j = 'UPDATE ' . $tbl_my_message.' SET msg_status=7 WHERE user_receiver_id=' . $user_id.' AND user_sender_id='.$friend_id;
-			//Delete user
-			$sql_ij = 'UPDATE ' . $tbl_my_friend . ' SET relation_type='.SOCIALDELETED.' WHERE user_id=' . $friend_id.' AND friend_user_id='.$user_id;
-			$sql_ji = 'UPDATE ' . $tbl_my_message . ' SET msg_status=7 WHERE user_receiver_id=' . $friend_id.' AND user_sender_id='.$user_id;
-			Database::query($sql_i, __FILE__, __LINE__);
-			Database::query($sql_j, __FILE__, __LINE__);
-			Database::query($sql_ij, __FILE__, __LINE__);
-			Database::query($sql_ji, __FILE__, __LINE__);
+			$sql_delete_relationship1 = 'UPDATE ' . $tbl_my_friend .' SET relation_type='.SOCIALDELETED.' WHERE friend_user_id='.$friend_id;			
+			$sql_delete_relationship2 = 'UPDATE ' . $tbl_my_friend . ' SET relation_type='.SOCIALDELETED.' WHERE user_id=' . $friend_id;
+			
+			Database::query($sql_delete_relationship1, __FILE__, __LINE__);
+			Database::query($sql_delete_relationship2, __FILE__, __LINE__);		
+			
+		} else {
+			$user_id=api_get_user_id();
+			$sql = 'SELECT COUNT(*) as count FROM ' . $tbl_my_friend . ' WHERE user_id=' . $user_id . ' AND relation_type<>6 AND friend_user_id='.$friend_id;
+			$result = Database::query($sql, __FILE__, __LINE__);
+			$row = Database :: fetch_array($result, 'ASSOC');
+			if ($row['count'] == 1) {
+				//Delete user friend
+				$sql_i = 'UPDATE ' . $tbl_my_friend .' SET relation_type='.SOCIALDELETED.' WHERE user_id=' . $user_id.' AND friend_user_id='.$friend_id;
+				$sql_j = 'UPDATE ' . $tbl_my_message.' SET msg_status=7 WHERE user_receiver_id=' . $user_id.' AND user_sender_id='.$friend_id;
+				//Delete user
+				$sql_ij = 'UPDATE ' . $tbl_my_friend . ' SET relation_type='.SOCIALDELETED.' WHERE user_id=' . $friend_id.' AND friend_user_id='.$user_id;
+				$sql_ji = 'UPDATE ' . $tbl_my_message . ' SET msg_status=7 WHERE user_receiver_id=' . $friend_id.' AND user_sender_id='.$user_id;
+				Database::query($sql_i, __FILE__, __LINE__);
+				Database::query($sql_j, __FILE__, __LINE__);
+				Database::query($sql_ij, __FILE__, __LINE__);
+				Database::query($sql_ji, __FILE__, __LINE__);
+			}			
 		}
+		
+		
+		
+
 	}
 	/**
 	 * Allow to see contacts list
@@ -385,13 +400,11 @@ class SocialManager extends UserManager {
 	 * @author  Yannick Warnier
 	 * @since   Dokeos 1.8.6.1
 	 */
-	function get_user_feeds($user,$limit=5) {
+	function get_user_feeds($user, $limit=5) {
 	    if (!function_exists('fetch_rss')) { return '';}
 		$fields = UserManager::get_extra_fields();
 	    $feed_fields = array();
 	    $feeds = array();
-	    $res = '<div class="sectiontitle">'.get_lang('RSSFeeds').'</div>';
-	    $res .= '<div class="social-content-training">';
 	    $feed = UserManager::get_extra_user_data_by_field($user,'rssfeeds');
 	    if(empty($feed)) { return ''; }
 	    $feeds = split(';',$feed['rssfeeds']);
@@ -411,8 +424,6 @@ class SocialManager extends UserManager {
 	        }
 	        $res .= '</div>';
 	    }
-	    $res .= '</div>';
-	    $res .= '<div class="clear"></div><br />';
 	    return $res;
 	}
 	
@@ -615,7 +626,7 @@ class SocialManager extends UserManager {
 			echo '<a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('lp_users.png').' '.get_lang('Invitations').'</a>';
 			echo '<a href="'.api_get_path(WEB_PATH).'main/social/groups.php">'.Display::return_icon('group.gif').' '.get_lang('MyGroups').'</a>';
 			echo '<a href="'.api_get_path(WEB_PATH).'main/social/search.php">'.Display::return_icon('search.gif').' '.get_lang('Search').'</a>';
-			echo '<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php?show=1">'.Display::return_icon('edit.gif').' '.get_lang('ModifProfile').'</a>';	
+			echo '<a href="'.api_get_path(WEB_PATH).'main/auth/profile.php?show=1">'.Display::return_icon('edit.gif').' '.get_lang('EditProfile').'</a>';	
 			/*
 			echo '<span style="float:right; padding-top:7px;">'.
 				 '<a href="/main/auth/profile.php?show=1">'.Display::return_icon('edit.gif').' '.get_lang('Configuration').'</a>';

+ 8 - 1
main/inc/lib/usermanager.lib.php

@@ -248,7 +248,14 @@ class UserManager
 			}
 			UrlManager::delete_url_rel_user($user_id, $url_id);
 		}
-
+		
+		if (api_get_setting('allow_social_tool')=='true' ) {
+			require_once api_get_path(LIBRARY_PATH).'social.lib.php';
+			//Delete user from groups
+			
+			//Delete from user friend lists 
+			SocialManager::removed_friend($user_id,true);
+		}
 		// add event to system log
 		$time = time();
 		$user_id_manager = api_get_user_id();

+ 15 - 11
main/social/friends.php

@@ -96,7 +96,11 @@ function hide_icon_delete(element_html)  {
 	$(ident).attr("title","");
 }
 		
-
+function clear_form () {
+	$("input[@type=radio]").attr("checked", false);
+	$("div#div_qualify_image").html("");
+	$("div#div_info_user").html("");
+}
 </script>';
 
 $interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
@@ -118,12 +122,12 @@ $user_id=api_get_user_id();
 $image_path = UserManager::get_user_picture_path_by_id ($user_id,'web',false,true);
 ?>
 <div align="center" >
-<table width="100%" border="0" cellpadding="0" cellspacing="0" class="social-content-table">
+<table width="100%" border="0" cellpadding="0" cellspacing="0" >
   <tr>
     <td height="25" valign="top">
-    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="social-subtitle-search">
+    <table width="100%" border="0" cellpadding="0" cellspacing="0" >
       <tr>
-        <td width="100%"  valign="top" class="social-align-box">&nbsp;&nbsp;<?php echo api_xml_http_response_encode(get_lang('Search')) .'&nbsp;&nbsp; : &nbsp;&nbsp;'; ?>
+        <td width="100%"  valign="top" class="social-align-box">&nbsp;&nbsp;<?php echo get_lang('Search') .'&nbsp;&nbsp; : &nbsp;&nbsp;'; ?>
         	<input class="social-search-image" type="text" class="search-image" id="id_search_image" name="id_search_image" value="" onkeyup="search_image_social(this)" />
         </td>
       </tr>
@@ -133,13 +137,13 @@ $image_path = UserManager::get_user_picture_path_by_id ($user_id,'web',false,tru
     <td height="175" valign="top">
     <table width="100%" border="0" cellpadding="0" cellspacing="0" >
       <tr>
-	<td height="153" valign="top">
-<?php
-echo '<div id="div_content_table">';
-require_once 'show_search_image.inc.php';
-echo '</div>';
-?>
-        </td>
+		<td height="153" valign="top">
+			<?php
+			echo '<div id="div_content_table">';
+			require_once 'show_search_image.inc.php';
+			echo '</div>';
+			?>
+		</td>
         </tr>
     </table></td>
   </tr>

+ 0 - 1
main/social/group_edit.php

@@ -39,7 +39,6 @@ $group_data = Database::fetch_array($res, 'ASSOC');
 
 // Create the form
 $form = new FormValidator('group_edit', 'post', '', '', array('style' => 'width: 60%; float: '.($text_dir == 'rtl' ? 'right;' : 'left;')));
-$form->addElement('header', '', $tool_name);
 $form->addElement('hidden', 'id', $group_id);
 
 // name

+ 6 - 10
main/social/group_invitation.php

@@ -227,8 +227,6 @@ global $_configuration;
 
 $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
 
-
-
 if ($ajax_search) {
 	$sql="SELECT  u.user_id, lastname, firstname, username, group_id
 				FROM $tbl_user u
@@ -340,18 +338,16 @@ if ($ajax_search) {
 		foreach($friends as $friend) {			
 			$user_info=api_get_user_info($friend['friend_user_id']);
 			$group_friend_list = GroupPortalManager::get_groups_by_user($friend['friend_user_id']);
-			//var_dump($group_friend_list);
 			$friend_group_id = '';
-			if (in_array($group_id,$group_friend_list)) {
+			if (isset($group_friend_list[$group_id]) && $group_friend_list[$group_id]['id'] == $group_id) {
 				$friend_group_id = $group_id;
 			} 
-			$Users2[]=array('user_id' => $friend['friend_user_id'],  'firstname' =>$user_info['firstName'], 'lasttname' => $user_info['lastName'], 'username' =>$user_info['username'],'group_id'=>$friend_group_id );
+			$Users[]=array('user_id' => $friend['friend_user_id'],  'firstname' =>$user_info['firstName'], 'lasttname' => $user_info['lastName'], 'username' =>$user_info['username'],'group_id'=>$friend_group_id );
 		}
-		//var_dump($Users2);
-
+		
 	//	echo $sql;
-		$result = Database::query($sql,__FILE__,__LINE__);
-		$Users	= Database::store_result($result,'ASSOC');
+		//$result = Database::query($sql,__FILE__,__LINE__);
+		//$Users	= Database::store_result($result,'ASSOC');
 
 		foreach ($Users as $user) {
 			if($user['group_id'] != $group_id)
@@ -469,7 +465,7 @@ if(!empty($errorMsg)) {
   <td align="center"><b><?php echo get_lang('UserListInGroup') ?> :</b></td>
 </tr>
 
-<?php if ($add_type=='multiple') { ?>
+<?php if ($add_type=='no') { ?>
 <tr>
 <td align="center">
 

+ 2 - 1
main/social/group_members.php

@@ -58,7 +58,8 @@ foreach($users as $user) {
 			$user['link'] = Display::return_icon('admin_star.png', get_lang('Admin'));
 		break;
 		case  GROUP_USER_PERMISSION_READER:
-			$user['link'] = '<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=delete">'.Display::return_icon('delete.png', get_lang('Delete')).'</a>';
+			$user['link'] = '<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=delete">'.Display::return_icon('delete.png', get_lang('DeleteFromGroup')).'</a><br />'.
+							'<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=set_admin">'.Display::return_icon('delete.png', get_lang('LikeModerator')).'</a>';
 		break;		
 		case  GROUP_USER_PERMISSION_PENDING_INVITATION:
 			$user['link'] = '<a href="group_members.php?id='.$group_id.'&u='.$user['user_id'].'&action=add">'.Display::return_icon('pending_invitation.png', get_lang('PendingInvitation')).'</a>';

+ 1 - 1
main/social/groups.php

@@ -61,7 +61,7 @@ if ($group_id != 0 ) {
 	//@todo this must be move to default.css for dev use only
 	echo '<style> 		
 			#group_members { width:250px; height:300px; overflow-x:none; overflow-y: auto;}
-			.group_member_item { width:80px; float:left;}
+			.group_member_item { width:80px; height:100px; float:left; margin:5px 5px 15px 5px; }
 			
 	</style>';
 

+ 1 - 1
main/social/invitations.php

@@ -176,7 +176,7 @@ if (count($list_get_invitation_sent) > 0 ){
 }
 
 if (count($pending_invitations) > 0) {
-	echo get_lang('GroupInvitations');
+	echo get_lang('GroupsWaitingApproval');
 	Display::display_sortable_grid('search_users', array(), $pending_invitations, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, true, true,false));
 }
 	

+ 68 - 41
main/social/profile.php

@@ -16,6 +16,8 @@ require '../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
 require_once api_get_path(LIBRARY_PATH).'social.lib.php';
 require_once api_get_path(LIBRARY_PATH).'array.lib.php';
+require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
+
 $user_id = api_get_user_id();
 $show_full_profile = true;
 //social tab
@@ -200,10 +202,7 @@ $interbreadcrumb[]= array (
 
 if (isset($_GET['u']) && is_numeric($_GET['u'])) {
 	$info_user=api_get_user_info($_GET['u']);
-	$interbreadcrumb[]= array (
-		'url' => 'javascript: void(0);',
-		'name' => api_get_person_name($info_user['firstName'], $info_user['lastName'])
-	);
+	$interbreadcrumb[]= array ('url' => 'javascript: void(0);','name' => api_get_person_name($info_user['firstName'], $info_user['lastName']));
 }
 if (isset($_GET['u'])) {
 	$param_user='u='.Security::remove_XSS($_GET['u']);
@@ -345,35 +344,35 @@ echo '<div id="social-profile-wrapper">';
 			echo $friend_html;
 			//Pending invitations
 			if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) {
-			$pending_invitations = SocialManager::get_list_invitation_of_friends_by_user_id(api_get_user_id());
-			$list_get_path_web=SocialManager::get_list_web_path_user_invitation_by_user_id(api_get_user_id());
-			$count_pending_invitations = count($pending_invitations);
-			//echo '<div class="clear"></div><br />';
-				//javascript:register_friend(this)
-				//var_dump($pending_invitations);
-			echo '<div class="clear"></div><br />';
-			echo '<div id="social-profile-invitations" >';
-			if ($count_pending_invitations > 0) {
-				echo '<div class="sectiontitle">';
-					echo api_convert_encoding(get_lang('PendingInvitations'),$charset,'UTF-8');
-					echo '</div><br />';
-				for ($i=0;$i<$count_pending_invitations;$i++) {
-					//var_dump($invitations);
-						echo '<div id="dpending_'.$pending_invitations[$i]['user_sender_id'].'" class="friend_invitations">';
-						echo '<div style="float:left;width:60px;" >';
-							echo '<img style="margin-bottom:5px;" src="'.$list_get_path_web[$i]['dir'].'/'.$list_get_path_web[$i]['file'].'" width="60px">';
-						echo '</div>';
-						echo '<div style="padding-left:70px;">';
-								echo ' '.api_convert_encoding(substr($pending_invitations[$i]['content'],0,50),$charset,'UTF-8');
-							echo '<br />';
-							echo '<a id="btn_accepted_'.$pending_invitations[$i]['user_sender_id'].'" onclick="register_friend(this)" href="javascript:void(0)">'.get_lang('SocialAddToFriends').'</a>';
-							echo '<div id="id_response">&nbsp;</div>';
+				$pending_invitations = SocialManager::get_list_invitation_of_friends_by_user_id(api_get_user_id());
+				$list_get_path_web=SocialManager::get_list_web_path_user_invitation_by_user_id(api_get_user_id());
+				$count_pending_invitations = count($pending_invitations);
+				//echo '<div class="clear"></div><br />';
+					//javascript:register_friend(this)
+					//var_dump($pending_invitations);
+				echo '<div class="clear"></div><br />';
+				echo '<div id="social-profile-invitations" >';
+				if ($count_pending_invitations > 0) {
+					echo '<div class="sectiontitle">';
+						echo api_convert_encoding(get_lang('PendingInvitations'),$charset,'UTF-8');
+						echo '</div><br />';
+					for ($i=0;$i<$count_pending_invitations;$i++) {
+						//var_dump($invitations);
+							echo '<div id="dpending_'.$pending_invitations[$i]['user_sender_id'].'" class="friend_invitations">';
+							echo '<div style="float:left;width:60px;" >';
+								echo '<img style="margin-bottom:5px;" src="'.$list_get_path_web[$i]['dir'].'/'.$list_get_path_web[$i]['file'].'" width="60px">';
+							echo '</div>';
+							echo '<div style="padding-left:70px;">';
+									echo ' '.api_convert_encoding(substr($pending_invitations[$i]['content'],0,50),$charset,'UTF-8');
+								echo '<br />';
+								echo '<a id="btn_accepted_'.$pending_invitations[$i]['user_sender_id'].'" onclick="register_friend(this)" href="javascript:void(0)">'.get_lang('SocialAddToFriends').'</a>';
+								echo '<div id="id_response">&nbsp;</div>';
+							echo '</div>';
 						echo '</div>';
-					echo '</div>';
-					echo '<div class="clear"></div>';
+						echo '<div class="clear"></div>';
+					}
 				}
-			}
-			echo '</div>';
+				echo '</div>';
 			}
 
 			//--Productions
@@ -492,7 +491,9 @@ echo '<div id="social-profile-container">';
     	  		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>';
     	  		} else {
-    	  			echo '&nbsp;<a href="/main/messages/send_message_to_userfriend.inc.php?view_panel=2&height=300&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 (!$show_full_profile) {
+    	  				echo '&nbsp;<a href="/main/messages/send_message_to_userfriend.inc.php?view_panel=2&height=300&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>';
+    	  			}
     	  		}
 				
 				
@@ -556,7 +557,9 @@ echo '<div id="social-profile-container">';
 											$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.implode(', ',$tag_tmp).'<br />';
 										}
 									} else {
-										$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.$data.'<br />';
+										if (!empty($data)) {
+											$extra_information_value .= '<strong>'.ucfirst($field_display_text).':</strong> '.$data.'<br />';
+										}
 									}
 								}
 							}
@@ -568,23 +571,38 @@ echo '<div id="social-profile-container">';
 					$extra_information .= '</div>';
 					$extra_information .= '<br /><br />';
 				}
+				
 				// 	if there are information to show
 				if (!empty($extra_information_value))
 					echo $extra_information;
-
+				
+					$results = GroupPortalManager::get_groups_by_user($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'));
+					}
+					$groups[]= array($url_open.$result['picture_uri'].$url_close, $url_open.$result['name'].$url_close);
+					}
+					echo '<h2>'.get_lang('MyGroups').'</h2>';
+					Display::display_sortable_grid('groups', array(), $groups, array('hide_navigation'=>true, 'per_page' => 100), $query_vars, false, array(true, true, true,false));
+	
 
 				// ---- My Agenda Items
 				$my_agenda_items = show_simple_personal_agenda($user_id);
 				if (!empty($my_agenda_items)) {
 					echo '<div class="sectiontitle">';
-					echo get_lang('MyAgenda');
+						echo get_lang('MyAgenda');
 					echo '</div>';
 					$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
 					echo '<div class="social-content-agenda">';
-					echo '<div class="social-background-content">';
-					echo $my_agenda_items;
-					echo '</div>';
-
+						echo '<div class="social-background-content">';
+						echo $my_agenda_items;
+						echo '</div>';
 					echo '<br /><br />';
 					echo '</div>';
 				}
@@ -658,6 +676,7 @@ echo '<div id="social-profile-container">';
 
 			echo '<div class="clear"></div><br />';
 			echo '</div>';
+			
 			// COURSES LIST
 			if ($show_full_profile) {
 				//print_r($personal_course_list);
@@ -716,8 +735,16 @@ echo '<div id="social-profile-container">';
 					*/
 				}
 				echo '</ul><br />';
-                echo SocialManager::get_user_feeds($user_id);
-        		echo '</div>';
+				
+				$user_feeds = SocialManager::get_user_feeds($user_id);
+				if (!empty($user_feeds )) {
+					echo '<div class="sectiontitle">'.get_lang('RSSFeeds').'</div>';
+	    			echo '<div class="social-content-training">';
+                	echo $user_feeds;
+                	echo '</div>';
+	    			echo '<div class="clear"></div><br />';
+        			echo '</div>';
+				}
 		    }
             echo '</div>';
         echo '</div>';

+ 3 - 3
main/social/register_friend.php

@@ -35,14 +35,14 @@ if (isset($_POST['friend_id'])) {
 	}
 }
 if (isset($_POST['denied_friend_id'])) {
-	SocialManager::invitation_denied((int)$my_denied_current_friend,(int)$the_current_user_id);
+	SocialManager::invitation_denied($my_denied_current_friend,$the_current_user_id);
 	Display::display_confirmation_message(api_xml_http_response_encode(get_lang('InvitationDenied')));
 }
 if (isset($_POST['delete_friend_id'])) {
-	SocialManager::removed_friend((int)$my_delete_friend);
+	SocialManager::removed_friend($my_delete_friend);
 }
 if(isset($_POST['user_id_friend_q']) && isset($_POST['type_friend_q'])) {
-	SocialManager::qualify_friend((int)$friend_id_qualify,(int)$type_friend_qualify);
+	SocialManager::qualify_friend($friend_id_qualify,$type_friend_qualify);
 	echo api_xml_http_response_encode(get_lang('AttachContactsToGroupSuccesfuly'));
 }
 ?>

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

@@ -1,25 +1,5 @@
 <?php
-/*
-==============================================================================
-	Dokeos - elearning and course management software
-
-	Copyright (c) 2009 Dokeos SPRL
-	Copyright (c) Julio Montoya Armas
-
-	For a full list of contributors, see "credits.txt".
-	The full license can be read in "license.txt".
-
-	This program is free software; you can redistribute it and/or
-	modify it under the terms of the GNU General Public License
-	as published by the Free Software Foundation; either version 2
-	of the License, or (at your option) any later version.
-
-	See the GNU General Public License for more details.
-
-	Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
-	Mail: info@dokeos.com
-==============================================================================
-*/
+/* For licensing terms, see /dokeos_license.txt */
 
 $cidReset = true;
 require '../inc/global.inc.php';
@@ -44,6 +24,7 @@ $number_friends=0;
 $list_friends_id=array();
 $list_friends_dir=array();
 $list_friends_file=array();
+
 if (count($list_path_friends)!=0) {
 	for ($z=0;$z<count($list_path_friends['id_friend']);$z++) {
 		$list_friends_id[]  = $list_path_friends['id_friend'][$z]['friend_user_id'];
@@ -54,7 +35,7 @@ if (count($list_path_friends)!=0) {
 	$number_loop   = ($number_friends/$number_of_images);
 	$loop_friends  = ceil($number_loop);
 	$j=0;
-	$friend_html.= '<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFC" >';
+	$friend_html.= '<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="" >';
 	for ($k=0;$k<$loop_friends;$k++) {
 		$friend_html.='<tr><td valign="top">';
 		if ($j==$number_of_images) {
@@ -65,9 +46,9 @@ if (count($list_path_friends)!=0) {
 				$user_info=api_get_user_info($list_friends_id[$j]);
 				$user_name=api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName']));
 				$friends_profile = SocialManager::get_picture_user($list_friends_id[$j], $list_friends_file[$j], 92);
-				$friend_html.='<div onMouseover="show_icon_delete(this)" onMouseout="hide_icon_delete(this)" class="image-social-content" id=div_'.$list_friends_id[$j].'  >
-				<span><center><img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' id="imgfriend_'.$list_friends_id[$j].'" title="'.$user_name.'" onclick=load_thick(\'qualify_contact.inc.php?path_user="'.urlencode($list_friends_dir[$j].$list_friends_file[$j]).'&amp;id_user="'.$list_friends_id[$j].'"\',"") /></center></span>
-				<img onclick="delete_friend (this)" id=img_'.$list_friends_id[$j].' src="../img/blank.gif" alt="" title=""  class="image-delete" /> <center class="friend">'.$user_name.'</center></div>';
+				$friend_html.='<div onMouseover="show_icon_delete(this)" onMouseout="hide_icon_delete(this)" class="image-social-content" id=div_'.$list_friends_id[$j].'>';
+				$friend_html.='<span><a href="profile.php?u='.$list_friends_id[$j].'"><center><img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' id="imgfriend_'.$list_friends_id[$j].'" title="'.$user_name.'" /></center></a></span>';
+				$friend_html.='<img onclick="delete_friend (this)" id=img_'.$list_friends_id[$j].' src="../img/blank.gif" alt="" title=""  class="image-delete" /> <center class="friend">'.$user_name.'</center></div>';
 				/*
 				 * $friend_html.='&nbsp;<div onMouseover="show_icon_delete(this)" onMouseout="hide_icon_delete(this)" class="image-social-content" id=div_'.$list_friends_id[$j].' style="float:left" >
 				 * <img src="'.$list_friends_dir[$j]."/".$list_friends_file[$j].'" width="90" height="110" style="margin-left:3px ;margin-rigth:3px;margin-top:10px;margin-bottom:3px;" id="imgfriend_'.$list_friends_id[$j].'" title="'.$user_name.'" onclick="qualify_friend(this)"/>