phpldapadmin/application/classes/PLA/SystemMessage.php

66 lines
1.5 KiB
PHP
Raw Normal View History

2012-06-05 03:50:21 +00:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
2012-06-05 03:50:21 +00:00
* This class is for rendering PLA System Messages
2012-06-05 03:50:21 +00:00
*
* 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
*/
2012-06-05 03:50:21 +00:00
abstract class PLA_SystemMessage extends HTMLRender {
2012-06-05 03:50:21 +00:00
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() {
2012-06-05 03:50:21 +00:00
return new SystemMessage;
2012-06-05 03:50:21 +00:00
}
/**
* 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;
}
}
?>