function admin_display_main
Search API
7.x admin.module | admin_display_main() |
6.x admin.module | admin_display_main() |
4.x admin.module | admin_display_main() |
5.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 1869 - The administrative configurations for FlightPath.
Code
function admin_display_main() {
// Use default_school.
$de_catalog_year = admin_get_de_catalog_year(FALSE, 0);
// 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 .= "<table class='fp-semester-table admin-display-main-table' cellpadding='5'>
<tr>
<td valign='top' class='system-configuration-left'>
" . fp_render_menu_block(t("System Configuration"), "admin/config") . "
</td>
<td valign='top' class='advising-settings-right'>
";
// Advising Settings
$rtn .= fp_render_section_title("Advising Settings", "admin-advising-settings");
$defs = array(0 => '');
if (module_enabled("schools")) {
$defs = schools_get_school_definitions();
}
foreach ($defs as $school_id => $school_name) {
$rtn .= "<div class='admin-advising-settings'><!--SCHOOL_NAME-->
<ul>
<li>" . t("Available terms for advising: %v", array("%v" => fp_space_csv(variable_get_for_school("available_advising_term_ids", "", $school_id)))) . "</li>
<li>" . t("Default advising term: %v", array("%v" => fp_space_csv(variable_get_for_school("advising_term_id", "", $school_id)))) . "</li>
<li>" . t("Current catalog year: %v", array("%v" => variable_get_for_school("current_catalog_year", "", $school_id))) . "</li>
<li>" . t("Current draft catalog year: %v", array("%v" => variable_get_for_school("current_draft_catalog_year", "", $school_id))) . "</li>
<li>" . t("Not released grades terms: %v", array("%v" => fp_space_csv(variable_get_for_school("not_released_grades_terms", "", $school_id)))) . "</li>
</ul>";
$url_suffix = "";
if (intval($school_id) != 0) {
$url_suffix .= "/" . $school_id;
}
if (user_has_permission("can_edit_advising_settings")) {
$rtn .= l("<i class='fa fa-pencil'></i> " . t("Edit Advising Settings") . "<!--SCHOOL_EDIT_LINK-->", "admin/edit-advising-settings" . $url_suffix);
}
if ($school_name) {
$rtn = str_replace("<!--SCHOOL_NAME-->", "<label>" . $school_name . "</label>", $rtn);
$rtn = str_replace("<!--SCHOOL_EDIT_LINK-->", t(" for ") . "<em>$school_name</em>", $rtn);
}
$rtn .= "</div>";
} // foreach
$rtn .= "</td>
</tr>";
$rtn .= "</table><br>"; // close table
// TODO: Similar to the advising settings, do we just loop for each school?
$current_catalog_year = variable_get("current_catalog_year", 2006); // TODO: how to figure out school?
$earliest_catalog_year = variable_get("earliest_catalog_year", 2006); // TODO: how to figure out school?
if (user_has_permission("can_access_data_entry")) {
$rtn .= fp_render_section_title("Degree & Course Management", "degree-course-management");
$rtn .= "<div class='data-entry-cats'>";
// Have a pulldown here of years, then use javascript to hide/show relavant groups.
$rtn .= " " . t("Select a catalog year") . ": <select id='data-entry-select-cats' onChange='adminHideDECats();'>";
$selected_cat = ($de_catalog_year != "") ? $de_catalog_year : $current_catalog_year;
for ($t = $current_catalog_year + 1; $t >= $earliest_catalog_year; $t--) {
$sel = ($t == $selected_cat) ? "selected" : "";
$rtn .= "<option value='$t' $sel>$t-" . ($t + 1) . "</option>";
}
$rtn .= "</select>";
for ($t = $current_catalog_year + 1; $t >= $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;
}