Fix missing END:VCALENDAR.
[davical.git] / inc / page-header.php
blobea87eee55cbb952cc0e36c33fd1efe05f397fb64
1 <?php
3 if ( !isset($c->page_title) ) {
4 $c->page_title = translate('DAViCal CalDAV Server');
7 function make_help_link($matches)
9 global $c;
11 // as usual: $matches[0] is the complete match
12 // $matches[1] the match for the first subpattern
13 // enclosed in '##...##' and so on
14 // Use like: $s = preg_replace_callback('/##([^#]+)##', 'make_help_link', $s);
15 // $help_topic = preg_replace( '/^##(.+)##$/', '$1', $matches[1]);
16 $help_topic = $matches[1];
17 $display_url = $help_topic;
18 if ( $GLOBALS['session']->AllowedTo('Admin') || $GLOBALS['session']->AllowedTo('Support') ) {
19 if ( strlen($display_url) > 30 ) {
20 $display_url = substr( $display_url, 0, 28 ) . '...' ;
23 else {
24 $display_url = 'help';
26 return ' <a class="help" href="'.$c->base_url.'/help.php?h='.$help_topic.'" title="'.translate('Show help on').' &39;'.$help_topic.'&39;" target="_new">['.$display_url.']</a> ';
30 if ( !function_exists('send_page_header') ) {
31 function send_page_header() {
32 global $session, $c, $main_menu, $related_menu;
34 header( 'Content-type: text/html; charset="utf-8"' );
36 echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
37 echo <<<EOHDR
38 <html>
39 <head>
40 <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
41 <title>$c->page_title</title>
43 EOHDR;
45 foreach ( $c->stylesheets AS $stylesheet ) {
46 echo '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'">';
48 if ( isset($c->local_styles) ) {
49 // Always load local styles last, so they can override prior ones...
50 foreach ( $c->local_styles AS $stylesheet ) {
51 echo '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'">';
55 if ( isset($c->print_styles) ) {
56 // Finally, load print styles last, so they can override all of the above...
57 foreach ( $c->print_styles AS $stylesheet ) {
58 echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$stylesheet\" media=\"print\">\n";
62 echo "</head>\n<body>\n";
63 echo "<div id=\"pageheader\">\n";
65 if ( isset($main_menu) ) echo $main_menu->RenderAsCSS();
66 if ( isset($related_menu) && $related_menu->Size() > 0 ) {
67 echo $related_menu->Render( true );
70 echo "</div>\n";
72 if ( isset($c->messages) && is_array($c->messages) && count($c->messages) > 0 ) {
73 echo "<div id=\"messages\"><ul class=\"messages\">\n";
74 foreach( $c->messages AS $i => $msg ) {
75 // ##HelpTextKey## gets converted to a "/help.phph=HelpTextKey" link
76 $msg = preg_replace_callback("/##([^#]+)##/", "make_help_link", translate($msg));
77 echo "<li class=\"messages\">$msg</li>\n";
79 echo "</ul>\n</div>\n";
85 send_page_header();