2007-04-16 11:58:25 +00:00
|
|
|
<?php
|
2009-07-19 08:38:13 +01:00
|
|
|
/**
|
|
|
|
* A basic chunk of a page
|
2007-12-06 11:01:18 +00:00
|
|
|
*/
|
2007-04-16 11:58:25 +00:00
|
|
|
class Block {
|
2009-07-19 08:38:13 +01:00
|
|
|
/**
|
|
|
|
* The block's title
|
|
|
|
*
|
2009-07-21 07:36:12 +01:00
|
|
|
* @retval string
|
2009-07-19 08:38:13 +01:00
|
|
|
*/
|
2007-04-16 11:58:25 +00:00
|
|
|
var $header;
|
2009-07-19 08:38:13 +01:00
|
|
|
/**
|
|
|
|
* The content
|
|
|
|
*
|
2009-07-21 07:36:12 +01:00
|
|
|
* @retval string
|
2009-07-19 08:38:13 +01:00
|
|
|
*/
|
2007-04-16 11:58:25 +00:00
|
|
|
var $body;
|
2009-07-19 08:38:13 +01:00
|
|
|
/**
|
|
|
|
* Where the block should be placed. The default theme supports
|
|
|
|
* "main" and "left", other themes can add their own areas
|
|
|
|
*
|
2009-07-21 07:36:12 +01:00
|
|
|
* @retval string
|
2009-07-19 08:38:13 +01:00
|
|
|
*/
|
2007-06-30 01:19:11 +00:00
|
|
|
var $section;
|
2009-07-19 08:38:13 +01:00
|
|
|
/**
|
|
|
|
* How far down the section the block should appear, higher
|
|
|
|
* numbers appear lower. The scale is 0-100 by convention,
|
|
|
|
* though any number or string will work.
|
|
|
|
*
|
2009-07-21 07:36:12 +01:00
|
|
|
* @retval int
|
2009-07-19 08:38:13 +01:00
|
|
|
*/
|
2007-06-30 01:19:11 +00:00
|
|
|
var $position;
|
2007-04-16 11:58:25 +00:00
|
|
|
|
2012-02-02 13:58:48 +00:00
|
|
|
public function __construct($header, $body, /*string*/ $section="main", /*int*/ $position=50) {
|
2007-04-16 11:58:25 +00:00
|
|
|
$this->header = $header;
|
|
|
|
$this->body = $body;
|
2007-06-30 01:19:11 +00:00
|
|
|
$this->section = $section;
|
|
|
|
$this->position = $position;
|
2007-04-16 11:58:25 +00:00
|
|
|
}
|
|
|
|
}
|
2007-12-04 22:24:58 +00:00
|
|
|
|
2007-12-06 11:01:18 +00:00
|
|
|
|
2009-07-19 08:38:13 +01:00
|
|
|
/**
|
|
|
|
* A generic navigation block with a link to the main page.
|
|
|
|
*
|
|
|
|
* Used because "new NavBlock()" is easier than "new Block('Navigation', ..."
|
2007-12-06 11:01:18 +00:00
|
|
|
*/
|
2007-12-04 22:24:58 +00:00
|
|
|
class NavBlock extends Block {
|
2008-08-23 12:05:24 +00:00
|
|
|
public function __construct() {
|
|
|
|
parent::__construct("Navigation", "<a href='".make_link()."'>Index</a>", "left", 0);
|
2007-12-04 22:24:58 +00:00
|
|
|
}
|
|
|
|
}
|
2007-04-16 11:58:25 +00:00
|
|
|
?>
|