Mino - fix after merge with 1.11.x

pull/3016/head
Julio 6 years ago
parent d4012ce8ce
commit dcfc652e8c
  1. 409
      main/inc/lib/social.lib.php
  2. 2
      main/inc/lib/usergroup.lib.php
  3. 89
      main/messages/inbox.php
  4. 110
      main/messages/new_message.php
  5. 90
      main/messages/outbox.php
  6. 2
      main/social/home.php
  7. 2
      main/social/myfiles.php
  8. 165
      main/template/default/social/home.html.twig
  9. 2
      src/CoreBundle/Component/Editor/Editor.php
  10. 3
      src/CoreBundle/Entity/ExtraField.php
  11. 12
      src/CoreBundle/Repository/LegalRepository.php

@ -413,7 +413,7 @@ class SocialManager extends UserManager
* *
* @return array * @return array
*/ */
public static function get_list_invitation_of_friends_by_user_id($userId, $limit) public static function get_list_invitation_of_friends_by_user_id($userId, $limit = 0)
{ {
$userId = (int) $userId; $userId = (int) $userId;
$limit = (int) $limit; $limit = (int) $limit;
@ -1263,6 +1263,413 @@ class SocialManager extends UserManager
return Display::dropdownMenu($itemMenu); return Display::dropdownMenu($itemMenu);
} }
/**
* Shows the right menu of the Social Network tool.
*
* @param string $show highlight link possible values:
* group_add,
* home,
* messages,
* messages_inbox,
* messages_compose ,
* messages_outbox,
* invitations,
* shared_profile,
* friends,
* groups search
* @param int $group_id group id
* @param int $user_id user id
* @param bool $show_full_profile show profile or not (show or hide the user image/information)
* @param bool $show_delete_account_button
*/
public static function show_social_menu(
$show = '',
$group_id = 0,
$user_id = 0,
$show_full_profile = false,
$show_delete_account_button = false
) {
$user_id = (int) $user_id;
$group_id = (int) $group_id;
if (empty($user_id)) {
$user_id = api_get_user_id();
}
$usergroup = new UserGroup();
$show_groups = [
'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::getNumberOfMessages(true);
$count_unread_message = !empty($count_unread_message) ? Display::badge($count_unread_message) : null;
$number_of_new_messages_of_friend = self::get_message_number_invitation_by_user_id(api_get_user_id());
$group_pending_invitations = $usergroup->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) : '');
$filesIcon = Display::return_icon('sn-files.png', get_lang('MyFiles'), null, ICON_SIZE_SMALL);
$friendsIcon = Display::return_icon('sn-friends.png', get_lang('Friends'), null, ICON_SIZE_SMALL);
$groupsIcon = Display::return_icon('sn-groups.png', get_lang('SocialGroups'), null, ICON_SIZE_SMALL);
$homeIcon = Display::return_icon('sn-home.png', get_lang('Home'), null, ICON_SIZE_SMALL);
$invitationsIcon = Display::return_icon('sn-invitations.png', get_lang('Invitations'), null, ICON_SIZE_SMALL);
$messagesIcon = Display::return_icon('sn-message.png', get_lang('Messages'), null, ICON_SIZE_SMALL);
$sharedProfileIcon = Display::return_icon('sn-profile.png', get_lang('ViewMySharedProfile'));
$searchIcon = Display::return_icon('sn-search.png', get_lang('Search'), null, ICON_SIZE_SMALL);
$portfolioIcon = Display::return_icon('wiki_task.png', get_lang('Portfolio'));
$personalDataIcon = Display::return_icon('database.png', get_lang('PersonalDataReport'));
$forumCourseId = api_get_configuration_value('global_forums_course_id');
$groupUrl = api_get_path(WEB_CODE_PATH).'social/groups.php';
if (!empty($forumCourseId)) {
$courseInfo = api_get_course_info_by_id($forumCourseId);
if (!empty($courseInfo)) {
$groupUrl = api_get_path(WEB_CODE_PATH).'forum/index.php?cidReq='.$courseInfo['code'];
}
}
$html = '';
$active = null;
if (!in_array(
$show,
['shared_profile', 'groups', 'group_edit', 'member_list', 'waiting_list', 'invite_friends']
)) {
$links = '<ul class="nav nav-pills nav-stacked">';
$active = $show === 'home' ? 'active' : null;
$links .= '
<li class="home-icon '.$active.'">
<a href="'.api_get_path(WEB_CODE_PATH).'social/home.php">
'.$homeIcon.' '.get_lang('Home').'
</a>
</li>';
$active = $show == 'messages' ? 'active' : null;
$links .= '
<li class="messages-icon '.$active.'">
<a href="'.api_get_path(WEB_CODE_PATH).'messages/inbox.php">
'.$messagesIcon.' '.get_lang('Messages').$count_unread_message.'
</a>
</li>';
// Invitations
$active = $show == 'invitations' ? 'active' : null;
$links .= '
<li class="invitations-icon '.$active.'">
<a href="'.api_get_path(WEB_CODE_PATH).'social/invitations.php">
'.$invitationsIcon.' '.get_lang('Invitations').$total_invitations.'
</a>
</li>';
// Shared profile and groups
$active = $show == 'shared_profile' ? 'active' : null;
$links .= '
<li class="shared-profile-icon'.$active.'">
<a href="'.api_get_path(WEB_CODE_PATH).'social/profile.php">
'.$sharedProfileIcon.' '.get_lang('ViewMySharedProfile').'
</a>
</li>';
$active = $show == 'friends' ? 'active' : null;
$links .= '
<li class="friends-icon '.$active.'">
<a href="'.api_get_path(WEB_CODE_PATH).'social/friends.php">
'.$friendsIcon.' '.get_lang('Friends').'
</a>
</li>';
$active = $show === 'browse_groups' ? 'active' : null;
$links .= '
<li class="browse-groups-icon '.$active.'">
<a href="'.$groupUrl.'">
'.$groupsIcon.' '.get_lang('SocialGroups').'
</a>
</li>';
// Search users
$active = $show == 'search' ? 'active' : null;
$links .= '
<li class="search-icon '.$active.'">
<a href="'.api_get_path(WEB_CODE_PATH).'social/search.php">
'.$searchIcon.' '.get_lang('Search').'
</a>
</li>';
// My files
$active = $show == 'myfiles' ? 'active' : null;
$myFiles = '
<li class="myfiles-icon '.$active.'">
<a href="'.api_get_path(WEB_CODE_PATH).'social/myfiles.php">
'.$filesIcon.' '.get_lang('MyFiles').'
</a>
</li>';
if (api_get_setting('allow_my_files') === 'false') {
$myFiles = '';
}
$links .= $myFiles;
if (api_get_configuration_value('allow_portfolio_tool')) {
$links .= '
<li class="portoflio-icon '.($show == 'portfolio' ? 'active' : '').'">
<a href="'.api_get_path(WEB_CODE_PATH).'portfolio/index.php">
'.$portfolioIcon.' '.get_lang('Portfolio').'
</a>
</li>
';
}
if (!api_get_configuration_value('disable_gdpr')) {
$active = $show == 'personal-data' ? 'active' : null;
$personalData = '
<li class="personal-data-icon '.$active.'">
<a href="'.api_get_path(WEB_CODE_PATH).'social/personal_data.php">
'.$personalDataIcon.' '.get_lang('PersonalDataReport').'
</a>
</li>';
$links .= $personalData;
$links .= '</ul>';
}
$html .= Display::panelCollapse(
get_lang('SocialNetwork'),
$links,
'social-network-menu',
null,
'sn-sidebar',
'sn-sidebar-collapse'
);
}
if (in_array($show, $show_groups) && !empty($group_id)) {
$html .= $usergroup->show_group_column_information(
$group_id,
api_get_user_id(),
$show
);
}
if ($show === 'shared_profile') {
$links = '<ul class="nav nav-pills nav-stacked">';
// My own profile
if ($show_full_profile && $user_id == intval(api_get_user_id())) {
$links .= '
<li class="home-icon '.$active.'">
<a href="'.api_get_path(WEB_CODE_PATH).'social/home.php">
'.$homeIcon.' '.get_lang('Home').'
</a>
</li>
<li class="messages-icon '.$active.'">
<a href="'.api_get_path(WEB_CODE_PATH).'messages/inbox.php">
'.$messagesIcon.' '.get_lang('Messages').$count_unread_message.'
</a>
</li>';
$active = $show === 'invitations' ? 'active' : null;
$links .= '
<li class="invitations-icon'.$active.'">
<a href="'.api_get_path(WEB_CODE_PATH).'social/invitations.php">
'.$invitationsIcon.' '.get_lang('Invitations').$total_invitations.'
</a>
</li>';
$links .= '
<li class="shared-profile-icon active">
<a href="'.api_get_path(WEB_CODE_PATH).'social/profile.php">
'.$sharedProfileIcon.' '.get_lang('ViewMySharedProfile').'
</a>
</li>
<li class="friends-icon">
<a href="'.api_get_path(WEB_CODE_PATH).'social/friends.php">
'.$friendsIcon.' '.get_lang('Friends').'
</a>
</li>';
$links .= '<li class="browse-groups-icon">
<a href="'.$groupUrl.'">
'.$groupsIcon.' '.get_lang('SocialGroups').'
</a>
</li>';
$active = $show == 'search' ? 'active' : null;
$links .= '
<li class="search-icon '.$active.'">
<a href="'.api_get_path(WEB_CODE_PATH).'social/search.php">
'.$searchIcon.' '.get_lang('Search').'
</a>
</li>';
$active = $show == 'myfiles' ? 'active' : null;
$myFiles = '
<li class="myfiles-icon '.$active.'">
<a href="'.api_get_path(WEB_CODE_PATH).'social/myfiles.php">
'.$filesIcon.' '.get_lang('MyFiles').'
</a>
</li>';
if (api_get_setting('allow_my_files') === 'false') {
$myFiles = '';
}
$links .= $myFiles;
if (api_get_configuration_value('allow_portfolio_tool')) {
$links .= '
<li class="portoflio-icon '.($show == 'portfolio' ? 'active' : '').'">
<a href="'.api_get_path(WEB_CODE_PATH).'portfolio/index.php">
'.$portfolioIcon.' '.get_lang('Portfolio').'
</a>
</li>
';
}
}
// My friend profile.
if ($user_id != api_get_user_id()) {
$sendMessageText = get_lang('SendMessage');
$sendMessageIcon = Display::return_icon(
'new-message.png',
$sendMessageText
);
$sendMessageUrl = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?'.http_build_query([
'a' => 'get_user_popup',
'user_id' => $user_id,
]);
$links .= '<li>';
$links .= Display::url(
"$sendMessageIcon $sendMessageText",
$sendMessageUrl,
[
'class' => 'ajax',
'title' => $sendMessageText,
'data-title' => $sendMessageText,
]
);
$links .= '</li>';
if (api_get_configuration_value('allow_portfolio_tool')) {
$links .= '
<li class="portoflio-icon '.($show == 'portfolio' ? 'active' : '').'">
<a href="'.api_get_path(WEB_CODE_PATH).'portfolio/index.php?user='.$user_id.'">
'.$portfolioIcon.' '.get_lang('Portfolio').'
</a>
</li>
';
}
}
// Check if I already sent an invitation message
$invitation_sent_list = self::get_list_invitation_sent_by_user_id(api_get_user_id());
if (isset($invitation_sent_list[$user_id]) && is_array($invitation_sent_list[$user_id]) &&
count($invitation_sent_list[$user_id]) > 0
) {
$links .= '<li><a href="'.api_get_path(WEB_CODE_PATH).'social/invitations.php">'.
Display::return_icon('invitation.png', get_lang('YouAlreadySentAnInvitation'))
.'&nbsp;&nbsp;'.get_lang('YouAlreadySentAnInvitation').'</a></li>';
} else {
if (!$show_full_profile) {
$links .= '<li>
<a class="btn-to-send-invitation" href="#" data-send-to="'.$user_id.'" title="'.get_lang('SendInvitation').'">'.
Display::return_icon('invitation.png', get_lang('SocialInvitationToFriends')).'&nbsp;'.get_lang('SendInvitation').
'</a></li>';
}
}
$links .= '</ul>';
$html .= Display::panelCollapse(
get_lang('SocialNetwork'),
$links,
'social-network-menu',
null,
'sn-sidebar',
'sn-sidebar-collapse'
);
if ($show_full_profile && $user_id == intval(api_get_user_id())) {
$personal_course_list = UserManager::get_personal_session_course_list($user_id);
$course_list_code = [];
$i = 1;
if (is_array($personal_course_list)) {
foreach ($personal_course_list as $my_course) {
if ($i <= 10) {
$course_list_code[] = ['code' => $my_course['code']];
} else {
break;
}
$i++;
}
// To avoid repeated courses
$course_list_code = array_unique_dimensional($course_list_code);
}
// Announcements
$my_announcement_by_user_id = intval($user_id);
$announcements = [];
foreach ($course_list_code as $course) {
$course_info = api_get_course_info($course['code']);
if (!empty($course_info)) {
$content = AnnouncementManager::get_all_annoucement_by_user_course(
$course_info['code'],
$my_announcement_by_user_id
);
if (!empty($content)) {
$url = Display::url(
Display::return_icon(
'announcement.png',
get_lang('Announcements')
).$course_info['name'].' ('.$content['count'].')',
api_get_path(WEB_CODE_PATH).'announcements/announcements.php?cidReq='.$course['code']
);
$announcements[] = Display::tag('li', $url);
}
}
}
if (!empty($announcements)) {
$html .= '<div class="social_menu_items">';
$html .= '<ul>';
foreach ($announcements as $announcement) {
$html .= $announcement;
}
$html .= '</ul>';
$html .= '</div>';
}
}
}
if ($show_delete_account_button) {
$html .= '<div class="panel panel-default"><div class="panel-body">';
$html .= '<ul class="nav nav-pills nav-stacked"><li>';
$url = api_get_path(WEB_CODE_PATH).'auth/unsubscribe_account.php';
$html .= Display::url(
Display::return_icon(
'delete.png',
get_lang('Unsubscribe'),
[],
ICON_SIZE_TINY
).get_lang('Unsubscribe'),
$url
);
$html .= '</li></ul>';
$html .= '</div></div>';
}
$html .= '';
return $html;
}
/** /**
* Displays a sortable table with the list of online users. * Displays a sortable table with the list of online users.
* *

@ -2066,7 +2066,7 @@ class UserGroup extends Model
* *
* @author Julio Montoya * @author Julio Montoya
* */ * */
public function get_groups_by_user($user_id, $relation_type = GROUP_USER_PERMISSION_READER, $with_image = false) public function get_groups_by_user($user_id, $relationType = GROUP_USER_PERMISSION_READER, $with_image = false)
{ {
$table_group_rel_user = $this->usergroup_rel_user_table; $table_group_rel_user = $this->usergroup_rel_user_table;
$tbl_group = $this->table; $tbl_group = $this->table;

@ -14,15 +14,6 @@ if (api_get_setting('allow_message_tool') != 'true') {
api_not_allowed(true); api_not_allowed(true);
} }
$logInfo = [
'tool' => 'Messages',
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => isset($_GET['action']) ? $_GET['action'] : 'inbox',
'action_details' => '',
];
Event::registerLog($logInfo);
$allowSocial = api_get_setting('allow_social_tool') == 'true'; $allowSocial = api_get_setting('allow_social_tool') == 'true';
$allowMessage = api_get_setting('allow_message_tool') == 'true'; $allowMessage = api_get_setting('allow_message_tool') == 'true';
@ -115,47 +106,47 @@ $interbreadcrumb[] = [
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Inbox')]; $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Inbox')];
$actions = ''; $actions = '';
$keyword = '';
// Comes from normal profile // Comes from normal profile
if ($allowSocial == false && $allowMessage) { if ($allowMessage) {
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'. $actionsLeft = '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
Display::return_icon('message_new.png', get_lang('ComposeMessage')).'</a>'; Display::return_icon('new-message.png', get_lang('ComposeMessage'), null, ICON_SIZE_MEDIUM).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'. $actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('inbox.png', get_lang('Inbox')).'</a>'; Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_MEDIUM).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'. $actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
Display::return_icon('outbox.png', get_lang('Outbox')).'</a>'; Display::return_icon('outbox.png', get_lang('Outbox'), null, ICON_SIZE_MEDIUM).'</a>';
$form = MessageManager::getSearchForm(api_get_path(WEB_PATH).'main/messages/inbox.php');
try {
if ($form->validate()) {
$values = $form->getSubmitValues();
$keyword = $values['keyword'];
}
} catch (HTML_QuickForm_Error $e) {
echo $e->getMessage();
}
$actionsRight = $form->returnForm();
$actions = Display::toolbarAction('toolbar', [$actionsLeft, $actionsRight]);
} }
// LEFT CONTENT // SOCIAL MENU
$social_menu_block = ''; /*$social_menu_block = '';
if ($allowSocial) { if ($allowSocial) {
// Block Social Menu // Block Social Menu
$social_menu_block = SocialManager::show_social_menu('messages'); $social_menu_block = SocialManager::show_social_menu('messages');
} }*/
// Right content // Right content
$social_right_content = ''; $message_content = '';
$keyword = '';
if (api_get_setting('allow_social_tool') === 'true') {
$actionsLeft = '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
Display::return_icon('new-message.png', get_lang('ComposeMessage'), [], 32).'</a>';
$actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
Display::return_icon('outbox.png', get_lang('Outbox'), [], 32).'</a>';
$form = MessageManager::getSearchForm(api_get_path(WEB_PATH).'main/messages/inbox.php');
if ($form->validate()) {
$values = $form->getSubmitValues();
$keyword = $values['keyword'];
}
$actionsRight = $form->returnForm();
$social_right_content .= Display::toolbarAction('toolbar', [$actionsLeft, $actionsRight]);
}
//MAIN CONTENT //MAIN CONTENT
if (!isset($_GET['del_msg'])) { if (!isset($_GET['del_msg'])) {
$social_right_content .= MessageManager::inbox_display($keyword); $message_content .= MessageManager::inbox_display($keyword);
} else { } else {
$num_msg = intval($_POST['total']); $num_msg = (int) $_POST['total'];
for ($i = 0; $i < $num_msg; $i++) { for ($i = 0; $i < $num_msg; $i++) {
if ($_POST[$i]) { if ($_POST[$i]) {
//the user_id was necessary to delete a message?? //the user_id was necessary to delete a message??
@ -165,24 +156,20 @@ if (!isset($_GET['del_msg'])) {
); );
} }
} }
$social_right_content .= MessageManager::inbox_display(); $message_content .= MessageManager::inbox_display();
} }
$tpl = new Template(null); $tpl = new Template($nameTools);
if ($actions) { if ($actions) {
$tpl->assign('actions', Display::toolbarAction('toolbar', [$actions])); $tpl->assign('actions', $actions);
} }
// Block Social Avatar // Block Social Avatar
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages'); // SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
if (api_get_setting('allow_social_tool') == 'true') {
$tpl->assign('social_menu_block', $social_menu_block); $tpl->assign('content_inbox', $message_content);
$tpl->assign('social_right_content', $social_right_content); $social_layout = $tpl->get_template('message/inbox.html.twig');
$social_layout = $tpl->get_template('social/inbox.tpl'); $content = $tpl->fetch($social_layout);
$tpl->display($social_layout); $tpl->assign('message', $show_message);
} else { $tpl->assign('content', $content);
$content = $social_right_content; $tpl->display_one_col_template();
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
}

