Theme work with focusbusiness and baseadmin
Improvements to NAVBAR, updates to StaticList methods, other minor items Enable product category rendering and other minor improvements Added ADSL-large category price plan
This commit is contained in:
@@ -10,33 +10,16 @@
|
||||
* @license http://dev.osbill.net/license.html
|
||||
*/
|
||||
abstract class StaticList {
|
||||
// This is our list of items that will be rendered
|
||||
protected $list = array();
|
||||
// Our Static Items List
|
||||
abstract protected function _table();
|
||||
|
||||
/**
|
||||
* Each static list type must provide the table function that contains
|
||||
* the table of list and values.
|
||||
*/
|
||||
abstract protected function table();
|
||||
|
||||
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__));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a static name for a value
|
||||
*
|
||||
* @param key $id value to render
|
||||
* @see _display()
|
||||
*/
|
||||
public static function display($value) {
|
||||
return static::_display($value);
|
||||
}
|
||||
// To get an individual item from the table
|
||||
// @note This must be declared in the child class due to static scope
|
||||
//abstract public static function get($value);
|
||||
|
||||
// Due to static scope, sometimes we need to call this function from the child class.
|
||||
protected static function _display($id) {
|
||||
$table = static::factory()->table();
|
||||
protected function _get($id) {
|
||||
$table = $this->_table();
|
||||
|
||||
if (! $table)
|
||||
return 'No Table';
|
||||
@@ -47,10 +30,13 @@ abstract class StaticList {
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists our available keys
|
||||
* Setup our class instantiation
|
||||
* @note This must be declared in the child class due to static scope
|
||||
*/
|
||||
public static function keys() {
|
||||
return array_keys(static::factory()->table());
|
||||
public static function factory() {
|
||||
$x = get_called_class();
|
||||
|
||||
return new $x;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,13 +45,24 @@ abstract class StaticList {
|
||||
* @param string Form name to render
|
||||
* @param string Default value to populate in the Form input.
|
||||
*/
|
||||
public static function form($name,$default='',$addblank=FALSE) {
|
||||
$table = static::factory()->table();
|
||||
public static function form($name,$default='',$addblank=FALSE,array $attributes=NULL) {
|
||||
$table = static::factory()->_table();
|
||||
|
||||
if ($addblank)
|
||||
$table = array_merge(array(''=>' '),$table);
|
||||
|
||||
return Form::Select($name,$table,$default);
|
||||
return Form::Select($name,$table,$default,$attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists our available keys
|
||||
*/
|
||||
public static function keys() {
|
||||
return array_keys(static::factory()->_table());
|
||||
}
|
||||
|
||||
public static function table() {
|
||||
return static::factory()->_table();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user