adding themes system
This commit is contained in:
parent
a1d9b63dcf
commit
747e28e07c
5
.gitignore
vendored
5
.gitignore
vendored
@ -25,4 +25,7 @@ system/uploads/**
|
|||||||
system/uploads/sms/**
|
system/uploads/sms/**
|
||||||
!system/uploads/sms/index.html
|
!system/uploads/sms/index.html
|
||||||
system/uploads/system/**
|
system/uploads/system/**
|
||||||
!system/uploads/system/index.html
|
!system/uploads/system/index.html
|
||||||
|
ui/themes/**
|
||||||
|
!ui/themes/index.html
|
||||||
|
!ui/themes/README.md
|
@ -81,4 +81,9 @@ class Lang
|
|||||||
return $_notifmsg_default[$key];
|
return $_notifmsg_default[$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function ucWords($text)
|
||||||
|
{
|
||||||
|
return ucwords(str_replace('_', ' ', $text));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,9 +128,18 @@ function _notify($msg, $type = 'e')
|
|||||||
}
|
}
|
||||||
|
|
||||||
$lan_file = File::pathFixer('system/lan/' . $config['language'] . '/common.lan.php');
|
$lan_file = File::pathFixer('system/lan/' . $config['language'] . '/common.lan.php');
|
||||||
require($lan_file);
|
require $lan_file;
|
||||||
|
|
||||||
$ui = new Smarty();
|
$ui = new Smarty();
|
||||||
$ui->setTemplateDir(['custom' => File::pathFixer('ui/ui_custom/'), 'default' => File::pathFixer('ui/ui/')]);
|
|
||||||
|
if (!empty($config['theme']) && $config['theme'] != 'default') {
|
||||||
|
$_theme = APP_URL . '/ui/theme/' . $config['theme'];
|
||||||
|
$ui->setTemplateDir(['custom' => File::pathFixer('ui/ui_custom/'), 'theme' => $_theme, 'default' => File::pathFixer('ui/ui/')]);
|
||||||
|
} else {
|
||||||
|
$_theme = APP_URL . '/ui/ui';
|
||||||
|
$ui->setTemplateDir(['custom' => File::pathFixer('ui/ui_custom/'), 'default' => File::pathFixer('ui/ui/')]);
|
||||||
|
}
|
||||||
|
$ui->assign('_theme', $_theme);
|
||||||
$ui->addTemplateDir(File::pathFixer('system/paymentgateway/ui/'), 'pg');
|
$ui->addTemplateDir(File::pathFixer('system/paymentgateway/ui/'), 'pg');
|
||||||
$ui->addTemplateDir(File::pathFixer('system/plugin/ui/'), 'plugin');
|
$ui->addTemplateDir(File::pathFixer('system/plugin/ui/'), 'plugin');
|
||||||
$ui->setCompileDir(File::pathFixer('ui/compiled/'));
|
$ui->setCompileDir(File::pathFixer('ui/compiled/'));
|
||||||
@ -338,7 +347,7 @@ try {
|
|||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$ui->assign("error_title", "PHPNuxBill Crash");
|
$ui->assign("error_title", "PHPNuxBill Crash");
|
||||||
$ui->assign("error_message", $e->getMessage().'<br><pre>'.$e->getTraceAsString().'</pre>');
|
$ui->assign("error_message", $e->getMessage() . '<br><pre>' . $e->getTraceAsString() . '</pre>');
|
||||||
$ui->display('router-error.tpl');
|
$ui->display('router-error.tpl');
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,14 @@ switch ($action) {
|
|||||||
//ignore
|
//ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$themes = [];
|
||||||
|
$files = scandir('ui/themes/');
|
||||||
|
foreach ($files as $file) {
|
||||||
|
if (is_dir('ui/themes/' . $file) && !in_array($file, ['.', '..'])) {
|
||||||
|
$themes[] = $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ui->assign('themes', $themes);
|
||||||
run_hook('view_app_settings'); #HOOK
|
run_hook('view_app_settings'); #HOOK
|
||||||
$ui->display('app-settings.tpl');
|
$ui->display('app-settings.tpl');
|
||||||
break;
|
break;
|
||||||
@ -46,7 +54,6 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$ui->assign('lan', $folders);
|
$ui->assign('lan', $folders);
|
||||||
|
|
||||||
$timezonelist = Timezone::timezoneList();
|
$timezonelist = Timezone::timezoneList();
|
||||||
$ui->assign('tlist', $timezonelist);
|
$ui->assign('tlist', $timezonelist);
|
||||||
$ui->assign('xjq', ' $("#tzone").select2(); ');
|
$ui->assign('xjq', ' $("#tzone").select2(); ');
|
||||||
@ -242,6 +249,7 @@ switch ($action) {
|
|||||||
$http_proxyauth = _post('http_proxyauth');
|
$http_proxyauth = _post('http_proxyauth');
|
||||||
$radius_enable = _post('radius_enable');
|
$radius_enable = _post('radius_enable');
|
||||||
$radius_client = _post('radius_client');
|
$radius_client = _post('radius_client');
|
||||||
|
$theme = _post('theme');
|
||||||
run_hook('save_settings'); #HOOK
|
run_hook('save_settings'); #HOOK
|
||||||
|
|
||||||
|
|
||||||
@ -289,6 +297,18 @@ switch ($action) {
|
|||||||
$d->save();
|
$d->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$d = ORM::for_table('tbl_appconfig')->where('setting', 'theme')->find_one();
|
||||||
|
if ($d) {
|
||||||
|
$d->value = $theme;
|
||||||
|
$d->save();
|
||||||
|
} else {
|
||||||
|
$d = ORM::for_table('tbl_appconfig')->create();
|
||||||
|
$d->setting = 'theme';
|
||||||
|
$d->value = $theme;
|
||||||
|
$d->save();
|
||||||
|
}
|
||||||
|
|
||||||
$d = ORM::for_table('tbl_appconfig')->where('setting', 'CompanyFooter')->find_one();
|
$d = ORM::for_table('tbl_appconfig')->where('setting', 'CompanyFooter')->find_one();
|
||||||
if ($d) {
|
if ($d) {
|
||||||
$d->value = $footer;
|
$d->value = $footer;
|
||||||
|
3
ui/themes/README.md
Normal file
3
ui/themes/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Themes Folder
|
||||||
|
|
||||||
|
Folder name must only alphanumeric characters and underscores _**my_theme**_ will show as _**My Theme**_
|
@ -53,6 +53,17 @@
|
|||||||
<input type="text" class="form-control" id="phone" name="phone" value="{$_c['phone']}">
|
<input type="text" class="form-control" id="phone" name="phone" value="{$_c['phone']}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-2 control-label">Theme</label>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<select name="theme" id="theme" class="form-control">
|
||||||
|
<option value="default" {if $_c['theme'] eq 'default'}selected="selected" {/if}>Default</option>
|
||||||
|
{foreach $themes as $theme}
|
||||||
|
<option value="{$theme}" {if $_c['theme'] eq $theme}selected="selected" {/if}>{Lang::ucWords($theme)}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-2 control-label">{Lang::T('Disable Voucher')}</label>
|
<label class="col-md-2 control-label">{Lang::T('Disable Voucher')}</label>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user