class CharactersController extends AppController {
var $name = 'Characters';
- var $helpers = array('Html', 'Form');
+ var $helpers = array(
+ 'Html',
+ 'Form',
+ 'Token'
+ );
+
+ /* ACL */
+ // 追加アクション用 crudMap
+ var $actionMapPlus = array(
+ );
+
+ var $disableTokenActions = array();
+
+ /* メソッド */
+
+ function beforeFilter() {
+
+ parent::beforeFilter();
+
+ // 不正fieldsのPOST削除(id, createdなど)
+ $this->unsetData('auto', true);
+
+ // 認証なしアクセス可
+ $this->AuthPlus->allow('view');
+ $this->AuthPlus->allow('index');
+ }
+
+ /* アクションメソッド */
function index() {
$this->Character->recursive = 0;
}
function add() {
+ $this->unsetData('add', false);
+
if (!empty($this->data)) {
+ $this->data['Character']['user_id'] = $this->user['User']['id'];
+
$this->Character->create();
if ($this->Character->save($this->data)) {
$this->Session->setFlash(__('The Character has been saved', true));
class Character extends AppModel {
var $name = 'Character';
+
+ var $fields = array(
+ 'id' => array(
+ 'auto' => true,
+ ),
+ 'name' => array(
+ 'auto' => false,
+ 'add' => true,
+ 'edit' => true,
+ 'escape' => array(
+ 'html' => true,
+ 'all' => true,
+ ),
+ ),
+ 'image_filename' => array(
+ 'auto' => false,
+ 'add' => false,
+ 'edit' => false,
+ ),
+ 'system_id' => array(
+ 'auto' => false,
+ 'add' => true,
+ 'edit' => false,
+ ),
+ 'sort_order' => array(
+ 'auto' => false,
+ 'add' => true,
+ 'edit' => true,
+ ),
+ 'status' => array(
+ 'auto' => false,
+ 'add' => true,
+ 'edit' => true,
+ ),
+ 'public_flag' => array(
+ 'auto' => false,
+ 'add' => true,
+ 'edit' => true,
+ ),
+ 'user_id' => array(
+ 'auto' => true,
+ ),
+ 'detail' => array(
+ 'auto' => false,
+ 'add' => true,
+ 'edit' => true,
+ 'escape' => array(
+ 'html' => true,
+ 'images' => true,
+ 'sctipts' => true,
+ ),
+ ),
+ 'deleted' => array(
+ 'auto' => true,
+ ),
+ 'created' => array(
+ 'auto' => true,
+ ),
+ 'modified' => array(
+ 'auto' => true,
+ ),
+ 'deleted_date' => array(
+ 'auto' => true,
+ ),
+ );
+
var $validate = array(
'name' => array('notempty'),
'sort_order' => array('numeric')
echo $form->input('system_id');
echo $form->input('user_id');
echo $form->input('name');
- echo $form->input('image_filename');
- echo $form->input('notes');
- echo $form->input('public_flag');
- echo $form->input('status_2');
+ echo $form->input('system_id');
echo $form->input('sort_order');
- echo $form->input('deleted');
- echo $form->input('deleted_date');
+ echo $form->input('status');
+ echo $form->input('public_flag');
+ echo $form->input('notes');
+
+ echo $token->create();
?>
</fieldset>
<?php echo $form->end('Submit');?>