view_message.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. use Chamilo\CoreBundle\Framework\Container;
  4. /**
  5. * @package chamilo.messages
  6. */
  7. $cidReset= true;
  8. api_block_anonymous_users();
  9. if (api_get_setting('message.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' => Container::getRouter()->generate('fos_user_profile_edit'),'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('profile.extended_profile') == 'true') {
  25. $social_right_content .= '<div class="actions">';
  26. if (api_get_setting(
  27. 'social.allow_social_tool'
  28. ) == 'true' && api_get_setting(
  29. 'message.allow_message_tool'
  30. ) == 'true'
  31. ) {
  32. $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php">'.
  33. Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).'</a>';
  34. }
  35. if (api_get_setting('message.allow_message_tool') == 'true') {
  36. $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.
  37. Display::return_icon('message_new.png',get_lang('ComposeMessage')).'</a>';
  38. $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php">'.
  39. Display::return_icon('inbox.png',get_lang('Inbox')).'</a>';
  40. $social_right_content .= '<a href="'.api_get_path(WEB_PATH).'main/messages/outbox.php">'.
  41. Display::return_icon('outbox.png',get_lang('Outbox')).'</a>';
  42. }
  43. $social_right_content .= '</div>';
  44. }
  45. }
  46. if (empty($_GET['id'])) {
  47. $id_message = $_GET['id_send'];
  48. $source = 'outbox';
  49. $show_menu = 'messages_outbox';
  50. } else {
  51. $id_message = $_GET['id'];
  52. $source = 'inbox';
  53. $show_menu = 'messages_inbox';
  54. }
  55. $message = '';
  56. // LEFT COLUMN
  57. if (api_get_setting('social.allow_social_tool') == 'true') {
  58. //Block Social Menu
  59. $social_menu_block = SocialManager::show_social_menu($show_menu);
  60. }
  61. //MAIN CONTENT
  62. $message .= MessageManager::show_message_box($id_message, $source);
  63. if (!empty($message)) {
  64. $social_right_content .= $message;
  65. } else {
  66. api_not_allowed();
  67. }
  68. //$tpl = new Template(get_lang('View'));
  69. $tpl = \Chamilo\CoreBundle\Framework\Container::getTwig();
  70. // Block Social Avatar
  71. SocialManager::setSocialUserBlock($tpl, api_get_user_id(), $show_menu);
  72. if (api_get_setting('social.allow_social_tool') == 'true') {
  73. $tpl->addGlobal('social_menu_block', $social_menu_block);
  74. $tpl->addGlobal('social_right_content', $social_right_content);
  75. echo $tpl->render('@template_style/social/inbox.html.twig');
  76. } else {
  77. $content = $social_right_content;
  78. echo $actions;
  79. echo $content;
  80. }