Themeing work based on bootstrap

This commit is contained in:
Deon George
2013-04-25 10:22:36 +10:00
parent b310cdb125
commit 74a9c291e4
184 changed files with 37653 additions and 8903 deletions

View File

@@ -11,21 +11,92 @@
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_HTMLRender {
protected static $_media_path = 'default/media';
protected static $_required_keys = array();
protected static $_unique_vals = array();
protected $_x = 0;
abstract protected function render();
public function __call($name,$args=NULL) {
if (! in_array($name,$this->_items))
throw new Kohana_Exception('Unknown call to :name',array(':name'=>$name));
$c = $this->_x;
if (! $args)
return static::$_data[$c][$name];
static::$_data[$c][$name] = array_pop($args);
return $this;
}
public function __construct() {
if (! isset(static::$_data))
throw new Kohana_Exception(':class is missing important static variables',array(':class'=>get_called_class()));
$this->_x = ++static::$_c;
}
/**
* Return the HTML to render the header images
*/
public function __toString() {
if (! static::$_data)
return '';
if (empty(static::$_data[$this->_x]))
$this->record();
return $this->render();
try {
return $this->render();
}
// Display the exception message
catch (Exception $e) {
return $e->getMessage();
}
}
public static function factory() {
$x = get_called_class();
return new $x;
}
public function record($x=NULL) {
$this->_x = (is_null($x) OR empty(static::$_data[$x])) ? max(array_keys(static::$_data)) : $x;
return $this;
}
/**
* Render all of these items
*/
public static function render_all() {
$output = '';
$o = static::factory();
for ($x=0; $x<static::$_c; $x++)
if (isset(static::$_data[$x]))
$output .= (string)$o->record($x);
return $output;
}
/**
* Set the space used between rendering output
*/
public static function spacer($spacer) {
static::$_spacer = $spacer;
}
/**
* Add an item to be rendered
*
* @param array Item to be added
* @deprecated
*/
public static function add($item,$prepend=FALSE) {
public static function add($item) {
static::$_c = count(static::$_data);
foreach (static::$_required_keys as $key)
if (! isset($item[$key]))
throw new Kohana_Exception('Missing key :key for image',array(':key'=>$key));
@@ -37,55 +108,7 @@ abstract class lnApp_HTMLRender {
if (isset($d[$u]) && $d['data'] == $item['data'])
return;
if ($prepend)
array_unshift(static::$_data,$item);
else
array_push(static::$_data,$item);
}
/**
* Set the space used between rendering output
*/
public static function setSpacer($spacer) {
static::$_spacer = $spacer;
}
/**
* Set the Kohana Media Path, used to determine where to find additional
* HTML content required for rendering.
*/
public static function setMediaPath($path) {
static::$_media_path = $path;
}
/**
* Factory instance method must be declared by the child class
*/
public static function factory() {
throw new Kohana_Exception(':class is calling :method, when it should have its own method',
array(':class'=>get_called_class(),':method'=>__METHOD__));
}
/**
* Return the HTML to render the header images
*/
public function __toString() {
try {
return static::render();
}
// Display the exception message
catch (Exception $e) {
Kohana_Exception::handler($e);
}
}
/**
* Rendering must be declared by the child class
*/
protected function render() {
throw new Kohana_Exception(':class is calling :method, when it should have its own method',
array(':class'=>get_called_class(),':method'=>__METHOD__));
static::$_data[++static::$_c] = $item;
}
}
?>