51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
/**
|
|
* This class is for Site Information
|
|
*
|
|
* @package Membership Database
|
|
* @category Helpers
|
|
* @author Deon George
|
|
* @copyright (c) 2014 Deon George
|
|
* @license http://dev.leenooks.net/license.html
|
|
*/
|
|
class Site extends lnApp_Site {
|
|
private static $_weekstart = 'monday'; // @todo Move into setup table
|
|
private static $_weekend = 'sunday'; // @todo Move into setup table
|
|
|
|
/**
|
|
* Show a date using a site configured format
|
|
*/
|
|
public static function Date($date) {
|
|
return (is_null($date) OR ! $date) ? '' : date(Company::instance()->date_format(),$date);
|
|
}
|
|
|
|
public static function DateEndOfWeek($date) {
|
|
return strtotime(self::$_weekend.' this week',$date);
|
|
}
|
|
|
|
public static function DateStartOfWeek($date) {
|
|
return strtotime(self::$_weekstart.' this week',$date);
|
|
}
|
|
|
|
/**
|
|
* Work out our site ID for multihosting
|
|
*/
|
|
public static function ID($format=FALSE) {
|
|
return Company::instance()->site($format);
|
|
}
|
|
|
|
public static function Theme() {
|
|
// If we are using user admin pages (and login), we'll choose the admin theme.
|
|
return 'theme/'.(URL::admin_url() ? Kohana::$config->load('config')->theme_admin : Kohana::$config->load('config')->theme);
|
|
}
|
|
|
|
/**
|
|
* Show a date using a site configured format
|
|
*/
|
|
public static function Time($date) {
|
|
return date(Company::instance()->time_format(),($date ? $date : time()));
|
|
}
|
|
}
|
|
?>
|