config now in settings
This commit is contained in:
42
Controller/Settings.php
Normal file
42
Controller/Settings.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Drone\Controller;
|
||||
|
||||
use \Cockpit\AuthController;
|
||||
|
||||
|
||||
/**
|
||||
* Settings controller class.
|
||||
*/
|
||||
class Settings extends AuthController {
|
||||
|
||||
/**
|
||||
* Default index controller.
|
||||
*/
|
||||
public function index() {
|
||||
if (!$this->app->module('cockpit')->hasaccess('drone', 'manage.settings')) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$drone = $this->app->storage->findOne('drone/settings');
|
||||
|
||||
return $this->render('drone:views/settings/index.php', compact('drone'));
|
||||
}
|
||||
|
||||
public function save() {
|
||||
if ($data = $this->param('drone', false)) {
|
||||
|
||||
$data['_modified'] = time();
|
||||
|
||||
if (!isset($data['_id'])) {
|
||||
$data['_created'] = $data['_modified'];
|
||||
}
|
||||
|
||||
$this->app->storage->save('drone/settings', $data);
|
||||
|
||||
return json_encode($data);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user