From 9569467153ab0f1337be79585d5c5a56743cb510 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 10 Oct 2014 16:38:58 +1100 Subject: [PATCH] Minor fixes --- application/classes/Company.php | 122 ++++++++++++++++++++++++ application/classes/Kohana.php | 2 +- application/views/account/user/edit.php | 4 +- modules/lnapp | 2 +- 4 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 application/classes/Company.php diff --git a/application/classes/Company.php b/application/classes/Company.php new file mode 100644 index 0000000..c57779c --- /dev/null +++ b/application/classes/Company.php @@ -0,0 +1,122 @@ +so = $so; + + if (! $this->so->loaded()) + throw new Kohana_Exception(_('Site [:site] not defined in DB?'),array(':site'=>URL::base('http'))); + + Kohana::$environment = (int)$this->so->status; + } + + public static function instance() { + $x = URL::base('http'); + + if (! isset(Company::$instance[$x])) + Company::$instance[$x] = new Company(ORM::factory('Setup',array('url'=>$x))); + + return Company::$instance[$x]; + } + + public function admin() { + return $this->so->account; + } + + public function address($ln='
') { + return implode($ln,array($this->street($ln),sprintf('%s, %s %s',$this->city(),$this->state(),$this->pcode()))); + } + + public function city() { + return $this->so->site_details('city'); + } + + public function contacts() { + return 'Tel: '.$this->phone(); + } + + public function country() { + return $this->so->country; + } + + public function date_format() { + return $this->so->date_format; + } + + public function decimals() { + return $this->so->decimal_place; + } + + public function email() { + return $this->so->site_details('email'); + } + + public function fax() { + return $this->so->site_details('fax'); + } + + public function faq() { + return $this->so->site_details('faqurl'); + } + + public function language() { + return $this->so->language; + } + + public function logo_file() { + list ($path,$suffix) = explode('.',Config::$logo); + + return ($x=Kohana::find_file(sprintf('media/site/%s',$this->site()),$path,$suffix)) ? $x : Kohana::find_file('media',$path,$suffix); + } + + public function name() { + return $this->so->site_details('name'); + } + + public function module_config($item,array $value=NULL) { + return $this->so->module_config($item,$value); + } + + public function pcode() { + return $this->so->site_details('pcode'); + } + + public function phone() { + return $this->so->site_details('phone'); + } + + public function site($format=FALSE) { + return $format ? sprintf('%02s',$this->so->id) : $this->so->id; + } + + public function so() { + return $this->so; + } + + public function state() { + return $this->so->site_details('state'); + } + + public function street($ln='
') { + return $this->so->site_details('address2') ? implode($ln,array($this->so->site_details('address1'),$this->so->site_details('address2'))) : $this->so->site_details('address1'); + } + + public function time_format() { + return $this->so->time_format; + } +} +?> diff --git a/application/classes/Kohana.php b/application/classes/Kohana.php index 9bdd9b6..2ad79e9 100644 --- a/application/classes/Kohana.php +++ b/application/classes/Kohana.php @@ -3,7 +3,7 @@ /** * This class overrides Kohana's Core * - * @package Membership Database + * @package TSM Access Management * @category Modifications * @author Deon George * @copyright (c) 2014 Deon George diff --git a/application/views/account/user/edit.php b/application/views/account/user/edit.php index 56d0e82..1f99253 100644 --- a/application/views/account/user/edit.php +++ b/application/views/account/user/edit.php @@ -34,11 +34,11 @@
- display('state'),array('class'=>'form-control','label'=>'','class'=>'input-mini','placeholder'=>'State','required','nocg'=>TRUE)); ?> + display('state'),array('class'=>'form-control','placeholder'=>'State','required','nocg'=>TRUE)); ?>
- display('zip'),array('class'=>'form-control','label'=>'','class'=>'input-mini','placeholder'=>'Post Code','required','nocg'=>TRUE)); ?> + display('zip'),array('class'=>'form-control','placeholder'=>'Post Code','required','nocg'=>TRUE)); ?>
diff --git a/modules/lnapp b/modules/lnapp index 9302b51..f7567dc 160000 --- a/modules/lnapp +++ b/modules/lnapp @@ -1 +1 @@ -Subproject commit 9302b51ebb18a638a8ed1f87643d1d04e1e27649 +Subproject commit f7567dc2507403430f3e34d3d663aee5d756fb51