diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php
index dd6cde0b0a..d20dde7779 100755
--- a/main/inc/lib/social.lib.php
+++ b/main/inc/lib/social.lib.php
@@ -413,7 +413,7 @@ class SocialManager extends UserManager
*
* @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;
$limit = (int) $limit;
@@ -1263,6 +1263,413 @@ class SocialManager extends UserManager
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 = '
';
+ }
+
+ $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 = '';
+ // My own profile
+ if ($show_full_profile && $user_id == intval(api_get_user_id())) {
+ $links .= '
+ -
+
+ '.$homeIcon.' '.get_lang('Home').'
+
+
+ -
+
+ '.$messagesIcon.' '.get_lang('Messages').$count_unread_message.'
+
+
';
+ $active = $show === 'invitations' ? 'active' : null;
+ $links .= '
+ -
+
+ '.$invitationsIcon.' '.get_lang('Invitations').$total_invitations.'
+
+
';
+
+ $links .= '
+ -
+
+ '.$sharedProfileIcon.' '.get_lang('ViewMySharedProfile').'
+
+
+ -
+
+ '.$friendsIcon.' '.get_lang('Friends').'
+
+
';
+
+ $links .= '-
+
+ '.$groupsIcon.' '.get_lang('SocialGroups').'
+
+
';
+
+ $active = $show == 'search' ? 'active' : null;
+ $links .= '
+ -
+
+ '.$searchIcon.' '.get_lang('Search').'
+
+
';
+ $active = $show == 'myfiles' ? 'active' : null;
+
+ $myFiles = '
+ -
+
+ '.$filesIcon.' '.get_lang('MyFiles').'
+
+
';
+
+ if (api_get_setting('allow_my_files') === 'false') {
+ $myFiles = '';
+ }
+ $links .= $myFiles;
+
+ if (api_get_configuration_value('allow_portfolio_tool')) {
+ $links .= '
+ -
+
+ '.$portfolioIcon.' '.get_lang('Portfolio').'
+
+
+ ';
+ }
+ }
+
+ // 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 .= '- ';
+ $links .= Display::url(
+ "$sendMessageIcon $sendMessageText",
+ $sendMessageUrl,
+ [
+ 'class' => 'ajax',
+ 'title' => $sendMessageText,
+ 'data-title' => $sendMessageText,
+ ]
+ );
+ $links .= '
';
+
+ if (api_get_configuration_value('allow_portfolio_tool')) {
+ $links .= '
+ -
+
+ '.$portfolioIcon.' '.get_lang('Portfolio').'
+
+
+ ';
+ }
+ }
+
+ // 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 .= '- '.
+ Display::return_icon('invitation.png', get_lang('YouAlreadySentAnInvitation'))
+ .' '.get_lang('YouAlreadySentAnInvitation').'
';
+ } else {
+ if (!$show_full_profile) {
+ $links .= '-
+ '.
+ Display::return_icon('invitation.png', get_lang('SocialInvitationToFriends')).' '.get_lang('SendInvitation').
+ '
';
+ }
+ }
+
+ $links .= '
';
+ $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 .= '';
+ }
+ }
+ }
+
+ if ($show_delete_account_button) {
+ $html .= '';
+ $html .= '
- ';
+ $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 .= '
';
+ $html .= '
';
+ }
+ $html .= '';
+
+ return $html;
+ }
+
/**
* Displays a sortable table with the list of online users.
*
diff --git a/main/inc/lib/usergroup.lib.php b/main/inc/lib/usergroup.lib.php
index cf3fc5e2b3..e6daf7ddee 100755
--- a/main/inc/lib/usergroup.lib.php
+++ b/main/inc/lib/usergroup.lib.php
@@ -2066,7 +2066,7 @@ class UserGroup extends Model
*
* @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;
$tbl_group = $this->table;
diff --git a/main/messages/inbox.php b/main/messages/inbox.php
index 972b54f597..3f9245313c 100755
--- a/main/messages/inbox.php
+++ b/main/messages/inbox.php
@@ -14,15 +14,6 @@ if (api_get_setting('allow_message_tool') != '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';
$allowMessage = api_get_setting('allow_message_tool') == 'true';
@@ -115,47 +106,47 @@ $interbreadcrumb[] = [
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Inbox')];
$actions = '';
+$keyword = '';
// Comes from normal profile
-if ($allowSocial == false && $allowMessage) {
- $actions .= ''.
- Display::return_icon('message_new.png', get_lang('ComposeMessage')).'';
- $actions .= ''.
- Display::return_icon('inbox.png', get_lang('Inbox')).'';
- $actions .= ''.
- Display::return_icon('outbox.png', get_lang('Outbox')).'';
+if ($allowMessage) {
+ $actionsLeft = ''.
+ Display::return_icon('new-message.png', get_lang('ComposeMessage'), null, ICON_SIZE_MEDIUM).'';
+ $actionsLeft .= ''.
+ Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_MEDIUM).'';
+ $actionsLeft .= ''.
+ Display::return_icon('outbox.png', get_lang('Outbox'), null, ICON_SIZE_MEDIUM).'';
+
+ $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_block = '';
+// SOCIAL MENU
+/*$social_menu_block = '';
if ($allowSocial) {
// Block Social Menu
$social_menu_block = SocialManager::show_social_menu('messages');
-}
+}*/
// Right content
-$social_right_content = '';
-$keyword = '';
-if (api_get_setting('allow_social_tool') === 'true') {
- $actionsLeft = ''.
- Display::return_icon('new-message.png', get_lang('ComposeMessage'), [], 32).'';
- $actionsLeft .= ''.
- Display::return_icon('outbox.png', get_lang('Outbox'), [], 32).'';
+$message_content = '';
- $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
if (!isset($_GET['del_msg'])) {
- $social_right_content .= MessageManager::inbox_display($keyword);
+ $message_content .= MessageManager::inbox_display($keyword);
} else {
- $num_msg = intval($_POST['total']);
+ $num_msg = (int) $_POST['total'];
for ($i = 0; $i < $num_msg; $i++) {
if ($_POST[$i]) {
//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) {
- $tpl->assign('actions', Display::toolbarAction('toolbar', [$actions]));
+ $tpl->assign('actions', $actions);
}
// Block Social Avatar
-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('social_right_content', $social_right_content);
- $social_layout = $tpl->get_template('social/inbox.tpl');
- $tpl->display($social_layout);
-} else {
- $content = $social_right_content;
- $tpl->assign('message', $show_message);
- $tpl->assign('content', $content);
- $tpl->display_one_col_template();
-}
+// SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
+
+$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();
\ No newline at end of file
diff --git a/main/messages/new_message.php b/main/messages/new_message.php
index 8df9ffe00d..b2ce968a89 100755
--- a/main/messages/new_message.php
+++ b/main/messages/new_message.php
@@ -22,15 +22,6 @@ if (api_get_setting('allow_message_tool') !== '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';
$nameTools = api_xml_http_response_encode(get_lang('Messages'));
@@ -58,9 +49,10 @@ function add_image_form() {
}
}
';
+
$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.
@@ -184,17 +176,17 @@ function manageForm($default, $select_from_user_list = null, $sent_to = '', $tpl
if (isset($_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('save_form', 'save_form');
// Adding reply mail
$user_reply_info = api_get_user_info($message_reply_info['user_sender_id']);
$default['content'] = '
'.sprintf(
- get_lang('XWroteY'),
- $user_reply_info['complete_name'],
- Security::filter_terms($message_reply_info['content'])
- );
+ get_lang('XWroteY'),
+ $user_reply_info['complete_name'],
+ Security::filter_terms($message_reply_info['content'])
+ );
}
if (isset($_GET['forward_id'])) {
@@ -205,14 +197,14 @@ function manageForm($default, $select_from_user_list = null, $sent_to = '', $tpl
$fileListToString = !empty($attachments) ? implode('
', $attachments) : '';
$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('save_form', 'save_form');
$receiverInfo = api_get_user_info($message_reply_info['user_receiver_id']);
$forwardMessage = '---------- '.get_lang('ForwardedMessage').' ---------'.'
';
$forwardMessage .= get_lang('Date').': '.api_get_local_time($message_reply_info['send_date']).'
';
- $forwardMessage .= get_lang('Subject').': '.Security::remove_XSS($message_reply_info['title']).'
';
+ $forwardMessage .= get_lang('Subject').': '.$message_reply_info['title'].'
';
$forwardMessage .= get_lang('To').': '.$receiverInfo['complete_name'].' - '.$receiverInfo['email'].'
';
$default['content'] = '
'.$forwardMessage.'
'.Security::filter_terms($message_reply_info['content']);
}
@@ -347,45 +339,24 @@ $interbreadcrumb[] = [
];
$group_id = isset($_REQUEST['group_id']) ? (int) $_REQUEST['group_id'] : 0;
-$social_right_content = null;
+$message_content = null;
+$actions = null;
if ($group_id != 0) {
- $social_right_content .= '';
+ $actions .= ''.
+ Display::return_icon('back.png', api_xml_http_response_encode(get_lang('ComposeMessage')), null, ICON_SIZE_MEDIUM).'';
+ $actions .= ''.
+ Display::return_icon('message_new.png', api_xml_http_response_encode(get_lang('ComposeMessage')), null, ICON_SIZE_MEDIUM).'';
} else {
- if ($allowSocial) {
- } else {
- $social_right_content .= '';
+ $actions .= ''.
+ Display::return_icon('back.png', get_lang('Back'), null, ICON_SIZE_MEDIUM).'';
+ if (api_get_setting('allow_message_tool') === 'true') {
+ $actions .= ''.
+ Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_MEDIUM).'';
+ $actions .= ''.
+ Display::return_icon('outbox.png', get_lang('Outbox'), null, ICON_SIZE_MEDIUM).'';
}
}
-
-// LEFT COLUMN
-$social_left_content = '';
-if ($allowSocial) {
- // Block Social Menu
- $social_menu_block = SocialManager::show_social_menu('messages');
- $social_right_content .= '';
- $social_right_content .= '
';
- $social_right_content .= '
';
- $social_right_content .= '
';
- $social_right_content .= '
';
-}
-
+$show_message = null;
// MAIN CONTENT
if (!isset($_POST['compose'])) {
if (isset($_GET['re_id'])) {
@@ -414,7 +385,7 @@ if (!isset($_POST['compose'])) {
// comes from a reply button
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 {
// post
if ($restrict) {
@@ -426,29 +397,24 @@ if (!isset($_POST['compose'])) {
if (isset($_POST['hidden_user'])) {
$default['users'] = [$_POST['hidden_user']];
}
- $social_right_content .= manageForm($default, null, null, $tpl);
+ $message_content .= manageForm($default, null, null, $tpl);
} 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 .= '
';
- $social_right_content .= '
';
-}
-
-// Block Social Avatar
-SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
-
MessageManager::cleanAudioMessage();
-if ($allowSocial) {
- $tpl->assign('social_menu_block', $social_menu_block);
- $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;
- $tpl->assign('content', $content);
- $tpl->display_one_col_template();
+
+if ($actions) {
+ $tpl->assign(
+ 'actions',
+ Display::toolbarAction('toolbar', [$actions])
+ );
}
+$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();
\ No newline at end of file
diff --git a/main/messages/outbox.php b/main/messages/outbox.php
index 5ac29f2878..2a1f5452b2 100755
--- a/main/messages/outbox.php
+++ b/main/messages/outbox.php
@@ -13,17 +13,9 @@ if (api_get_setting('allow_message_tool') != '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';
$allowMessage = api_get_setting('allow_message_tool') == 'true';
+$show_message = null;
if (isset($_GET['messages_page_nr'])) {
if ($allowSocial && $allowMessage) {
@@ -48,28 +40,16 @@ $interbreadcrumb[] = [
'name' => get_lang('Messages'),
];
-$actions = '';
+$actions = null;
if ($allowMessage) {
- $actions .= ''.
- Display::return_icon('message_new.png', get_lang('ComposeMessage')).'';
- $actions .= ''.
- Display::return_icon('inbox.png', get_lang('Inbox')).'';
- $actions .= ''.
- Display::return_icon('outbox.png', get_lang('Outbox')).'';
-}
-
-$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 = ''.
- Display::return_icon('back.png', get_lang('Back'), [], 32).'';
+ Display::return_icon('back.png', get_lang('Back'), null, ICON_SIZE_MEDIUM).'';
+ $actionsLeft .= ''.
+ Display::return_icon('new-message.png', get_lang('ComposeMessage'), null, ICON_SIZE_MEDIUM).'';
+ $actionsLeft .= ''.
+ Display::return_icon('inbox.png', get_lang('Inbox'), null, ICON_SIZE_MEDIUM).'';
+ $actionsLeft .= ''.
+ Display::return_icon('outbox.png', get_lang('Outbox'), null, ICON_SIZE_MEDIUM).'';
$form = MessageManager::getSearchForm(api_get_path(WEB_PATH).'main/messages/outbox.php');
if ($form->validate()) {
@@ -77,11 +57,22 @@ if ($allowSocial) {
$keyword = $values['keyword'];
}
$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
if ($action == 'delete') {
$delete_list_id = [];
@@ -92,40 +83,33 @@ if ($action == 'delete') {
$delete_list_id = $_POST['id'];
}
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(),
$delete_list_id[$i]
);
}
$delete_list_id = [];
- $social_right_content .= MessageManager::outbox_display($keyword);
+ $message_content .= MessageManager::outbox_display($keyword);
} elseif ($action == 'deleteone') {
$delete_list_id = [];
$id = Security::remove_XSS($_GET['id']);
MessageManager::delete_message_by_user_sender(api_get_user_id(), $id);
$delete_list_id = [];
- $social_right_content .= MessageManager::outbox_display($keyword);
+ $message_content .= MessageManager::outbox_display($keyword);
} else {
- $social_right_content .= MessageManager::outbox_display($keyword);
+ $message_content .= MessageManager::outbox_display($keyword);
}
$tpl = new Template(get_lang('Outbox'));
// Block Social Avatar
-SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
-if ($allowSocial) {
- $tpl->assign('social_menu_block', $social_menu_block);
- $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();
+if ($actions) {
+ $tpl->assign('actions', $actions);
}
+
+$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();
\ No newline at end of file
diff --git a/main/social/home.php b/main/social/home.php
index 8625846fe4..62b185333f 100755
--- a/main/social/home.php
+++ b/main/social/home.php
@@ -95,7 +95,7 @@ SocialManager::getScrollJs($countPost, $htmlHeadXtra);
$social_menu_block = SocialManager::show_social_menu('home');
$social_search_block = Display::panel(
- UserManager::get_search_form(''),
+ UserManager::getSearchForm(''),
get_lang('SearchUsers')
);
diff --git a/main/social/myfiles.php b/main/social/myfiles.php
index 69547b9300..c6fd4eabf0 100755
--- a/main/social/myfiles.php
+++ b/main/social/myfiles.php
@@ -102,7 +102,7 @@ if (api_get_setting('allow_social_tool') == 'true') {
$tpl = new Template(get_lang('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());
$editor = $tpl->fetch($template);
diff --git a/main/template/default/social/home.html.twig b/main/template/default/social/home.html.twig
index b59dfe1bc5..46c869fb26 100644
--- a/main/template/default/social/home.html.twig
+++ b/main/template/default/social/home.html.twig
@@ -1,89 +1,114 @@
-
-{% import '@ChamiloTheme/Macros/box.html.twig' as macro %}
+{% extends '@ChamiloTheme/Layout/layout_one_col.html.twig' %}
{% block content %}
-{% autoescape false %}
+ {% autoescape false %}
+
-
-
- {% set avatar %}
- {% include '@ChamiloTheme/Social/user_block.html.twig' %}
- {% endset %}
-
- {{ macro.panel('', avatar ) }}
+
+ {{ social_avatar_block }}
- {{ macro.panel("Search Users" | trans, social_search ) }}
-
- {{ macro.panel("SocialFriend" | get_lang, social_friend_block ) }}
+
-
-
- {{ social_skill_block }}
+
+ {#{{ social_search_block }}#}
- {% set group %}
-
- {{ 'The last'|get_lang }}
+
+ {{ social_wall_block }}
+
+
+
+
{{ "Url" | get_lang }} - {{ "Preview" | get_lang }}
+
+
-
- {% for item in groups.newest %}
- -
-
-
-
-
-
-
{{ 'Members'|get_lang }} {{ item.count }}
- {{ item.description }}
-
-
- {% endfor %}
-
-
- {{ 'Popular'|get_lang }}
-
-
- {% for item in groups.popular %}
- -
-
-
-
-
-
-
{{ 'Members'|get_lang }} {{ item.count }}
- {{ item.description }}
-
-
- {% endfor %}
-
- {% endset %}
-
- {{ macro.panel("Groups" | trans, group ) }}
+ {{ social_post_wall_block }}
+ {{ social_auto_extend_link }}
+
{{ social_right_content }}
- {{ social_auto_extend_link }}
+
+
+
+
+
+
+
+
+
+ {{ search_friends_form }}
+
+ {{ social_friend_block }}
- {#
- {{ macro.panel("SocialFriend" | get_lang, social_friend_block ) }}
+ {% if 'allow_social_map_fields'|api_get_configuration_value %}
+
+ {% endif %}
+
+
+
+
+
-
- {% set sessionList %}
-
- {% for session in session_list %}
- -
-
- {{ session.name }}
-
- {% endfor %}
-
- {% endset %}
+ {{ social_group_block }}
- {{ macro.panel("MySessions" | get_lang, sessionList) }}
-
#}
+ {{ social_skill_block }}
+
+ {% if session_list != null %}
+
+
+
+
+
+
+ {% for session in session_list %}
+ -
+
+ {{ session.name }}
+
+ {% endfor %}
+
+
+
+
+
+ {% endif %}
+
-{% endautoescape %}
+ {% endautoescape %}
{% endblock %}
diff --git a/src/CoreBundle/Component/Editor/Editor.php b/src/CoreBundle/Component/Editor/Editor.php
index 01cc166d94..091b8223a7 100644
--- a/src/CoreBundle/Component/Editor/Editor.php
+++ b/src/CoreBundle/Component/Editor/Editor.php
@@ -155,7 +155,7 @@ class Editor
*/
public function getEditorStandAloneTemplate()
{
- return 'javascript/editor/elfinder_standalone.tpl';
+ return 'elfinder_standalone.html.twig';
}
/**
diff --git a/src/CoreBundle/Entity/ExtraField.php b/src/CoreBundle/Entity/ExtraField.php
index 7008b63d2c..c03e38fc68 100644
--- a/src/CoreBundle/Entity/ExtraField.php
+++ b/src/CoreBundle/Entity/ExtraField.php
@@ -29,6 +29,9 @@ class ExtraField // extends BaseAttribute
public const USER_CERTIFICATE = 11;
public const SURVEY_FIELD_TYPE = 12;
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
diff --git a/src/CoreBundle/Repository/LegalRepository.php b/src/CoreBundle/Repository/LegalRepository.php
index edd910b381..bb4a2e5e0c 100644
--- a/src/CoreBundle/Repository/LegalRepository.php
+++ b/src/CoreBundle/Repository/LegalRepository.php
@@ -3,19 +3,25 @@
namespace Chamilo\CoreBundle\Repository;
+use Chamilo\CoreBundle\Entity\Legal;
+use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry;
-use Doctrine\ORM\EntityRepository;
/**
* Class LegalRepository.
*
* @package Chamilo\CoreBundle\Repository
*/
-class LegalRepository extends EntityRepository
+class LegalRepository extends ServiceEntityRepository
{
+ /**
+ * LegalRepository constructor.
+ *
+ * @param ManagerRegistry $registry
+ */
public function __construct(ManagerRegistry $registry)
{
- parent::__construct($registry, Language::class);
+ parent::__construct($registry, Legal::class);
}
/**