2009-07-06 11:31:40 +00:00
|
|
|
<?php
|
2009-07-21 06:36:12 +00:00
|
|
|
/**
|
|
|
|
* A class to turn a Page data structure into a blob of HTML
|
|
|
|
*/
|
2019-05-28 16:59:38 +00:00
|
|
|
class Layout
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* turns the Page into HTML
|
|
|
|
*/
|
2019-08-02 19:54:48 +00:00
|
|
|
public function display_page(Page $page, array $nav_links)
|
2019-05-28 16:59:38 +00:00
|
|
|
{
|
|
|
|
global $config;
|
2009-07-06 11:31:40 +00:00
|
|
|
|
2019-08-02 19:40:03 +00:00
|
|
|
//$theme_name = $config->get_string(SetupConfig::THEME, 'default');
|
2019-05-28 16:59:38 +00:00
|
|
|
//$data_href = get_base_href();
|
|
|
|
$contact_link = contact_link();
|
|
|
|
$header_html = $page->get_all_html_headers();
|
2009-07-06 11:31:40 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$left_block_html = "";
|
|
|
|
$main_block_html = "";
|
|
|
|
$sub_block_html = "";
|
2009-07-06 11:31:40 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
foreach ($page->blocks as $block) {
|
|
|
|
switch ($block->section) {
|
|
|
|
case "left":
|
|
|
|
$left_block_html .= $block->get_html(true);
|
|
|
|
break;
|
|
|
|
case "main":
|
|
|
|
$main_block_html .= $block->get_html(false);
|
|
|
|
break;
|
|
|
|
case "subheading":
|
|
|
|
$sub_block_html .= $block->get_html(false);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
print "<p>error: {$block->header} using an unknown section ({$block->section})";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-07-06 11:31:40 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$debug = get_debug_info();
|
2009-07-06 11:31:40 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
|
2009-07-06 11:31:40 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$wrapper = "";
|
|
|
|
if (strlen($page->heading) > 100) {
|
|
|
|
$wrapper = ' style="height: 3em; overflow: auto;"';
|
|
|
|
}
|
2009-07-06 11:31:40 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$flash = $page->get_cookie("flash_message");
|
|
|
|
$flash_html = "";
|
|
|
|
if ($flash) {
|
|
|
|
$flash_html = "<b id='flash'>".nl2br(html_escape($flash))." <a href='#' onclick=\"\$('#flash').hide(); return false;\">[X]</a></b>";
|
|
|
|
}
|
2012-06-09 16:00:25 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
print <<<EOD
|
2012-03-05 10:14:58 +00:00
|
|
|
<!doctype html>
|
|
|
|
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
|
|
|
|
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
|
|
|
|
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
|
|
|
|
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
|
2009-07-06 11:31:40 +00:00
|
|
|
<head>
|
|
|
|
<title>{$page->title}</title>
|
|
|
|
$header_html
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
2012-03-11 16:18:37 +00:00
|
|
|
<header>
|
|
|
|
<h1$wrapper>{$page->heading}</h1>
|
|
|
|
$sub_block_html
|
|
|
|
</header>
|
|
|
|
<nav>
|
|
|
|
$left_block_html
|
|
|
|
</nav>
|
|
|
|
<article>
|
2012-06-09 16:00:25 +00:00
|
|
|
$flash_html
|
2012-03-11 16:18:37 +00:00
|
|
|
$main_block_html
|
|
|
|
</article>
|
|
|
|
<footer>
|
2009-07-06 11:31:40 +00:00
|
|
|
Images © their respective owners,
|
2018-09-26 21:49:37 +00:00
|
|
|
<a href="https://code.shishnet.org/shimmie2/">Shimmie</a> ©
|
|
|
|
<a href="https://www.shishnet.org/">Shish</a> &
|
2014-02-25 17:40:07 +00:00
|
|
|
<a href="https://github.com/shish/shimmie2/graphs/contributors">The Team</a>
|
2019-06-12 22:36:36 +00:00
|
|
|
2007-2019,
|
2009-07-06 11:31:40 +00:00
|
|
|
based on the Danbooru concept.
|
|
|
|
$debug
|
|
|
|
$contact
|
2012-03-11 16:18:37 +00:00
|
|
|
</footer>
|
2009-07-06 11:31:40 +00:00
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
EOD;
|
2019-05-28 16:59:38 +00:00
|
|
|
}
|
2009-07-06 11:31:40 +00:00
|
|
|
}
|