Skip to content

Commit 76ce21e

Browse files
committed
fix inbox templates
1 parent cac717b commit 76ce21e

File tree

5 files changed

+55
-79
lines changed

5 files changed

+55
-79
lines changed

assets/js/app.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -368,19 +368,6 @@ $(function() {
368368
placement: 'right'
369369
};
370370
$('.boot-tooltip').tooltip(tip_options);
371-
// var more = '{{ 'SeeMore' | get_lang | escape('js') }}';
372-
// var close = '{{ 'Close' | get_lang | escape('js') }}';
373-
374-
var more = 'see more';
375-
var close = 'close';
376-
// readmore dont work with jquery3
377-
// $('.list-teachers').readmore({
378-
// speed: 75,
379-
// moreLink: '<a href="#">' + more + '</a>',
380-
// lessLink: '<a href="#">' + close + '</a>',
381-
// collapsedHeight: 35,
382-
// blockCSS: 'display: block; width: 100%;'
383-
// });
384371

385372
$('.star-rating li a').on('click', function(event) {
386373
var id = $(this).parents('ul').attr('id');

main/messages/inbox.php

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
$nameTools = get_lang('Messages');
3737
$show_message = null;
38+
$messageContent = null;
39+
3840
if (isset($_GET['form_reply']) || isset($_GET['form_delete'])) {
3941
$info_reply = [];
4042
$info_delete = [];
@@ -72,12 +74,12 @@
7274
if (isset($user_reply) && !is_null($user_id_by_email) && strlen($info_reply[0]) > 0) {
7375
MessageManager::send_message($user_id_by_email, $title, $content);
7476
$show_message .= MessageManager::return_message($user_id_by_email, 'confirmation');
75-
$social_right_content .= MessageManager::inbox_display();
77+
$messageContent .= MessageManager::inbox_display();
7678
exit;
7779
} elseif (is_null($user_id_by_email)) {
7880
$message_box = get_lang('ErrorSendingMessage');
7981
$show_message .= Display::return_message(api_xml_http_response_encode($message_box), 'error');
80-
$social_right_content .= MessageManager::inbox_display();
82+
$messageContent .= MessageManager::inbox_display();
8183
exit;
8284
}
8385
} elseif (trim($info_delete[0]) == 'delete') {
@@ -89,7 +91,7 @@
8991
}
9092
$message_box = get_lang('SelectedMessagesDeleted');
9193
$show_message .= Display::return_message(api_xml_http_response_encode($message_box));
92-
$social_right_content .= MessageManager::inbox_display();
94+
$messageContent .= MessageManager::inbox_display();
9395
exit;
9496
}
9597
}
@@ -126,15 +128,8 @@
126128
Display::return_icon('outbox.png', get_lang('Outbox')).'</a>';
127129
}
128130

129-
// LEFT CONTENT
130-
$social_menu_block = '';
131-
if ($allowSocial) {
132-
// Block Social Menu
133-
$social_menu_block = SocialManager::show_social_menu('messages');
134-
}
135-
136131
// Right content
137-
$social_right_content = '';
132+
138133
$keyword = '';
139134
if ($allowSocial) {
140135
$actionsLeft = '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
@@ -148,11 +143,11 @@
148143
$keyword = $values['keyword'];
149144
}
150145
$actionsRight = $form->returnForm();
151-
$social_right_content .= Display::toolbarAction('toolbar', [$actionsLeft, $actionsRight]);
146+
$toolbar = Display::toolbarAction('toolbar', [$actionsLeft, $actionsRight]);
152147
}
153148

154149
if (!isset($_GET['del_msg'])) {
155-
$social_right_content .= MessageManager::inbox_display($keyword);
150+
$messageContent .= MessageManager::inbox_display($keyword);
156151
} else {
157152
$num_msg = (int) $_POST['total'];
158153
for ($i = 0; $i < $num_msg; $i++) {
@@ -164,7 +159,7 @@
164159
);
165160
}
166161
}
167-
$social_right_content .= MessageManager::inbox_display();
162+
$messageContent .= MessageManager::inbox_display();
168163
}
169164

170165
$tpl = new Template(null);
@@ -173,15 +168,11 @@
173168
$tpl->assign('actions', Display::toolbarAction('toolbar', [$actions]));
174169
}
175170
// Block Social Avatar
176-
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
177-
if (api_get_setting('allow_social_tool') == 'true') {
178-
$tpl->assign('social_menu_block', $social_menu_block);
179-
$tpl->assign('social_right_content', $social_right_content);
180-
$social_layout = $tpl->get_template('social/inbox.tpl');
181-
$tpl->display($social_layout);
182-
} else {
183-
$content = $social_right_content;
171+
172+
$tpl->assign('content_inbox', $messageContent);
173+
$social_layout = $tpl->get_template('social/inbox.html.twig');
174+
$content = $tpl->fetch($social_layout);
184175
$tpl->assign('message', $show_message);
176+
$tpl->assign('actions', $toolbar);
185177
$tpl->assign('content', $content);
186178
$tpl->display_one_col_template();
187-
}

main/messages/outbox.php

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
$allowSocial = api_get_setting('allow_social_tool') == 'true';
2626
$allowMessage = api_get_setting('allow_message_tool') == 'true';
27+
$show_message = null;
2728

2829
if (isset($_GET['messages_page_nr'])) {
2930
if ($allowSocial && $allowMessage) {
@@ -48,40 +49,41 @@
4849
'name' => get_lang('Messages'),
4950
];
5051

51-
$actions = '';
52+
$actions = null;
53+
5254
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">'.
5456
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">'.
5658
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">'.
5860
Display::return_icon('outbox.png', get_lang('Outbox')).'</a>';
5961
}
6062

6163
$action = null;
64+
6265
if (isset($_REQUEST['action'])) {
6366
$action = $_REQUEST['action'];
6467
}
6568

6669
$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(
8179
'toolbar',
82-
[$actionsLeft, $actionsRight]
80+
[
81+
$actionsLeft,
82+
$actionsRight
83+
]
8384
);
84-
}
85+
$message_content = null;
86+
8587
//MAIN CONTENT
8688
if ($action == 'delete') {
8789
$delete_list_id = [];
@@ -98,34 +100,30 @@
98100
);
99101
}
100102
$delete_list_id = [];
101-
$social_right_content .= MessageManager::outbox_display($keyword);
103+
$message_content .= MessageManager::outbox_display($keyword);
102104
} elseif ($action == 'deleteone') {
103105
$delete_list_id = [];
104106
$id = Security::remove_XSS($_GET['id']);
105107
MessageManager::delete_message_by_user_sender(api_get_user_id(), $id);
106108
$delete_list_id = [];
107-
$social_right_content .= MessageManager::outbox_display($keyword);
109+
$message_content .= MessageManager::outbox_display($keyword);
108110
} else {
109-
$social_right_content .= MessageManager::outbox_display($keyword);
111+
$message_content .= MessageManager::outbox_display($keyword);
110112
}
111113

112114
$tpl = new Template(get_lang('Outbox'));
113-
// Block Social Avatar
114-
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
115115

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+
);
131121
}
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+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{% autoescape false %}
2+
{{ content_inbox }}
3+
{% endautoescape %}

src/ThemeBundle/Resources/views/Layout/header.html.twig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,6 @@ $(function () {
8585
{{ "Course catalog"|trans }}
8686
</a>
8787
</li>
88-
<li>
89-
[[ chamilo ]]
90-
</li>
9188
<form class="form-inline my-2 my-lg-0">
9289
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
9390
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>

0 commit comments

Comments
 (0)