}
/* ユーザ情報取得 */
- function getUser($id) {
+ function getUser($id, $isAdmin=false) {
if (!$id) {
return array();
}
$this->User = CorePlus::set_model('User');
}
- // Media.Attachmentから関連ファイルの取得
+ $conditions = array(
+ 'User.id' => $id,
+ );
+
+ $fields = array(
+ 'User.id',
+ 'User.group_id',
+ 'User.name',
+ 'User.pcmail',
+ 'User.mobile_mail',
+ 'User.modified',
+ );
+ if ($isAdmin === true) {
+ $fields = array_merge($fields, array(
+ 'User.username',
+ 'User.useragent',
+ 'User.host',
+ 'User.created',
+ ));
+ }
+
+ $contain = array(
+ 'Attachment',
+ );
+ if ($isAdmin === true) {
+ $contain = array_merge($contain, array(
+ 'Character',
+ ));
+
+ unset($this->User->hasMany['Character']['conditions']['Character.public_flag']);
+ unset($this->User->hasMany['Character']['limit']);
+ }
+
+ if (empty($contain)) {
+ $recursive = -1;
+ } else {
+ $recursive = Set::countDim($contain);
+ }
+
$user = $this->User->find('first', array(
- 'conditions' => array('User.id' => $id),
- 'fields' => array(
- 'User.id',
- 'User.group_id',
- 'User.name',
- 'User.pcmail',
- 'User.mobile_mail',
- 'User.modified',
- ),
- 'recursive' => 1,
- 'contain' => array(
- 'Attachment',
- ),
+ 'conditions' => $conditions,
+ 'fields' => $fields,
+ 'recursive' => $recursive,
+ 'contain' => $contain,
));
return $user;
var $disableTokenActions = array('add','mobile_add');
+ // listView用のpagenate設定
+ var $paginate = array(
+ 'conditions' => array(
+ ),
+ 'fields' => array(
+ 'User.id',
+ 'User.group_id',
+ 'User.name',
+ 'User.modified',
+ ),
+ 'recursive' => 1,
+ 'contain' => array(
+ 'Character',
+ ),
+ 'limit' => 20,
+ 'order' => array(
+ 'User.id' => 'asc'
+ ),
+ );
+
function beforeFilter() {
parent::beforeFilter();
function admin_listview() {
// 検索処理
- $this->User->contain();
- $contain = array();
$searchword = array();
if (!empty($this->data)) {
if (isset($this->data['User']['name'])) {
}
}
-
if (isset($name)) {
$this->data['User']['name'] = $name;
- $contain["User.name LIKE"] = "%".Sanitize::html($name)."%";
+ $this->paginate['conditions']['User.name LIKE'] = '%'.Sanitize::html($name).'%';
$searchword['name'] = urlencode($name);
}
$this->set('searchword', $searchword);
- $this->set('users', $this->paginate('User', $contain));
+ // 非公開キャラクター取得
+ unset($this->User->hasMany['Character']['conditions']['Character.public_flag']);
+
+ $this->paginate['fields'] = array_merge($this->paginate['fields'], array(
+ 'User.username',
+ 'User.pcmail',
+ 'User.mobile_mail',
+ 'User.useragent',
+ 'User.host',
+ 'User.created',
+ ));
+
+ self::_listview();
}
$this->redirect(array('controller' => 'users', 'action'=>'index'));
}
- $user = $this->getUser($id);
+ $user = $this->getUser($id, true);
if (!$user) {
$this->redirect(array('action'=>'listview'));
}
$this->set('target_user', $user);
-
- $this->set('target_user', $this->User->read(null, $id));
}
function admin_add() {
}
function _listview() {
- $this->User->recursive = -1;
- $this->set('users', $this->paginate());
+ $users = $this->paginate();
+
+ if (!empty($users)) {
+ // 全キャラクター数取得
+ foreach ($users as $k => $v) {
+ if (empty($v['Character'])) {
+ $users[$k]['User']['character_num'] = 0;
+ continue;
+ }
+
+ $users[$k]['User']['character_num'] = $this->User->Character->find('count', array(
+ 'conditions' => array_merge($this->User->hasMany['Character']['conditions'],
+ array('Character.user_id' => $v['User']['id'])),
+ 'recursive' => -1,
+ ));
+ }
+
+ $users = $this->HtmlEscape->nl_unescape($users);
+ }
+ $this->set('users', $users);
}
function _add() {
'Character.public_flag' => 'public',
'Character.deleted' => '0',
),
- 'fields' => '',
+ 'fields' => array(
+ 'Character.id',
+ 'Character.system_id',
+ 'Character.user_id',
+ 'Character.name',
+ 'Character.main_picture',
+ 'Character.public_flag',
+ 'Character.status',
+ 'Character.modified',
+ ),
'order' => 'Character.modified DESC',
'limit' => '5',
),
'order' => '',
'limit' => '',
'offset' => '',
- 'finderQuery' => '',
- 'deleteQuery' => '',
- 'insertQuery' => ''
+ ),
+ 'Character' => array(
+ 'className' => 'Character',
+ 'foreignKey' => 'user_id',
+ 'dependent' => false,
+ 'conditions' => array(
+ 'Character.public_flag' => 'public',
+ 'Character.deleted' => '0',
+ ),
+ 'fields' => array(
+ 'Character.id',
+ 'Character.system_id',
+ 'Character.user_id',
+ 'Character.name',
+ 'Character.main_picture',
+ 'Character.public_flag',
+ 'Character.status',
+ 'Character.modified',
+ ),
+ 'order' => array(
+ 'Character.modified' => 'DESC',
+ ),
+ 'limit' => '5',
+ 'offset' => '',
)
);
}
}
-?>
\ No newline at end of file
<th><?php echo $paginator->sort(__('Name', true), 'name');?></th>
<th><?php echo $paginator->sort(__('Group', true), 'group_id');?></th>
<th><?php echo $paginator->sort(__('Last Access', true), 'modified');?></th>
+ <th><?php echo __('Characters'); ?></th>
<th><?php echo $paginator->sort(__('ID', true), 'username');?></th>
<th><?php echo $paginator->sort(__('PC', true), 'pcmail');?></th>
<th><?php echo $paginator->sort(__('Mobile', true), 'mobile_mail');?></th>
<td>
<?php echo $time->niceShort($user['User']['modified'], array('format' => 'Y/m/d H:i')); ?>
</td>
+<td class="characterList">
+<?php
+if (!empty($user['Character'])) {
+ foreach ($user['Character'] as $v) {
+ $picture = $this->renderElement('character_picture_image', array(
+ 'basename' => $v['main_picture'],
+ 'options' => array(
+ 'previewVersion' => 'xs',
+ 'class' => 'shadow',
+ 'url' => array('controller' => 'characters', 'action' => 'view', $v['id']),
+ 'alternative' => $text->truncate($v['name'], 32),
+ )
+ ));
+
+ echo $html->tag('span', $picture, array('class' => 'image'));
+ }
+
+ echo $html->div('total_chara_num',
+ $html->link(
+ sprintf(__('Total %d Characters', true), $user['User']['character_num']),
+ $url = array('controller' => 'characters', 'action' => 'index', $user['User']['id'])
+ )
+ );
+}
+?>
+</td>
<td>
<?php echo $user['User']['username']; ?>
</td>
<td>
<?php echo $time->niceShort($user['User']['created'], array('format' => 'Y/m/d H:i')); ?>
</td>
-<td>
+<td class="userAgent">
<?php
if (strrpos($user['User']['useragent'], 'MSIE') !== false) {
echo $text->highlight($text->excerpt($user['User']['useragent'], 'MSIE', 28), 'MSIE');
<div class="users view">
-<h2><?php __('User');?></h2>
-<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']; ?>
-
-</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']; ?>
-
-</dd>
-<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Image'); ?></dt>
-<dd<?php if ($i++ % 2 == 0) echo $class;?>>
+
+<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/m',
+ 'filter/xs',
CorePlus::get_value($target_user, 'Attachment.0'),
array(
'model_name' => 'User',
'nodata' => 'image',
)
);
-
- echo $medium->embed(
+ $user_img = $upfile->embed(
$file,
array(
- 'alt' => CorePlus::get_value($user, 'User.name'),
- 'class' => 'shadow',
- 'id' => 'HomeUserImage',
- 'restrict' => array('image')
+ 'alt' => $target_user['User']['name'],
+ 'restrict' => array('image'),
+ 'htmlAttributes' => array(
+ 'target' => '_blank',
+ ),
+ )
+ );
+
+ $edit = $html->tag('span',
+ "[".$html->link(__('Change Password', true), array('action' => 'change_password', $target_user['User']['id']))."]",
+ array(
+ 'class' => 'link',
+ )
+ );
+
+ $delete = $html->tag('span',
+ "[".$html->link(__('Delete User', true), array('action' => 'delete', $target_user['User']['id']))."]",
+ array(
+ 'class' => 'link',
)
);
+
+ $footer = null;
?>
-</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']; ?>
+<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 __('UserId'); ?></dt>
-<dd<?php if ($i++ % 2 == 0) echo $class;?>>
+<dt><?php __('ID'); ?></dt>
+<dd>
<?php echo $target_user['User']['username']; ?>
-
</dd>
-<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Pc Mail Address'); ?></dt>
-<dd<?php if ($i++ % 2 == 0) echo $class;?>>
+<dt><?php __('Pc Mail Address'); ?></dt>
+<dd>
<?php echo $target_user['User']['pcmail']; ?>
</dd>
-<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Mobile Mail Address'); ?></dt>
-<dd<?php if ($i++ % 2 == 0) echo $class;?>>
+<dt><?php __('Mobile Mail Address'); ?></dt>
+<dd>
<?php echo $target_user['User']['mobile_mail']; ?>
</dd>
-<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Useragent'); ?></dt>
-<dd<?php if ($i++ % 2 == 0) echo $class;?>>
+<dt><?php __('Useragent'); ?></dt>
+<dd>
<?php echo $target_user['User']['useragent']; ?>
</dd>
-<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Host'); ?></dt>
-<dd<?php if ($i++ % 2 == 0) echo $class;?>>
+<dt><?php __('Host'); ?></dt>
+<dd>
<?php echo $target_user['User']['host']; ?>
</dd>
-<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Created'); ?></dt>
-<dd<?php if ($i++ % 2 == 0) echo $class;?>>
+<dt><?php __('Created'); ?></dt>
+<dd>
<?php echo $target_user['User']['created']; ?>
</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']; ?>
-
-</dd>
</dl>
</div>
-<div class="actions">
-<ul>
-<li><?php echo $html->link(__('Change Password', true), array('action' => 'change_password', $target_user['User']['id'])); ?> </li>
-<li><?php echo $html->link(__('Delete User', true), array('action' => 'delete', $target_user['User']['id'])); ?> </li>
-</ul>
+<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>
+
+</div>
\ No newline at end of file
-<div class="users list">
+<div class="users listview">
<h2><?php __('Users');?> <?php __('List');?></h2>
<p>
<?php
<th><?php echo $paginator->sort(__('ID', true), 'id');?></th>
<th><?php echo $paginator->sort(__('Name', true), 'name');?></th>
<th><?php echo $paginator->sort(__('Last Access', true), 'modified');?></th>
+<th><?php echo __('Characters'); ?></th>
</tr>
<?php
$i = 0;
<td>
<?php echo $time->niceShort($user['User']['modified'], array('format' => 'Y/m/d H:i')); ?>
</td>
+<td class="characterList">
+<?php
+if (!empty($user['Character'])) {
+ foreach ($user['Character'] as $v) {
+ $picture = $this->renderElement('character_picture_image', array(
+ 'basename' => $v['main_picture'],
+ 'options' => array(
+ 'previewVersion' => 'xs',
+ 'class' => 'shadow',
+ 'url' => array('controller' => 'characters', 'action' => 'view', $v['id']),
+ 'alternative' => $text->truncate($v['name'], 32),
+ )
+ ));
+
+ echo $html->tag('span', $picture, array('class' => 'image'));
+ }
+
+ echo $html->div('total_chara_num',
+ $html->link(
+ sprintf(__('Total %d Characters', true), $user['User']['character_num']),
+ $url = array('controller' => 'characters', 'action' => 'index', $user['User']['id'])
+ )
+ );
+}
+?>
+</td>
</tr>
<?php endforeach; ?>
</table>
width: 100%;
height:100%;
min-height:100%;
- padding: 5px 10px;
+ padding: 5px 0;
overflow: hidden;
position : relative
}
+#content div#subNavi,
+#content div.view,
+#content div.index,
+#content div.add,
+#content div.edit,
+#content div.listview,
+#content div.admin_listview
+ {
+ margin-left: 10px;
+}
#footer {
width: 100%;
}
/* ページごとの設定 */
+div.users .user_data .box {
+ width: 720px;
+ margin-bottom: 20px;
+}
+div.users .user_data .boxHeader {
+ padding-bottom: 0;
+}
+div.users .user_data .boxHeader h3 {
+ width: 720px;
+ overflow: hidden;
+ font-size: 250%;
+}
+div.users .user_data .boxHeader span {
+ font-size: 50%;
+}
+div.users .user_data .boxBody {
+ width: 720px;
+ padding: 10px;
+}
+div.users .user_data .boxFooter {
+ width: 720px;
+ overflow: hidden;
+ padding-left: 10px;
+}
+div.users .characters .box {
+ margin-bottom: 20px;
+}
+
div.systems .system_data .box {
width: 720px;
margin-bottom: 20px;
font-size: 80%;
font-weight: normal;
}
+
+/* ユーザ一覧のキャラ表示 */
+.users .characterList {
+ width: 185px;
+ white-space: nowrap;
+}
+.listview .characterList {
+ width: 330px;
+ white-space: nowrap;
+ padding-bottom: 0;
+}
+.users .characterList span.image {
+ padding-left: 4px;
+}
+.users .characterList .total_chara_num {
+ font-size: 80%;
+}
+.listview .characterList .total_chara_num {
+ display: inline;
+ position: relative;
+ top: -4px;
+ left: 5px;
+}
+
+td.userAgent {
+ width: 200px;
+}
+
margin: 0;
}
+/* ユーザ一覧のキャラ表示 */
+.users .characterList span.image {
+ padding: 0 1px 0 0;
+ margin: 0;
+}
+.users .characterList span.image img {
+ padding: 0;
+ border-width: 2px;
+}
+.listview .characterList .total_chara_num {
+ top: -6px;
+}
+
+
/* 画像キャプション */
.boxBody div.picture .image_caption {
left: 4px;