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(); } else { $num_msg = intval($_POST['total']); for ($i = 0; $i < $num_msg; $i++) { if ($_POST[$i]) { //the user_id was necesarry to delete a message?? Display::addFlash(MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_POST['_' . $i])); } } $social_right_content .= MessageManager::inbox_display(); } if (api_get_setting('social.allow_social_tool') == 'true') { $social_right_content .= '</div>'; } $tpl = \Chamilo\CoreBundle\Framework\Container::getTwig(); // Block Social Avatar SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages'); if (api_get_setting('social.allow_social_tool') == 'true') { $tpl->addGlobal('social_menu_block', $social_menu_block); $tpl->addGlobal('social_right_content', $social_right_content); echo $tpl->render('@template_style/social/inbox.html.twig'); } else {
/** * @return string */ static function outbox_display() { $social_link = false; if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'social') { $social_link = 'f=social'; } $success = get_lang('SelectedMessagesDeleted') . ' </b><br /><a href="outbox.php?' . $social_link . '">' . get_lang('BackToOutbox') . '</a>'; $html = null; if (isset($_REQUEST['action'])) { switch ($_REQUEST['action']) { case 'delete': $number_of_selected_messages = count($_POST['id']); if ($number_of_selected_messages != 0) { foreach ($_POST['id'] as $index => $message_id) { MessageManager::delete_message_by_user_receiver(api_get_user_id(), $message_id); } } $html .= Display::return_message(api_xml_http_response_encode($success), 'normal', false); break; case 'deleteone': MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']); $html .= Display::return_message(api_xml_http_response_encode($success), 'normal', false); $html .= '<br/>'; break; } } // display sortable table with messages of the current user $table = new SortableTable('message_outbox', array('MessageManager', 'get_number_of_messages_sent'), array('MessageManager', 'get_message_data_sent'), 3, 20, 'DESC'); $parameters['f'] = isset($_GET['f']) && $_GET['f'] == 'social' ? 'social' : null; $table->set_additional_parameters($parameters); $table->set_header(0, '', false, array('style' => 'width:15px;')); $table->set_header(1, get_lang('Messages'), false); $table->set_header(2, get_lang('Date'), true, array('style' => 'width:160px;')); $table->set_header(3, get_lang('Modify'), false, array('style' => 'width:70px;')); $table->set_form_actions(array('delete' => get_lang('DeleteSelectedMessages'))); $html .= $table->return_table(); return $html; }
$social_right_content .= '<div class="actions">'; $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/new_message.php?f=social">' . Display::return_icon('compose_message.png', get_lang('ComposeMessage'), array(), 32) . '</a>'; $social_right_content .= '<a href="' . api_get_path(WEB_PATH) . 'main/messages/outbox.php?f=social">' . Display::return_icon('outbox.png', get_lang('Outbox'), array(), 32) . '</a>'; $social_right_content .= '</div>'; $social_right_content .= '</div>'; $social_right_content .= '<div class="col-md-12">'; } //MAIN CONTENT if (!isset($_GET['del_msg'])) { $social_right_content .= MessageManager::inbox_display(); } else { $num_msg = intval($_POST['total']); for ($i = 0; $i < $num_msg; $i++) { if ($_POST[$i]) { //the user_id was necesarry to delete a message?? $show_message .= MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_POST['_' . $i]); } } $social_right_content .= MessageManager::inbox_display(); } if (api_get_setting('allow_social_tool') == 'true') { $social_right_content .= '</div>'; } $tpl = new Template(null); // Block Social Avatar SocialManager::setSocialUserBlock($tpl, $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);