function _AdvisingScreen::output_to_browser

4.x _AdvisingScreen.php _AdvisingScreen::output_to_browser()
5.x _AdvisingScreen.php _AdvisingScreen::output_to_browser()

This method outputs the screen to the browser by performing an include(path-to-theme-file.php). All necessary information must be placed into certain variables before the include happens.

File

classes/_AdvisingScreen.php, line 273

Class

_AdvisingScreen

Code

function output_to_browser() 
 {
  // This method will output the screen to the browser.
  // outputs the $page_content variable.

  $page_content = $this->page_content;
  $page_tabs = $this->page_tabs;
  $page_has_search = $this->page_has_search;
  $page_on_load = $this->page_on_load;
  $page_scroll_top = $this->page_scroll_top;
  $page_is_popup = $this->page_is_popup;
  $page_title = $this->page_title;
  $page_body_classes = $this->page_body_classes;

  $page_extra_js_files = "";
  $page_extra_js_settings = "";
  $page_extra_css_files = "";

  if ($page_title == "") {
    // By default, page title is this...
    $page_title = $GLOBALS ["fp_system_settings"]["school_initials"] . " FlightPath";
  }


  $page_hide_report_error = $this->page_hide_report_error;

  $print_option = "";
  if ($this->bool_print == true) {
    $print_option = "print_";
  }

  if ($this->page_is_mobile == true) {
    $print_option = "mobile_";
  }

  // A dummy query-string is added to filenames, to gain control over
  // browser-caching. The string changes on every update or full cache
  // flush, forcing browsers to load a new copy of the files, as the
  // URL changed.
  $page_css_js_query_string = variable_get('css_js_query_string', '0');


  // Add extra JS files.    
  if (is_array($GLOBALS ["fp_extra_js"]) && count($GLOBALS ["fp_extra_js"]) > 0) {
    foreach ($GLOBALS ["fp_extra_js"] as $js_file_name) {
      $page_extra_js_files .= "<script type='text/javascript' src='$js_file_name?$page_css_js_query_string'></script> \n";
    }
  }



  // Load any extra CSS files which addon modules might have added.
  if (isset($GLOBALS ["fp_extra_css"]) && is_array($GLOBALS ["fp_extra_css"]) && count($GLOBALS ["fp_extra_css"]) > 0) {
    foreach ($GLOBALS ["fp_extra_css"] as $css_file_name) {
      $page_extra_css_files .= "<link rel='stylesheet' type='text/css' href='$css_file_name?$page_css_js_query_string' /> \n";
    }
  }


  // Javascript settings...
  $page_extra_js_settings .= "var FlightPath = new Object();   \n";
  $page_extra_js_settings .= " FlightPath.settings = new Object();   \n";
  foreach ($GLOBALS ["fp_extra_js_settings"] as $key => $val) {
    $page_extra_js_settings .= "FlightPath.settings.$key = '$val';  \n";
  }

  // Scrolling somewhere?  Add it to the page_on_load...    
  if (trim($page_scroll_top != "")) {
    $page_on_load .= " scrollTo(0, $page_scroll_top);";
  }

  // Add in our hidden divs which we will sometimes display...
  $page_content .= "<div id='updateMsg' class='updateMsg' style='display: none;'>" . t("Updating...") . "</div>
								<div id='loadMsg' class='updateMsg' style='display: none;'>" . t("Loading...") . "</div>";


  // We are going to try to include the theme.  If it can't be found, we will display a CORE theme, and display a message.
  $template_filename = $GLOBALS ["fp_system_settings"]["theme"] . "/fp_" . $print_option . "template.php";
  if (!file_exists($template_filename)) {
    print "<p><b>Theme Error:</b> Tried to load template from: $template_filename, but this file could not be found.
                <br>This is possibly because either the filename or the directory specified does not exist.
                <br>Contact site administrator.</p>";
    $template_filename = "themes/fp5_clean" . "/fp_" . $print_option . "template.php";
  }

  include ($template_filename);
}