0) {
MessageManager::send_message($user_id_by_email, $title, $content);
$show_message .= MessageManager::return_message($user_id_by_email, 'confirmation');
$social_right_content .= MessageManager::inbox_display();
exit;
} elseif (is_null($user_id_by_email)) {
$message_box = get_lang('ErrorSendingMessage');
$show_message .= Display::return_message(api_xml_http_response_encode($message_box), 'error');
$social_right_content .= MessageManager::inbox_display();
exit;
}
} elseif (trim($info_delete[0]) == 'delete') {
for ($i = 1; $i <= $count_delete; $i++) {
MessageManager::delete_message_by_user_receiver(
api_get_user_id(),
$info_delete[$i]
);
}
$message_box = get_lang('SelectedMessagesDeleted');
$show_message .= Display::return_message(api_xml_http_response_encode($message_box));
$social_right_content .= MessageManager::inbox_display();
exit;
}
}
if ($allowSocial) {
$this_section = SECTION_SOCIAL;
$interbreadcrumb[] = [
'url' => api_get_path(WEB_PATH).'main/social/home.php',
'name' => get_lang('SocialNetwork')
];
} else {
$this_section = SECTION_MYPROFILE;
$interbreadcrumb[] = [
'url' => api_get_path(WEB_PATH).'main/auth/profile.php',
'name' => get_lang('Profile')
];
}
$interbreadcrumb[] = [
'url' => api_get_path(WEB_PATH).'main/messages/inbox.php',
'name' => get_lang('Messages')
];
$interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Inbox')];
$actions = '';
// 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')).'';
}
// LEFT CONTENT
$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).'';
$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);
} else {
$num_msg = intval($_POST['total']);
for ($i = 0; $i < $num_msg; $i++) {
if ($_POST[$i]) {
//the user_id was necessary to delete a message??
$show_message .= MessageManager::delete_message_by_user_receiver(
api_get_user_id(),
$_POST['_'.$i]
);
}
}
$social_right_content .= MessageManager::inbox_display();
}
$tpl = new Template(null);
if ($actions) {
$tpl->assign('actions', Display::toolbarAction('toolbar', [$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();
}