| @@ 13-50 (lines=38) @@ | ||
| 10 | namespace erdiko\controllers; |
|
| 11 | ||
| 12 | ||
| 13 | class Ajax extends \erdiko\Controller |
|
| 14 | { |
|
| 15 | ||
| 16 | /** |
|
| 17 | * Contructor |
|
| 18 | */ |
|
| 19 | public function __construct() |
|
| 20 | { |
|
| 21 | $this->_webroot = ERDIKO_ROOT; |
|
| 22 | $this->_response = new \erdiko\core\AjaxResponse; |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Before |
|
| 27 | */ |
|
| 28 | public function _before() |
|
| 29 | { |
|
| 30 | // Do nothing, it overrides the core before function which prepares for theming |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * setStatusCode |
|
| 35 | * |
|
| 36 | */ |
|
| 37 | public function setStatusCode($code = null) |
|
| 38 | { |
|
| 39 | if (!empty($code)) { |
|
| 40 | $this->_response->setStatusCode($code); |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||
| 44 | public function setErrors($errors = null) |
|
| 45 | { |
|
| 46 | if (!empty($errors)) { |
|
| 47 | $this->_response->setErrors($errors); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||
| @@ 12-41 (lines=30) @@ | ||
| 9 | namespace erdiko\controllers; |
|
| 10 | ||
| 11 | ||
| 12 | class Api extends \erdiko\Controller |
|
| 13 | { |
|
| 14 | ||
| 15 | /** |
|
| 16 | * Contructor |
|
| 17 | */ |
|
| 18 | public function __construct() |
|
| 19 | { |
|
| 20 | $this->_webroot = ERDIKO_ROOT; |
|
| 21 | $this->_response = new \erdiko\core\ApiResponse; |
|
| 22 | } |
|
| 23 | ||
| 24 | /** |
|
| 25 | * setStatusCode |
|
| 26 | * |
|
| 27 | */ |
|
| 28 | public function setStatusCode($code = null) |
|
| 29 | { |
|
| 30 | if (!empty($code)) { |
|
| 31 | $this->_response->setStatusCode($code); |
|
| 32 | } |
|
| 33 | } |
|
| 34 | ||
| 35 | public function setErrors($errors = null) |
|
| 36 | { |
|
| 37 | if (!empty($errors)) { |
|
| 38 | $this->_response->setErrors($errors); |
|
| 39 | } |
|
| 40 | } |
|
| 41 | } |
|
| 42 | ||