view_promoted_message.php 1.3 KB

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