view_message.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.messages
  5. */
  6. $cidReset= true;
  7. require_once '../inc/global.inc.php';
  8. api_block_anonymous_users();
  9. if (api_get_setting('allow_message_tool')!='true') {
  10. api_not_allowed();
  11. }
  12. if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'social') {
  13. $this_section = SECTION_SOCIAL;
  14. $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social'));
  15. $interbreadcrumb[]= array ('url' => 'inbox.php?f=social','name' => get_lang('Inbox'));
  16. } else {
  17. $this_section = SECTION_MYPROFILE;
  18. $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/auth/profile.php','name' => get_lang('Profile'));
  19. }
  20. $social_right_content = null;
  21. if (isset($_GET['f']) && $_GET['f']=='social') {
  22. $social_parameter = '?f=social';
  23. } else {
  24. if (api_get_setting('extended_profile') == 'true') {
  25. $social_right_content .= '<div class="actions">';
  26. if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') {
  27. $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.
  28. Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'</a>';
  29. }
  30. if (api_get_setting('allow_message_tool') == 'true') {
  31. $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
  32. Display::return_icon('message_new.png',get_lang('ComposeMessage')).'</a>';
  33. $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
  34. Display::return_icon('inbox.png',get_lang('Inbox')).'</a>';
  35. $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
  36. Display::return_icon('outbox.png',get_lang('Outbox')).'</a>';
  37. }
  38. $social_right_content .= '</div>';
  39. }
  40. }
  41. if (empty($_GET['id'])) {
  42. $id_message = $_GET['id_send'];
  43. $source = 'outbox';
  44. $show_menu = 'messages_outbox';
  45. } else {
  46. $id_message = $_GET['id'];
  47. $source = 'inbox';
  48. $show_menu = 'messages_inbox';
  49. }
  50. $message = '';
  51. // LEFT COLUMN
  52. if (api_get_setting('allow_social_tool') == 'true') {
  53. //Block Social Menu
  54. $social_menu_block = SocialManager::show_social_menu($show_menu);
  55. }
  56. //MAIN CONTENT
  57. $message .= MessageManager::show_message_box($id_message, $source);
  58. if (!empty($message)) {
  59. $social_right_content .= $message;
  60. } else {
  61. api_not_allowed();
  62. }
  63. $tpl = new Template(get_lang('View'));
  64. // Block Social Avatar
  65. SocialManager::setSocialUserBlock($tpl, $user_id, $show_menu);
  66. if (api_get_setting('allow_social_tool') == 'true') {
  67. $tpl->assign('social_menu_block', $social_menu_block);
  68. $tpl->assign('social_right_content', $social_right_content);
  69. $social_layout = $tpl->get_template('social/inbox.tpl');
  70. $tpl->display($social_layout);
  71. } else {
  72. $content = $social_right_content;
  73. $tpl->assign('content', $content);
  74. $tpl->display_one_col_template();
  75. }