Themeing work based on bootstrap
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class is for rendering HTML body blocks (left, center, right).
|
||||
* This class is for rendering HTML blocks or widget.
|
||||
*
|
||||
* It will provide a header, body and footer.
|
||||
* It will provide a title and body for the content.
|
||||
*
|
||||
* @package lnApp
|
||||
* @category lnApp/Helpers
|
||||
@@ -14,13 +14,17 @@
|
||||
*/
|
||||
abstract class lnApp_Block extends HTMLRender {
|
||||
protected static $_data = array();
|
||||
protected static $_spacer = '<table><tr class="spacer"><td> </td></tr></table>';
|
||||
protected static $_spacer = '';
|
||||
protected static $_c = 0;
|
||||
protected $_items = array('body','title','title_icon','type');
|
||||
|
||||
protected static $_required_keys = array('body');
|
||||
|
||||
/**
|
||||
* Add a block to be rendered
|
||||
*
|
||||
* @param array Block attributes
|
||||
* @deprecated
|
||||
*/
|
||||
public static function add($block,$prepend=FALSE) {
|
||||
// Any body objects should be converted to a string, so that any calls to Style/Script are processed
|
||||
@@ -40,43 +44,39 @@ abstract class lnApp_Block extends HTMLRender {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance of this class
|
||||
*
|
||||
* @return Block
|
||||
*/
|
||||
public static function factory() {
|
||||
return new Block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render this block
|
||||
*
|
||||
* @see HTMLRender::render()
|
||||
* Render this Block
|
||||
*/
|
||||
protected function render() {
|
||||
$record = static::$_data[$this->_x];
|
||||
|
||||
$output = '';
|
||||
$styles = array();
|
||||
$output .= '<div class="row">';
|
||||
$output .= sprintf('<div class="%s">',empty($record['span']) ? 'span12' : $record['span']);
|
||||
$output .= '<div class="widget stacked">';
|
||||
|
||||
$i = 0;
|
||||
foreach (static::$_data as $value) {
|
||||
if ($i++)
|
||||
$output .= static::$_spacer;
|
||||
if (! empty($record['title']))
|
||||
$output .= sprintf('<div class="widget-header">%s<h3>%s</h3></div>',empty($record['title_icon']) ? '' : sprintf(' <i class="%s"></i>',$record['title_icon']),$record['title']);
|
||||
|
||||
$output .= '<table class="block" border="0">';
|
||||
$output .= '<div class="widget-content">';
|
||||
|
||||
if (! empty($value['title']))
|
||||
$output .= sprintf('<tr class="title"><td>%s</td></tr>',$value['title']);
|
||||
if (! empty($record['type']))
|
||||
switch ($record['type']) {
|
||||
case 'form-horizontal': $output .= Form::open(NULL,array('class'=>'form-horizontal'));
|
||||
$output .= (string)$record['body'];
|
||||
$output .= Form::close();
|
||||
break;
|
||||
|
||||
if (! empty($value['subtitle']))
|
||||
$output .= sprintf('<tr class="subtitle"><td>%s</td></tr>',$value['subtitle']);
|
||||
default:
|
||||
$output .= (string)$record['body'];
|
||||
}
|
||||
|
||||
$output .= sprintf('<tr class="body"><td>%s</td></tr>',$value['body']);
|
||||
else
|
||||
$output .= (string)$record['body'];
|
||||
|
||||
if (! empty($value['footer']))
|
||||
$output .= sprintf('<tr class="footer"><td>%s</td></tr>',$value['footer']);
|
||||
|
||||
$output .= '</table>';
|
||||
}
|
||||
$output .= '</div> <!-- /widget-content -->';
|
||||
$output .= '</div> <!-- /widget-stacked -->';
|
||||
$output .= '</div> <!-- /span -->';
|
||||
$output .= '</div> <!-- /row -->';
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
Reference in New Issue
Block a user