2012-06-05 03:50:21 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class is for rendering HTML body blocks (left, center, right).
|
|
|
|
*
|
|
|
|
* It will provide a header, body and footer.
|
|
|
|
*
|
|
|
|
* @package PLA
|
|
|
|
* @subpackage Page
|
|
|
|
* @category Helpers
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) phpLDAPadmin Development Team
|
|
|
|
* @license http://dev.phpldapadmin.org/license.html
|
|
|
|
* @uses Style
|
|
|
|
*/
|
|
|
|
abstract class PLA_Block extends HTMLRender {
|
|
|
|
protected static $_data = array();
|
|
|
|
protected static $_required_keys = array('body');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a block to be rendered
|
|
|
|
*
|
|
|
|
* @param array Block attributes
|
|
|
|
*/
|
|
|
|
public static function add($block,$prepend=FALSE) {
|
|
|
|
parent::add($block);
|
|
|
|
|
|
|
|
// Detect any style sheets.
|
|
|
|
if (! empty($block['style']) && is_array($block['style']))
|
|
|
|
foreach ($block['style'] as $data=>$media)
|
|
|
|
Style::add(array(
|
|
|
|
'type'=>'file',
|
|
|
|
'data'=>$data,
|
|
|
|
'media'=>$media,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return an instance of this class
|
|
|
|
*
|
|
|
|
* @return Block
|
|
|
|
*/
|
|
|
|
public static function factory() {
|
|
|
|
return new Block;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Render this block
|
|
|
|
*
|
|
|
|
* @see HTMLRender::render()
|
|
|
|
*/
|
|
|
|
protected function render() {
|
|
|
|
$output = '';
|
|
|
|
|
2012-06-05 03:50:21 +00:00
|
|
|
foreach (static::$_data as $value)
|
|
|
|
$output .= View::factory(Kohana::Config('config.theme').'/block')
|
|
|
|
->set('title',empty($value['title']) ? '' : $value['title'])
|
|
|
|
->set('subtitle',empty($value['subtitle']) ? '' : $value['subtitle'])
|
|
|
|
->set('body',empty($value['body']) ? '' : $value['body'])
|
|
|
|
->set('footer',empty($value['footer']) ? '' : $value['footer']);
|
2012-06-05 03:50:21 +00:00
|
|
|
|
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|