2 class ProfileTableStaticsController extends AppController {
4 var $name = 'ProfileTableStatics';
9 // POSTのTokenチェックをしないアクション
10 var $disableTokenActions = array();
12 function admin_edit($profile_table_id = null) {
13 if (!$profile_table_id && empty($this->data)) {
14 $this->Session->setFlash(__('Invalid Static ProfileTable', true));
15 $this->redirect(array('controller'=>'systems', 'action'=>'admin_index'));
17 $profileTable = $this->ProfileTableStatic->ProfileTable->find(
20 'conditions' => array(
21 'ProfileTable.id' => $profile_table_id,
25 'Profile' => array( 'System',
33 if (empty($profileTable['ProfileTable'])) {
34 $this->Session->setFlash(__('Invalid ID.', true));
35 $this->redirect(array('controller'=>'systems', 'action'=>'admin_index'));
38 foreach ($profileTable['ProfileTableStatic'] as $k => $v) {
39 if (isset($v['sort_order']) && !empty($v['sort_order'])) {
40 $sort_order[$k] = $v['sort_order'];
45 $profileTable['ProfileTableStatic'] = $this->sort4sort_order($profileTable['ProfileTableStatic'], $sort_order);
47 if (!empty($this->data)) {
49 $this->_set_new_profile_table_static($profileTable['ProfileTable']['id']);
51 $this->ProfileTableStatic->create();
52 if ($this->ProfileTableStatic->saveAll(
53 $this->data['ProfileTableStatic'],
55 'validate' => 'first',
56 'fieldList' => $this->ProfileTableStatic->fields['edit'],
59 $this->Session->setFlash(__('The Static ProfileTable has been saved', true));
60 $this->redirect(array('controller'=>'profile_tables', 'action'=>'admin_listview', $profileTable['ProfileTable']['profile_id']));
62 $this->Session->setFlash(__('The data could not be saved. Please, try again.', true));
64 unset($this->data['ProfileTableStatic']['__Token']);
65 $this->data['Profile'] = $profileTable['Profile'];
66 $this->data['ProfileTable'] = $profileTable['ProfileTable'];
69 if (empty($this->data)) {
70 $this->data = $profileTable;
73 $this->pageTitle .= " - ". __('Edit Static ProfileTable', true);
76 function admin_delete($id = null) {
78 $this->Session->setFlash(__('Invalid URL.', true));
79 $this->redirect(array('controller' => 'systems', 'action'=>'admin_index'));
82 $profileTableStatic = $this->ProfileTableStatic->find(
85 'conditions' => array(
86 'ProfileTableStatic.id' => $id,
94 if (empty($profileTableStatic)) {
95 $this->Session->setFlash(__('Invalid ID.', true));
96 $this->redirect(array('controller'=>'systems', 'action'=>'admin_index'));
99 if ($this->ProfileTableStatic->delete($id)) {
100 $this->Session->setFlash(__('ProfileTable Static has deleted', true));
102 $this->Session->setFlash(__('The data has not been deleted', true));
105 $this->redirect(array('action'=>'admin_edit', $profileTableStatic['ProfileTable']['id']));
108 function _set_new_profile_table_static($profile_table_id)
110 if (!isset($this->data['ProfileTableStatic']) || empty($profile_table_id)) {
114 foreach ($this->data['ProfileTableStatic'] as $k => $v) {
115 if (isset($v['__Token'])) {
120 if (!CorePlus::is_valid($v, 'title')) {
121 unset($this->data['ProfileTableStatic'][$k]);
125 $this->data['ProfileTableStatic'][$k]['profile_table_id'] = $profile_table_id;
127 if (empty($v['sort_order'])) {
128 $this->data['ProfileTableStatic'][$k]['sort_order'] = 0;
131 unset($this->data['ProfileTableStatic']['__Token']);