admin.module 1.88 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")) {
40
    menu("admin", t("administer"), NULL, NULL, 9);
Dries's avatar
 
Dries committed
41 42 43
  }
}

Dries's avatar
 
Dries committed
44
function admin_page() {
Dries's avatar
 
Dries committed
45
  if (user_access("access administration pages")) {
Dries's avatar
 
Dries committed
46 47
    theme("header");

48
    if ($help = menu_get_active_help()) {
Dries's avatar
 
Dries committed
49 50 51
      $contents = "<small>$help</small><hr />";
    }
    if (arg(1)) {
Dries's avatar
 
Dries committed
52
      $contents .= menu_execute_active_handler();
Dries's avatar
 
Dries committed
53 54 55 56 57 58
    }
    else {
      $contents.= watchdog_overview("actions");
      $title = t("System messages");
    }

Dries's avatar
 
Dries committed
59
    $breadcrumb = menu_get_active_breadcrumb();
Dries's avatar
 
Dries committed
60
    array_pop($breadcrumb);
61
    $title = menu_get_active_title();
Dries's avatar
 
Dries committed
62 63 64 65

    theme("breadcrumb", $breadcrumb);
    theme("box", $title, $contents);
    theme("footer");
Dries's avatar
 
Dries committed
66 67
  }
  else {
Dries's avatar
 
Dries committed
68 69 70
    theme("header");
    theme("box", t("Access denied"), message_access());
    theme("footer");
Dries's avatar
 
Dries committed
71 72 73 74
  }
}

?>