123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <?php
- class Page
- {
- protected $title = null;
- protected $help = null;
- protected $header = null;
- protected $content;
- protected $breadcrumbs = '';
- protected $message = null;
- protected $warning = null;
- protected $error = null;
-
- static function create($title = '')
- {
- return new self($title);
- }
- function __construct($title = '')
- {
- $this->title = $title;
- }
-
- function header($header)
- {
- $this->header = $header;
- return $this;
- }
-
- function title($title)
- {
- $this->title = $title;
- return $this;
- }
-
- function breadcrumbs($crumbs)
- {
- $this->breadcrumbs = $crumbs;
- return $this;
- }
-
- function help($help)
- {
- $this->help = $help;
- return $this;
- }
-
- function message($message)
- {
- $this->message = $message;
- return $this;
- }
-
- function warning($warning)
- {
- $this->warning = $warning;
- return $this;
- }
-
- function error($error)
- {
- $this->error = $error;
- return $this;
- }
-
- function content($content)
- {
- $this->content = $content;
- return $this;
- }
- function __toString()
- {
- $this->display($this->content);
- }
- function display($content = null)
- {
- $this->display_header();
- $this->display_content($content);
- $this->display_footer();
- }
- function display_header()
- {
- global $interbreadcrumb;
- $interbreadcrumb = $this->breadcrumbs;
- Display::display_header($this->title, $this->help, $this->header);
- if ($message = $this->message) {
- Display::display_confirmation_message($message);
- }
- if ($warning = $this->warning) {
- Display::display_warning_message($warning);
- }
- if ($error = $this->error) {
- Display::display_error_message($error);
- }
- }
- protected function display_content($content)
- {
- $content = $content ? $content : $this->content;
- echo $content;
- }
- function display_footer()
- {
- Display::display_footer();
- }
- }
|