@ -22,15 +22,6 @@ if (api_get_setting('allow_message_tool') !== 'true') {
api_not_allowed(true); api_not_allowed(true);
} }
$logInfo = [
'tool' => 'Messages',
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => 'new_message',
'action_details' => isset($_GET['re_id']) ? 're_id' : '',
];
Event::registerLog($logInfo);
$allowSocial = api_get_setting('allow_social_tool') == 'true'; $allowSocial = api_get_setting('allow_social_tool') == 'true';
$nameTools = api_xml_http_response_encode(get_lang('Messages')); $nameTools = api_xml_http_response_encode(get_lang('Messages'));
@ -58,9 +49,10 @@ function add_image_form() {
} }
} }
</script>'; </script>';
$nameTools = get_lang('ComposeMessage'); $nameTools = get_lang('ComposeMessage');
$tpl = new Template(get_lang('ComposeMessage')); $tpl = new Template($nameTools);
/** /**
* Shows the compose area + a list of users to select from. * Shows the compose area + a list of users to select from.
@ -184,17 +176,17 @@ function manageForm($default, $select_from_user_list = null, $sent_to = '', $tpl
if (isset($_GET['re_id'])) { if (isset($_GET['re_id'])) {
$message_reply_info = MessageManager::get_message_by_id($_GET['re_id']); $message_reply_info = MessageManager::get_message_by_id($_GET['re_id']);
$default['title'] = get_lang('MailSubjectReplyShort').' '.Security::remove_XSS($message_reply_info['title']); $default['title'] = get_lang('MailSubjectReplyShort').' '.$message_reply_info['title'];
$form->addHidden('re_id', (int) $_GET['re_id']); $form->addHidden('re_id', (int) $_GET['re_id']);
$form->addHidden('save_form', 'save_form'); $form->addHidden('save_form', 'save_form');
// Adding reply mail // Adding reply mail
$user_reply_info = api_get_user_info($message_reply_info['user_sender_id']); $user_reply_info = api_get_user_info($message_reply_info['user_sender_id']);
$default['content'] = '<p><br/></p>'.sprintf( $default['content'] = '<p><br/></p>'.sprintf(
get_lang('XWroteY'), get_lang('XWroteY'),
$user_reply_info['complete_name'], $user_reply_info['complete_name'],
Security::filter_terms($message_reply_info['content']) Security::filter_terms($message_reply_info['content'])
); );
} }
if (isset($_GET['forward_id'])) { if (isset($_GET['forward_id'])) {
@ -205,14 +197,14 @@ function manageForm($default, $select_from_user_list = null, $sent_to = '', $tpl
$fileListToString = !empty($attachments) ? implode('<br />', $attachments) : ''; $fileListToString = !empty($attachments) ? implode('<br />', $attachments) : '';
$form->addLabel('', $fileListToString); $form->addLabel('', $fileListToString);
} }
$default['title'] = '['.get_lang('MailSubjectForwardShort').": ".Security::remove_XSS($message_reply_info['title']).']'; $default['title'] = '['.get_lang('MailSubjectForwardShort').": ".$message_reply_info['title'].']';
$form->addHidden('forward_id', $forwardId); $form->addHidden('forward_id', $forwardId);
$form->addHidden('save_form', 'save_form'); $form->addHidden('save_form', 'save_form');
$receiverInfo = api_get_user_info($message_reply_info['user_receiver_id']); $receiverInfo = api_get_user_info($message_reply_info['user_receiver_id']);
$forwardMessage = '---------- '.get_lang('ForwardedMessage').' ---------'.'<br />'; $forwardMessage = '---------- '.get_lang('ForwardedMessage').' ---------'.'<br />';
$forwardMessage .= get_lang('Date').': '.api_get_local_time($message_reply_info['send_date']).'<br />'; $forwardMessage .= get_lang('Date').': '.api_get_local_time($message_reply_info['send_date']).'<br />';
$forwardMessage .= get_lang('Subject').': '.Security::remove_XSS($message_reply_info['title']).'<br />'; $forwardMessage .= get_lang('Subject').': '.$message_reply_info['title'].'<br />';
$forwardMessage .= get_lang('To').': '.$receiverInfo['complete_name'].' - '.$receiverInfo['email'].' <br />'; $forwardMessage .= get_lang('To').': '.$receiverInfo['complete_name'].' - '.$receiverInfo['email'].' <br />';
$default['content'] = '<p><br/></p>'.$forwardMessage.'<br />'.Security::filter_terms($message_reply_info['content']); $default['content'] = '<p><br/></p>'.$forwardMessage.'<br />'.Security::filter_terms($message_reply_info['content']);
} }
@ -347,45 +339,24 @@ $interbreadcrumb[] = [
]; ];
$group_id = isset($_REQUEST['group_id']) ? (int) $_REQUEST['group_id'] : 0; $group_id = isset($_REQUEST['group_id']) ? (int) $_REQUEST['group_id'] : 0;
$social_right_content = null; $message_content = null;
$actions = null;
if ($group_id != 0) { if ($group_id != 0) {
$social_right_content .= '<div class=actions>'; $actions .= '<a href="'.api_get_path(WEB_PATH).'main/social/group_view.php?id='.$group_id.'">'.
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/group_view.php?id='.$group_id.'">'. Display::return_icon('back.png', api_xml_http_response_encode(get_lang('ComposeMessage')), null, ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('back.png', api_xml_http_response_encode(get_lang('ComposeMessage'))).'</a>'; $actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php?group_id='.$group_id.'">'.
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php?group_id='.$group_id.'">'. Display::return_icon('message_new.png', api_xml_http_response_encode(get_lang('ComposeMessage')), null, ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('message_new.png', api_xml_http_response_encode(get_lang('ComposeMessage'))).'</a>';
$social_right_content .= '</div>';
} else { } else {
if ($allowSocial) { $actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
} else { Display::return_icon('back.png', get_lang('Back'), null, ICON_SIZE_MEDIUM).'</a>';
$social_right_content .= '<div class=actions>'; if (api_get_setting('allow_message_tool') === 'true') {
if (api_get_setting('allow_message_tool') === 'true') { $actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'. Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('message_new.png', get_lang('ComposeMessage')).'</a>'; $actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'. Display::return_icon('outbox.png', get_lang('Outbox'), null, ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('inbox.png', get_lang('Inbox')).'</a>';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
Display::return_icon('outbox.png', get_lang('Outbox')).'</a>';
}
$social_right_content .= '</div>';
} }
} }
$show_message = null;
// LEFT COLUMN
$social_left_content = '';
if ($allowSocial) {
// Block Social Menu
$social_menu_block = SocialManager::show_social_menu('messages');
$social_right_content .= '<div class="row">';
$social_right_content .= '<div class="col-md-12">';
$social_right_content .= '<div class="actions">';
$social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('back.png', get_lang('Back'), [], 32).'</a>';
$social_right_content .= '</div>';
$social_right_content .= '</div>';
$social_right_content .= '<div class="col-md-12">';
}
// MAIN CONTENT // MAIN CONTENT
if (!isset($_POST['compose'])) { if (!isset($_POST['compose'])) {
if (isset($_GET['re_id'])) { if (isset($_GET['re_id'])) {
@ -414,7 +385,7 @@ if (!isset($_POST['compose'])) {
// comes from a reply button // comes from a reply button
if (isset($_GET['re_id']) || isset($_GET['forward_id'])) { if (isset($_GET['re_id']) || isset($_GET['forward_id'])) {
$social_right_content .= manageForm($default, null, null, $tpl); $message_content .= manageForm($default, null, null, $tpl);
} else { } else {
// post // post
if ($restrict) { if ($restrict) {
@ -426,29 +397,24 @@ if (!isset($_POST['compose'])) {
if (isset($_POST['hidden_user'])) { if (isset($_POST['hidden_user'])) {
$default['users'] = [$_POST['hidden_user']]; $default['users'] = [$_POST['hidden_user']];
} }
$social_right_content .= manageForm($default, null, null, $tpl); $message_content .= manageForm($default, null, null, $tpl);
} else { } else {
$social_right_content .= Display::return_message(get_lang('ErrorSendingMessage'), 'error'); $show_message = Display::return_message(get_lang('ErrorSendingMessage'), 'error');
} }
} }
} }
if ($allowSocial) {
$social_right_content .= '</div>';
$social_right_content .= '</div>';
}
// Block Social Avatar
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
MessageManager::cleanAudioMessage(); MessageManager::cleanAudioMessage();
if ($allowSocial) {
$tpl->assign('social_menu_block', $social_menu_block); if ($actions) {
$tpl->assign('social_right_content', $social_right_content); $tpl->assign(
$social_layout = $tpl->get_template('social/inbox.tpl'); 'actions',
$tpl->display($social_layout); Display::toolbarAction('toolbar', [$actions])
} else { );
$content = $social_right_content;
$tpl->assign('content', $content);
$tpl->display_one_col_template();
} }
$tpl->assign('message', $show_message);
$tpl->assign('content_inbox', $message_content);
$social_layout = $tpl->get_template('message/inbox.html.twig');
$content = $tpl->fetch($social_layout);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -13,17 +13,9 @@ if (api_get_setting('allow_message_tool') != 'true') {
api_not_allowed(true); api_not_allowed(true);
} }
$logInfo = [
'tool' => 'Messages',
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => isset($_GET['action']) ? $_GET['action'] : 'outbox',
'action_details' => '',
];
Event::registerLog($logInfo);
$allowSocial = api_get_setting('allow_social_tool') == 'true'; $allowSocial = api_get_setting('allow_social_tool') == 'true';
$allowMessage = api_get_setting('allow_message_tool') == 'true'; $allowMessage = api_get_setting('allow_message_tool') == 'true';
$show_message = null;
if (isset($_GET['messages_page_nr'])) { if (isset($_GET['messages_page_nr'])) {
if ($allowSocial && $allowMessage) { if ($allowSocial && $allowMessage) {
@ -48,28 +40,16 @@ $interbreadcrumb[] = [
'name' => get_lang('Messages'), 'name' => get_lang('Messages'),
]; ];
$actions = ''; $actions = null;
if ($allowMessage) { if ($allowMessage) {
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
Display::return_icon('message_new.png', get_lang('ComposeMessage')).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('inbox.png', get_lang('Inbox')).'</a>';
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
Display::return_icon('outbox.png', get_lang('Outbox')).'</a>';
}
$action = null;
if (isset($_REQUEST['action'])) {
$action = $_REQUEST['action'];
}
$keyword = '';
$social_right_content = '';
if ($allowSocial) {
// Block Social Menu
$social_menu_block = SocialManager::show_social_menu('messages');
$actionsLeft = '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'. $actionsLeft = '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('back.png', get_lang('Back'), [], 32).'</a>'; Display::return_icon('back.png', get_lang('Back'), null, ICON_SIZE_MEDIUM).'</a>';
$actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
Display::return_icon('new-message.png', get_lang('ComposeMessage'), null, ICON_SIZE_MEDIUM).'</a>';
$actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_MEDIUM).'</a>';
$actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
Display::return_icon('outbox.png', get_lang('Outbox'), null, ICON_SIZE_MEDIUM).'</a>';
$form = MessageManager::getSearchForm(api_get_path(WEB_PATH).'main/messages/outbox.php'); $form = MessageManager::getSearchForm(api_get_path(WEB_PATH).'main/messages/outbox.php');
if ($form->validate()) { if ($form->validate()) {
@ -77,11 +57,22 @@ if ($allowSocial) {
$keyword = $values['keyword']; $keyword = $values['keyword'];
} }
$actionsRight = $form->returnForm(); $actionsRight = $form->returnForm();
$social_right_content .= Display::toolbarAction(
'toolbar',
[$actionsLeft, $actionsRight]
);
} }
$action = null;
if (isset($_REQUEST['action'])) {
$action = $_REQUEST['action'];
}
$keyword = '';
$message_content = null;
$actions .= Display::toolbarAction(
'toolbar',
[$actionsLeft, $actionsRight]
);
//MAIN CONTENT //MAIN CONTENT
if ($action == 'delete') { if ($action == 'delete') {
$delete_list_id = []; $delete_list_id = [];
@ -92,40 +83,33 @@ if ($action == 'delete') {
$delete_list_id = $_POST['id']; $delete_list_id = $_POST['id'];
} }
for ($i = 0; $i < count($delete_list_id); $i++) { for ($i = 0; $i < count($delete_list_id); $i++) {
MessageManager::delete_message_by_user_sender( $show_message .= MessageManager::delete_message_by_user_sender(
api_get_user_id(), api_get_user_id(),
$delete_list_id[$i] $delete_list_id[$i]
); );
} }
$delete_list_id = []; $delete_list_id = [];
$social_right_content .= MessageManager::outbox_display($keyword); $message_content .= MessageManager::outbox_display($keyword);
} elseif ($action == 'deleteone') { } elseif ($action == 'deleteone') {
$delete_list_id = []; $delete_list_id = [];
$id = Security::remove_XSS($_GET['id']); $id = Security::remove_XSS($_GET['id']);
MessageManager::delete_message_by_user_sender(api_get_user_id(), $id); MessageManager::delete_message_by_user_sender(api_get_user_id(), $id);
$delete_list_id = []; $delete_list_id = [];
$social_right_content .= MessageManager::outbox_display($keyword); $message_content .= MessageManager::outbox_display($keyword);
} else { } else {
$social_right_content .= MessageManager::outbox_display($keyword); $message_content .= MessageManager::outbox_display($keyword);
} }
$tpl = new Template(get_lang('Outbox')); $tpl = new Template(get_lang('Outbox'));
// Block Social Avatar // Block Social Avatar
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
if ($allowSocial) { if ($actions) {
$tpl->assign('social_menu_block', $social_menu_block); $tpl->assign('actions', $actions);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/inbox.tpl');
$tpl->display($social_layout);
} else {
$content = $social_right_content;
if ($actions) {
$tpl->assign(
'actions',
Display::toolbarAction('toolbar', [$actions])
);
}
$tpl->assign('content', $content);
$tpl->display_one_col_template();
} }
$tpl->assign('content_inbox', $message_content);
$social_layout = $tpl->get_template('message/inbox.html.twig');
$content = $tpl->fetch($social_layout);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();

@ -95,7 +95,7 @@ SocialManager::getScrollJs($countPost, $htmlHeadXtra);
$social_menu_block = SocialManager::show_social_menu('home'); $social_menu_block = SocialManager::show_social_menu('home');
$social_search_block = Display::panel( $social_search_block = Display::panel(
UserManager::get_search_form(''), UserManager::getSearchForm(''),
get_lang('SearchUsers') get_lang('SearchUsers')
); );

@ -102,7 +102,7 @@ if (api_get_setting('allow_social_tool') == 'true') {
$tpl = new Template(get_lang('MyFiles')); $tpl = new Template(get_lang('MyFiles'));
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'myfiles'); SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'myfiles');
$editor = new \Chamilo\CoreBundle\Component\Editor\Editor(); $editor = \Chamilo\CoreBundle\Framework\Container::getHtmlEditor();
$template = $tpl->get_template($editor->getEditorStandAloneTemplate()); $template = $tpl->get_template($editor->getEditorStandAloneTemplate());
$editor = $tpl->fetch($template); $editor = $tpl->fetch($template);

@ -1,89 +1,114 @@
{% extends '@ChamiloTheme/Layout/layout_one_col.html.twig' %}
{% import '@ChamiloTheme/Macros/box.html.twig' as macro %}
{% block content %} {% block content %}
{% autoescape false %} {% autoescape false %}
<style>
#listFriends .list-group {
max-height: 250px;
overflow-y:auto;
}
</style>
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-3">
{{ social_avatar_block }}
{% set avatar %}
{% include '@ChamiloTheme/Social/user_block.html.twig' %}
{% endset %}
{{ macro.panel('', avatar ) }}
{{ macro.panel("Search Users" | trans, social_search ) }} <div class="social-network-menu">
{{ social_menu_block }}
{{ macro.panel("SocialFriend" | get_lang, social_friend_block ) }} </div>
</div> </div>
<div class="col-md-8"> <div class="col-md-6">
{#{{ social_search_block }}#}
{{ social_skill_block }}
{% set group %} <div id="wallMessages">
<div class="group-title"> {{ social_wall_block }}
{{ 'The last'|get_lang }} <div class="spinner"></div>
<div class="panel panel-preview panel-default" hidden="true">
<div class="panel-heading">
<h3 class="panel-title">{{ "Url" | get_lang }} - {{ "Preview" | get_lang }}</h3>
</div>
<div class="panel-body">
<div class="url_preview"></div>
</div>
</div> </div>
<ul class="list-unstyled"> {{ social_post_wall_block }}
{% for item in groups.newest %} {{ social_auto_extend_link }}
<li class="media item-{{ item.id }}"> </div>
<a href="{{ item.url }}" title="{{ item.name }}">
<img class="mr-3" src="{{ item.picture }}" alt="{{ item.name }}">
</a>
<div class="media-body">
<h5 class="mt-0 mb-1"><a href="{{ item.url }}" title="{{ item.name }}">{{ item.name }}</a></h5>
<div class="details"><i class="fas fa-users"></i> {{ 'Members'|get_lang }} {{ item.count }}</div>
{{ item.description }}
</div>
</li>
{% endfor %}
</ul>
<div class="group-title">
{{ 'Popular'|get_lang }}
</div>
<ul class="list-unstyled">
{% for item in groups.popular %}
<li class="media mb-3 item-{{ item.id }}">
<a href="{{ item.url }}" title="{{ item.name }}">
<img class="mr-3" src="{{ item.picture }}" alt="{{ item.name }}">
</a>
<div class="media-body">
<h5 class="mt-0 mb-1"><a href="{{ item.url }}" title="{{ item.name }}">{{ item.name }}</a></h5>
<div class="details"><i class="fas fa-users"></i> {{ 'Members'|get_lang }} {{ item.count }}</div>
{{ item.description }}
</div>
</li>
{% endfor %}
</ul>
{% endset %}
{{ macro.panel("Groups" | trans, group ) }}
{{ social_right_content }} {{ social_right_content }}
<div id="message_ajax_reponse" class=""></div> <div id="message_ajax_reponse" class=""></div>
<div id="display_response_id"></div> <div id="display_response_id"></div>
{{ social_auto_extend_link }}
</div> </div>
<div class="col-md-3">
<!-- Block chat list -->
<div class="chat-friends">
<div class="panel-group" id="blocklistFriends" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a role="button"
data-toggle="collapse"
data-parent="#blocklistFriends"
href="#listFriends"
aria-expanded="true"
aria-controls="listFriends">
{{ "SocialFriend" | get_lang }}
</a>
</h4>
</div>
<div id="listFriends"
class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
<div class="panel-body">
<div class="search-friend">
{{ search_friends_form }}
</div>
{{ social_friend_block }}
{#<div class="col-md-3"> {% if 'allow_social_map_fields'|api_get_configuration_value %}
{{ macro.panel("SocialFriend" | get_lang, social_friend_block ) }} <div class="geolocalization">
<a class="btn btn-maps" id="profile-tab" href="{{ _p.web }}main/social/map.php" >
{{ "geolocalization.png"|img(32) }}
{{ 'SearchUserByGeolocalization' | get_lang }}
</a>
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
<!-- Block session list --> {{ social_group_block }}
{% set sessionList %}
<ul class="list-group">
{% for session in session_list %}
<li id="session_{{ session.id }}" class="list-group-item" style="min-height:65px;">
<img class="img-session" src="{{ session.image }}"/>
<span class="title">{{ session.name }}</span>
</li>
{% endfor %}
</ul>
{% endset %}
{{ macro.panel("MySessions" | get_lang, sessionList) }} {{ social_skill_block }}
</div>#}
<!-- Block session list -->
{% if session_list != null %}
<div class="panel-group" id="session-block" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#session-block" href="#sessionList" aria-expanded="true" aria-controls="sessionList">
{{ "MySessions" | get_lang }}
</a>
</h4>
</div>
<div id="sessionList" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
<div class="panel-body">
<ul class="list-group">
{% for session in session_list %}
<li id="session_{{ session.id }}" class="list-group-item" style="min-height:65px;">
<img class="img-session" src="{{ session.image }}"/>
<span class="title">{{ session.name }}</span>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
{% endif %}
</div>
</div> </div>
{% endautoescape %} {% endautoescape %}
{% endblock %} {% endblock %}

@ -155,7 +155,7 @@ class Editor
*/ */
public function getEditorStandAloneTemplate() public function getEditorStandAloneTemplate()
{ {
return 'javascript/editor/elfinder_standalone.tpl'; return 'elfinder_standalone.html.twig';
} }
/** /**

@ -29,6 +29,9 @@ class ExtraField // extends BaseAttribute
public const USER_CERTIFICATE = 11; public const USER_CERTIFICATE = 11;
public const SURVEY_FIELD_TYPE = 12; public const SURVEY_FIELD_TYPE = 12;
public const SCHEDULED_ANNOUNCEMENT = 13; public const SCHEDULED_ANNOUNCEMENT = 13;
public const TERMS_AND_CONDITION_TYPE = 14;
public const FORUM_CATEGORY_TYPE = 15;
public const FORUM_POST_TYPE = 16;
/** /**
* @var int * @var int

@ -3,19 +3,25 @@
namespace Chamilo\CoreBundle\Repository; namespace Chamilo\CoreBundle\Repository;
use Chamilo\CoreBundle\Entity\Legal;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry; use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\ORM\EntityRepository;
/** /**
* Class LegalRepository. * Class LegalRepository.
* *
* @package Chamilo\CoreBundle\Repository * @package Chamilo\CoreBundle\Repository
*/ */
class LegalRepository extends EntityRepository class LegalRepository extends ServiceEntityRepository
{ {
/**
* LegalRepository constructor.
*
* @param ManagerRegistry $registry
*/
public function __construct(ManagerRegistry $registry) public function __construct(ManagerRegistry $registry)
{ {
parent::__construct($registry, Language::class); parent::__construct($registry, Legal::class);
} }
/** /**

Loading…
Cancel
Save