OSDN Git Service

Systemの非公開でキャラクター非公開化
authorCake <cake_67@users.sourceforge.jp>
Wed, 31 Mar 2010 05:03:02 +0000 (14:03 +0900)
committerCake <cake_67@users.sourceforge.jp>
Wed, 31 Mar 2010 05:03:02 +0000 (14:03 +0900)
app/controllers/systems_controller.php
app/controllers/users_controller.php
app/views/elements/character_picture_table.ctp
app/views/elements/home_right.ctp
app/views/systems/admin_edit.ctp

index d72f454..2d13b7e 100644 (file)
@@ -109,6 +109,11 @@ class SystemsController extends AppController {
 
                        if ($this->System->saveAll($this->data, array('fieldList' => array_merge($this->System->fields['edit'], $this->System->fields['image'])))) {
                                $this->Session->setFlash(sprintf(__('%s has been changed', true), $this->data['System']['name']));
+
+                               if ($this->data['System']['public_flag'] != 'public') {
+                                       $this->System->Character->updateAll(array('Character.public_flag' => "'private'"), array('Character.system_id' => $id));
+                               }
+
                                Cache::clear();
                                $this->redirect(array('action'=>'view', $id));
                        } else {
index cedb58d..2d37cf2 100644 (file)
@@ -3,6 +3,7 @@ class UsersController extends ModuleController {
 
        var $name = 'Users';
        var $helpers = array(
+               'Select',
                'Time',
        );
 
@@ -397,6 +398,7 @@ class UsersController extends ModuleController {
                }
                $this->set('public_characters', $public_characters);
 
+               $this->set_public_flag4view();
        }
 
        function _listview() {
index 323e044..68723b0 100644 (file)
@@ -55,6 +55,11 @@ foreach ($characters as $character):
        echo $html->div('lastModified', $time->niceShort($character['Character']['modified'], array('format' => 'Y/m/d H:i')));
 ?>
 <?php endif; ?>
+<?php if (isset($viewPublic) && $viewPublic === true): ?>
+<?php
+       echo $html->div('publicFlag', $select->get_i18n_unpublic_flag($character['Character']['public_flag'], $public_flags));
+?>
+<?php endif; ?>
 </td>
 
 <?php
index 1b5709c..8ad0741 100644 (file)
@@ -11,6 +11,7 @@
                'id' => null,
                'isUser' => false,
                'isSystem' => true,
+               'viewPublic' => true,
                'more_url' => array(
                        'controller' => 'characters', 
                        'action' => 'index',
index b38ea9c..7b2349b 100644 (file)
                'label' => __('URL', true),
        ));
        echo $select->create_publicflag_select($public_flags, 'public_flag', array(
-               'label' => __('Public Flag', true)
+               'label' => __('Public Flag', true),
+               'after' => $html->tag(
+                       'div',
+                       __('If unpublic, the belonging characters will be also unpublic.', true),
+                       array('class' => 'notice')
+               ),
        ));
        echo $form->input('set_npc', array(
                'label' => __('Use NPC', true),