diff --git a/classes/Kohana.php b/classes/Kohana.php new file mode 100644 index 0000000..066ac5d --- /dev/null +++ b/classes/Kohana.php @@ -0,0 +1,4 @@ + diff --git a/classes/StaticList.php b/classes/StaticList.php new file mode 100644 index 0000000..6d2fff1 --- /dev/null +++ b/classes/StaticList.php @@ -0,0 +1,4 @@ + diff --git a/classes/StaticList/YesNo.php b/classes/StaticList/YesNo.php new file mode 100644 index 0000000..adedd92 --- /dev/null +++ b/classes/StaticList/YesNo.php @@ -0,0 +1,4 @@ + diff --git a/classes/lnApp/Core.php b/classes/lnApp/Core.php new file mode 100644 index 0000000..75cceaa --- /dev/null +++ b/classes/lnApp/Core.php @@ -0,0 +1,52 @@ + diff --git a/classes/lnApp/Site.php b/classes/lnApp/Site.php index 4a8dacb..4e5a246 100644 --- a/classes/lnApp/Site.php +++ b/classes/lnApp/Site.php @@ -32,6 +32,13 @@ abstract class lnApp_Site { return sprintf('%s %s',self::Date($date),self::Time($date)); } + /** + * Return the site configured language + */ + public static function ID() { + return Kohana::$config->load('config')->id; + } + /** * Return the site configured language */ diff --git a/classes/lnApp/StaticList.php b/classes/lnApp/StaticList.php new file mode 100644 index 0000000..3355d50 --- /dev/null +++ b/classes/lnApp/StaticList.php @@ -0,0 +1,66 @@ +_table(); + + if (! $table) + return 'No Table'; + elseif (! $id AND empty($table[$id])) + return ''; + elseif (empty($table[$id])) + return sprintf('No Value (%s)',$id); + else + return $table[$id]; + } + + /** + * Setup our class instantiation + * @note This must be declared in the child class due to static scope + */ + public static function factory() { + $x = get_called_class(); + + return new $x; + } + + /** + * Renders form input + * + * @param string Form name to render + * @param string Default value to populate in the Form input. + */ + public static function form($name,$default='',$addblank=FALSE,array $attributes=NULL) { + $table = self::factory()->_table(); + + if ($addblank) + $table = array_merge(array(''=>' '),$table); + + return Form::Select($name,$table,$default,$attributes); + } + + /** + * Lists our available keys + */ + public static function keys() { + return array_keys(self::factory()->_table()); + } + + public static function table() { + return self::factory()->_table(); + } +} +?> diff --git a/classes/lnApp/StaticList/YesNo.php b/classes/lnApp/StaticList/YesNo.php new file mode 100644 index 0000000..a9a8d44 --- /dev/null +++ b/classes/lnApp/StaticList/YesNo.php @@ -0,0 +1,29 @@ +_('No'), + 1=>_('Yes'), + ); + } + + public static function get($value,$format=FALSE) { + if (! $value) + $value = 0; + + return $format ? View::factory(Site::Theme().'/label/bool') + ->set('label',$value ? 'label-success' : '') + ->set('column',self::factory()->_get($value)) : $value; + } +} +?> diff --git a/config/config.php b/config/config.php index 56db907..2f77d5a 100644 --- a/config/config.php +++ b/config/config.php @@ -11,10 +11,11 @@ */ return array( - 'date_format' => 'd-M-Y', - 'language' => 'auto', - 'method_security' => FALSE, - 'theme' => 'bootstrap', - 'time_format' => 'H:i:s', + 'id' => '', // Site ID, for mullti site usage + 'date_format' => 'd-M-Y', // Site Date Format + 'language' => 'auto', // Site Language + 'method_security' => FALSE, // Enable User Based method security + 'theme' => 'bootstrap', // Site Theme + 'time_format' => 'H:i:s', // Site Time Format ); ?> diff --git a/views/theme/bootstrap/label/bool.php b/views/theme/bootstrap/label/bool.php new file mode 100644 index 0000000..2ed34cc --- /dev/null +++ b/views/theme/bootstrap/label/bool.php @@ -0,0 +1 @@ +