marvin.theme 5.7 KB
Newer Older
1
2
<?php
// $Id$
Dries Buytaert's avatar
   
Dries Buytaert committed
3

Dries Buytaert's avatar
   
Dries Buytaert committed
4
function marvin_help($section) {
5

Dries Buytaert's avatar
   
Dries Buytaert committed
6
  $output = "";
Dries Buytaert's avatar
   
Dries Buytaert committed
7
8
9
10
11
12
13
14
15
16

  switch ($section) {
    case 'admin/system/themes#description':
      $output = t("A PHP theme");
      break;
  }

  return $output;
}

Dries Buytaert's avatar
   
Dries Buytaert committed
17
function marvin_header() {
18
19
20
21
22
23
24

  $output  = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
  $output .= "<html>\n";
  $output .= "<head>\n";
  $output .= theme_head($main);
  $output .= "<title>";

Dries Buytaert's avatar
   
Dries Buytaert committed
25
26
  if ($title = drupal_get_title()) {
    $output .= "$title - ". variable_get("site_name", "drupal");
27
28
  }
  else {
Dries Buytaert's avatar
   
Dries Buytaert committed
29
30
    $output .= variable_get("site_name", "drupal");
    $output .= ($slogan = variable_get("site_slogan", "")) ? " - $slogan" : "";
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
  }

  $output .= "</title>\n";
  $output .= "<style type=\"text/css\">\n  @import \"themes/marvin/marvin.css\";\n</style>\n";
  $output .= "</head>\n";
  $output .= "<body ". theme_onload_attribute() .">\n";

  $output .= "<table border=\"0\" style=\"width: 100%\" cellpadding=\"8\" cellspacing=\"0\">\n";
  $output .= "  <tr>\n";
  $output .= "      <td><a href=\"". url() ."\"><img src=\"". path_to_theme() ."/images/logo.png\" style=\"border: 0px;\" alt=\"\" title=\"\" /></a></td>\n";
  $output .= "      <td>&nbsp;</td>\n";
  $output .= "  </tr>\n";
  $output .= "  <tr>\n";
  $output .= "    <td colspan=\"2\" style=\"text-align: right;\">". theme("links", link_page()) ."</td>\n";
  $output .= "  </tr>\n";
  $output .= "</table>\n";

  $output .= "<table border=\"0\" style=\"width: 100%\" cellpadding=\"8\" cellspacing=\"0\">\n";
  $output .= "  <tr>\n";

51
  $blocks = theme("blocks", "left");
52
53
54
55
56
57
58
  if ($blocks) {
    $output .= "    <td style=\"width: 200px; vertical-align: top;\">\n";
    $output .= $blocks;
    $output .= "    </td>\n";
  }
  $output .= "    <td style=\"vertical-align: top; width: 85%;\">\n";

Dries Buytaert's avatar
   
Dries Buytaert committed
59
60
61
62
63
  if ($title = drupal_get_title()) {
    $output .= theme("breadcrumb", drupal_get_breadcrumb());
    $output .= "<h2>$title</h2>";
  }

Dries Buytaert's avatar
   
Dries Buytaert committed
64
  if ($help = menu_get_active_help()) {
65
    $output .= "<small>$help</small><hr />";
Dries Buytaert's avatar
   
Dries Buytaert committed
66
67
  }

Dries Buytaert's avatar
   
Dries Buytaert committed
68
69
70
  foreach (drupal_get_messages() as $message) {
    list($message, $type) = $message;
    $output .= "<strong>". t("Status") ."</strong>: $message<hr />";
Dries Buytaert's avatar
   
Dries Buytaert committed
71
72
  }

73
  return $output;
Dries Buytaert's avatar
   
Dries Buytaert committed
74
75
}

Dries Buytaert's avatar
   
Dries Buytaert committed
76
function marvin_node($node, $main = 0, $page = 0) {
Dries Buytaert's avatar
   
Dries Buytaert committed
77

Dries Buytaert's avatar
   
Dries Buytaert committed
78
79
80
  $output = "<div class=\"node\">\n";
  if (!$page) {
    $output .= "<h2 class=\"title\">". l($node->title, "node/view/$node->nid") ."</h2>\n";
Dries Buytaert's avatar
   
Dries Buytaert committed
81
82
  }

Dries Buytaert's avatar
   
Dries Buytaert committed
83
84
85
86
  $output .= "<div class=\"submitted\">". t("Submitted by %a on %b", array("%a" => format_name($node), "%b" => format_date($node->created, "large"))) ."</div>";

  if (module_exist("taxonomy") && ($taxonomy = taxonomy_link("taxonomy terms", $node))) {
    $output .= "<div class=\"taxonomy\">". theme("links", $taxonomy) ."</div>";
Dries Buytaert's avatar
   
Dries Buytaert committed
87
  }
Dries Buytaert's avatar
   
Dries Buytaert committed
88
89

  $output .= "<div class=\"content\">";
Dries Buytaert's avatar
   
Dries Buytaert committed
90
91

  if ($main && $node->teaser) {
Dries Buytaert's avatar
   
Dries Buytaert committed
92
    $output .= $node->teaser;
Dries Buytaert's avatar
   
Dries Buytaert committed
93
94
  }
  else {
Dries Buytaert's avatar
   
Dries Buytaert committed
95
    $output .= $node->body;
Dries Buytaert's avatar
   
Dries Buytaert committed
96
  }
Dries Buytaert's avatar
   
Dries Buytaert committed
97

Dries Buytaert's avatar
   
Dries Buytaert committed
98
  $output .= "</div>\n";
Dries Buytaert's avatar
   
Dries Buytaert committed
99
100

  if ($links = link_node($node, $main)) {
Dries Buytaert's avatar
   
Dries Buytaert committed
101
    $output .= "<div class=\"links\">". theme("links", $links) ."</div>\n";
Dries Buytaert's avatar
   
Dries Buytaert committed
102
103
  }

Dries Buytaert's avatar
   
Dries Buytaert committed
104
105
  $output .= "</div>\n";

106
  return $output;
Dries Buytaert's avatar
   
Dries Buytaert committed
107

Dries Buytaert's avatar
   
Dries Buytaert committed
108
109
110
111
}

