view_message.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. $message .='<div class="span9">';
  56. }
  57. //MAIN CONTENT
  58. $message .= MessageManager::show_message_box($id_message, $source);
  59. if (api_get_setting('allow_social_tool') == 'true') {
  60. $message .='</div>';
  61. }
  62. if (!empty($message)) {
  63. $social_right_content .= $message;
  64. } else {
  65. api_not_allowed();
  66. }
  67. $tpl = new Template(get_lang('View'));
  68. // Block Social Avatar
  69. SocialManager::setSocialUserBlock($tpl, $user_id, $show_menu);
  70. if (api_get_setting('allow_social_tool') == 'true') {
  71. $tpl->assign('social_menu_block', $social_menu_block);
  72. $tpl->assign('social_right_content', $social_right_content);
  73. $social_layout = $tpl->get_template('social/inbox.tpl');
  74. $tpl->display($social_layout);
  75. } else {
  76. $content = $social_right_content;
  77. $tpl->assign('content', $content);
  78. $tpl->display_one_col_template();
  79. }