Social: Shows quick access to portfolio, change of order of accesses in

right side menu. #3626 - refs GH#3626
pull/3634/head
Carlos Alvarado 5 years ago
parent 005fd49c79
commit c47623551d
No known key found for this signature in database
GPG Key ID: B612DB1EE6658FBB
  1. 4
      app/Resources/public/css/base.css
  2. 144
      main/inc/lib/social.lib.php
  3. 35
      main/social/profile.php

@ -10490,3 +10490,7 @@ ul.dropdown-menu.inner > li > a {
top:-5px;
left: -2px;
}
.production-no-padding > .files-production > ul {
padding-left: 0px;
}

@ -916,6 +916,7 @@ class SocialManager extends UserManager
) {
$user_id = (int) $user_id;
$group_id = (int) $group_id;
$settingExtendedProfileEnabled = api_get_setting('extended_profile');
if (empty($user_id)) {
$user_id = api_get_user_id();
@ -960,6 +961,7 @@ class SocialManager extends UserManager
$portfolioIcon = Display::return_icon('wiki_task.png', get_lang('Portfolio'));
$personalDataIcon = Display::return_icon('database.png', get_lang('PersonalDataReport'));
$messageSocialIcon = Display::return_icon('promoted_message.png', get_lang('PromotedMessages'));
$portfolio = Display::return_icon('vcard.png', get_lang('Portfolio '));
$forumCourseId = api_get_configuration_value('global_forums_course_id');
$groupUrl = api_get_path(WEB_CODE_PATH).'social/groups.php';
@ -991,6 +993,16 @@ class SocialManager extends UserManager
'.$messagesIcon.' '.get_lang('Messages').$count_unread_message.'
</a>
</li>';
if ($settingExtendedProfileEnabled == true) {
$active = $show === 'portfolio' ? 'active' : null;
$links .= '
<li class="portfolio-icon '.$active.'">
<a href="'.api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$user_id.'&p=1">
'.$portfolio.' '.get_lang('Portfolio').'
</a>
</li>';
}
// Invitations
$active = $show === 'invitations' ? 'active' : null;
@ -1112,6 +1124,15 @@ class SocialManager extends UserManager
'.$messagesIcon.' '.get_lang('Messages').$count_unread_message.'
</a>
</li>';
if ($settingExtendedProfileEnabled == true) {
$active = $show === 'portfolio' ? 'active' : null;
$links .= '
<li class="portfolio-icon '.$active.'">
<a href="'.api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$user_id.'&p=1">
'.$portfolio.' '.get_lang('Portfolio').'
</a>
</li>';
}
$active = $show === 'invitations' ? 'active' : null;
$links .= '
<li class="invitations-icon'.$active.'">
@ -1204,7 +1225,15 @@ class SocialManager extends UserManager
'data-title' => $sendMessageText,
]
);
$links .= '</li>';
if($settingExtendedProfileEnabled == true) {
$active = $show === 'portfolio' ? 'active' : null;
$links .= '
<li class="portfolio-icon '.$active.'">
<a href="'.api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$user_id.'&p=1">
'.$portfolio.' '.get_lang('Portfolio').'
</a>
</li>';
}
if (api_get_configuration_value('allow_portfolio_tool')) {
$links .= '
@ -2414,6 +2443,119 @@ class SocialManager extends UserManager
return $html;
}
/**
* Show middle section for Portfolio extended.
* Must be active on main/admin/settings.php?category=User into extended_profile
*
* @param string $urlForm
*
* @return string
*/
public static function getWallFormPortfolio($urlForm)
{
$userId = (int) isset($_GET['u']) ? $_GET['u'] : '';
$userId = ($userId!=0) ? $userId : api_get_user_id();
$user_info = api_get_user_info($userId);
$portfolioName = ' '.$userId;
$friend = true;
if($userId != api_get_user_id()){
$portfolioName = $user_info['complete_name'];
$friend = self::get_relation_between_contacts(api_get_user_id(), $userId);
}
if ($friend == 0) {
/* if has not relation, get current user */
$userId = api_get_user_id();
$user_info = api_get_user_info($userId);
}
// Images uploaded by course
$more_info = '';
// Productions
$production_list = UserManager::build_production_list($userId);
$form = new FormValidator(
'social_wall_main',
'post',
$urlForm.$userId,
null,
['enctype' => 'multipart/form-data'],
FormValidator::LAYOUT_HORIZONTAL
);
$socialWallPlaceholder = isset($_GET['u']) ? get_lang('SocialWallWriteNewPostToFriend') : get_lang(
'SocialWallWhatAreYouThinkingAbout'
);
if (!empty($user_info['competences']) || !empty($user_info['diplomas'])
|| !empty($user_info['openarea']) || !empty($user_info['teach'])) {
// $more_info .= '<div><h3>'.get_lang('MoreInformation').'</h3></div>';
// MY PERSONAL OPEN AREA
if (!empty($user_info['openarea'])) {
$more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div>';
$more_info .= '<div class="social-profile-extended">'.$user_info['openarea'].'</div>';
$more_info .= '<br />';
}
// MY COMPETENCES
if (!empty($user_info['competences'])) {
$more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyCompetences').'</strong></div>';
$more_info .= '<div class="social-profile-extended">'.$user_info['competences'].'</div>';
$more_info .= '<br />';
}
if (!empty($user_info['diplomas'])) {
$more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div>';
$more_info .= '<div class="social-profile-extended">'.$user_info['diplomas'].'</div>';
$more_info .= '<br />';
}
// MY PRODUCTIONS
$product_content = '';
if (!empty($production_list)) {
$more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyProductions').'</strong></div>';
$more_info .= '<div class="social-profile-extended">'.$production_list.'</div>';
$more_info .= '<br />';
}else{
$more_info = "Nada aqui";
}
// WHAT I AM ABLE TO TEACH
if (!empty($user_info['teach'])) {
$more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyTeach').'</strong></div>';
$more_info .= '<div class="social-profile-extended">'.$user_info['teach'].'</div>';
$more_info .= '<br />';
}
//$socialRightInformation .= SocialManager::social_wrapper_div($more_info, 4);
}
$form->addTextarea(
'social_wall_new_msg_main',
null,
[
'placeholder' => $socialWallPlaceholder,
'cols-size' => [1, 12, 1],
'aria-label' => $socialWallPlaceholder,
]
);
$form->addHtml('<div class="form-group">');
$form->addHtml('<div class="col-sm-6">');
$form->addFile('picture', get_lang('UploadFile'), ['custom' => true]);
$form->addHtml('</div>');
$form->addHtml('<div class="col-sm-6 "><div class="pull-right">');
$form->addButtonSend(
get_lang('Post'),
'wall_post_button',
false,
[
'cols-size' => [1, 10, 1],
'custom' => true,
]
);
$form->addHtml('</div></div>');
$form->addHtml('</div>');
$form->addHidden('url_content', '');
return Display::panel($more_info, get_lang('Portfolio'));
}
/**
* @param int $userId
* @param int $start

@ -20,7 +20,8 @@ if (api_get_setting('allow_social_tool') !== 'true') {
header('Location: '.$url);
exit;
}
$portfolioRequest = (isset($_GET['p']))?true:false;
$productionString = '';
$bossId = isset($_REQUEST['sup']) ? (int) $_REQUEST['sup'] : 0;
$user_id = api_get_user_id();
@ -141,6 +142,7 @@ $sessionList = [];
// My friends
$friend_html = SocialManager::listMyFriendsBlock($user_id, $link_shared);
$addPostForm = SocialManager::getWallForm(api_get_self());
$addPostFormPortfolio = SocialManager::getWallFormPortfolio(api_get_self());
$posts = SocialManager::getWallMessagesByUser($friendId);
$socialAutoExtendLink = SocialManager::getAutoExtendLink($user_id, $countPost);
@ -150,6 +152,7 @@ $htmlHeadXtra[] = SocialManager::getScriptToGetOpenGraph();
$socialRightInformation = '';
$listInvitations = '';
$more_info = '';
if ($show_full_profile) {
$social_group_info_block = SocialManager::getGroupBlock($friendId);
@ -223,13 +226,18 @@ if ($show_full_profile) {
}
}
// MY PRODUCTIONS
// Productions
$production_list = UserManager::build_production_list($user_id);
$product_content = '';
if (!empty($production_list)) {
$product_content .= '<div><h3>'.get_lang('MyProductions').'</h3></div>';
$product_content .= $production_list;
$socialRightInformation .= SocialManager::social_wrapper_div($product_content, 4);
// $socialRightInformation .= SocialManager::social_wrapper_div($product_content, 4);
$more_info_1 = '<div class="social-actions-message"><strong>'.get_lang('MyProductions').'</strong></div>';
$more_info_1 .= '<div class="social-profile-extended">'.$production_list.'</div>';
$more_info_1 .= '<br />';
$productionString .= $more_info_1;
}
$images_uploaded = null;
@ -238,8 +246,14 @@ if ($show_full_profile) {
if (!empty($user_info['competences']) || !empty($user_info['diplomas'])
|| !empty($user_info['openarea']) || !empty($user_info['teach'])) {
$more_info .= '<div><h3>'.get_lang('MoreInformation').'</h3></div>';
if (!empty($user_info['competences'])) {
// MY PERSONAL OPEN AREA
if (!empty($user_info['openarea'])) {
$more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div>';
$more_info .= '<div class="social-profile-extended">'.$user_info['openarea'].'</div>';
$more_info .= '<br />';
}
// MY COMPETENCES
if (!empty($user_info['competences'])) {
$more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyCompetences').'</strong></div>';
$more_info .= '<div class="social-profile-extended">'.$user_info['competences'].'</div>';
$more_info .= '<br />';
@ -249,11 +263,10 @@ if ($show_full_profile) {
$more_info .= '<div class="social-profile-extended">'.$user_info['diplomas'].'</div>';
$more_info .= '<br />';
}
if (!empty($user_info['openarea'])) {
$more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div>';
$more_info .= '<div class="social-profile-extended">'.$user_info['openarea'].'</div>';
$more_info .= '<br />';
}
// MY PRODUCTIONS
$more_info .= $productionString;
// WHAT I AM ABLE TO TEACH
if (!empty($user_info['teach'])) {
$more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyTeach').'</strong></div>';
$more_info .= '<div class="social-profile-extended">'.$user_info['teach'].'</div>';
@ -275,7 +288,11 @@ SocialManager::setSocialUserBlock(
$tpl->assign('social_friend_block', $friend_html);
$tpl->assign('social_menu_block', $menu);
$tpl->assign('add_post_form', $addPostForm);
if($portfolioRequest == true && api_get_setting('extended_profile') == true){
$tpl->assign('add_post_form', $addPostFormPortfolio);
}else{
$tpl->assign('add_post_form', $addPostForm);
}
$tpl->assign('posts', $posts);
$tpl->assign('social_course_block', $social_course_block);
$tpl->assign('social_group_info_block', $social_group_info_block);

Loading…
Cancel
Save