Fix Friends page

1.10.x
Angel Fernando Quiroz Campos 9 years ago
parent 1d647a98dd
commit 65b8771aea
  1. 28
      main/inc/ajax/social.ajax.php
  2. 60
      main/social/friends.php

@ -78,31 +78,37 @@ switch ($action) {
$number_loop = ($number_friends/$number_of_images);
$loop_friends = ceil($number_loop);
$j=0;
$friend_html.= '<ul class="thumbnails">';
for ($k=0; $k<$loop_friends; $k++) {
if ($j==$number_of_images) {
$number_of_images=$number_of_images*2;
}
while ($j<$number_of_images) {
if (isset($friends[$j])) {
$friend_html.='<li class="span2">';
$friend = $friends[$j];
$user_name = api_xml_http_response_encode($friend['firstName'].' '.$friend['lastName']);
$userPicture = UserManager::getUserPicture($friend['friend_user_id']);
$friend_html.='<div class="thumbnail" onMouseover="show_icon_delete(this)" onMouseout="hide_icon_delete(this)" class="image-social-content" id=div_'.$friends[$j]['friend_user_id'].'>';
$friend_html.='<img src="'.$userPicture.'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$user_name.'" />';
$friend_html.='<div class="caption">';
$friend_html.='<a href="profile.php?u='.$friend['friend_user_id'].'"><h5>'.$user_name.'</h5></a>';
$friend_html.='<p><button class="btn btn-danger" onclick="delete_friend(this)" id=img_'.$friend['friend_user_id'].'>'.get_lang('Delete').'</button></p>';
$friend_html.='</div>';
$friend_html.='</div>';
$friend_html.='</li>';
$friend_html .= '
<div class="col-md-3">
<div class="thumbnail text-center" id="div_' . $friends[$j]['friend_user_id'] . '">
<img src="' . $userPicture . '" class="img-responsive" id="imgfriend_' . $friend['friend_user_id'] . '" title="$user_name">
<div class="caption">
<h3>
<a href="profile.php?u=' . $friend['friend_user_id'] . '">' . $user_name . '</a>
</h3>
<p>
<button class="btn btn-danger" onclick="delete_friend(this)" id=img_' . $friend['friend_user_id'] . '>
' . get_lang('Delete') . '
</button>
</p>
</div>
</div>
</div>
';
}
$j++;
}
}
$friend_html.='</ul>';
}
echo $friend_html;
break;

@ -37,7 +37,7 @@ function delete_friend (element_div) {
}
function search_image_social() {
var name_search = $("#id_search_image").attr("value");
var name_search = $("#id_search_image").val();
$.ajax({
contentType: "application/x-www-form-urlencoded",
type: "POST",
@ -90,17 +90,35 @@ if (isset($name_search) && $name_search != 'undefined') {
$friends = SocialManager::get_friends($user_id);
}
$social_right_content = '<div class="col-md-9">';
$social_right_content = '<div class="col-md-12">';
if (count($friends) == 0) {
$social_right_content .= get_lang('NoFriendsInYourContactList').'<br />';
$social_right_content .= '<a class="btn btn-success" href="search.php">
<em class="fa fa-search"></em> '.get_lang('TryAndFindSomeFriends').'</a>';
$social_right_content .= Display::return_message(
Display::tag('p', get_lang('NoFriendsInYourContactList')),
'warning',
false
);
$social_right_content .= Display::toolbarButton(
get_lang('TryAndFindSomeFriends'),
'search.php',
'search',
'success'
);
} else {
$social_right_content .= get_lang('Search').'&nbsp;&nbsp; : &nbsp;&nbsp;';
$social_right_content .= '<input class="social-search-image" type="text" id="id_search_image" name="id_search_image" onkeyup="search_image_social()" />';
$filterForm = new FormValidator('filter');
$filterForm->addText(
'id_search_image',
get_lang('Search'),
false,
[
'onkeyup' => 'search_image_social()',
'id' => 'id_search_image'
]
);
$friend_html = '<div id="friends">';
$social_right_content .= $filterForm->returnForm();
$friend_html = '<div id="friends" class="row">';
$number_friends = count($friends);
$j = 0;
@ -108,19 +126,27 @@ if (count($friends) == 0) {
for ($k = 0; $k < $number_friends; $k++) {
while ($j < $number_friends) {
if (isset($friends[$j])) {
$friend_html.='<div class="card">';
$friend = $friends[$j];
$user_name = api_xml_http_response_encode($friend['firstName'].' '.$friend['lastName']);
$userPicture = UserManager::getUserPicture($friend['friend_user_id']);
$friend_html.='<div class="avatar" class="image-social-content" id=div_'.$friends[$j]['friend_user_id'].'>';
$friend_html.='<img src="'.$userPicture.'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$user_name.'" /> ';
$friend_html.='</div>';
$friend_html.='<div class="content">
<a href="profile.php?u='.$friend['friend_user_id'].'"> <h5>'.$user_name.'</h5></a>';
$friend_html.='<p><button onclick="delete_friend(this)" id=img_'.$friend['friend_user_id'].' />'.get_lang('Delete').'</button></p>
</div>';
$friend_html.='</div>';
$friend_html .= '
<div class="col-md-3">
<div class="thumbnail text-center" id="div_' . $friends[$j]['friend_user_id'] . '">
<img src="' . $userPicture . '" class="img-responsive" id="imgfriend_' . $friend['friend_user_id'] . '" title="$user_name">
<div class="caption">
<h3>
<a href="profile.php?u=' . $friend['friend_user_id'] . '">' . $user_name . '</a>
</h3>
<p>
<button class="btn btn-danger" onclick="delete_friend(this)" id=img_' . $friend['friend_user_id'] . '>
' . get_lang('Delete') . '
</button>
</p>
</div>
</div>
</div>
';
}
$j++;
}

Loading…
Cancel
Save