diff --git a/src/bootstrap.php b/src/bootstrap.php index 768ff81..bff6a5f 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -31,6 +31,9 @@ case 'PanaceaPageView': case 'PanaceaTemplateView': + case 'PanaceaHeaderView': + case 'PanaceaLogoView': + case 'PanaceaMenuView': $file = "$path/lib/views/$className.php"; break; } diff --git a/src/lib/PanaceaPageController.php b/src/lib/PanaceaPageController.php index 42a7844..b3309bc 100644 --- a/src/lib/PanaceaPageController.php +++ b/src/lib/PanaceaPageController.php @@ -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) { diff --git a/src/lib/PanaceaViewFactory.php b/src/lib/PanaceaViewFactory.php index 173a59b..6fba135 100644 --- a/src/lib/PanaceaViewFactory.php +++ b/src/lib/PanaceaViewFactory.php @@ -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); } diff --git a/src/lib/views/PanaceaHeaderView.php b/src/lib/views/PanaceaHeaderView.php new file mode 100644 index 0000000..4b020fd --- /dev/null +++ b/src/lib/views/PanaceaHeaderView.php @@ -0,0 +1,60 @@ +Panacea + * + * @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() { ?> + + + \ No newline at end of file diff --git a/src/lib/views/PanaceaLogoView.php b/src/lib/views/PanaceaLogoView.php new file mode 100644 index 0000000..a7f172e --- /dev/null +++ b/src/lib/views/PanaceaLogoView.php @@ -0,0 +1,42 @@ +Panacea + * + * @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() { ?> + + + \ No newline at end of file diff --git a/src/lib/views/PanaceaMenuView.php b/src/lib/views/PanaceaMenuView.php new file mode 100644 index 0000000..1de0fc6 --- /dev/null +++ b/src/lib/views/PanaceaMenuView.php @@ -0,0 +1,49 @@ +Panacea + * + * @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() { ?> + + + \ No newline at end of file diff --git a/src/lib/views/PanaceaTemplateView.php b/src/lib/views/PanaceaTemplateView.php index 142fbaa..c98a4b0 100644 --- a/src/lib/views/PanaceaTemplateView.php +++ b/src/lib/views/PanaceaTemplateView.php @@ -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 * diff --git a/src/media/css/global.css b/src/media/css/global.css index 3875bd3..7131538 100644 --- a/src/media/css/global.css +++ b/src/media/css/global.css @@ -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; } \ No newline at end of file diff --git a/src/media/images/logo.png b/src/media/images/logo.png new file mode 100644 index 0000000..c18993e Binary files /dev/null and b/src/media/images/logo.png differ