2007-04-16 11:58:25 +00:00
|
|
|
<?php
|
2007-06-30 01:19:11 +00:00
|
|
|
class GenericPage {
|
2007-04-16 11:58:25 +00:00
|
|
|
var $mode = "page";
|
|
|
|
var $type = "text/html";
|
|
|
|
|
|
|
|
public function set_mode($mode) {
|
|
|
|
$this->mode = $mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function set_type($type) {
|
|
|
|
$this->type = $type;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==============================================
|
|
|
|
|
|
|
|
// data
|
|
|
|
var $data = "";
|
|
|
|
|
|
|
|
public function set_data($data) {
|
|
|
|
$this->data = $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==============================================
|
|
|
|
|
|
|
|
// redirect
|
|
|
|
var $redirect = "";
|
|
|
|
|
|
|
|
public function set_redirect($redirect) {
|
|
|
|
$this->redirect = $redirect;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ==============================================
|
|
|
|
|
|
|
|
// page
|
|
|
|
var $title = "";
|
|
|
|
var $heading = "";
|
|
|
|
var $subheading = "";
|
|
|
|
var $quicknav = "";
|
2007-05-01 12:41:44 +00:00
|
|
|
var $headers = array();
|
2007-06-30 01:19:11 +00:00
|
|
|
var $blocks = array();
|
2007-04-16 11:58:25 +00:00
|
|
|
|
|
|
|
public function set_title($title) {
|
|
|
|
$this->title = $title;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function set_heading($heading) {
|
|
|
|
$this->heading = $heading;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function set_subheading($subheading) {
|
|
|
|
$this->subheading = $subheading;
|
|
|
|
}
|
|
|
|
|
2007-05-01 12:41:44 +00:00
|
|
|
public function add_header($line, $position=50) {
|
|
|
|
while(isset($this->headers[$position])) $position++;
|
|
|
|
$this->headers[$position] = $line;
|
|
|
|
}
|
|
|
|
|
2007-06-30 01:19:11 +00:00
|
|
|
public function add_block($block) {
|
|
|
|
$this->blocks[] = $block;
|
2007-04-16 11:58:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ==============================================
|
|
|
|
|
|
|
|
public function display() {
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
header("Content-type: {$this->type}");
|
|
|
|
|
|
|
|
switch($this->mode) {
|
|
|
|
case "page":
|
|
|
|
header("Cache-control: no-cache");
|
2007-06-30 01:19:11 +00:00
|
|
|
usort($this->blocks, "blockcmp");
|
|
|
|
$layout = new Layout();
|
|
|
|
$layout->display_page($this);
|
2007-04-16 11:58:25 +00:00
|
|
|
break;
|
|
|
|
case "data":
|
|
|
|
print $this->data;
|
|
|
|
break;
|
|
|
|
case "redirect":
|
|
|
|
header("Location: {$this->redirect}");
|
|
|
|
print "You should be redirected to <a href='{$this->redirect}'>{$this->redirect}</a>";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
print "Invalid page mode";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|