Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

base-template.inc.php

Go to the documentation of this file.
00001 <?
00008 abstract class BaseTemplate
00009 {
00010     public $object;
00011 
00012     public $content = null;
00013 
00018     public function draw()
00019     {
00020         global $sqlQueryCount;
00021         
00022         //load our page to get stuff like js/css/feeds
00023         if (!$this->object->hasError())
00024             $this->getContent();
00025 
00026         //draw our header
00027         $this->drawHeader($this->object->getTitle());
00028         
00029         //obviously want to draw the objects page
00030         $this->drawPage();
00031 
00032         //and we should draw the footer too
00033         $this->drawFooter();
00034     }
00035 
00040     public function drawHeader($title)
00041     {
00042     }
00043 
00047     public function drawPage()
00048     {
00049         //draw our errors...
00050         if ($this->object->hasError())
00051             $this->drawError();
00052         //nope, we're clean.
00053         else
00054         {
00055             //do we draw status?
00056             $this->drawStatus();
00057         
00058             //do we draw content?
00059             $this->drawContent();
00060         }
00061     }
00062 
00068     public function drawError()
00069     {
00070         //draw our errors!
00071         $error = $this->object->getError();
00072         echo "<p id=\"error-$key\" class=\"BaseError\">$error</p>\n";
00073     }
00074 
00080     public function drawStatus()
00081     {
00082         $status = $this->object->getStatus();
00083         echo implode("\r\n", $status);
00084     }
00085 
00089     public function drawContent()
00090     {
00091         echo $this->getContent();
00092     }
00093 
00099     public function getContent()
00100     {
00101         //if its not already set.. get it.
00102         if ($this->content === null)
00103             $this->content = $this->object->getContent();
00104         
00105         return $this->content;
00106     }
00107 
00111     public function drawFooter()
00112     {
00113     }
00114 
00118     public function drawGenerationStats()
00119     {
00120         echo "Generated in %%BJ_RUNTIME%% seconds. %%BJ_QUERIES%% db queries. %%BJ_CACHE_HITS%% cache hits.";
00121     }
00122 
00129     public function drawRecachePageLink($link = 'Recache Page')
00130     {
00131         if ($this->object->doCachePage)
00132             echo $this->object->getLink("main.recache?do=" . base64_encode($_SERVER['REQUEST_URI']), $link);
00133     }
00134 }
00135 ?>

Generated on Fri Oct 27 12:26:40 2006 for BaseJumper by doxygen 1.3.9.1