main views, plus crappy logo

This commit is contained in:
tmont 2008-10-17 05:14:48 +00:00
parent 934acc18bd
commit e0bcc0003b
9 changed files with 212 additions and 4 deletions

View File

@ -31,6 +31,9 @@
case 'PanaceaPageView':
case 'PanaceaTemplateView':
case 'PanaceaHeaderView':
case 'PanaceaLogoView':
case 'PanaceaMenuView':
$file = "$path/lib/views/$className.php";
break;
}

View File

@ -55,7 +55,7 @@
try {
$templateView = new PanaceaTemplateView($this->page);
$templateView->addView($this->viewFactory->getView($this->page));
$templateView->addView($this->viewFactory->getView($this->page, $templateView->getNextPriority()));
return $templateView;
}
catch (ClassNotFoundException $e) {

View File

@ -43,7 +43,7 @@
* @throws {@link ClassNotFoundException}
* @return View
*/
public function getView($page) {
public function getView($page, $priority = 0) {
if (!is_string($page)) {
throw new InvalidTypeException(1, 'string', $page);
}

View File

@ -0,0 +1,60 @@
<?php
/**
* PanaceaHeaderView
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-16
*/
/** Bootstraps the NowhereConcave framework */
require_once 'NowhereConcave/bootstrap.php';
/**
* Header view of <i>Panacea</i>
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-16
*/
class PanaceaHeaderView extends View {
/**
* Creates a view for the header
*
* @author Tommy Montgomery
* @since 2008-10-16
* @uses PanaceaLogoView
* @uses PanaceaMenuView
*
* @param int $priority The priority of the view
*/
public function __construct($priority = 1) {
parent::__construct($priority);
$this->addView(new PanaceaLogoView(1));
$this->addView(new PanaceaMenuView(2));
}
/**
* Renders the view
*
* @author Tommy Montgomery
* @since 2008-10-16
*/
public function send() { ?>
<div id="head">
<?php parent::send(); ?>
</div>
<?php
}
}
?>

View File

@ -0,0 +1,42 @@
<?php
/**
* PanaceaLogoView
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-16
*/
/** Bootstraps the NowhereConcave framework */
require_once 'NowhereConcave/bootstrap.php';
/**
* Logo view of <i>Panacea</i>
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-16
*/
class PanaceaLogoView extends View {
/**
* Renders the view
*
* @author Tommy Montgomery
* @since 2008-10-16
*/
public function send() { ?>
<div id="logo">
<img alt="Panacea" src="/panacea/src/media/images/logo2.png"/>
</div>
<?php
}
}
?>

View File

@ -0,0 +1,49 @@
<?php
/**
* PanaceaLogoView
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-16
*/
/** Bootstraps the NowhereConcave framework */
require_once 'NowhereConcave/bootstrap.php';
/**
* Menu view of <i>Panacea</i>
*
* @package Panacea
* @subpackage Views
* @author Tommy Montgomery
* @since 2008-10-16
*/
class PanaceaMenuView extends View {
/**
* Renders the view
*
* @author Tommy Montgomery
* @since 2008-10-16
*/
public function send() { ?>
<div id="menu">
<ul>
<li><a href="#">Item #1</a></li>
<li><a href="#">Item #2</a></li>
<li><a href="#">Item #3</a></li>
<li><a href="#">Item #4</a></li>
<li><a href="#">Item #5</a></li>
</ul>
<div style="clear:left"></div>
</div>
<?php
}
}
?>

View File

@ -30,7 +30,7 @@
*
* @param string $title The title of the page
*/
public function __construct($title = 'Home') {
public function __construct($title = '') {
if (!is_string($title)) {
throw new InvalidTypeException(1, 'string', $title);
}
@ -38,7 +38,9 @@
parent::__construct();
$this->defaultTitle = 'Panacea';
$this->title = (!empty($title)) ? $title : 'Home';
$this->title = (!empty($title)) ? $title : 'It doesn\'t suck';
$this->addView(new PanaceaHeaderView(1));
}
/**
@ -54,6 +56,21 @@
return parent::getMetaData()->addCss('/panacea/src/media/css/global.css');
}
/**
* Gets the next default priority
*
* @author Tommy Montgomery
* @since 2008-10-16
*/
public function getNextPriority() {
$priority = 1;
foreach ($this->views as $view) {
$priority = max($priority, $view->priority);
}
return $priority + 1;
}
/**
* Renders the view
*

View File

@ -6,4 +6,41 @@ body {
font-family: Verdana, Arial, sans-serif;
font-size: 8pt;
color: #000000;
}
#wrapper {
}
#head {
}
#logo {
width: 535px;
height: 173px;
margin: auto;
}
#menu {
border-top: 2px solid #000000;
border-bottom: 2px solid #000000;
}
#menu ul {
list-style-type: none;
margin: 0;
padding: 0;
}
#menu ul li {
float: left;
}
#menu ul li a {
display: block;
width: 10em;
height: 2em;
font-size: 1.5em;
line-height: 1.5em;
font-weight: bold;
margin-right: 1px;
text-decoration: none;
}

BIN
src/media/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB