promoted_messages.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. $cidReset = true;
  4. require_once __DIR__.'/../inc/global.inc.php';
  5. api_protect_admin_script();
  6. if (api_get_setting('allow_social_tool') !== 'true') {
  7. api_not_allowed(true);
  8. }
  9. $logInfo = [
  10. 'tool' => 'Messages',
  11. 'action' => 'promoted_messages_list',
  12. ];
  13. Event::registerLog($logInfo);
  14. $this_section = SECTION_SOCIAL;
  15. $interbreadcrumb[] = [
  16. 'url' => api_get_path(WEB_CODE_PATH).'social/home.php',
  17. 'name' => get_lang('Social network'),
  18. ];
  19. $interbreadcrumb[] = [
  20. 'url' => api_get_path(WEB_CODE_PATH).'social/promoted_messages.php',
  21. 'name' => get_lang('PromotedMessages'),
  22. ];
  23. $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('List')];
  24. $menu = SocialManager::show_social_menu('messages');
  25. // Right content
  26. $social_right_content = '';
  27. $keyword = '';
  28. $actionsLeft = '<a href="'.api_get_path(WEB_CODE_PATH).'social/new_promoted_message.php">'.
  29. Display::return_icon('new-message.png', get_lang('Compose message'), [], 32).'</a>';
  30. $form = MessageManager::getSearchForm(api_get_self());
  31. if ($form->validate()) {
  32. $values = $form->getSubmitValues();
  33. $keyword = $values['keyword'];
  34. }
  35. $actionsRight = $form->returnForm();
  36. $social_right_content .= Display::toolbarAction('toolbar', [$actionsLeft, $actionsRight]);
  37. $social_right_content .= MessageManager::getPromotedMessagesGrid($keyword);
  38. $tpl = new Template(null);
  39. // Block Social Avatar
  40. SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
  41. $tpl->assign('social_menu_block', $menu);
  42. $tpl->assign('social_right_content', $social_right_content);
  43. $social_layout = $tpl->get_template('social/inbox.tpl');
  44. $tpl->display($social_layout);