Initial commit
This commit is contained in:
48
app/controllers/admin/settings.php
Normal file
48
app/controllers/admin/settings.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* app/controllers/admin/settings.php
|
||||
*
|
||||
* This is the configuration and settings controller.
|
||||
*
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
*/
|
||||
namespace TheTempusProject\Controllers\Admin;
|
||||
|
||||
use TheTempusProject\Bedrock\Functions\Input;
|
||||
use TheTempusProject\Houdini\Classes\Components;
|
||||
use TheTempusProject\Houdini\Classes\Views;
|
||||
use TheTempusProject\Houdini\Classes\Issues;
|
||||
use TheTempusProject\Houdini\Classes\Forms;
|
||||
use TheTempusProject\Classes\AdminController;
|
||||
use TheTempusProject\Models\Group;
|
||||
use TheTempusProject\Classes\Config;
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
|
||||
class Settings extends AdminController {
|
||||
public static $group;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
self::$title = 'Admin - Settings';
|
||||
self::$group = new Group;
|
||||
}
|
||||
|
||||
public function index() {
|
||||
if ( Input::exists( 'submit' ) ) {
|
||||
if ( !App::$activeConfig->updateFromForm( true ) ) {
|
||||
Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] );
|
||||
} else {
|
||||
Issues::add( 'success', 'Settings Updated' );
|
||||
}
|
||||
}
|
||||
Components::set( 'configForm', Config::getEditHtml() );
|
||||
Components::set(
|
||||
'group-defaultGroup-options',
|
||||
Forms::getOptionsHtml( self::$group->listGroupsSimple(), Config::getValue( 'group/defaultGroup' ) )
|
||||
);
|
||||
Views::view( 'admin.settings' );
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user