view_promoted_message.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.messages
  5. */
  6. $cidReset = true;
  7. require_once __DIR__.'/../inc/global.inc.php';
  8. api_block_anonymous_users();
  9. if (api_get_setting('allow_social_tool') != 'true') {
  10. api_not_allowed(true);
  11. }
  12. $this_section = SECTION_SOCIAL;
  13. $interbreadcrumb[] = ['url' => api_get_path(WEB_PATH).'main/social/home.php', 'name' => get_lang('SocialNetwork')];
  14. $interbreadcrumb[] = ['url' => 'promoted_messages.php', 'name' => get_lang('PromotedMessages')];
  15. $social_right_content = '';
  16. $messageId = $_GET['id'];
  17. $message = '';
  18. $logInfo = [
  19. 'tool' => 'Messages',
  20. 'action' => 'promoted_messages',
  21. 'action_details' => 'view-message',
  22. ];
  23. Event::registerLog($logInfo);
  24. $social_menu_block = SocialManager::show_social_menu('inbox');
  25. $message .= MessageManager::showMessageBox($messageId, MessageManager::MESSAGE_TYPE_PROMOTED);
  26. if (!empty($message)) {
  27. $social_right_content .= $message;
  28. } else {
  29. api_not_allowed(true);
  30. }
  31. $tpl = new Template(get_lang('View'));
  32. // Block Social Avatar
  33. SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'promoted_messages');
  34. $tpl->assign('social_menu_block', $social_menu_block);
  35. $tpl->assign('social_right_content', $social_right_content);
  36. $social_layout = $tpl->get_template('social/inbox.tpl');
  37. $tpl->display($social_layout);