[251] | 1 | <?php |
---|
| 2 | /** |
---|
| 3 | * technikum29v6 Page Template |
---|
| 4 | * |
---|
| 5 | * Global vars: |
---|
| 6 | * $lang = de | en |
---|
| 7 | * $seiten_id = kurzkennung der aktuellen seite |
---|
| 8 | * $root = Seiten-Root fuer URLs ($root/de, $root/shared, etc.) |
---|
[254] | 9 | * $titel = Seitentitel |
---|
| 10 | * $header_cache_file, $footer_cache_file. |
---|
[251] | 11 | **/ |
---|
[254] | 12 | |
---|
| 13 | class t29Template { |
---|
[255] | 14 | public $conf, $menu, $msg; |
---|
| 15 | public $body_classes = array(); |
---|
| 16 | public $javascript_config = array(); |
---|
[259] | 17 | public $page_relations, $interlang_links; |
---|
[255] | 18 | |
---|
[254] | 19 | function __construct($conf_array) { |
---|
| 20 | $this->conf = $conf_array; |
---|
[255] | 21 | |
---|
[254] | 22 | // create a menu: |
---|
| 23 | require_once $this->conf['lib'].'/menu.php'; |
---|
| 24 | $this->menu = new t29Menu($this->conf); |
---|
[255] | 25 | |
---|
| 26 | // create localisation class: |
---|
| 27 | require_once $this->conf['lib'].'/messages.php'; |
---|
| 28 | $this->msg = new t29Messages($this->conf['lang']); |
---|
| 29 | |
---|
[259] | 30 | // fill up configuration |
---|
| 31 | $this->conf['legal_pagename'] = $this->conf['lang_path'] . $this->msg->_('footer-legal-file'); |
---|
| 32 | |
---|
[255] | 33 | // setup body classes: |
---|
| 34 | $this->body_classes[] = "lang-" . $this->conf['lang']; |
---|
| 35 | $this->body_classes[] = "page-" . $this->conf['seiten_id']; |
---|
| 36 | |
---|
| 37 | // setup javascript configuration |
---|
| 38 | $this->javascript_config['lang'] = $this->conf['lang']; |
---|
| 39 | $this->javascript_config['seiten_id'] = $this->conf['seiten_id']; |
---|
[259] | 40 | |
---|
| 41 | // get all kind of relations |
---|
| 42 | $this->page_relations = $this->menu->get_page_relations(); |
---|
| 43 | $this->interlang_links = $this->menu->get_interlanguage_link(); |
---|
[261] | 44 | |
---|
| 45 | // check and load additional css |
---|
| 46 | $this->conf['pagecss'] = '/shared/css-v6/pagestyles/'.$this->conf['seiten_id'].'.css'; |
---|
| 47 | $this->conf['has_pagecss'] = file_exists($this->conf['webroot'].$this->conf['pagecss']); |
---|
| 48 | // FIXME: There is no caching check yet for this setting |
---|
| 49 | // (new pagecss file won't be detected and wont purge the tmpl cache) |
---|
[254] | 50 | } |
---|
| 51 | |
---|
| 52 | /** |
---|
| 53 | * Main caching and output system. |
---|
| 54 | * Parameters (global configuration): |
---|
| 55 | * skip_cache - if true, skips writing output to cache file |
---|
| 56 | * purge_cache - if true, forces creation of new cache file |
---|
| 57 | * (does not change behaviour of this file's code) |
---|
| 58 | **/ |
---|
[264] | 59 | function create_cache($cache_object) { |
---|
| 60 | $cache_object->start_cache(array($this, 'print_footer')); |
---|
[254] | 61 | $this->print_header(); |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | function print_header() { |
---|
[259] | 65 | $p = $this->msg->get_shorthand_printer(); |
---|
| 66 | $_ = $this->msg->get_shorthand_returner(); |
---|
[251] | 67 | ?> |
---|
| 68 | <!doctype html> |
---|
[255] | 69 | <html class="no-js" lang="<?php echo $this->conf['lang']; ?>"> |
---|
[251] | 70 | <head> |
---|
| 71 | <meta charset="utf-8"> |
---|
[261] | 72 | <title><?php echo isset($this->conf['titel']) ? $this->conf['titel'].' - ' : ''; $p('html-title'); ?></title> |
---|
[251] | 73 | <meta name="description" content="Produziert am 08.01.2012"> |
---|
| 74 | <meta name="author" content="Sven"> |
---|
[264] | 75 | <meta name="generator" content="t29v6"> |
---|
[254] | 76 | <meta name="t29.cachedate" content="<?php print date('r'); ?>"> |
---|
[264] | 77 | <?php |
---|
| 78 | if(isset($this->conf['version'])) printf('<meta name="t29.version" content="%s">', $this->conf['version']); |
---|
| 79 | ?> |
---|
[259] | 80 | |
---|
| 81 | <?php |
---|
| 82 | foreach(array_merge(array("first" => t29Menu::dom_new_link($this->conf['lang_path'], $_('head-rel-first'))), |
---|
| 83 | $this->page_relations) as $rel => $a) { |
---|
| 84 | if($rel == 'start') continue; // not in standard |
---|
| 85 | printf("\n <link rel='%s' href='%s' title='%s' />", |
---|
[266] | 86 | $rel, $a['href'], sprintf($_('head-rel-'.$rel), $this->relational_link_to_string($a)) |
---|
[259] | 87 | ); |
---|
| 88 | } |
---|
| 89 | ?> |
---|
| 90 | |
---|
| 91 | <link rel="copyright" href="<?php echo $this->conf['legal_pagename']; ?>" title="<?php $p('footer-legal-link'); ?>"> |
---|
| 92 | <?php |
---|
| 93 | // print interlanguage links for all languages except the active one |
---|
| 94 | foreach($this->interlang_links as $lang => $a) { |
---|
| 95 | if($lang != $this->conf['lang']) { |
---|
| 96 | printf('<link rel="alternate" href="%s" hreflang="%s" title="%s">', |
---|
| 97 | $a['href'], $lang, sprintf($_('head-rel-interlang'), $a) |
---|
| 98 | ); |
---|
| 99 | } |
---|
| 100 | } |
---|
| 101 | ?> |
---|
| 102 | |
---|
[251] | 103 | <meta name="viewport" content="width=device-width,initial-scale=1"> |
---|
| 104 | <link rel="stylesheet" href="/shared/css-v6/boiler.css"> |
---|
| 105 | <link rel="stylesheet" href="/shared/css-v6/style.css"> |
---|
| 106 | <link rel="stylesheet" href="/shared/css/common.css"> |
---|
[261] | 107 | <?php |
---|
| 108 | if($this->conf['has_pagecss']) |
---|
| 109 | printf('<link rel="stylesheet" href="%s">', $this->conf['pagecss']); |
---|
| 110 | ?> |
---|
[251] | 111 | |
---|
| 112 | <script src="/shared/js-v6/libs/modernizr-2.0.6.min.js"></script> |
---|
| 113 | </head> |
---|
| 114 | |
---|
[255] | 115 | <body class="<?php echo implode(' ', $this->body_classes) ?>"> |
---|
[251] | 116 | <div id="footer-background-container"><!-- helper --> |
---|
| 117 | <div id="container"> |
---|
[259] | 118 | <h1 role="banner"><a href="/" title="<?php $p('head-h1-title'); ?>"><?php $p('head-h1'); ?></a></h1> |
---|
[251] | 119 | <div id="background-color-container"><!-- helper --> |
---|
| 120 | <section class="main content" role="main" id="content"> |
---|
| 121 | <!--<header class="teaser"> |
---|
| 122 | <h2 id="pdp8L">Wissenschaftliche Rechner und Minicomputer</h2> |
---|
| 123 | <img width=880 src="http://www.technikum29.de/shared/photos/rechnertechnik/univac/panorama-rechts.jpg"> |
---|
| 124 | </header>--> |
---|
[254] | 125 | <!-- start content --> |
---|
[251] | 126 | <?php |
---|
| 127 | } // function print_header(). |
---|
| 128 | |
---|
[259] | 129 | function print_footer() { |
---|
| 130 | $p = $this->msg->get_shorthand_printer(); |
---|
| 131 | $_ = $this->msg->get_shorthand_returner(); |
---|
| 132 | ?> |
---|
[254] | 133 | <!-- end content --> |
---|
[251] | 134 | </section> |
---|
| 135 | <hr> |
---|
[265] | 136 | <section class="sidebar top"> |
---|
[255] | 137 | <h2 class="visuallyhidden"><?php $p("sidebar-h2-tour"); ?></h2> |
---|
[251] | 138 | <nav class="side"> |
---|
[255] | 139 | <?php $this->menu->print_menu(t29Menu::sidebar_menu); ?> |
---|
[251] | 140 | </nav> |
---|
[255] | 141 | <!-- menu changing buttons are made with javascript --> |
---|
[251] | 142 | </section> |
---|
[265] | 143 | <section class="sidebar bottom"> |
---|
| 144 | <!-- inhalte die unten ueber dem header sind --> |
---|
| 145 | </section> |
---|
[251] | 146 | </div><!-- div id="background-color-container" helper end --> |
---|
| 147 | <hr> |
---|
| 148 | <header class="banner"> |
---|
[255] | 149 | <h2 class="visuallyhidden"><?php $p("sidebar-h2-mainnav"); ?></h2> |
---|
[251] | 150 | <nav class="horizontal"> |
---|
[255] | 151 | <?php $this->menu->print_menu(t29Menu::horizontal_menu); ?> |
---|
[251] | 152 | </nav> |
---|
| 153 | <nav class="top"> |
---|
[255] | 154 | <h3 class="visuallyhidden"><?php $p("sidebar-h2-lang"); ?></h3> |
---|
[251] | 155 | <ul> |
---|
[255] | 156 | <?php |
---|
[259] | 157 | foreach($this->interlang_links as $lang => $a) { |
---|
[255] | 158 | printf("\t\t\t\t<li%s><a href='%s' title='%s'>%s</a></li>\n", |
---|
[259] | 159 | ($lang == $this->conf['lang'] ? ' class="active"' : ''), |
---|
| 160 | $a['href'], sprintf($_('topnav-interlang-title'), $a), |
---|
| 161 | $this->conf['languages'][$lang][0] // verbose language name |
---|
[255] | 162 | ); |
---|
| 163 | } |
---|
| 164 | ?> |
---|
[251] | 165 | </ul> |
---|
[268] | 166 | <form method="get" action="<?php $p('topnav-search-page'); ?>"> |
---|
| 167 | <span class="no-js"><?php $p('topnav-search-label'); ?>:</span> |
---|
| 168 | <input type="text" value="" data-defaultvalue="<?php $p('topnav-search-label'); ?>" name="q" class="text"> |
---|
| 169 | <input type="submit" value="<? $p('topnav-search-label'); ?>" class="button"> |
---|
[251] | 170 | </form> |
---|
| 171 | </nav> |
---|
| 172 | </header> |
---|
| 173 | <hr> |
---|
| 174 | <footer> |
---|
| 175 | <nav class="guide"> |
---|
| 176 | <!-- hier wird nav.side die Liste per JS reinkopiert --> |
---|
| 177 | </nav> |
---|
| 178 | <nav class="rel clearfix"> |
---|
| 179 | <ul> |
---|
[259] | 180 | <?php |
---|
| 181 | foreach($this->page_relations as $rel => $a) { |
---|
| 182 | printf("\t<li class='%s'><a href='%s' title='%s'>%s <strong>%s</strong></a>\n", |
---|
[266] | 183 | $rel, $a['href'], sprintf($_('head-rel-'.$rel), $this->relational_link_to_string($a)), |
---|
| 184 | $_('nav-rel-'.$rel), $this->relational_link_to_string($a) |
---|
[259] | 185 | ); |
---|
| 186 | } |
---|
| 187 | ?> |
---|
[251] | 188 | </ul> |
---|
| 189 | </nav> |
---|
| 190 | <div class="right"> |
---|
[252] | 191 | <img src="/shared/img-v6/logo.footer.png" title="technikum29 Logo" alt="Logo" class="logo"> |
---|
[255] | 192 | <?php $p('footer-copyright-tag'); ?> |
---|
| 193 | <br/><?php printf('<a href="%s">%s</a>', $this->conf['legal_pagename'], $_('footer-legal-link')); ?> |
---|
[252] | 194 | <div class="icons"> |
---|
[255] | 195 | <a href="<?php echo $this->conf['legal_pagename']; ?>#image-copyright"><img src="/shared/img-v6/cc-icon.png"></a> |
---|
[254] | 196 | <!--<a href="http://ufopixel.de" title="Designed by Ufopixel"><img src="http://svenk.homeip.net/dropbox/Ufopixel/Ufopixel-Design/logo_90x30/ufopixel_logo_90x30_version2.png"></a>--> |
---|
[251] | 197 | </div> |
---|
| 198 | <!--CC<br>Viele Bilder können unter einer CreativeCommons-Lizenz |
---|
| 199 | verwendet werden. Erkundigen Sie sich.--> |
---|
| 200 | </div> |
---|
| 201 | </footer> |
---|
| 202 | </div> <!--! end of #container --> |
---|
| 203 | |
---|
| 204 | |
---|
| 205 | <!-- JavaScript at the bottom for fast page loading --> |
---|
| 206 | |
---|
| 207 | <!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline --> |
---|
[260] | 208 | <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> |
---|
| 209 | <script>window.jQuery || document.write('<script src="/shared/js-v6/libs/jquery-1.7.2.min.js"><\/script>')</script> |
---|
[251] | 210 | |
---|
[260] | 211 | <script>window.t29={'conf': <?php print json_encode($this->javascript_config); ?>};</script> |
---|
[269] | 212 | <script src="/lib/ressourceloader.php?type=js"></script> |
---|
[251] | 213 | </div><!-- end of div id="footer-background-container" helper --> |
---|
| 214 | </body> |
---|
| 215 | </html> |
---|
| 216 | <?php |
---|
[254] | 217 | } // function print_footer() |
---|
| 218 | |
---|
[266] | 219 | // Hilfsfunktionen |
---|
| 220 | private function relational_link_to_string($a) { |
---|
| 221 | // wenn es bei einem relationalen Link einen Titel gibt, diesen ausgeben, ansonsten die |
---|
| 222 | // Linkbeschreibung. Die Links sind XML-Elemente in der Navigation. |
---|
| 223 | return isset($a['title']) ? $a['title'] : $a; |
---|
| 224 | } |
---|
| 225 | |
---|
[254] | 226 | } // class t29Template |
---|