Configure::write('Group.subadmin', 2);
Configure::write('Group.watcher', 3);
Configure::write('Group.member', 4);
-Configure::write('Group.pre', 5);
-Configure::write('Group.locked', 6);
+Configure::write('Group.locked', 5);
+Configure::write('Group.pre', 6);
Configure::write('Group.deleted', 7);
-Configure::write('Group.banned', 8);
/* TimeZone */
date_default_timezone_set('Asia/Tokyo');
$conditions = array(
'User.id' => $id,
);
+ if ($isAdmin === true) {
+ $conditions['User.group_id'] = array(
+ Configure::read('Group.admin'),
+ Configure::read('Group.subadmin'),
+ Configure::read('Group.watcher'),
+ Configure::read('Group.member'),
+ Configure::read('Group.locked'),
+ Configure::read('Group.pre'),
+ );
+ } else {
+ $conditions['User.group_id'] = array(
+ Configure::read('Group.admin'),
+ Configure::read('Group.subadmin'),
+ Configure::read('Group.watcher'),
+ Configure::read('Group.member'),
+ Configure::read('Group.locked'),
+ );
+ }
$fields = array(
'User.id',
self::_index();
} else {
$this->pageTitle = sprintf(__("%s's Home", true), __('Guest', true));
-
}
// 全体の情報
// 非公開キャラクター取得
unset($this->User->hasMany['Character']['conditions']['Character.public_flag']);
+ // group設定
+ unset($this->User->hasMany['Character']['conditions']['Character.public_flag']);
+
$this->paginate['fields'] = array_merge($this->paginate['fields'], array(
'User.username',
'User.pcmail',
'User.created',
));
- self::_listview();
+ self::_listview(true);
}
}
}
- $user = $this->getUser($id);
+ $user = $this->getUser($id, true, true);
if (!$user) {
$this->Session->setFlash(__('No User', true));
$this->redirect(array('controller' => 'users', 'action'=>'listview'));
$this->set_public_flag4view();
}
- function _listview() {
+ function _listview($isAdmin = false) {
+ if ($isAdmin === true) {
+ $this->paginate['conditions']['User.group_id'] = array(
+ Configure::read('Group.admin'),
+ Configure::read('Group.subadmin'),
+ Configure::read('Group.watcher'),
+ Configure::read('Group.member'),
+ Configure::read('Group.locked'),
+ Configure::read('Group.pre'),
+ );
+ } else {
+ $this->paginate['conditions']['User.group_id'] = array(
+ Configure::read('Group.admin'),
+ Configure::read('Group.subadmin'),
+ Configure::read('Group.watcher'),
+ Configure::read('Group.member'),
+ Configure::read('Group.locked'),
+ );
+ }
$users = $this->paginate();
if (!empty($users)) {
if (!$user) {
return false;
}
- if ($user['User']['group_id'] == 1) {
+ if ($user['User']['group_id'] == Configure::read('Group.admin')) {
$this->Session->setFlash(__('Super Administrator can not be deleted.', true));
return false;
}
- App::import('Controller', 'Characters');
- $this->CharactersController = new CharactersController;
- $this->CharactersController->Character = CorePlus::set_model('Character');
- $this->CharactersController->Session = new SessionComponent;
- $this->CharactersController->data['Character'] = $this->data['Character'];
- if ($this->User->del($id)) {
+ if ($isAdmin) {
+ $this->data['User']['id'] = $id;
+ $this->data['User']['group_id'] = Configure::read('Group.deleted');
+
+ $this->User->create();
+ $result = $this->User->save(
+ $this->data,
+ array(
+ 'validate' => false,
+ 'fieldList' => array(
+ 'group_id',
+ ),
+ )
+ );
+ } else {
+ $result = $this->User->del($id);
+ }
+
+ if ($result) {
if (!empty($user['Character'])) {
+ App::import('Controller', 'Characters');
+ $this->CharactersController = new CharactersController;
+ $this->CharactersController->Character = CorePlus::set_model('Character');
+ $this->CharactersController->Session = new SessionComponent;
+ $this->CharactersController->data['Character'] = $this->data['Character'];
+
foreach ($user['Character'] as $character) {
$this->CharactersController->_delete($character['id'], array(), true);
}
<fieldset>
<legend><?php __('Do you really delete the account?');?></legend>
-<dl><?php $i = 0; $class = ' class="altrow"';?>
-<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt>
-<dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $target_user['User']['id']; ?>
+<div class="user_data">
+<?php
+ $user_name = $target_user['User']['name'];
+ $id = $html->tag('span',
+ '('. sprintf(__('UserNo %d', true), $target_user['User']['id']). ')',
+ array(
+ 'class' => 'text',
+ )
+ );
+ $group = $html->tag('span',
+ $target_user['User']['group_id'],
+ array(
+ 'class' => 'text',
+ )
+ );
+
+ $file = $upfile->file(
+ 'filter/xs',
+ CorePlus::get_value($target_user, 'Attachment.0'),
+ array(
+ 'model_name' => 'User',
+ 'mime_type' => 'original',
+ 'nodata' => 'image',
+ )
+ );
+ $user_img = $upfile->embed(
+ $file,
+ array(
+ 'alt' => $target_user['User']['name'],
+ 'restrict' => array('image'),
+ 'htmlAttributes' => array(
+ 'target' => '_blank',
+ ),
+ )
+ );
+
+ $edit = null;
+
+ $delete = null;
+
+ $footer = null;
+?>
+<div class="box">
+<div class="boxHeader"><h3><?php echo $user_img. $user_name. $id. $group. $edit. $delete ?></h3></div>
+<div class="boxBody">
+<dl>
+<dt><?php __('Last Access'); ?></dt>
+<dd>
+ <?php echo $target_user['User']['modified']; ?>
</dd>
-<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('GroupId'); ?></dt>
-<dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $target_user['User']['group_id']; ?>
+<dt><?php __('Id'); ?></dt>
+<dd>
+ <?php echo $target_user['User']['username']; ?>
+</dd>
+<dt><?php __('Pc Mail Address'); ?></dt>
+<dd>
+ <?php echo $target_user['User']['pcmail']; ?>
</dd>
-<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Name'); ?></dt>
-<dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $target_user['User']['name']; ?>
+<dt><?php __('Mobile Mail Address'); ?></dt>
+<dd>
+ <?php echo $target_user['User']['mobile_mail']; ?>
</dd>
-<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('UserId'); ?></dt>
-<dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $target_user['User']['username']; ?>
+<dt><?php __('Useragent'); ?></dt>
+<dd>
+ <?php echo $target_user['User']['useragent']; ?>
</dd>
-<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Created'); ?></dt>
-<dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $target_user['User']['created']; ?>
+<dt><?php __('Host'); ?></dt>
+<dd>
+ <?php echo $target_user['User']['host']; ?>
</dd>
-<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Modified'); ?></dt>
-<dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $target_user['User']['modified']; ?>
+<dt><?php __('Created'); ?></dt>
+<dd>
+ <?php echo $target_user['User']['created']; ?>
</dd>
</dl>
+</div>
+
+<div class="boxFooter"><?php if (isset($footer)): ?><?php echo $footer; ?><?php endif; ?></div>
+</div>
+</div>
+
+<div class="characters">
+<?php
+ $total = $html->tag('span', sprintf(__('Total Characters %d', true), count($target_user['Character'])), array('class' => 'total_chara_num'));
+
+ echo $this->renderElement('character_picture_table', array(
+ 'header' => __('Characters', true). $total,
+ 'characters' => $target_user['Character'],
+ 'previewVersion' => 'xs',
+ 'colNum' => 15,
+ 'id' => null,
+ 'isUser' => false,
+ 'isCharacter' => false,
+ 'isSystem' => false,
+ 'isModified' => false,
+ 'more_url' => array(
+ 'controller' => 'characters',
+ 'action' => 'index',
+ $target_user['User']['id'],
+ ),
+ ));
+?>
+</div>
<?php
+ echo $form->input('Character.confirm', array(
+ 'type' => 'hidden',
+ 'value' => 'yes',
+ )
+ );
echo $token->create();
?>
</fieldset>