phpldapadmin/application/classes/PLA/SystemMessage.php
2013-06-25 13:18:36 +10:00

66 lines
1.5 KiB
PHP

<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is for rendering PLA System Messages
*
* 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_SystemMessage 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 SystemMessage;
}
/**
* Render this block
*
* @see HTMLRender::render()
*/
protected function render() {
$output = '';
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']);
return $output;
}
}
?>