| 1 |
<?php |
| 2 |
/** |
| 3 |
* |
| 4 |
*/ |
| 5 |
|
| 6 |
// Disallow direct access. |
| 7 |
defined('ABSPATH') or die("Access denied"); |
| 8 |
|
| 9 |
// import dependencies. |
| 10 |
cssJSToolbox::import('framework:mvc:controller-ajax.inc.php'); |
| 11 |
|
| 12 |
/** |
| 13 |
* |
| 14 |
*/ |
| 15 |
class CJTSettingsController extends CJTAjaxController { |
| 16 |
|
| 17 |
/** |
| 18 |
* put your comment there... |
| 19 |
* |
| 20 |
* @var mixed |
| 21 |
*/ |
| 22 |
protected $controllerInfo = array('model' => 'settings'); |
| 23 |
|
| 24 |
/** |
| 25 |
* put your comment there... |
| 26 |
* |
| 27 |
*/ |
| 28 |
public function __construct() { |
| 29 |
parent::__construct(); |
| 30 |
// Actions. |
| 31 |
$this->registryAction('manageForm'); |
| 32 |
$this->registryAction('save'); |
| 33 |
$this->registryAction('restoreDefault'); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* put your comment there... |
| 38 |
* |
| 39 |
*/ |
| 40 |
public function manageFormAction() { |
| 41 |
// Create settings view. |
| 42 |
$view = self::getView('settings/manager'); |
| 43 |
// Push settings into the view. |
| 44 |
$view->settings = $this->model; |
| 45 |
// Output settings view. |
| 46 |
$this->httpContentType = 'text/html'; |
| 47 |
$this->response = $view->getTemplate('settings'); |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* put your comment there... |
| 52 |
* |
| 53 |
*/ |
| 54 |
public function restoreDefaultAction() { |
| 55 |
|
| 56 |
} |
| 57 |
|
| 58 |
/** |
| 59 |
* put your comment there... |
| 60 |
* |
| 61 |
*/ |
| 62 |
public function saveAction() { |
| 63 |
// Get settings page parameters. |
| 64 |
$settings = filter_input(INPUT_POST, 'settings', FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY); |
| 65 |
$this->model->save($settings); |
| 66 |
$this->response = true; |
| 67 |
} |
| 68 |
|
| 69 |
} // End class. |