admin.module 2.15 KB
Newer Older
Dries's avatar
 
Dries committed
1 2 3 4 5 6 7 8 9 10 11
<?php
// $Id$

include_once "includes/common.inc";

function status($message) {
  if ($message) {
    return "<b>Status:</b> $message<hr />\n";
  }
}

Dries's avatar
 
Dries committed
12 13 14 15
function admin_help($section) {
  $output = "";

  switch ($section) {
Dries's avatar
 
Dries committed
16
    case "admin/system/modules":
Dries's avatar
 
Dries committed
17 18
      $output .= "Handles the administration pages.";
      break;
Dries's avatar
 
Dries committed
19
    case "admin":
Dries's avatar
 
Dries committed
20 21
      $output .= "Welcome to the administration section. Below are the most recent system events.  To get started please choose an item in the left column. If there is an arrow it will expand into a submenu. To jump up a level use the link,bread crumbs, above this block of text. To return to the home page click on the site name, and to go to Drupal's home page click on Druplicon, the drop on to the right.";
      break;
Dries's avatar
 
Dries committed
22
    case "admin":
Dries's avatar
 
Dries committed
23 24 25 26 27
      $output = "This is a complete overview of the site administration page.";
      break;
  }
  return t($output);
}
Dries's avatar
 
Dries committed
28

Dries's avatar
 
Dries committed
29
function admin_system($field){
Dries's avatar
 
Dries committed
30
  $output = "";
Dries's avatar
 
Dries committed
31 32 33
  if ($field == "description") {
    $output = admin_help("admin/system/modules");
  }
Dries's avatar
 
Dries committed
34 35

  return $output;
Dries's avatar
 
Dries committed
36 37
}

Dries's avatar
 
Dries committed
38
function admin_link($type) {
Dries's avatar
Dries committed
39
  if ($type == "system" && user_access("access administration pages")) {
Dries's avatar
 
Dries committed
40
    menu("admin", t("administer %a", array("%a" => variable_get("site_name", "drupal"))) , NULL, NULL, 9);
Dries's avatar
 
Dries committed
41
    menu("admin/overview", "sitemap", "overview_callback", admin_help("admin/overview"), 8);
Dries's avatar
 
Dries committed
42 43 44
  }
}

Dries's avatar
 
Dries committed
45
function overview_callback() {
Dries's avatar
 
Dries committed
46
  return menu_map();
Dries's avatar
 
Dries committed
47 48
}

Dries's avatar
 
Dries committed
49
function admin_admin() {
Dries's avatar
 
Dries committed
50
  return menu_map();
Dries's avatar
 
Dries committed
51 52
}

Dries's avatar
 
Dries committed
53

Dries's avatar
 
Dries committed
54
function admin_page() {
Dries's avatar
 
Dries committed
55
  if (user_access("access administration pages")) {
Dries's avatar
 
Dries committed
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
    if (!isset($GLOBALS["_gmenu"])) {
      menu_build("system");
    }
    if ($help = menu_help()) {
      $contents = "<small>$help</small><hr />";
    }
    if (arg(1)) {
      $contents .= menu_execute_action();
    }
    else {
      $contents.= watchdog_overview("actions");
      $title = t("System messages");
    }

    $breadcrumb = menu_path();
    array_pop($breadcrumb);
    $title = menu_title();

    theme("header");
    theme("breadcrumb", $breadcrumb);
    theme("box", $title, $contents);
    theme("footer");
Dries's avatar
 
Dries committed
78 79
  }
  else {
Dries's avatar
 
Dries committed
80 81 82
    theme("header");
    theme("box", t("Access denied"), message_access());
    theme("footer");
Dries's avatar
 
Dries committed
83 84 85 86
  }
}

?>