diff --git a/assets/css/base.css b/assets/css/base.css index 2b2de711d7..95b180b12b 100644 --- a/assets/css/base.css +++ b/assets/css/base.css @@ -4385,56 +4385,6 @@ i.size-32.icon-new-work { top: 30px; } -#sm-groups .list-group-newest .items { - display: block; -} - -#sm-groups .list-group-newest .items .group-image { - vertical-align: top; - padding-left: 10px; - padding-right: 10px; -} - -#sm-groups .list-group-newest .items .group-image, -#sm-groups .list-group-newest .items .group-info { - display: inline-block; -} - -#sm-groups .list-group-newest .items .group-info { - width: auto; -} - -#sm-groups .items { - border-bottom: 1px dotted #B1DDE0; - padding-bottom: 5px; - margin-bottom: 5px; -} - -#sm-groups .group-name a { - font-size: 18px; - font-weight: bold; -} - -#sm-groups .count-username { - font-size: 12px; - color: #4D4D4D; -} - -#sm-groups .description p { - color: #4D4D4D; - padding-top: 5px; - padding-bottom: 0; - line-height: 22px; -} - -.sm-groups .social-profile .img-responsive { - display: inline-block; -} - -.sm-groups-content .groups-messages { - padding: 20px; -} - .social-post .mediaPost { padding-top: 10px; padding-bottom: 5px; diff --git a/main/inc/lib/message.lib.php b/main/inc/lib/message.lib.php index d5e71bc6f8..866e643ca6 100755 --- a/main/inc/lib/message.lib.php +++ b/main/inc/lib/message.lib.php @@ -1560,7 +1560,7 @@ class MessageManager api_get_path( WEB_CODE_PATH ).'social/group_topics.php?action=delete&id='.$group_id.'&topic_id='.$topic['id'], - ['class' => 'btn btn-default'] + ['class' => 'btn btn-primary'] ); } @@ -1581,7 +1581,7 @@ class MessageManager $image = $user_sender_info['avatar']; - $user_info = '
'; + $user_info = ''; $user_info .= ''; diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php index e87d798d8a..a92ac7c541 100755 --- a/main/inc/lib/social.lib.php +++ b/main/inc/lib/social.lib.php @@ -842,33 +842,27 @@ class SocialManager extends UserManager if (in_array($show, $show_groups) && !empty($group_id)) { // Group image $userGroup = new UserGroup(); - $group_info = $userGroup->get($group_id); + $groupInfo = $userGroup->get($group_id); $userGroupImage = [ 'big' => $userGroup->get_picture_group( $group_id, - $group_info['picture'], + $groupInfo['picture'], 128, GROUP_IMAGE_SIZE_BIG ), 'normal' => $userGroup->get_picture_group( $group_id, - $group_info['picture'], + $groupInfo['picture'], 128, GROUP_IMAGE_SIZE_MEDIUM ) ]; $template->assign('show_group', true); - $template->assign('group_id', $group_id); + $template->assign('group', $groupInfo); $template->assign('avatar', $userGroupImage); - $template->assign( - 'user_is_group_admin', - $userGroup->is_group_admin( - $group_id, - api_get_user_id() - ) - ); + } else { $template->assign('show_group', false); $template->assign('show_user', true); @@ -888,7 +882,7 @@ class SocialManager extends UserManager ); } - $skillBlock = $template->get_template('social/avatar_block.tpl'); + $skillBlock = $template->get_template('social/avatar_block.html.twig'); return $template->fetch($skillBlock); } @@ -1875,7 +1869,20 @@ class SocialManager extends UserManager $userInfo = api_get_user_info($userId, true, false, true, true); + + $userGroup = new UserGroup(); + $groupInfo = $userGroup->get($groupId); + + $template->assign( + 'user_is_group_admin', + $userGroup->is_group_admin( + $groupId, + api_get_user_id() + ) + ); + $template->assign('user', $userInfo); + $template->assign('group', $groupInfo); $template->assign('social_avatar_block', $socialAvatarBlock); $template->assign('profile_edition_link', $profileEditionLink); // Added the link to export the vCard to the Template diff --git a/main/social/group_view.php b/main/social/group_view.php index a675c4d799..b42908fee7 100644 --- a/main/social/group_view.php +++ b/main/social/group_view.php @@ -109,17 +109,17 @@ $role = 0; $usergroup = new UserGroup(); if ($group_id != 0) { - $group_info = $usergroup->get($group_id); - $group_info['name'] = Security::remove_XSS($group_info['name']); - $group_info['description'] = Security::remove_XSS($group_info['description']); + $groupInfo = $usergroup->get($group_id); + $groupInfo['name'] = Security::remove_XSS($groupInfo['name']); + $groupInfo['description'] = Security::remove_XSS($groupInfo['description']); - $interbreadcrumb[] = ['url' => '#', 'name' => $group_info['name']]; + $interbreadcrumb[] = ['url' => '#', 'name' => $groupInfo['name']]; if (isset($_GET['action']) && $_GET['action'] == 'leave') { $user_leaved = intval($_GET['u']); // I can "leave me myself" if (api_get_user_id() == $user_leaved) { - if (UserGroup::canLeave($group_info)) { + if (UserGroup::canLeave($groupInfo)) { $usergroup->delete_user_rel_group($user_leaved, $group_id); Display::addFlash( Display::return_message(get_lang('UserIsNotSubscribedToThisGroup'), 'confirmation', false) @@ -133,7 +133,7 @@ if ($group_id != 0) { // we add a user only if is a open group $user_join = intval($_GET['u']); if (api_get_user_id() == $user_join && !empty($group_id)) { - if ($group_info['visibility'] == GROUP_PERMISSION_OPEN) { + if ($groupInfo['visibility'] == GROUP_PERMISSION_OPEN) { $usergroup->add_user_to_group($user_join, $group_id); Display::addFlash( Display::return_message(get_lang('UserIsSubscribedToThisGroup'), 'confirmation', false) @@ -155,9 +155,9 @@ $create_thread_link = ''; $social_right_content = null; $socialForum = ''; -$group_info = $usergroup->get($group_id); -$group_info['name'] = Security::remove_XSS($group_info['name']); -$group_info['description'] = Security::remove_XSS($group_info['description']); +$groupInfo = $usergroup->get($group_id); +$groupInfo['name'] = Security::remove_XSS($groupInfo['name']); +$groupInfo['description'] = Security::remove_XSS($groupInfo['description']); //Loading group information if (isset($_GET['status']) && $_GET['status'] == 'sent') { @@ -167,13 +167,13 @@ if (isset($_GET['status']) && $_GET['status'] == 'sent') { $is_group_member = $usergroup->is_group_member($group_id); $role = $usergroup->get_user_group_role(api_get_user_id(), $group_id); -if (!$is_group_member && $group_info['visibility'] == GROUP_PERMISSION_CLOSED) { +if (!$is_group_member && $groupInfo['visibility'] == GROUP_PERMISSION_CLOSED) { if ($role == GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER) { $social_right_content .= Display::return_message(get_lang('YouAlreadySentAnInvitation')); } } -if ($is_group_member || $group_info['visibility'] == GROUP_PERMISSION_OPEN) { +if ($is_group_member || $groupInfo['visibility'] == GROUP_PERMISSION_OPEN) { if (!$is_group_member) { if (!in_array( $role, @@ -211,7 +211,7 @@ if ($is_group_member || $group_info['visibility'] == GROUP_PERMISSION_OPEN) { get_lang('YouShouldCreateATopic'), $createThreadUrl, [ - 'class' => 'ajax btn btn-primary', + 'class' => 'btn btn-primary', 'title' => get_lang('ComposeMessage'), 'data-title' => get_lang('ComposeMessage'), 'data-size' => 'lg', @@ -231,7 +231,7 @@ if ($is_group_member || $group_info['visibility'] == GROUP_PERMISSION_OPEN) { get_lang('NewTopic'), $createThreadUrl, [ - 'class' => 'ajax btn btn-default', + 'class' => 'btn btn-primary', 'title' => get_lang('ComposeMessage'), 'data-title' => get_lang('ComposeMessage'), 'data-size' => 'lg', @@ -242,13 +242,6 @@ if ($is_group_member || $group_info['visibility'] == GROUP_PERMISSION_OPEN) { $members = $usergroup->get_users_by_group($group_id, true); $member_content = ''; - // My friends - $friend_html = SocialManager::listMyFriendsBlock( - api_get_user_id(), - '', - '' - ); - // Members if (count($members) > 0) { if ($role == GROUP_USER_PERMISSION_ADMIN) { @@ -302,8 +295,10 @@ if ($is_group_member || $group_info['visibility'] == GROUP_PERMISSION_OPEN) { if (!empty($create_thread_link)) { $create_thread_link = Display::div($create_thread_link, ['class' => 'pull-right']); } - $headers = [get_lang('Discussions'), get_lang('Members')]; - $socialForum = Display::tabs($headers, [$content, $member_content], 'tabs'); + + $listTopic = $content; + $listMembers = $member_content; + } else { // if I already sent an invitation message if (!in_array( @@ -323,15 +318,16 @@ $tpl = new Template(null); // Block Social Avatar SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'groups', $group_id); -//Block Social Menu -$social_menu_block = SocialManager::getMenuSocial('groups', $group_id); + $tpl->setHelp('Groups'); $tpl->assign('create_link', $create_thread_link); $tpl->assign('is_group_member', $is_group_member); -$tpl->assign('group_info', $group_info); -$tpl->assign('social_friend_block', $friend_html); -$tpl->assign('social_menu_block', $social_menu_block); -$tpl->assign('social_forum', $socialForum); + +$tpl->assign('list_members', $listMembers); +$tpl->assign('list_topic', $listTopic); + $tpl->assign('social_right_content', $social_right_content); -$social_layout = $tpl->get_template('social/group_view.tpl'); -$tpl->display($social_layout); +$social_layout = $tpl->get_template('social/group_view.html.twig'); +$content = $tpl->fetch($social_layout); +$tpl->assign('content', $content); +$tpl->display_one_col_template(); diff --git a/main/social/message_for_group_form.inc.php b/main/social/message_for_group_form.inc.php index 8f2323e5df..44a65a9ede 100755 --- a/main/social/message_for_group_form.inc.php +++ b/main/social/message_for_group_form.inc.php @@ -114,4 +114,4 @@ if (api_get_setting('allow_message_tool') === 'true') { $tpl->assign('content', $form->returnForm()); } -$tpl->displayBlankTemplateNoHeader(); +$tpl->display_one_col_template(); diff --git a/main/template/default/social/avatar_block.html.twig b/main/template/default/social/avatar_block.html.twig index 3427c4ce3d..93fefa2298 100644 --- a/main/template/default/social/avatar_block.html.twig +++ b/main/template/default/social/avatar_block.html.twig @@ -9,19 +9,9 @@ -