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
00023 if (!$this->object->hasError())
00024 $this->getContent();
00025
00026
00027 $this->drawHeader($this->object->getTitle());
00028
00029
00030 $this->drawPage();
00031
00032
00033 $this->drawFooter();
00034 }
00035
00040 public function drawHeader($title)
00041 {
00042 }
00043
00047 public function drawPage()
00048 {
00049
00050 if ($this->object->hasError())
00051 $this->drawError();
00052
00053 else
00054 {
00055
00056 $this->drawStatus();
00057
00058
00059 $this->drawContent();
00060 }
00061 }
00062
00068 public function drawError()
00069 {
00070
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
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 ?>