owner_block.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * Modbash Clean Elgg Theme
  4. *
  5. * Copyright (c) 2015 ModBash
  6. *
  7. * @author Shane Barron <admin@modbash.com>
  8. * @copyright 2015 SocialApparatus
  9. * @license GNU General Public License (GPL) version 2
  10. * @version 1
  11. * @link http://modbash.com
  12. */
  13. $user = elgg_get_page_owner_entity();
  14. if (!$user) {
  15. // no user so we quit view
  16. echo elgg_echo('viewfailure', array(__FILE__));
  17. return TRUE;
  18. }
  19. $icon = elgg_view_entity_icon($user, 'large', array(
  20. 'use_hover' => false,
  21. 'use_link' => false,
  22. 'img_class' => 'photo u-photo',
  23. ));
  24. $icon = "<img src='" . $user->getIconURL('large') . "' class='img-responsive'/>";
  25. // grab the actions and admin menu items from user hover
  26. $menu = elgg_trigger_plugin_hook('register', "menu:user_hover", array('entity' => $user), array());
  27. $builder = new ElggMenuBuilder($menu);
  28. $menu = $builder->getMenu();
  29. $actions = elgg_extract('action', $menu, array());
  30. $admin = elgg_extract('admin', $menu, array());
  31. $profile_actions = '';
  32. if (elgg_is_logged_in() && $actions) {
  33. $profile_actions = '<div class="btn-group-vertical btn-block" style="margin-top:20px;margin-bottom:20px;">';
  34. foreach ($actions as $action) {
  35. $item = elgg_view_menu_item($action, array('class' => 'btn btn-success '.$action->getItemClass()));
  36. $profile_actions .= "$item";
  37. }
  38. $profile_actions .= '</div>';
  39. }
  40. $profile_actions = elgg_view_menu('owner_block', array('entity' => $user));
  41. elgg_view('page/elements/owner_block/extend', $vars);
  42. // if admin, display admin links
  43. $admin_links = '';
  44. if (elgg_is_admin_logged_in() && elgg_get_logged_in_user_guid() != elgg_get_page_owner_guid()) {
  45. $text = elgg_echo('admin:options');
  46. $admin_links = '<ul class="nav nav-pills nav-stacked">';
  47. $admin_links .= "<li><a rel=\"toggle\" href=\"#profile-menu-admin\">$text&hellip;</a>";
  48. $admin_links .= '<ul class="profile-admin-menu" id="profile-menu-admin">';
  49. foreach ($admin as $menu_item) {
  50. $admin_links .= elgg_view('navigation/menu/elements/item', array('item' => $menu_item));
  51. }
  52. $admin_links .= '</ul>';
  53. $admin_links .= '</li>';
  54. $admin_links .= '</ul>';
  55. }
  56. // content links
  57. $content_menu = elgg_view_menu('owner_block', array(
  58. 'entity' => elgg_get_page_owner_entity(),
  59. 'class' => 'nav nav-pills nav-stacked',
  60. ));
  61. echo <<<HTML
  62. <div class="col-sm-4">
  63. $icon
  64. $profile_actions
  65. $content_menu
  66. $admin_links
  67. </div>
  68. HTML;