|
24 | 24 |
|
25 | 25 | $allowSocial = api_get_setting('allow_social_tool') == 'true'; |
26 | 26 | $allowMessage = api_get_setting('allow_message_tool') == 'true'; |
| 27 | +$show_message = null; |
27 | 28 |
|
28 | 29 | if (isset($_GET['messages_page_nr'])) { |
29 | 30 | if ($allowSocial && $allowMessage) { |
|
48 | 49 | 'name' => get_lang('Messages'), |
49 | 50 | ]; |
50 | 51 |
|
51 | | -$actions = ''; |
| 52 | +$actions = null; |
| 53 | + |
52 | 54 | if ($allowMessage) { |
53 | | - $actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'. |
| 55 | + $actionsLeft = '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'. |
54 | 56 | Display::return_icon('message_new.png', get_lang('ComposeMessage')).'</a>'; |
55 | | - $actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'. |
| 57 | + $actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'. |
56 | 58 | Display::return_icon('inbox.png', get_lang('Inbox')).'</a>'; |
57 | | - $actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'. |
| 59 | + $actionsLeft .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'. |
58 | 60 | Display::return_icon('outbox.png', get_lang('Outbox')).'</a>'; |
59 | 61 | } |
60 | 62 |
|
61 | 63 | $action = null; |
| 64 | + |
62 | 65 | if (isset($_REQUEST['action'])) { |
63 | 66 | $action = $_REQUEST['action']; |
64 | 67 | } |
65 | 68 |
|
66 | 69 | $keyword = ''; |
67 | | -$social_right_content = ''; |
68 | | -if ($allowSocial) { |
69 | | - // Block Social Menu |
70 | | - $social_menu_block = SocialManager::show_social_menu('messages'); |
71 | | - $actionsLeft = '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'. |
72 | | - Display::return_icon('back.png', get_lang('Back'), [], 32).'</a>'; |
73 | | - |
74 | | - $form = MessageManager::getSearchForm(api_get_path(WEB_PATH).'main/messages/outbox.php'); |
75 | | - if ($form->validate()) { |
76 | | - $values = $form->getSubmitValues(); |
77 | | - $keyword = $values['keyword']; |
78 | | - } |
79 | | - $actionsRight = $form->returnForm(); |
80 | | - $social_right_content .= Display::toolbarAction( |
| 70 | + |
| 71 | +$form = MessageManager::getSearchForm(api_get_path(WEB_PATH).'main/messages/outbox.php'); |
| 72 | +if ($form->validate()) { |
| 73 | + $values = $form->getSubmitValues(); |
| 74 | + $keyword = $values['keyword']; |
| 75 | +} |
| 76 | +$actionsRight = $form->returnForm(); |
| 77 | + |
| 78 | +$actions .= Display::toolbarAction( |
81 | 79 | 'toolbar', |
82 | | - [$actionsLeft, $actionsRight] |
| 80 | + [ |
| 81 | + $actionsLeft, |
| 82 | + $actionsRight |
| 83 | + ] |
83 | 84 | ); |
84 | | -} |
| 85 | +$message_content = null; |
| 86 | + |
85 | 87 | //MAIN CONTENT |
86 | 88 | if ($action == 'delete') { |
87 | 89 | $delete_list_id = []; |
|
98 | 100 | ); |
99 | 101 | } |
100 | 102 | $delete_list_id = []; |
101 | | - $social_right_content .= MessageManager::outbox_display($keyword); |
| 103 | + $message_content .= MessageManager::outbox_display($keyword); |
102 | 104 | } elseif ($action == 'deleteone') { |
103 | 105 | $delete_list_id = []; |
104 | 106 | $id = Security::remove_XSS($_GET['id']); |
105 | 107 | MessageManager::delete_message_by_user_sender(api_get_user_id(), $id); |
106 | 108 | $delete_list_id = []; |
107 | | - $social_right_content .= MessageManager::outbox_display($keyword); |
| 109 | + $message_content .= MessageManager::outbox_display($keyword); |
108 | 110 | } else { |
109 | | - $social_right_content .= MessageManager::outbox_display($keyword); |
| 111 | + $message_content .= MessageManager::outbox_display($keyword); |
110 | 112 | } |
111 | 113 |
|
112 | 114 | $tpl = new Template(get_lang('Outbox')); |
113 | | -// Block Social Avatar |
114 | | -SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages'); |
115 | 115 |
|
116 | | -if ($allowSocial) { |
117 | | - $tpl->assign('social_menu_block', $social_menu_block); |
118 | | - $tpl->assign('social_right_content', $social_right_content); |
119 | | - $social_layout = $tpl->get_template('social/inbox.tpl'); |
120 | | - $tpl->display($social_layout); |
121 | | -} else { |
122 | | - $content = $social_right_content; |
123 | | - if ($actions) { |
124 | | - $tpl->assign( |
125 | | - 'actions', |
126 | | - Display::toolbarAction('toolbar', [$actions]) |
127 | | - ); |
128 | | - } |
129 | | - $tpl->assign('content', $content); |
130 | | - $tpl->display_one_col_template(); |
| 116 | +if ($actions) { |
| 117 | + $tpl->assign( |
| 118 | + 'actions', |
| 119 | + $actions |
| 120 | + ); |
131 | 121 | } |
| 122 | + |
| 123 | +$tpl->assign('content_inbox', $message_content); |
| 124 | +$social_layout = $tpl->get_template('message/inbox.html.twig'); |
| 125 | +$content = $tpl->fetch($social_layout); |
| 126 | +$tpl->assign('message', $show_message); |
| 127 | +$tpl->assign('content', $content); |
| 128 | +$tpl->display_one_col_template(); |
| 129 | + |
0 commit comments