Split social_left_content in blocks at tpl level - refs #5637

1.9.x
Yannick Warnier 10 years ago
parent b61eab0c00
commit 9f627e9dba
  1. 70
      main/inc/lib/social.lib.php
  2. 6
      main/social/friends.php
  3. 6
      main/social/group_add.php
  4. 6
      main/social/group_edit.php
  5. 7
      main/social/group_invitation.php
  6. 6
      main/social/group_members.php
  7. 8
      main/social/group_topics.php
  8. 7
      main/social/group_waiting_list.php
  9. 9
      main/social/groups.php
  10. 6
      main/social/home.php
  11. 7
      main/social/invitations.php
  12. 6
      main/social/myfiles.php
  13. 6
      main/social/profile.php
  14. 6
      main/social/search.php
  15. 6
      main/template/default/layout/social_layout.tpl

@ -566,43 +566,22 @@ class SocialManager extends UserManager
}
/**
* Shows the right menu of the Social Network tool
* Shows the avatar block in social pages
*
* @param string highlight link possible values: group_add, home, messages, messages_inbox, messages_compose ,messages_outbox ,invitations, shared_profile, friends, groups search
* @param int group id
* @param int user id
* @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, $show_delete_account_button = false)
public static function show_social_avatar_block($show = '', $group_id = 0, $user_id = 0)
{
if (empty($user_id)) {
$user_id = api_get_user_id();
}
$user_info = api_get_user_info($user_id, true);
$current_user_id = api_get_user_id();
$current_user_info = api_get_user_info($current_user_id, true);
if ($current_user_id == $user_id) {
$user_friend_relation = null;
} else {
$user_friend_relation = SocialManager::get_relation_between_contacts($current_user_id, $user_id);
}
$show_groups = array('groups', 'group_messages', 'messages_list', 'group_add', 'mygroups', 'group_edit', 'member_list', 'invite_friends', 'waiting_list', 'browse_groups');
// get count unread message and total invitations
$count_unread_message = MessageManager::get_number_of_messages(true);
$count_unread_message = !empty($count_unread_message) ? Display::badge($count_unread_message) : null;
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
$group_pending_invitations = GroupPortalManager::get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false);
$group_pending_invitations = count($group_pending_invitations);
$total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
$total_invitations = (!empty($total_invitations) ? Display::badge($total_invitations) : '');
$html = '<div class="social-menu">';
$html = '';
if (in_array($show, $show_groups) && !empty($group_id)) {
//--- Group image
$group_info = GroupPortalManager::get_group_data($group_id);
@ -638,6 +617,47 @@ class SocialManager extends UserManager
}
$html .= '</div>';
}
return $html;
}
/**
* Shows the right menu of the Social Network tool
*
* @param string highlight link possible values: group_add, home, messages, messages_inbox, messages_compose ,messages_outbox ,invitations, shared_profile, friends, groups search
* @param int group id
* @param int user id
* @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, $show_delete_account_button = false)
{
if (empty($user_id)) {
$user_id = api_get_user_id();
}
$user_info = api_get_user_info($user_id, true);
$current_user_id = api_get_user_id();
$current_user_info = api_get_user_info($current_user_id, true);
if ($current_user_id == $user_id) {
$user_friend_relation = null;
} else {
$user_friend_relation = SocialManager::get_relation_between_contacts($current_user_id, $user_id);
}
$show_groups = array('groups', 'group_messages', 'messages_list', 'group_add', 'mygroups', 'group_edit', 'member_list', 'invite_friends', 'waiting_list', 'browse_groups');
// get count unread message and total invitations
$count_unread_message = MessageManager::get_number_of_messages(true);
$count_unread_message = !empty($count_unread_message) ? Display::badge($count_unread_message) : null;
$number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());
$group_pending_invitations = GroupPortalManager::get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false);
$group_pending_invitations = count($group_pending_invitations);
$total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
$total_invitations = (!empty($total_invitations) ? Display::badge($total_invitations) : '');
$html = '';
if (!in_array($show, array('shared_profile', 'groups', 'group_edit', 'member_list', 'waiting_list', 'invite_friends'))) {
@ -788,7 +808,7 @@ class SocialManager extends UserManager
$html .= Display::url(Display::return_icon('delete.png', get_lang('Unsubscribe'), array(), ICON_SIZE_TINY).get_lang('Unsubscribe'), $url);
$html .= '</li></ul></div>';
}
$html .= '</div>';
$html .= '';
return $html;
}

@ -86,7 +86,8 @@ function clear_form () {
$interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNetwork'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Friends'));
$social_left_content = SocialManager::show_social_menu('friends');
$social_avatar_block = SocialManager::show_social_avatar_block('friends');
$social_menu_block = SocialManager::show_social_menu('friends');
$user_id = api_get_user_id();
@ -142,7 +143,8 @@ $social_right_content .= '</div>';
$tpl = new Template(get_lang('Social'));
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');

@ -71,13 +71,15 @@ $interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social'));
$interbreadcrumb[]= array ('url' =>'groups.php','name' => get_lang('Groups'));
$interbreadcrumb[]= array ('url' =>'#','name' => $nameTools);
$social_left_content = SocialManager::show_social_menu('group_add');
$social_avatar_block = SocialManager::show_social_avatar_block('group_add');
$social_menu_block = SocialManager::show_social_menu('group_add');
$social_right_content = $form->return_form();
$tpl = new Template();
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
//$tpl->assign('actions', $actions);
//$tpl->assign('message', $show_message);

@ -102,12 +102,14 @@ $big_image_width = $big_image_size['width'];
$big_image_height = $big_image_size['height'];
$url_big_image = $big_image.'?rnd='.time();
$social_left_content = SocialManager::show_social_menu('group_edit', $group_id);
$social_avatar_block = SocialManager::show_social_avatar_block('group_edit', $group_id);
$social_menu_block = SocialManager::show_social_menu('group_edit', $group_id);
$social_right_content = $form->return_form();
$tpl = new Template($tool_name);
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$tpl->display($social_layout);

@ -306,7 +306,8 @@ if ($add_type == 'multiple') {
$link_add_type_multiple = '<a href="'.api_get_self().'?id='.$group_id.'&add='.$add.'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
}
$social_left_content = SocialManager::show_social_menu('invite_friends',$group_id);
$social_avatar_block = SocialManager::show_social_avatar_block('invite_friends',$group_id);
$social_menu_block = SocialManager::show_social_menu('invite_friends',$group_id);
$social_right_content = '<h2>'.Security::remove_XSS($group_info['name'], STUDENT, true).'</h2>';
if (count($nosessionUsersList) == 0) {
@ -542,8 +543,8 @@ $social_right_content = Display::div($social_right_content, array('class' => 'sp
$tpl = new Template($tool_name);
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
//$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
//$tpl->assign('actions', $actions);
//$tpl->assign('content', $content);

@ -90,7 +90,8 @@ $users = GroupPortalManager::get_users_by_group(
);
$new_member_list = array();
$social_left_content = SocialManager::show_social_menu('member_list',$group_id);
$social_avatar_block = SocialManager::show_social_avatar_block('member_list', $group_id);
$social_menu_block = SocialManager::show_social_menu('member_list', $group_id);
$social_right_content = '<h2>'.$group_info['name'].'</h2>';
$social_right_content .= '<div style="width:90%">';
@ -138,7 +139,8 @@ $social_right_content .= '</div>';
$tpl = new Template($tool_name);
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');

@ -177,7 +177,9 @@ $social_right_content = '<div class="breadcrumb">
<span class="divider">/</span>
<a href="groups.php?id='.$group_id.'#tabs_2">'.get_lang('Discussions').'</a>
</div> ';
$social_left_content .= SocialManager::show_social_menu('member_list', $group_id);
$social_avatar_block = SocialManager::show_social_avatar_block('member_list', $group_id);
$social_menu_block = SocialManager::show_social_menu('member_list', $group_id);
if (!empty($show_message)) {
$social_right_content .= Display::return_message($show_message, 'confirmation');
@ -189,8 +191,8 @@ $social_right_content = '<div class="span9">'.$social_right_content.'</div>';
$tpl = new Template($tool_name);
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);

@ -79,7 +79,8 @@ if (isset($_GET['action']) && $_GET['action']=='set_moderator') {
$users = GroupPortalManager::get_users_by_group($group_id, true, array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER), 0, 1000);
$new_member_list = array();
$social_left_content = SocialManager::show_social_menu('waiting_list',$group_id);
$social_avatar_block = SocialManager::show_social_avatar_block('waiting_list', $group_id);
$social_menu_block = SocialManager::show_social_menu('waiting_list', $group_id);
if (!empty($show_message)){
$social_right_content .= Display :: return_message($show_message);
@ -104,8 +105,8 @@ if (count($new_member_list) > 0) {
$tpl = new Template($tool_name);
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$tpl->assign('actions', $actions);

@ -188,13 +188,15 @@ if ($group_id != 0) {
$create_thread_link = '';
if ($group_id != 0 ) {
$social_left_content = SocialManager::show_social_menu('groups',$group_id);
$social_avatar_block = SocialManager::show_social_avatar_block('groups', $group_id);
$social_menu_block = SocialManager::show_social_menu('groups', $group_id);
} else {
$show_menu = 'browse_groups';
if (isset($_GET['view']) && $_GET['view'] == 'mygroups') {
$show_menu = $_GET['view'];
}
$social_left_content = SocialManager::show_social_menu($show_menu);
$social_avatar_block = SocialManager::show_social_avatar_block($show_menu, $group_id);
$social_menu_block = SocialManager::show_social_menu($show_menu, $group_id);
}
$social_right_content = null;
@ -531,7 +533,8 @@ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'show_message' && $_REQ
$tpl = new Template();
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$tpl->assign('message', $show_message);

@ -58,7 +58,8 @@ if (api_get_setting('profile', 'picture') == 'true') {
$user_info = UserManager :: get_user_info_by_id(api_get_user_id());
$social_left_content = SocialManager::show_social_menu('home');
$social_avatar_block = SocialManager::show_social_avatar_block('home');
$social_menu_block = SocialManager::show_social_menu('home');
$social_right_content = '<div class="span5">';
$social_right_content .= '<div class="well_border">';
@ -163,7 +164,8 @@ $social_right_content .= '
$social_right_content .= '</div>';
$tpl = new Template(get_lang('SocialNetwork'));
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$tpl->display($social_layout);

@ -91,7 +91,9 @@ if (is_array($_GET) && count($_GET)>0) {
}
}
}
$social_left_content = SocialManager::show_social_menu('invitations');
$social_avatar_block = SocialManager::show_social_avatar_block('invitations');
$social_menu_block = SocialManager::show_social_menu('invitations');
$social_right_content = '<div id="id_response" align="center"></div>';
$user_id = api_get_user_id();
@ -200,7 +202,8 @@ if (count($pending_invitations) > 0) {
}
$tpl = new Template(null);
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$tpl->assign('message', $show_message);

@ -94,7 +94,8 @@ if (is_array($_GET) && count($_GET)>0) {
}
}
$social_left_content = SocialManager::show_social_menu('myfiles');
$social_avatar_block = SocialManager::show_social_avatar_block('myfiles');
$social_menu_block = SocialManager::show_social_menu('myfiles');
$actions = null;
if (isset($_GET['cidReq'])) {
@ -105,7 +106,8 @@ $social_right_content .= '<iframe name="fileManager" id="fileManager" src="'.api
$social_right_content .= '</div>';
$tpl = new Template();
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$tpl->assign('actions', $actions);

@ -302,7 +302,8 @@ if (is_array($personal_course_list)) {
$course_list_code = array_unique_dimensional($course_list_code);
}
$social_left_content = SocialManager::show_social_menu('shared_profile', null, $user_id, $show_full_profile);
$social_avatar_block = SocialManager::show_social_avatar_block('shared_profile', null, $user_id);
$social_menu_block = SocialManager::show_social_menu('shared_profile', null, $user_id, $show_full_profile);
$personal_info = null;
if (!empty($user_info['firstname']) || !empty($user_info['lastname'])) {
@ -763,7 +764,8 @@ $social_right_content .= MessageManager::generate_invitation_form('send_invitati
$tpl = new Template(get_lang('Social'));
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');

@ -139,7 +139,8 @@ $interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNet
$query = isset($_GET['q']) ? $_GET['q'] : null;
$query_vars = array('q' => $query);
$social_left_content = SocialManager::show_social_menu('search');
$social_avatar_block = SocialManager::show_social_avatar_block('search');
$social_menu_block = SocialManager::show_social_menu('search');
$social_right_content = '<div class="span9">'.UserManager::get_search_form($query).'</div>';
@ -314,7 +315,8 @@ $social_right_content .= MessageManager::generate_message_form('send_message');
$social_right_content .= MessageManager::generate_invitation_form('send_invitation');
$tpl = new Template($tool_name);
$tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_avatar_block', $social_avatar_block);
$tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');

@ -3,8 +3,10 @@
{% block content %}
<div class="row">
<div class="span3">
{{ social_left_content }}
{{ social_left_menu }}
<div class="social-menu">
{{ social_avatar_block }}
{{ social_menu_block }}
</div>
</div>
<div class="span9">
<div class="row">

Loading…
Cancel
Save