admin_display_main

4.x admin.module admin_display_main()

This is the "main" page for the admin module. It's what the user first sees when the click to go to the Admin page.

File

modules/admin/admin.module, line 1458
The administrative configurations for FlightPath.

Code

function admin_display_main() {
  $de_catalog_year = admin_get_de_catalog_year(FALSE);

  // Has the system cron been run recently?
  $cron_last_run = variable_get("cron_last_run", 0);
  if ($cron_last_run < strtotime("-7 DAY")) {
    // Warn admin that they need to have cron set up!  It's been over a week!
    fpm(t("Your system's cron process hasn't run in over a week.  In order for FlightPath
            to continue to function properly, a cron process much be configured.
            You may @run_link or see the @status_link page for instructions.", array(
      "@status_link" => l(t("System status"), "admin/config/status"),
      "@run_link" => l(t("run cron now"), "admin/config/run-cron"),
    )));
  }


  $rtn = "";

  fp_add_css(fp_get_module_path("admin") . "/css/admin.css");
  fp_add_js(fp_get_module_path("admin") . "/js/admin.js");

  $rtn .= "<h2>" . t("FlightPath Admin Console - Main Menu") . "</h2>";
  $rtn .= "<table class='fp-semester-table' cellpadding='5'>
           <tr>
            <td valign='top' width='50%'>
              " . fp_render_menu_block(t("System Configuration"), "admin/config") . "
            </td>
            <td valign='top' width='50%'>
              ";


  // Advising Settings
  $rtn .= fp_render_curved_line("Advising Settings");
  $rtn .= "<div class='admin-advising-settings'>
             
       <ul>
        <li>" . t("Available terms for advising: %v", array("%v" => variable_get("available_advising_term_ids", ""))) . "</li>
        <li>" . t("Default advising term: %v", array("%v" => variable_get("advising_term_id", ""))) . "</li>          
        <li>" . t("Current catalog year: %v", array("%v" => variable_get("current_catalog_year", ""))) . "</li>       
        <li>" . t("Current draft catalog year: %v", array("%v" => variable_get("current_draft_catalog_year", ""))) . "</li>             
        <li>" . t("Not released grades terms: %v", array("%v" => variable_get("not_released_grades_terms", ""))) . "</li>             
        
      </ul>";

  if (user_has_permission("can_edit_advising_settings")) {
    $rtn .= l(t("Edit Advising Settings"), "admin/edit-advising-settings");
  }

  $rtn .= "</div>";




  $rtn .= "</td>
                        
           </tr>";
  $rtn .= "</table><br>"; // close table


  $settings = fp_get_system_settings();

  if (user_has_permission("can_access_data_entry")) {
    $rtn .= fp_render_curved_line("Data Entry");

    $rtn .= "<div class='data-entry-cats'>";

    // Have a pulldown here of years, then use javascript to hide/show relavant groups.
    $rtn .= "&nbsp; &nbsp; &nbsp; " . t("Select a catalog year") . ": <select id='data-entry-select-cats' onChange='adminHideDECats();'>";
    $selected_cat = ($de_catalog_year != "") ? $de_catalog_year : $settings["current_catalog_year"];

    for ($t = $settings["current_catalog_year"] + 1; $t >= $settings["earliest_catalog_year"]; $t--) {
      $sel = ($t == $selected_cat) ? "selected" : "";
      $rtn .= "<option value='$t' $sel>$t-" . ($t + 1) . "</option>";
    }
    $rtn .= "</select>";

    for ($t = $settings["current_catalog_year"] + 1; $t >= $settings["earliest_catalog_year"]; $t--) {
      $rtn .= "<ul class='data-entry-for-cat data-entry-for-cat-$t'>";
      $rtn .= "<li>" . l(t("Degree plans for @year", array("@year" => "$t-" . ($t + 1))), "admin/degrees", "de_catalog_year=$t") . "</li>";
      $rtn .= "<li>" . l(t("Groups for @year", array("@year" => "$t-" . ($t + 1))), "admin/groups", "de_catalog_year=$t") . "</li>";
      $rtn .= "<li>" . l(t("Courses for @year", array("@year" => "$t-" . ($t + 1))), "admin/courses", "de_catalog_year=$t") . "</li>";
      $rtn .= "</ul>";
    }

    if (user_has_permission("can_edit_data_entry")) {
      $rtn .= "<b>" . t("Administrator function:") . "</b><ul>
              <li>" . l(t("Duplicate entire year worth of data to new year"), "admin/duplicate-year") . "</li>
                </ul>";
    }


    $rtn .= "</div>";

    // Draft changes?
    $res = db_query("SELECT * FROM draft_instructions");
    if (db_num_rows($res) > 0) {
      $rtn .= "<div class='draft-changes-waiting-msg'>
                      " . t("Draft changes have been made which have yet to be applied.
                      When you are ready for your draft changes to appear in
                      production, click the link below.") . "</div>";
    }
    $rtn .= "<ul class='data-entry-draft-waiting'>
              <li>" . l(t("Apply draft changes"), "admin/apply-draft-changes") . "</li>
           </ul>";

  }










  return $rtn;
}