|
@@ -188,8 +188,12 @@ class SocialManager extends UserManager {
|
|
|
$sql.=' AND relation_type='.$id_group;
|
|
|
}
|
|
|
if (isset($search_name) && is_string($search_name)===true) {
|
|
|
- $sql.=' AND friend_user_id IN (SELECT user_id FROM '.$tbl_my_user.' WHERE '.(api_is_western_name_order() ? 'concat(firstName, lastName)' : 'concat(lastName, firstName)').' like concat("%","'.Database::escape_string($search_name).'","%"));';
|
|
|
+ $search_name = trim($search_name);
|
|
|
+ $search_name = str_replace(' ', '', $search_name);
|
|
|
+ //$sql.=' AND friend_user_id IN (SELECT user_id FROM '.$tbl_my_user.' WHERE '.(api_is_western_name_order() ? 'concat(firstName, lastName)' : 'concat(lastName, firstName)').' like concat("%","'.Database::escape_string($search_name).'","%"));';
|
|
|
+ $sql.=' AND friend_user_id IN (SELECT user_id FROM '.$tbl_my_user.' WHERE firstName LIKE "%'.Database::escape_string($search_name).'%" OR lastName LIKE "%'.Database::escape_string($search_name).'%" OR '.(api_is_western_name_order() ? 'concat(firstName, lastName)' : 'concat(lastName, firstName)').' like concat("%","'.Database::escape_string($search_name).'","%") ) ';
|
|
|
}
|
|
|
+
|
|
|
$res=Database::query($sql,__FILE__,__LINE__);
|
|
|
while ($row=Database::fetch_array($res,'ASSOC')) {
|
|
|
if ($load_extra_info == true) {
|
|
@@ -649,10 +653,15 @@ class SocialManager extends UserManager {
|
|
|
* @param bool show profile or not (show or hide the user image/information)
|
|
|
*
|
|
|
*/
|
|
|
- public static function show_social_menu($show = '',$group_id = 0, $user_id = 0, $show_full_profile = false) {
|
|
|
+ public static function show_social_menu($show = '', $group_id = 0, $user_id = 0, $show_full_profile = false) {
|
|
|
+
|
|
|
+ if (empty($user_id)) {
|
|
|
+ $user_id = api_get_user_id();
|
|
|
+ }
|
|
|
|
|
|
$img_array = UserManager::get_user_picture_path_by_id($user_id,'web',true,true);
|
|
|
- $big_image = UserManager::get_picture_user($user_id, $img_array['file'],'',USER_IMAGE_SIZE_BIG);
|
|
|
+ $big_image = UserManager::get_picture_user($user_id, $img_array['file'],'', USER_IMAGE_SIZE_BIG);
|
|
|
+
|
|
|
$big_image = $big_image['file'].$big_image['dir'];
|
|
|
$show_groups = array('groups', 'group_messages', 'messages_list', 'group_add', 'mygroups', 'group_edit', 'member_list', 'invite_friends', 'waiting_list');
|
|
|
$show_messages = array('messages', 'messages_inbox', 'messages_outbox', 'messages_compose');
|
|
@@ -668,7 +677,25 @@ class SocialManager extends UserManager {
|
|
|
}
|
|
|
|
|
|
echo '<div class="social-menu">';
|
|
|
+
|
|
|
+ //--- User image
|
|
|
+ echo '<div class="social-content-image">';
|
|
|
+ echo '<div class="social-background-content" onmouseout="hide_icon_edit()" onmouseover="show_icon_edit()"><center>';
|
|
|
+
|
|
|
+ if ($img_array['file'] != 'unknown.jpg') {
|
|
|
+ echo '<a class="thickbox" href="'.$big_image.'"><img src='.$img_array['dir'].$img_array['file'].' /> </a>';
|
|
|
+ } else {
|
|
|
+ echo '<img src='.$img_array['dir'].$img_array['file'].' width="110px" />';
|
|
|
+ }
|
|
|
+ if (api_get_user_id() == $user_id) {
|
|
|
+ echo '<div id="edit_image" class="hidden_message" style="display:none"><a href="'.api_get_path(WEB_PATH).'main/auth/profile.php">'.get_lang('EditProfile').'</a></div>';
|
|
|
+ }
|
|
|
|
|
|
+ echo '</center></div>';
|
|
|
+ echo '</div>';
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if ($show != 'shared_profile') {
|
|
|
|
|
|
echo '<div align="center" class="social-menu-title" ><span class="social-menu-text1">'.get_lang('Menu').'</span></div>';
|
|
@@ -687,24 +714,21 @@ class SocialManager extends UserManager {
|
|
|
echo '</ul></li>';
|
|
|
}
|
|
|
|
|
|
- // why this link was hide?
|
|
|
- //if ($show == 'invitations') {
|
|
|
- echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('mail.png',get_lang('Invitations'),array('hspace'=>'6')).'<span class="'.($show=='invitations'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Invitations').'</span></a></li>';
|
|
|
- //}
|
|
|
-
|
|
|
- echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('shared_profile.png',get_lang('ViewMySharedProfile'),array('hspace'=>'6')).'<span class="'.($show=='shared_profile'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('ViewMySharedProfile').'</span></a></li>
|
|
|
- <li><a href="'.api_get_path(WEB_PATH).'main/social/friends.php">'.Display::return_icon('members.gif',get_lang('Friends'),array('hspace'=>'6')).'<span class="'.($show=='friends'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Friends').'</span></a></li>
|
|
|
- <li><a href="'.api_get_path(WEB_PATH).'main/social/groups.php">'.Display::return_icon('group.gif',get_lang('Groups'),array('hspace'=>'6')).'<span class="'.($show=='groups'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Groups').'</span></a></li>';
|
|
|
+ //Invitations
|
|
|
+ echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('mail.png',get_lang('Invitations'),array('hspace'=>'6')).'<span class="'.($show=='invitations'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Invitations').'</span></a></li>';
|
|
|
+ echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('shared_profile.png',get_lang('ViewMySharedProfile'),array('hspace'=>'6')).'<span class="'.($show=='shared_profile'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('ViewMySharedProfile').'</span></a></li>
|
|
|
+ <li><a href="'.api_get_path(WEB_PATH).'main/social/friends.php">'.Display::return_icon('members.gif',get_lang('Friends'),array('hspace'=>'6')).'<span class="'.($show=='friends'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Friends').'</span></a></li>
|
|
|
+ <li><a href="'.api_get_path(WEB_PATH).'main/social/groups.php">'.Display::return_icon('group.gif',get_lang('Groups'),array('hspace'=>'6')).'<span class="'.($show=='groups'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Groups').'</span></a></li>';
|
|
|
|
|
|
if (in_array($show,$show_groups)) {
|
|
|
echo '<li><ul>';
|
|
|
echo $create_group_item;
|
|
|
echo '<li class="social-menu-sub-level" style="background:none;padding:0px"><a href="'.api_get_path(WEB_PATH).'main/social/groups.php?view=mygroups">'.Display::return_icon('group.gif',get_lang('MyGroups'),array('hspace'=>'6')).'<span class="'.($show=='mygroups'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('MyGroups').'</span></a></li>';
|
|
|
echo '</ul></li>';
|
|
|
- }
|
|
|
- echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/search.php">'.Display::return_icon('search.gif',get_lang('Search'),array('hspace'=>'6')).'<span class="'.($show=='search'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Search').'</span></a></li>
|
|
|
- </ul>
|
|
|
- </div>';
|
|
|
+ }
|
|
|
+ echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/search.php">'.Display::return_icon('search.gif',get_lang('Search'),array('hspace'=>'6')).'<span class="'.($show=='search'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Search').'</span></a></li>
|
|
|
+ </ul>
|
|
|
+ </div>';
|
|
|
|
|
|
if (in_array($show, $show_groups) && !empty($group_id)) {
|
|
|
echo GroupPortalManager::show_group_column_information($group_id, api_get_user_id(), $show);
|
|
@@ -712,59 +736,44 @@ class SocialManager extends UserManager {
|
|
|
}
|
|
|
|
|
|
if ($show == 'shared_profile') {
|
|
|
-
|
|
|
- //--- User image
|
|
|
- echo '<div class="social-content-image">';
|
|
|
- echo '<div class="social-background-content" onmouseout="hide_icon_edit()" onmouseover="show_icon_edit()"><center>';
|
|
|
- if ($img_array['file'] != 'unknown.jpg') {
|
|
|
- echo '<a class="thickbox" href="'.$big_image.'"><img src='.$img_array['dir'].$img_array['file'].' width="180px" /> </a>';
|
|
|
- } else {
|
|
|
- echo '<img src='.$img_array['dir'].$img_array['file'].' width="110px" />';
|
|
|
- }
|
|
|
- if (api_get_user_id() == $user_id) {
|
|
|
- echo '<div id="edit_image" class="hidden_message" style="display:none"><a href="'.api_get_path(WEB_PATH).'main/auth/profile.php">'.get_lang('EditProfile').'</a></div>';
|
|
|
- }
|
|
|
-
|
|
|
- echo '</center></div>';
|
|
|
- echo '</div>';
|
|
|
-
|
|
|
- if ($user_id != intval(api_get_user_id())) {
|
|
|
- $user_info = api_get_user_info($user_id);
|
|
|
- echo '<div><center><strong>'.api_get_person_name($user_info['firstName'], $user_info['lastName']).'</strong></center></div><br />';
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if ($show_full_profile && $user_id == intval(api_get_user_id())) {
|
|
|
- echo '<div align="center" class="social-menu-title" ><span class="social-menu-text1">'.get_lang('Menu').'</span></div>';
|
|
|
+
|
|
|
+ echo '<div align="center" class="social-menu-title" ><span class="social-menu-text1">'.get_lang('Menu').'</span></div>';
|
|
|
echo '<div>
|
|
|
- <ul>
|
|
|
+ <ul>';
|
|
|
+
|
|
|
+ // My own profile
|
|
|
+ if ($show_full_profile && $user_id == intval(api_get_user_id())) {
|
|
|
+ echo '
|
|
|
<li><a href="'.api_get_path(WEB_PATH).'main/social/home.php">'.Display::return_icon('home.gif',get_lang('Home'),array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('Home').'</span></a></li>
|
|
|
<li><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php?f=social">'.Display::return_icon('inbox.png',get_lang('Messages'),array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('Messages').'</span></a></li>';
|
|
|
echo ' <li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.Display::return_icon('mail.png',get_lang('Invitations'),array('hspace'=>'6')).'<span class="'.($show=='invitations'?'social-menu-text-active':'social-menu-text4').'" >'.get_lang('Invitations').'</span></a></li>';
|
|
|
echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.Display::return_icon('shared_profile.png',get_lang('ViewMySharedProfile'),array('hspace'=>'6','style'=>'float:left')).'<span class="social-menu-text-active" >'.get_lang('ViewMySharedProfile').'</span></a></li>
|
|
|
<li><a href="'.api_get_path(WEB_PATH).'main/social/friends.php">'.Display::return_icon('members.gif',get_lang('Friends'),array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('Friends').'</span></a></li>
|
|
|
<li><a href="'.api_get_path(WEB_PATH).'main/social/groups.php">'.Display::return_icon('group.gif',get_lang('Groups'),array('hspace'=>'6')).'<span class="social-menu-text4" >'.get_lang('Groups').'</span></a></li>';
|
|
|
- echo '</ul></div>';
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+ // My friend profile
|
|
|
$html_actions = '';
|
|
|
- if ($user_id != api_get_user_id()) {
|
|
|
- $html_actions = ' <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').' '.get_lang('SendMessage').'</a><br />';
|
|
|
+
|
|
|
+ if ($user_id != api_get_user_id()) {
|
|
|
+ echo '<li><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').' '.get_lang('SendMessage').'</a></li>';
|
|
|
}
|
|
|
+
|
|
|
//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 ) {
|
|
|
- $html_actions .= '<a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.get_lang('YouAlreadySentAnInvitation').'</a>';
|
|
|
+ echo '<li><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.get_lang('YouAlreadySentAnInvitation').'</a></li>';
|
|
|
} else {
|
|
|
if (!$show_full_profile) {
|
|
|
- $html_actions .= ' <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')).' '.get_lang('SendInvitation').'</a>';
|
|
|
+ echo '<li><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')).' '.get_lang('SendInvitation').'</a></li>';
|
|
|
}
|
|
|
}
|
|
|
- echo $html_actions;
|
|
|
+ echo '</ul></div>';
|
|
|
+
|
|
|
|
|
|
/*
|
|
|
// ---- My Agenda Items
|