2010-11-29 22:41:08 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
2011-09-28 06:46:22 +00:00
|
|
|
* This class is for access company information.
|
2010-11-29 22:41:08 +00:00
|
|
|
*
|
|
|
|
* @package OSB
|
2011-09-28 06:46:22 +00:00
|
|
|
* @subpackage System
|
2010-11-29 22:41:08 +00:00
|
|
|
* @category Helpers
|
|
|
|
* @author Deon George
|
2011-09-28 06:46:22 +00:00
|
|
|
* @copyright (c) 2010 Open Source Billing
|
|
|
|
* @license http://dev.osbill.net/license.html
|
2010-11-29 22:41:08 +00:00
|
|
|
*/
|
|
|
|
class Company {
|
|
|
|
public static function instance() {
|
|
|
|
return new Company;
|
|
|
|
}
|
|
|
|
|
2011-10-14 05:44:12 +00:00
|
|
|
public static function name() {
|
2011-12-30 07:10:02 +00:00
|
|
|
return Config::instance()->so->site_details('name');
|
2011-10-14 05:44:12 +00:00
|
|
|
}
|
|
|
|
|
2011-12-30 07:10:02 +00:00
|
|
|
public static function street($ln='<br/>') {
|
|
|
|
if ($b = Config::instance()->so->site_details('address2'))
|
|
|
|
return implode($ln,array(Config::instance()->so->site_details('address1'),Config::instance()->so->site_details('address2')));
|
|
|
|
else
|
|
|
|
return Config::instance()->so->site_details('address1');
|
2011-05-02 12:28:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function city() {
|
2011-12-30 07:10:02 +00:00
|
|
|
return Config::instance()->so->site_details('city');
|
2011-05-02 12:28:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function state() {
|
2011-12-30 07:10:02 +00:00
|
|
|
return Config::instance()->so->site_details('state');
|
2011-05-02 12:28:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function pcode() {
|
2011-12-30 07:10:02 +00:00
|
|
|
return Config::instance()->so->site_details('pcode');
|
2011-05-02 12:28:17 +00:00
|
|
|
}
|
|
|
|
|
2010-11-29 22:41:08 +00:00
|
|
|
public static function address($ln='<br/>') {
|
2011-12-30 07:10:02 +00:00
|
|
|
return implode($ln,array(static::street($ln),sprintf('%s, %s %s',static::city(),static::state(),static::pcode())));
|
2011-05-02 12:28:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function phone() {
|
2011-12-30 07:10:02 +00:00
|
|
|
return Config::instance()->so->site_details('phone');
|
2011-05-02 12:28:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function fax() {
|
2011-12-30 07:10:02 +00:00
|
|
|
return Config::instance()->so->site_details('fax');
|
2010-11-29 22:41:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function contacts() {
|
2011-05-02 12:28:17 +00:00
|
|
|
return 'Tel: '.static::phone();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function bsb() {
|
|
|
|
// @todo Details should be obtained from DB
|
|
|
|
return Kohana::config('config.bsb');
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function account() {
|
|
|
|
// @todo Details should be obtained from DB
|
|
|
|
return Kohana::config('config.accnum');
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function taxid() {
|
|
|
|
// @todo Details should be obtained from DB
|
|
|
|
return Kohana::config('config.taxid');
|
2010-11-29 22:41:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function render() {
|
|
|
|
echo static::name();
|
|
|
|
echo static::address();
|
|
|
|
echo static::contacts();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the HTML to render the company address
|
|
|
|
*/
|
|
|
|
public function __toString() {
|
|
|
|
try {
|
|
|
|
return static::render();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Display the exception message
|
|
|
|
catch (Exception $e) {
|
|
|
|
Kohana::exception_handler($e);
|
|
|
|
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|