Initial Membership Database Work

This commit is contained in:
Deon George
2014-07-09 13:04:56 +10:00
parent d4b3b0f9bc
commit febaad9ea6
37 changed files with 1395 additions and 834 deletions

View File

@@ -4,16 +4,13 @@
* This class extends the core Kohana class by adding some core application
* specific functions, and configuration.
*
* @package WWZ
* @package Membership Database
* @category Helpers
* @author Deon George
* @copyright (c) 2014 Deon George
* @license http://dev.leenooks.net/license.html
*/
class Config extends Kohana_Config {
// Our default logo, if there is no site logo
public static $logo = 'img/logo-small.png';
/**
* Some early initialisation
*
@@ -41,73 +38,64 @@ class Config extends Kohana_Config {
return Config::$_instance;
}
/**
* Return our caching mechanism
*/
public static function cachetype() {
return is_null(Kohana::$config->load('config')->cache_type) ? 'file' : Kohana::$config->load('config')->cache_type;
}
public static function copywrite() {
public static function Copywrite() {
return '(c) 2014 Deon George';
}
public static function country() {
return NULL;
}
/**
* Show a date using a site configured format
*/
public static function date($date) {
return (is_null($date) OR ! $date) ? '' : date('d-M-Y',$date);
}
public static function language() {
// @todo To implement
return 'auto';
}
/**
* The URI to show for the login prompt.
* Normally if the user is logged in, we can replace it with something else
*/
public static function login_uri() {
return ($ao = Auth::instance()->get_user() AND is_object($ao)) ? $ao->name() : HTML::anchor('login',_('Login'));
}
public static function logo() {
return HTML::image(static::logo_uri(),array('class'=>'headlogo','alt'=>_('Logo')));
}
public static function logo_uri($protocol=NULL) {
list ($path,$suffix) = explode('.',static::$logo);
return URL::site(Route::get('default/media')->uri(array('file'=>$path.'.'.$suffix),array('alt'=>static::sitename())),$protocol);
}
public static function siteid($format=FALSE) {
return '';
}
/**
* Work out our site mode (dev,test,prod)
*/
public static function sitemode() {
return Kohana::$config->load('config.site')->mode;
}
public static function sitename() {
return 'AER Translate';
}
public static function theme() {
return 'theme/'.Kohana::$config->load('config')->theme;
}
public static function version() {
// @todo Work out our versioning
return 'TBA';
}
/**
* Find a list of all database enabled modules
*
* Our available modules are defined in the DB (along with method
* security).
*/
public static function modules() {
static $result = array();
if (! count($result)) {
// We need to know our site here, so that we can subsequently load our enabled modules.
if (PHP_SAPI === 'cli') {
if (! ($site = Minion_CLI::options('site'))) {
echo _('Cant figure out the site, use --site= for CLI')."\n";
die();
} else
$_SERVER['SERVER_NAME'] = $site;
}
foreach (ORM::factory('Module')->list_external() as $mo)
$result[$mo->name] = MODPATH.$mo->name;
}
return $result;
}
public static function module_config($item,array $value=NULL) {
return Company::instance()->module_config($item,$value);
}
public static function module_exist($module) {
return array_key_exists(strtolower($module),self::modules()) ? TRUE : FALSE;
}
/**
* See if our emails for the template should be sent to configured admin(s)
*
* @param string template - Template to test for
* @return mixed|array - Email to send test emails to
*/
public static function testmail($template) {
$config = Kohana::$config->load('debug')->email_admin_only;
if (is_null($config) OR ! is_array($config) OR empty($config[$template]))
return FALSE;
else
return $config[$template];
}
}
?>