walled_garden.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Walled garden page shell
  4. *
  5. * Used for the walled garden index page
  6. *
  7. * @uses $vars['head'] Parameters for the <head> element
  8. * @uses $vars['body'] The main content of the page
  9. * @uses $vars['sysmessages'] A 2d array of various message registers, passed from system_messages()
  10. */
  11. $is_sticky_register = elgg_is_sticky_form('register');
  12. $wg_body_class = 'elgg-body-walledgarden';
  13. $inline_js = '';
  14. if ($is_sticky_register) {
  15. $wg_body_class .= ' hidden';
  16. $inline_js = <<<__JS
  17. <script type="text/javascript">
  18. elgg.register_hook_handler('init', 'system', function() {
  19. $('.registration_link').trigger('click');
  20. });
  21. </script>
  22. __JS;
  23. }
  24. // render content before head so that JavaScript and CSS can be loaded. See #4032
  25. $messages = elgg_view('page/elements/messages', array('object' => $vars['sysmessages']));
  26. $content = $vars["body"];
  27. $body = <<<__BODY
  28. <div class="elgg-page elgg-page-walledgarden">
  29. <div class="elgg-page-messages">
  30. $messages
  31. </div>
  32. <div class="$wg_body_class">
  33. $content
  34. </div>
  35. </div>
  36. __BODY;
  37. $body .= elgg_view('page/elements/foot');
  38. $body .= $inline_js;
  39. $head = elgg_view('page/elements/head', $vars['head']);
  40. echo elgg_view("page/elements/html", array("head" => $head, "body" => $body));