view_message.php 3.2 KB

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