OSDN Git Service

単一システム時のキャラ作成処理修正
authorCake <cake_67@users.sourceforge.jp>
Wed, 11 Aug 2010 01:20:32 +0000 (10:20 +0900)
committerCake <cake_67@users.sourceforge.jp>
Wed, 11 Aug 2010 01:20:32 +0000 (10:20 +0900)
app/controllers/app_controller.php
app/controllers/characters_controller.php
app/views/characters/add.ctp

index 692392d..a16b666 100644 (file)
@@ -367,9 +367,15 @@ class AppController extends Controller
                        'conditions' => $conditions,
                        'recursive' => -1,
                ));
+
                if (!empty($systems)) {
                        foreach ($systems as $k => $v) {
                                $systems[$k] = $this->{$this->modelClass}->restore_html($v);
+
+                               // SingleSystem
+                               if (isset($this->site_configs['System.singleSystem']['value']) && $this->site_configs['System.singleSystem']['value']) {
+                                       break;
+                               }
                        }
                }
 
index f250906..1415c44 100644 (file)
@@ -108,6 +108,11 @@ class CharactersController extends AppController {
        function add() {
                $systems = $this->_get_systems();
 
+               // SingleSystem
+               if (isset($this->site_configs['System.singleSystem']['value']) && $this->site_configs['System.singleSystem']['value']) {
+                       $this->params['named']['system_id'] = key($systems);
+               }
+
                if (isset($this->params['named']['system_id'])) {
                        $system = $this->Character->System->find('first', array(
                                'conditions' => array(
@@ -120,9 +125,9 @@ class CharactersController extends AppController {
                                        'System.set_npc',
                                )
                        ));
-                       if (!empty($system['System']) && $system['System']['set_npc']) {
-                               $this->isNpc = true;
-                       }
+               }
+               if (isset($system['System']) && !empty($system['System']) && $system['System']['set_npc']) {
+                       $this->isNpc = true;
                }
 
                if (!empty($this->data)) {
index fee894d..db82a65 100644 (file)
@@ -23,7 +23,7 @@
        ));
        if (isset($this->params['named']['system_id']) && !empty($this->params['named']['system_id'])) {
                echo '<div class="input select">';
-               echo '<label for="CharacterSystemId">'. __('System').'</label>';
+               echo '<label for="CharacterSystemId">'. __('System', true).'</label>';
                echo $form->input('system_id', array(
                        'type' => 'hidden',
                        'value' => $this->params['named']['system_id'],