OSDN Git Service

group名称表示実装
authorCake <cake_67@users.sourceforge.jp>
Tue, 8 Jun 2010 05:04:17 +0000 (14:04 +0900)
committerCake <cake_67@users.sourceforge.jp>
Tue, 8 Jun 2010 05:08:30 +0000 (14:08 +0900)
app/controllers/users_controller.php
app/locale/jpn/LC_MESSAGES/default.po
app/views/helpers/group.php [new file with mode: 0644]
app/views/users/admin_add.ctp
app/views/users/admin_listview.ctp
app/views/users/admin_view.ctp

index 5e1c638..cc04f0d 100644 (file)
@@ -3,6 +3,7 @@ class UsersController extends ModuleController {
 
        var $name = 'Users';
        var $helpers = array(
+               'Group',
                'Select',
                'Time',
        );
index 7b10a16..67d2fe1 100644 (file)
@@ -1474,7 +1474,35 @@ msgstr ""
 
 #: /views/groups/admin_view.ctp:24
 msgid "Delete Group"
-msgstr "グループ削除"
+msgstr "権限設定削除"
+
+#: /views/helpers/group.php:
+msgid "Super Administrator"
+msgstr "管理者"
+
+#: /views/helpers/group.php:
+msgid "Vice-Administrator"
+msgstr "副管理者"
+
+#: /views/helpers/group.php:
+msgid "Watcher"
+msgstr "監視者"
+
+#: /views/helpers/group.php:
+msgid "User"
+msgstr "一般ユーザ"
+
+#: /views/helpers/group.php:
+msgid "Locked"
+msgstr "ログイン停止"
+
+#: /views/helpers/group.php:
+msgid "Pre-User"
+msgstr "仮登録"
+
+#: /views/helpers/group.php:
+msgid "Banned"
+msgstr "管理者削除"
 
 #: /views/helpers/profiledisp.php:67
 msgid "input"
diff --git a/app/views/helpers/group.php b/app/views/helpers/group.php
new file mode 100644 (file)
index 0000000..bf5f6d2
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+/* 
+ * 管理権限表示用Helper
+ */
+class GroupHelper extends Helper {
+       var $helpers = array(
+               'Html',
+               'Form'
+       );
+
+       var $full_groups = array();
+       var $groups = array();
+
+       function __construct()
+       {
+               $this->full_groups = array(
+                       Configure::read('Group.admin') => __('Super Administrator', true),
+                       Configure::read('Group.subadmin') => __('Vice-Administrator', true),
+//                     Configure::read('Group.watcher') => __('Watcher', true),
+                       Configure::read('Group.member') => __('User', true),
+                       Configure::read('Group.locked') => __('Locked', true),
+                       Configure::read('Group.pre') => __('Pre-User', true),
+                       Configure::read('Group.deleted') => __('Banned', true),
+               );
+
+               $this->groups = array(
+                       Configure::read('Group.admin') => __('Super Administrator', true),
+                       Configure::read('Group.subadmin') => __('Vice-Administrator', true),
+//                     Configure::read('Group.watcher') => __('Watcher', true),
+                       Configure::read('Group.member') => __('User', true),
+                       Configure::read('Group.pre') => __('Pre-User', true),
+               );
+       }
+
+       function get_name4group_id($group_id)
+       {
+               if (empty($group_id)) {
+                       return null;
+               }
+
+               if (isset($this->full_groups[$group_id])) {
+                       return $this->full_groups[$group_id];
+               } else {
+                       return null;
+               }
+       }
+
+
+       function create_group_select($fieldName = 'group_id', $options = array('type' => 'select', 'default' => ''))
+       {
+               if (!isset($options['type'])) {
+                       $options['type'] = 'select';
+               }
+
+               if (!isset($options['default']) || empty($options['default'])) {
+                       $options['default'] = Configure::read('Group.member');
+               }
+
+               $options['options'] = $this->groups;
+               return $this->Form->input($fieldName, $options);
+       }
+}
+
index d654ec1..0244de4 100644 (file)
@@ -15,9 +15,7 @@
                        array('class' => 'attention')
                )
        ));
-       echo $form->input('group_id', array(
-                       'label' => __('GroupId', true),
-       ));
+       echo $group->create_group_select();
        echo $form->input('password1', array(
                'type' => 'password',
                'label' => __('Password', true),
index 146750a..34fd3de 100644 (file)
@@ -54,7 +54,7 @@ foreach ($users as $user):
        <?php echo $html->link($text->truncate($user['User']['name'], 16), array('action' => 'view', $user['User']['id']), array(), false, false); ?>
 </td>
 <td>
-       <?php echo $user['User']['group_id']; ?>
+       <?php echo $group->get_name4group_id($user['User']['group_id']); ?>
 </td>
 <td class="lastAccess">
        <?php echo $time->niceShort($user['User']['modified'], array('format' => 'Y/m/d H:i')); ?>
index be0cb02..f0b1e65 100644 (file)
@@ -4,13 +4,13 @@
 <?php
        $user_name = $target_user['User']['name'];
        $id = $html->tag('span', 
-               '('. sprintf(__('UserNo %d', true), $target_user['User']['id']). ')',
+               '('. sprintf(__('UserNo %d', true), $target_user['User']['id']),
                array(
                        'class' => 'text',
                )
        );
        $group = $html->tag('span', 
-               $target_user['User']['group_id'],
+               $group->get_name4group_id($target_user['User']['group_id']). ')',
                array(
                        'class' => 'text',
                )