function fp_display_page

7.x theme.inc fp_display_page($page)
6.x theme.inc fp_display_page($page)
4.x theme.inc fp_display_page($page)
5.x theme.inc fp_display_page($page)

Output the contents of the $page variable to the screen. $page is an array containing details about the page, as well as its original menu item (router_item) definition.

3 calls to fp_display_page()
display_access_denied in includes/theme.inc
display_not_found in includes/theme.inc
index.php in ./index.php
The primary entry point for FlightPath.

File

includes/theme.inc, line 114

Code

function fp_display_page($page) {

  global $current_student_id, $screen;
  $page_title = $page ["title"];
  if (@$GLOBALS ["fp_set_title"] != "") {
    $page_title = $GLOBALS ["fp_set_title"];
  }

  if (!is_object($screen)) {
    $screen = new AdvisingScreen("", null, "not_advising");
  }
  $screen->page_title = $page_title;
  $screen->page_has_search = @$page ["router_item"]["page_settings"]["page_has_search"];

  // Add some body classes to the page for this student.
  $student = $screen->student;
  if (!is_object($student)) {
    $student = new Student();
    $student->student_id = $current_student_id;
    $student->load_student_data();
  }
  if (is_object($student)) {
    fp_add_body_class("student-rank-$student->db_rank  student-catalog-year-$student->catalog_year");
  }

  // If we don't have permission to search, then hide the little search.
  if (!user_has_permission("display_search_subtab")) {
    $screen->page_has_search = FALSE;
  }

  // mobile screens never have the search box
  if (fp_screen_is_mobile()) {
    $screen->page_has_search = FALSE;
  }

  $screen->page_banner_is_link = @$page ["router_item"]["page_settings"]["page_banner_is_link"];
  $screen->page_hide_report_error = @$page ["router_item"]["page_settings"]["page_hide_report_error"];
  $screen->page_is_popup = @$page ["router_item"]["page_settings"]["page_is_popup"];
  if (isset($page ["router_item"]["page_settings"]["screen_mode"])) {
    $screen->screen_mode = $page ["router_item"]["page_settings"]["screen_mode"];
  }
  if (isset($page ["router_item"]["page_settings"]["bool_print"])) {
    $screen->bool_print = $page ["router_item"]["page_settings"]["bool_print"];
  }

  if (@$_REQUEST ["scroll_top"] != "") {
    $screen->page_scroll_top = $_REQUEST ["scroll_top"];
  }

  // If there is a SESSION var for scroll_top, use that instead, then wipe it.
  if (@$_SESSION ['scroll_top'] != "") {
    $screen->page_scroll_top = $_SESSION ["scroll_top"];
    $_SESSION ['scroll_top'] = "";
    unset($_SESSION ['scroll_top']);
  }

  // Was this page a tab?  And if so, are there any other tabs we need to display? //
  if (@$page ["router_item"]["type"] == MENU_TYPE_TAB || @$page ["router_item"]["tab_parent"] != "") {
    // We know we should have at least 1 tab for this page.
    $tab_array = fp_build_tab_array($page);
    $screen->page_tabs = fp_render_tab_array($tab_array);
  }

  // Should we override the page_tabs with what is in "fp_set_page_tabs" ?
  if (isset($GLOBALS ["fp_set_page_tabs"]) && is_array($GLOBALS ["fp_set_page_tabs"])) {
    //fpm($GLOBALS["fp_set_page_tabs"]);
    $screen->page_tabs = fp_render_tab_array($GLOBALS ["fp_set_page_tabs"]);
  }


  // Build up the content //

  $content_top = "";
  $page_show_title = @$page ["router_item"]["page_settings"]["page_show_title"];
  if (isset($GLOBALS ["fp_set_show_title"])) {
    $page_show_title = $GLOBALS ["fp_set_show_title"];
  }

  if ($page_show_title == TRUE) {
    $content_top .= "<h2 class='title'>" . $page_title . "</h2>";
  }

  if (@$page ["router_item"]["page_settings"]["display_greeting"] == TRUE) {
    $content_top .= fp_render_greeting();
  }

  $c = 0;

  // Are there any "menu_link"s for this?  In order words, little links at the top of the page,
  // where breadcrumbs might appear.
  if (!$screen->bool_print && @is_array($page ["router_item"]["page_settings"]["menu_links"])) {
    $content_top .= "<ul class='top-menu-links'>";
    foreach ($page ["router_item"]["page_settings"]["menu_links"] as $item) {
      $lclass = "";
      if ($c == 0) {
        $lclass = 'first';
      }

      $p = menu_convert_replacement_pattern(@$item ["path"]);
      $q = menu_convert_replacement_pattern(@$item ["query"]);
      $t = @$item ["text"];
      $a = @$item ["attributes"];
      if (!is_array($a)) {
        $a = array();
      }

      // Make sure the current user has access to view this link.  Otherwise, do not even
      // bother showing it.
      $test_item = menu_get_item($p);
      if (!menu_check_user_access($test_item)) {
        continue;
      }


      $content_top .= "<li class='$lclass'>" . l($t, $p, $q, $a) . "</li>";
      $c++;
    }
    $content_top .= "</ul>";
  }


  if (!$screen->bool_print) {
    // Any sub-tabs we need to render?
    if (@$page ["router_item"]["type"] == MENU_TYPE_SUB_TAB) {
      $sub_tab_array = fp_build_sub_tab_array($page);
      $content_top .= fp_render_sub_tab_array($sub_tab_array);
    }

    // Should we override the page sub-tabs with what is in "fp_set_page_sub_tabs" ?
    if (isset($GLOBALS ["fp_set_page_sub_tabs"]) && is_array($GLOBALS ["fp_set_page_sub_tabs"])) {
      $content_top .= fp_render_sub_tab_array($GLOBALS ["fp_set_page_sub_tabs"]);
    }
  }


  // If there are "messages" waiting, then let's add them to the top of content.
  if (@count($_SESSION ["fp_messages"]) > 0) {
    $content_top .= "<div class='fp-messages'>";
    foreach ($_SESSION ["fp_messages"] as $key => $tmsg) {
      $type = $tmsg ["type"];
      $message = $tmsg ["msg"];
      $content_top .= "<div class='fp-message fp-message-$type'>$message</div>";
    }
    $content_top .= "</div>";
    unset($_SESSION ["fp_messages"]);
  }

  // content_top gets the Currently Advising box.
  if (@$page ["router_item"]["page_settings"]["display_currently_advising"] == TRUE) {
    $content_top .= fp_render_currently_advising_box(false, $screen->bool_blank, $screen->bool_print, NULL, $screen->screen_mode);
  }

  $screen->page_content = $content_top .= $page ["content"];
  // If there are CSS files to add, add those.


  // Add in the body classes
  $screen->page_body_classes .= " " . @$GLOBALS ["fp_add_body_classes"];

  // Add in our URL  (after we sanitize it appropriately)
  $class = @$_REQUEST ['q'];
  $class = str_replace("'", '', $class);
  $class = str_replace('"', '', $class);
  $class = str_replace('(', '', $class);
  $class = str_replace(')', '', $class);
  $class = str_replace(';', '', $class);
  $class = str_replace('.', '', $class);
  $class = str_replace('<', '', $class);
  $class = str_replace('>', '', $class);
  $class = str_replace('/', '', $class);
  $class = str_replace('\\', '', $class);
  $class = str_replace('#', '', $class);
  $class = str_replace('&', '', $class);

  $screen->page_body_classes .= " page-" . str_replace("/", "-", $class);


  $screen->output_to_browser();
}