]>
src.bluestatic.org Git - bugdar.git/blob - admin/fields.php
2 /*=====================================================================*\
3 || ###################################################################
5 || # Copyright (c)2002-2014 Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 namespace bugdar\admin
;
27 require_once HOPLITE_ROOT
. '/http/action_controller.php';
28 require_once BUGDAR_ROOT
. '/includes/model_field.php';
30 class FieldsAction
extends http\ActionController
implements TemplatePreCaching
32 public function TemplateSet()
34 return array('admin_fields_list', 'admin_fields_edit');
37 public function ActionList(http\Request
$request, http\Response
$response)
39 $response->data
['fields'] = bugdar\Field
::FetchGroup();
40 $response->context
['template'] = 'admin_fields_list';
43 public function ActionNew(http\Request
$request, http\Response
$response)
45 $response->data
['is_new'] = TRUE;
46 $response->context
['template'] = 'admin_fields_edit';
49 public function ActionEdit(http\Request
$request, http\Response
$response)
51 $field = new bugdar\
Field(bugdar
::$input->InputClean('g', 'field', http\Input
::TYPE_STR
));
52 $response->data
['field'] = $field->Fetch();
53 $response->context
['template'] = 'admin_fields_edit';
56 public function ActionSave(http\Request
$request, http\Response
$response)
58 if ($request->http_method
!= 'POST')
59 $this->controller()->StopWithCode(http\ResponseCode
::METHOD_NOT_ALLOWED
);
61 $this->controller()->StopWithRedirect($this->controller()->MakeURL('/fields/list'));
64 protected function _GetActionMethod(http\Request
$request)
66 $method = parent
::_GetActionMethod($request);