OSDN Git Service

キャラ画像の最大枚数設定追加
[trpgtools-onweb/cake-frame.git] / app / controllers / characters_controller.php
1 <?php
2
3 class CharactersController extends AppController {
4
5         var $name = 'Characters';
6         var $helpers = array(
7                 'Select',
8                 'Profiledisp',
9         );
10
11         /* ACL */
12         // 追加アクション用 crudMap
13         var $actionMapPlus = array(
14                 'add_milti_profiles' => 'update',
15                 'set_status' => 'update',
16         );
17
18         var $disableTokenActions = array();
19
20         var $post_data = array();
21
22         /* メソッド */
23
24         function beforeFilter() {
25
26                 parent::beforeFilter();
27
28                 // 認証なしアクセス可
29                 $this->AuthPlus->allow('view');
30                 $this->AuthPlus->allow('index');
31         }
32
33         function beforeRender()
34         {
35                 parent::beforeRender();
36
37                 $this->set_public_flag4view();
38                 $this->set_status4view();
39         }
40
41
42         /* アクションメソッド */
43
44         function index() {
45                 $this->_index();
46         }
47
48         function view($id = null) {
49                 if (!$id) {
50                         $this->Session->setFlash(__('Invalid Character.', true));
51                         $this->redirect(array('action'=>'index'));
52                 }
53
54                 $conditions = array(
55                         'Character.id' => $id,
56                         'Character.deleted' => 0,
57                 // todo:public_flagチェック
58                 );
59
60                 $character = $this->_view($id, $conditions);
61                 if (!$character['Character']) {
62                         $this->Session->setFlash(__('Invalid Character.', true));
63                         $this->redirect(array('action'=>'index'));
64                 }
65
66                 $this->set('maxPictures', $this->check_character_picture_max(count($character['CharacterPicture'])));
67
68                 $isOwner = false;
69                 if ($this->isOwner($character['Character'], $this->user_id)) {
70                         $isOwner = true;
71                 }
72                 $this->set('isOwner', $isOwner);
73
74                 // キャラ画像のpublic_flagチェック
75                 if ($isOwner !== true && !empty($character['CharacterPicture'])) {
76                         foreach($character['CharacterPicture'] as $k => $v) {
77                                 if (!$this->check_public_flag2($v)) {
78                                         unset($character['CharacterPicture'][$k]);
79                                 }
80                         }
81                 }
82
83                 $this->set('character', $this->HtmlEscape->nl2br_escaped($character));
84         }
85
86         function add() {
87                 if (!empty($this->data)) {
88                         $this->data['Character']['user_id'] = $this->user_id;
89
90                         $this->Character->create();
91                         if ($this->Character->save($this->data, array('fieldList' => $this->Character->fields['add']))) {
92                                 $this->Session->setFlash(__('The Character has been saved', true));
93                                 $this->redirect(array('action'=>'index'));
94                         } else {
95                                 $this->Session->setFlash(__('The Character could not be saved. Please, try again.', true));
96                         }
97                 }
98                 $systems = $this->Character->System->find('list');
99                 $this->set('systems', $systems);
100                 $this->set('isOwner', false);
101         }
102
103         function edit($id = null) {
104                 if (!$id && empty($this->data)) {
105                         $this->Session->setFlash(__('Invalid ID.', true));
106                         $this->redirect(array('action'=>'index'));
107                 }
108
109                 // Characterデータ取得
110                 $conditions = array(
111                         'Character.id' => $id,
112                 );
113                 $this->Character->System->hasMany['Profile']['fields'] = '';
114                 $this->Character->System->Profile->hasMany['CharactersHasProfile']['fields'] = '';
115
116                 $character = $this->_get_character4edit($conditions, $id);
117
118                 if (empty($this->data)) {
119                         $character['System']['Profile'] = $this->_set_profile_table2characters_has_profiles($character['System']['Profile']);
120                 }
121
122                 if (!empty($this->data)) {
123                         $this->post_data = $this->data;
124
125                         // 新hasProfile処理
126                         $this->data['CharactersHasProfile'] = $this->_set_new_characters_has_profile($this->data['CharactersHasProfile']);
127
128                         /* validate */
129                         $this->_set_validate4characters_has_profile($character['System']['id']);
130
131                         /* validateCheck */
132                         if ($this->Character->saveAll($this->data, array('validate' => 'only'))) {
133
134                                 // 現在のhas_profiles削除
135                                 $this->Character->CharactersHasProfile->deleteAll(array(
136                                         'CharactersHasProfile.character_id' => $id
137                                 ));
138
139
140                                 /* データ保存 */
141                                 $this->data['Character']['id'] = $id;
142                                 $this->Character->create();
143
144                                 if ($this->Character->saveAll($this->data, array(
145                                         'validate' => false,
146                                          'fieldList' => array_merge(
147                                                 $this->Character->fields['edit'], 
148                                                 $this->Character->CharactersHasProfile->fields['add']
149                                          )
150                                 ))) {
151                                         $this->Session->setFlash(__('The Character has been saved.', true));
152                                         Cache::clear();
153                                         $this->redirect(array('action'=>'view', $id));
154                                 }
155                         }
156
157                         $this->data = $character;
158                         $this->data['Character'] = $this->post_data['Character'];
159                         $this->data['Character']['id'] = $id;
160
161                         foreach($this->data['System']['Profile'] as $k1 => $profile) {
162                                 foreach($profile['CharactersHasProfile'] as $k2 => $v) {
163                                         $postdata = array_shift($this->post_data['CharactersHasProfile']);
164                                         if (isset($v['profile_select_id']) && !isset($postdata['profile_select_id'])) {
165                                                 array_unshift($this->post_data['CharactersHasProfile'], $postdata);
166                                                 continue;
167                                         } 
168                                         if (is_array($postdata['value'])) {
169                                                 $postdata['value'] = $postdata['value'][0];
170                                         }
171                                         $this->data['System']['Profile'][$k1]['CharactersHasProfile'][$k2]['value'] = $postdata['value'];
172                                         if (isset($postdata['profile_select_id'])) {
173                                                 $this->data['System']['Profile'][$k1]['CharactersHasProfile'][$k2]['profile_select_id'] = $postdata['profile_select_id'];
174                                         }
175                                 }
176                         }
177                 }
178
179                 if (empty($this->data)) {
180                         $this->data = $character;
181                         $this->data['Character'] = $this->_restore_html_character($this->data['Character']);
182
183                         $this->data['System']['Profile'] = $this->_restore_html_characters_has_profiles($this->data['System']['Profile']);
184                 }
185                 $this->set('isOwner', true);
186         }
187
188         function add_milti_profiles($id = null) {
189                 if (!$id || !CorePlus::is_valid($this->params['named'], 'profile_id')) {
190                         $this->Session->setFlash(__('Invalid ID.', true));
191                         $this->redirect(array('action'=>'index'));
192                 }
193
194                 // Characterデータ取得
195                 $conditions = array(
196                         'Character.id' => $id,
197                 );
198                 $this->Character->System->hasMany['Profile']['fields'] = '';
199                 $this->Character->System->Profile->hasMany['CharactersHasProfile']['fields'] = '';
200
201                 $character = $this->_get_character4edit($conditions, $id);
202
203                 // Profilesデータ取得
204                 if (empty($character['System']['Profile'])) {
205                         $this->Session->setFlash(__('Invalid Profile.', true));
206                         $this->redirect(array('action'=>'view', $id));
207                 }
208
209                 $profile_id = $this->params['named']['profile_id'];
210
211                 if (empty($this->data)) {
212                         $target = array();
213                         foreach ($character['System']['Profile'] as $profile) {
214                                 if ($profile['id'] == $profile_id) {
215                                         $target = $profile;
216                                         break;
217                                 }
218                         }
219
220                         if (!$target) {
221                                 $this->Session->setFlash(__('No Profile.', true));
222                                 $this->redirect(array('action'=>'view', $id));
223                         }
224
225                         $character['System']['Profile'] = array();
226                         $character['System']['Profile'][0] = $target;
227
228                         $character['System']['Profile'] = $this->_set_profile_table2characters_has_profiles($character['System']['Profile']);
229                 }
230
231                 if (!empty($this->data)) {
232                         $this->post_data = $this->data;
233
234                         $this->data['Character'] = $character['Character'];
235                         $this->data['Character'] = $this->_restore_html_character($this->data['Character']);
236                         $this->data['Character']['__Token'] = $this->post_data['Character']['__Token'];
237                         $this->data['Character']['modified'] = null;
238
239                         // 新hasProfile処理
240                         $this->data['CharactersHasProfile'] = $this->_set_new_characters_has_profile($this->data['CharactersHasProfile'], $profile_id, $character['System']['Profile']);
241
242                         /* validate */
243                         $this->_set_validate4characters_has_profile($character['System']['id']);
244
245                         /* validateCheck */
246                         if ($this->Character->saveAll($this->data, array('validate' => 'only'))) {
247
248                                 // 現在のhas_profiles削除
249                                 $this->Character->CharactersHasProfile->deleteAll(array(
250                                         'CharactersHasProfile.character_id' => $id
251                                 ));
252
253                                 /* データ保存 */
254                                 $this->Character->create();
255                                 if ($this->Character->saveAll($this->data, array(
256                                         'validate' => false,
257                                          'fieldList' => array_merge(
258                                                 $this->Character->CharactersHasProfile->fields['add']
259                                          )
260                                 ))) {
261                                         $this->Session->setFlash(__('The Character has been saved.', true));
262                                         Cache::clear();
263                                         $this->redirect(array('action'=>'view', $id));
264                                 }
265                         }
266
267                         $this->data = $character;
268                         $this->data['Character'] = $this->post_data['Character'];
269                         $this->data['Character']['id'] = $id;
270
271                 }
272
273                 if (empty($this->data)) {
274                         $this->data = $character;
275                         $this->data['System']['Profile'] = $this->_restore_html_characters_has_profiles($this->data['System']['Profile']);
276                 }
277
278                 $this->set('isOwner', true);
279         }
280
281         function set_status($id = null) {
282                 if (!$id || !isset($this->params['named']['mode'])) {
283                         $this->Session->setFlash(__('Invalid ID.', true));
284                         $this->redirect(array('controller' => 'characters', 'action'=>'index'));
285                 }
286
287                 $character = $this->_get_character4character_id($id, $this->user_id, 'public');
288
289                 if ($this->params['named']['mode'] != 'main_picture' && $this->params['named']['mode'] != 'full_length') {
290                         $this->Session->setFlash(__('Invalid URL.', true));
291                         $this->redirect(array('controller' => 'character_pictures', 'action'=>'index', $id));
292                 }
293
294                 // 新picture設定
295                 $new_character_picture = null;
296                 if (isset($this->params['named']['new_picture_id']) && $this->params['named']['new_picture_id'] != 'null') {
297                         if ($character['CharacterPicture']) {
298                                 foreach($character['CharacterPicture'] as $k => $v) {
299                                         if ($v['id'] == $this->params['named']['new_picture_id']) {
300                                                 $new_character_picture = CorePlus::get_value($v, 'Attachment.0.basename');
301                                                 break;
302                                         }
303                                 }
304                         }
305                         if (!$new_character_picture) {
306                                 $this->Session->setFlash(__('Invalid data.', true));
307                                 $this->redirect(array('controller' => 'character_pictures', 'action'=>'index', $id));
308                         }
309                 }
310
311                 // 設定変更
312                 $this->Character->id = $id;
313                 $this->data['Character'][$this->params['named']['mode']] = $new_character_picture;
314                 $this->Character->save(
315                         $this->data, 
316                         array(
317                                 'fieldList' => array(
318                                         $this->params['named']['mode']
319                                 ), 
320                         )
321                 );
322
323                 $this->Session->setFlash(__('CharacterPicture Configuration has been saved.', true));
324                 $this->redirect(array('controller' => 'character_pictures', 'action' => 'index', $id));
325         }
326
327         function delete($id = null) {
328                 if (!$id) {
329                         $this->Session->setFlash(__('Invalid id for Character', true));
330                         $this->redirect(array('action'=>'index'));
331                 }
332
333                 $character = $this->Character->read(null, $id);
334                 if (empty($character)) {
335                         $this->Session->setFlash(__('No Character', true));
336                         $this->redirect(array('action'=>'index'));
337                 }
338
339                 if (!$this->isOwner($character['Character'], $this->user_id)) {
340                         $this->Session->setFlash(__('No Permission', true));
341                         $this->redirect(array('action'=>'index'));
342                 }
343
344                 if ($this->Character->del($id)) {
345                         $this->Session->setFlash(__('Character deleted', true));
346                         $this->redirect(array('action'=>'index'));
347                 }
348
349                 $this->set('isOwner', true);
350         }
351
352
353         function admin_index() {
354                 $this->_index();
355         }
356
357         function admin_view($id = null) {
358                 if (!$id) {
359                         $this->Session->setFlash(__('Invalid Character.', true));
360                         $this->redirect(array('action'=>'admin_index'));
361                 }
362
363                 $conditions = array(
364                         'Character.id' => $id,
365                 );
366
367                 $character = $this->_view($id, $conditions);
368                 if (!$character['Character']) {
369                         $this->Session->setFlash(__('Invalid Character.', true));
370                         $this->redirect(array('action'=>'admin_index'));
371                 }
372
373                 $this->set('character', $this->HtmlEscape->nl2br_escaped($character));
374         }
375
376         function admin_delete($id = null) {
377                 if (!$id) {
378                         $this->Session->setFlash(__('Invalid id for Character', true));
379                         $this->redirect(array('action'=>'index'));
380                 }
381                 if ($this->Character->del($id)) {
382                         $this->Session->setFlash(__('Character deleted', true));
383                         $this->redirect(array('action'=>'index'));
384                 }
385         }
386
387
388         /* 共通化アクションメソッド */
389         function _index() {
390                 $this->Character->recursive = 0;
391                 $this->set('characters', $this->HtmlEscape->nl_unescape($this->paginate()));
392
393                 $this->set('isOwner', false);
394         }
395
396         function _view($id, $conditions, $public_flag = null) {
397                 $this->Character->System->Profile->hasMany['CharactersHasProfile']['conditions']['CharactersHasProfile.character_id'] = $id;
398                 if (empty($public_flag)) {
399                         unset($this->Character->hasMany['CharacterPicture']['conditions']['CharacterPicture.public_flag']);
400                 } else {
401                         $this->Character->hasMany['CharacterPicture']['conditions']['CharacterPicture.public_flag'] = $public_flag;
402                 }
403
404                 // キャラデータ取得
405                 $orig_character = $this->Character->find('first', array(
406                         'conditions' => $conditions,
407                         'order' => array('Character.modified' => 'desc'),
408                         'contain' => array(
409                                 'User',
410                                 'System' => array(
411                                         'Profile' => array(
412                                                 'CharactersHasProfile',
413                                                 'ProfileTable' => array(
414                                                         'ProfileTableStatic',
415                                                 ),
416                                         ),
417                                 ),
418                                 'CharacterPicture' => array(
419                                         'Attachment',
420                                 ),
421                         ),
422                         'recursive' => 4,
423                 ));
424
425                 if (empty($orig_character['Character'])) {
426                         return $orig_character;
427                 }
428
429                 if (!empty($orig_character['System']['Profile'])) {
430                         $new_profile = array();
431                         foreach ($orig_character['System']['Profile'] as $k => $profile) {
432                                 $new_profile[$profile['key_name']]['id'] = $profile['id'];
433                                 $new_profile[$profile['key_name']]['name'] = $profile['name'];
434                                 $new_profile[$profile['key_name']]['profile_type'] = $profile['profile_type'];
435                                 if (!empty($profile['ProfileTable'])) {
436                                         $new_profile[$profile['key_name']]['ProfileTable'] = $profile['ProfileTable'];
437                                 }
438                                 if ($profile['profile_type'] == 's-table' && empty($profile['CharactersHasProfile'])) {
439                                         if (isset($profile['ProfileTable'][0]['ProfileTableStatic'])) {
440                                                 foreach ($profile['ProfileTable'][0]['ProfileTableStatic'] as $k2 => $v2) {
441                                                         $new_profile[$profile['key_name']]['CharactersHasProfile'][] = $this->_set_blank4static_table($profile['ProfileTable'][0]['ProfileTableStatic'][$k2]['title'], $profile['ProfileTable'][0]['profile_id'], $profile['ProfileTable'][0]['id']);
442                                                         for ($i=1;$i<count($profile['ProfileTable']);$i++) {
443                                                                 $new_profile[$profile['key_name']]['CharactersHasProfile'][] = $this->_set_blank4static_table(null, $profile['ProfileTable'][$i]['profile_id'], $profile['ProfileTable'][$i]['id']);
444
445                                                         }
446                                                 }
447                                         } else {
448                                                 $new_profile[$profile['key_name']]['CharactersHasProfile'] = null;
449                                         }
450                                 } else {
451                                         $new_profile[$profile['key_name']]['CharactersHasProfile'] = $profile['CharactersHasProfile'];
452                                 }
453                         }
454
455                         $orig_character['System']['Profile'] = $new_profile;
456                 }
457
458                 $character = array(
459                         'Character' => $orig_character['Character'],
460                         'CharacterPicture' => $orig_character['CharacterPicture'],
461                         'System' => $orig_character['System'],
462                         'User' => $orig_character['User']
463                 );
464
465                 return $character;
466         } 
467
468
469         /* 共通関数 */
470         function _get_character4edit($conditions, $character_id)
471         {
472                 $this->Character->System->Profile->hasMany['CharactersHasProfile']['conditions']['CharactersHasProfile.character_id'] = $character_id;
473
474                 $character = $this->Character->find('first', array(
475                         'conditions' => $conditions,
476                         'contain' => array(
477                                 'User',
478                                 'System' => array(
479                                         'Profile' => array(
480                                                 'ProfileSelect',
481                                                 'ProfileTable' => array(
482                                                         'ProfileTableStatic',
483                                                 ),
484                                                 'CharactersHasProfile',
485                                         ),
486                                 ),
487                         ),
488                         'recursive' => 4,
489                 ));
490
491                 if (empty($character)) {
492                         $this->Session->setFlash(__('No Character', true));
493                         $this->redirect(array('action'=>'index'));
494                 }
495
496                 if (!$this->isOwner($character['Character'], $this->user_id)) {
497                         $this->Session->setFlash(__('No Permission', true));
498                         $this->redirect(array('action'=>'index'));
499                 }
500         
501                 return $character;
502         }
503
504         // ProfileTableをCharacterHasProfilesのTableの形式にセット
505         function _set_profile_table2characters_has_profiles($profile)
506         {
507                 if (!empty($profile[0]['CharactersHasProfile'])) {
508                         return $profile;
509                 }
510
511                 foreach($profile as $k => $v) {
512                         if (empty($v['ProfileTable'])) {
513                                 continue;
514                         }
515                         $tmp = array();
516                         $rows = count($v['CharactersHasProfile']);
517                         for($i=0; $i<$rows; $i++) {
518                                 foreach($v['ProfileTable'] as $k2 => $v2) {
519                                         if (isset($v2['CharactersHasProfile'][$i])) {
520                                                 $tmp[] = $v2['CharactersHasProfile'][$i];
521                                         } else {
522                                                 $tmp[] = null;
523                                         }
524                                 }
525                         }
526                         $profile[$k]['CharactersHasProfile'] = $tmp;
527                         }
528
529                 return $profile;
530         }
531
532         /* POSTのCharactersHasProfileを処理 */
533         function _set_new_characters_has_profile($characters_has_profiles, $profile_id = null, $now_data = array())
534         {
535                 $prev_profile_id = null;
536                 $profileTable_tmp = array();
537                 $i = 0;
538                 foreach ($characters_has_profiles as $k => $v) {
539                         if (!empty($character_id)) {
540                                 $characters_has_profiles[$k]['character_id'] = $character_id;
541                         }
542
543                         // 配列valueの処理
544                         if (is_array($v['value'])) {
545                                 $characters_has_profiles[$k]['value'] = $v['value'][0];
546                         }
547
548                         // 空の値処理
549                         // table: 一時保管して全項目空の場合行削除
550                         if (CorePlus::is_valid($v, 'profile_table_id')) {
551                                 if (isset($profileTable_tmp[$v['profile_id']][$i][$v['profile_table_id']])) {
552                                         $i++;
553                                 }
554                                 $profileTable_tmp[$v['profile_id']][$i][$v['profile_table_id']] = array($v, $k);
555                         // select/table以外は処理なし(処理停止)
556 /*                      } elseif (!CorePlus::is_valid($v, 'profile_select_id') && empty($v['value'])) {
557                                         unset($characters_has_profiles[$k]);
558                                         continue;*/
559                         }
560                 }
561
562                 // table: 空行削除、不正profile_table_idデータ削除
563                 if (!empty($profileTable_tmp)) {
564                         if (!isset($this->Character->ProfileTable)) {
565                                 $this->Character->ProfileTable = CorePlus::set_model('ProfileTable');
566                         }
567                         foreach($profileTable_tmp as $profile_id => $v) {
568                                 $profile_table_columns = $this->Character->ProfileTable->find('list', array(
569                                         'conditions' => array('ProfileTable.profile_id' => $profile_id),
570                                         'fields' => array('ProfileTable.id'),
571                                         'order' => array('ProfileTable.sort_order' => 'asc'),
572                                         'recursive' => -1,
573                                 ));
574
575                                 foreach ($v as $i => $profile_tables) {
576                                         // 不正POSTの削除
577                                         $diff_keys = array_diff_key($profile_tables, $profile_table_columns);
578                                         if (!empty($diff_keys)) {
579                                                 foreach($diff_keys as $dvalue) {
580                                                         unset($characters_has_profiles[$dvalue[1]]);
581                                                 }
582                                         }
583
584                                         // 空行削除
585                                         $delete_flg = true;
586                                         foreach($profile_table_columns as $k => $columns) {
587                                                 if (CorePlus::is_valid($profile_tables, $columns.'.0.value')) {
588                                                         $delete_flg = false;
589                                                         break;
590                                                 }
591                                         }
592                                         if ($delete_flg === true) {
593                                                 foreach ($profile_tables as $delk) {
594                                                         unset($characters_has_profiles[$delk[1]]);
595                                                 }
596                                         }
597                                 }
598                         }
599                 }
600
601                 // 指定データのみ変更
602                 if (!is_null($profile_id) && !empty($now_data)) {
603                         $tmp = array();
604                         $i = 0;
605                         foreach($now_data as $k => $v) {
606                                 if ($v['id'] == $profile_id) {
607                                         $v['CharactersHasProfile'] = $characters_has_profiles;
608                                 }
609
610                                 foreach ($v['CharactersHasProfile'] as $k2 => $v2) {
611                                         $tmp[$i] = $v2;
612                                         if (isset($tmp[$i]['id'])) {
613                                                 unset($tmp[$i]['id']);
614                                         }
615                                         if (isset($tmp[$i]['character_id'])) {
616                                                 unset($tmp[$i]['character_id']);
617                                         }
618
619                                         $i++;
620                                 }
621                         }
622
623                         $characters_has_profiles = $tmp;
624                 }
625
626                 return $characters_has_profiles;
627         }
628
629         // CharactersHasProfileの追加valiadte設定
630         function _set_validate4characters_has_profile($system_id)
631         {
632                 $this->Character->CharactersHasProfile->validate['profile_id']['validProfileId'] = array(
633                         'rule' => array('validProfileId', $system_id),
634                 );
635                 $this->Character->CharactersHasProfile->validate['profile_select_id']['validProfileSelectId'] = array(
636                         'rule' => array('validProfileSelectId', $system_id),
637                         'allowEmpty' => true,
638                 );
639                 $this->Character->CharactersHasProfile->validate['profile_table_id']['validProfiletableId'] = array(
640                 'rule' => array('validProfiletableId', $system_id),
641                 'allowEmpty' => true,
642                 );
643         }
644
645         /* restore_html */
646         function _restore_html_character($data, $nl2br = false) {
647                 $data['name'] = $this->{$this->modelClass}->restore_html($data['name'], false, false, false);
648                 $data['notes'] = $this->{$this->modelClass}->restore_html($data['notes'], false, false, false);
649                 if ($nl2br) {
650                         $data['notes'] = nl2br($data['notes']);
651                 }
652
653                 return $data;
654         }
655
656         function _restore_html_characters_has_profiles($profile, $nl2br = false) {
657                 if (empty($profile)) {
658                         return null;
659                 }
660
661                 foreach($profile as $k => $v) {
662                         if (empty($v['CharactersHasProfile'])) {
663                                 continue;
664                         }
665                         $profile[$k]['CharactersHasProfile'] = $this->__restore_html_characters_has_profiles($v['CharactersHasProfile'], $nl2br);
666                 }
667
668                 return $profile;
669         }
670         function __restore_html_characters_has_profiles($data, $nl2br = false) {
671                 if (empty($data)) {
672                         return null;
673                 }
674
675                 foreach ($data as $k => $v) {
676                         if (isset($v['value'])) {
677                                 $data[$k]['value'] = $this->{$this->modelClass}->restore_html($v['value'], false, false, false);
678                                 if ($nl2br) {
679                                 }
680                         }
681                 }
682
683                 return $data;
684         }
685
686         /* status設定をview用にセット */
687         function set_status4view()
688         {
689                 $model_status = $this->get_status();
690
691                 $this->set('status', $model_status);
692         }
693         function get_status()
694         {
695                 return $this->Character->status;
696         }
697
698         function _set_blank4static_table($value, $profile_id, $profile_table_id)
699         {
700                 return array(
701                         'profile_id' => $profile_id,
702                         'profile_table_id' => $profile_table_id,
703                         'value' => $value,
704                         'public_flag' => 'public',
705                 );
706         }
707
708 }
709