function marvin_comment($comment, $link = "") {
  // Create comment header:
112
113
114
115
116
117
118
119
  $output = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"background-color: #000000; width: 100%;\">\n";
  $output .= " <tr style=\"background-color: #000000;\">\n";
  $output .= "  <td>\n";
  $output .= "   <table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" style=\"width: 100%;\">\n";
  $output .= "    <tr>\n";
  $output .= "     <td style=\"background-color: #eaeaea;\">\n";
  $output .= "      <table border=\"0\" cellpadding=\"2\" cellspacing=\"1\" style=\"width: 100%;\">\n";
  $output .= "       <tr>\n";
Dries Buytaert's avatar
   
Dries Buytaert committed
120
121

  // Subject:
122
123
  $output .= "        <td style=\"text-align: right; width: 5%;\"><strong>". t("Subject") .":</strong></td>\n";
  $output .= "        <td style=\"width: 80%;\"><strong><div style=\"color: #666699;\">$comment->subject</div></strong></td>\n";
Dries Buytaert's avatar
   
Dries Buytaert committed
124

125
  $output .= "       </tr>\n";
Dries Buytaert's avatar
   
Dries Buytaert committed
126
127

  // Author:
128
129
130
  $output .= "       <tr>\n";
  $output .= "        <td style=\"text-align: right; vertical-align: top;\">". t("Author") .":</td><td>". format_name($comment) ."</td>\n";
  $output .= "       </tr>\n";
Dries Buytaert's avatar
   
Dries Buytaert committed
131
132

  // Date
133
134
135
  $output .= "       <tr>\n";
  $output .= "        <td style=\"text-align: right;\">". t("Date") .":</td><td>". format_date($comment->timestamp) ."</td>\n";
  $output .= "       </tr>\n";
Dries Buytaert's avatar
   
Dries Buytaert committed
136

137
138
139
  $output .= "      </table>\n";
  $output .= "     </td>\n";
  $output .= "    </tr>\n";
Dries Buytaert's avatar
   
Dries Buytaert committed
140
141
142

  // Print body of comment:
  if ($comment->comment) {
143
    $output .= "    <tr><td style=\"background-color: #ffffff;\">$comment->comment</td></tr>\n";
Dries Buytaert's avatar
   
Dries Buytaert committed
144
145
146
  }

  // Print bottom link(s):
Dries Buytaert's avatar
   
Dries Buytaert committed
147
  $output .= "    <tr><td style=\"background-color: #eaeaea; text-align: right;\">$link</td></tr>\n";
148
149
150
151
152
153
154
  $output .= "   </table>\n";
  $output .= "  </td>\n";
  $output .= " </tr>\n";
  $output .= "</table>\n";
  $output .= "<br />\n\n";

  return $output;
Dries Buytaert's avatar
   
Dries Buytaert committed
155
156
157
158
159
160
161
}

function marvin_links($links, $delimiter = " &middot; ") {
  return implode($delimiter, $links);
}

function marvin_footer() {
162
  $output  = "    </td>\n";
163
  $blocks = theme("blocks", "right");
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
  if ($blocks) {
    $output .= "    <td style=\"width: 200px; vertical-align: top;\">\n";
    $output .= $blocks;
    $output .= "    </td>\n";
  }
  $output .= "  </tr>\n</table>";
  $output .= "<table border=\"0\" style=\"width: 100%\" cellpadding=\"8\" cellspacing=\"0\">\n";
  $output .= "  <tr>\n";
  $output .= "    <td colspan=\"2\" style=\"text-align: center;\">";
  $output .= "<p>". theme("links", link_page()) ."</p><p>". variable_get("site_footer", "") ."</p>\n";
  $output .= "    </td>\n";
  $output .= "  </tr>\n";
  $output .= "</table>\n";
  $output .= theme_closure();
  $output .= "</body>\n</html>\n";

  return $output;
Dries Buytaert's avatar
   
Dries Buytaert committed
181
}
Dries Buytaert's avatar
   
Dries Buytaert committed
182
?>