* finish task #5611.

This commit is contained in:
wangyidong
2019-05-28 09:52:24 +08:00
parent 6872573a7e
commit 672a73dfad
9 changed files with 163 additions and 118 deletions

View File

@@ -147,7 +147,8 @@ class deptModel extends model
$deptMenu[$dept->parent] .= "</li>\n";
}
$lastMenu = "<ul class='tree' data-ride='tree' data-name='tree-dept'>" . @array_pop($deptMenu) . "</ul>\n";
$deptMenu = isset($deptMenu[0]) ? $deptMenu[0] : array_pop($deptMenu);
$lastMenu = "<ul class='tree' data-ride='tree' data-name='tree-dept'>{$deptMenu}</ul>\n";
return $lastMenu;
}

View File

@@ -519,11 +519,12 @@ class my extends control
$this->app->loadLang('user');
$user = $this->user->getById($this->app->user->account);
$this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->profile;
$this->view->position[] = $this->lang->my->profile;
$this->view->user = $user;
$this->view->groups = $this->loadModel('group')->getByAccount($this->app->user->account);
$this->view->deptPath = $this->dept->getParents($user->dept);
$this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->profile;
$this->view->position[] = $this->lang->my->profile;
$this->view->user = $user;
$this->view->groups = $this->loadModel('group')->getByAccount($this->app->user->account);
$this->view->deptPath = $this->dept->getParents($user->dept);
$this->view->personalData = $this->user->getPersonalData();
$this->display();
}

View File

@@ -0,0 +1,10 @@
.col-6{width:50% !important;}
.cell{height:450px;}
.main-header{margin-bottom:20px;}
.dl-horizontal dt{color:#999; font-weight:normal; padding:5px 0px;}
.dl-horizontal dd{padding:5px 0px;}
.divider{border-left:1px solid #e5e5e5;}
.tiles{padding-top:15px;}
.tile{margin-bottom:30px; text-align:left !important; padding-left:60px;}
.tile-title{color:#999; padding-bottom:5px !important;}

View File

@@ -1,7 +1,6 @@
$(function()
{
var sp = $('[data-id="profile"] a'), scp = $('[data-id="changePassword"] a');
var scp = $('[data-id="changePassword"] a');
var sign = config.requestType == 'GET' ? '&' : '?';
sp.attr('href', sp.attr('href') + sign + 'onlybody=yes').modalTrigger({width:600, type:'iframe'});
scp.attr('href', scp.attr('href') + sign + 'onlybody=yes').modalTrigger({width:500, type:'iframe'});
});

View File

@@ -45,7 +45,7 @@
<tr>
<th class='w-90px'><?php echo $lang->user->account;?></th>
<td style='width:33%'><?php echo html::input('account', $user->account, "class='form-control' readonly='readonly'");?></td>
<th class='w-90px'><?php echo $lang->user->commiter;?></th>
<th class='w-140px'><?php echo $lang->user->commiter;?></th>
<td><?php echo html::input('commiter', $user->commiter, "class='form-control'");?></td>
</tr>
<tr>

View File

@@ -11,116 +11,108 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php if(!isonlybody()):?>
<style>
.main-content{width: 600px; margin: 0 auto;}
</style>
<?php endif;?>
<div id='mainContent' class='main-content'>
<div class='main-header'>
<h2><?php echo html::icon($lang->icons['user']);?> <?php echo $lang->my->profile;?></h2>
<div class='actions pull-right'>
<?php echo html::a($this->createLink('my', 'editprofile'), $lang->user->editProfile, '', "class='btn btn-primary'");?>
<div id='mainContent' class='main-row'>
<div class='main-col col-6'>
<div class='cell'>
<div class='main-header'>
<h2><?php echo $lang->user->legendBasic;?></h2>
<div class='actions pull-right'>
<?php echo html::a($this->createLink('my', 'editprofile'), $lang->user->editProfile, '', "class='btn btn-primary'");?>
</div>
</div>
<div class='row'>
<div class='col-md-6'>
<dl class='dl-horizontal'>
<dt><?php echo $lang->user->account;?></dt>
<dd><?php echo $user->account;?></dd>
<dt><?php echo $lang->user->realname;?></dt>
<dd><?php echo $user->realname;?></dd>
<dt><?php echo $lang->user->dept;?></dt>
<dd>
<?php
if(empty($deptPath))
{
echo "/";
}
else
{
foreach($deptPath as $key => $dept)
{
if($dept->name) echo $dept->name;
if(isset($deptPath[$key + 1])) echo $lang->arrow;
}
}
?>
</dd>
<dt><?php echo $lang->user->role;?></dt>
<dd><?php echo $lang->user->roleList[$user->role];?></dd>
<dt><?php echo $lang->group->priv;?></dt>
<dd><?php foreach($groups as $group) echo $group->name . ' '; ?></dd>
<dt><?php echo $lang->user->join;?></dt>
<dd><?php echo formatTime($user->join);?></dd>
<dt><?php echo $lang->user->visits;?></dt>
<dd><?php echo $user->visits;?></dd>
<dt><?php echo $lang->user->ip;?></dt>
<dd><?php echo $user->ip;?></dd>
<dt><?php echo $lang->user->last;?></dt>
<dd><?php echo $user->last;?></dd>
<?php if($user->ranzhi):?>
<dt><?php echo $lang->user->ranzhi;?></dt>
<dd>
<?php echo $user->ranzhi . ' ';?>
<?php if(common::hasPriv('my', 'unbind')) echo html::a($this->createLink('my', 'unbind'), "<i class='icon-unlink'></i>", 'hiddenwin', "class='bin-icon' title='{$lang->user->unbind}'");?>
</dd>
<?php endif;?>
</dl>
</div>
<div class='col-md-6 divider'>
<dl class='dl-horizontal'>
<dt><?php echo $lang->user->commiter;?></dt>
<dd><?php echo $user->commiter;?></dd>
<dt><?php echo $lang->user->email;?></dt>
<dd><?php echo $user->email;?></dd>
<?php foreach(explode(',', $config->user->contactField) as $field):?>
<dt><?php echo $lang->user->$field;?></dt>
<dd>
<?php
if($field == 'skype' and $user->$field)
{
echo html::a("callto://$user->skype", $user->skype);
}
elseif($field == 'qq' and $user->$field)
{
echo html::a("tencent://message/?uin=$user->qq", $user->qq);
}
else
{
echo $user->$field;
}
?>
</dd>
<?php endforeach;?>
<dt><?php echo $lang->user->address;?></dt>
<dd><?php echo $user->address;?></dd>
<dt><?php echo $lang->user->zipcode;?></dt>
<dd><?php echo $user->zipcode;?></dd>
</dl>
</div>
</div>
</div>
</div>
<div class='side-col col-6'>
<div class='cell'>
<div class='main-header'>
<h2><?php echo $lang->user->legendContribution;?></h2>
</div>
<div class='row tiles'>
<?php foreach($lang->user->personalData as $key => $title):?>
<div class='col-4 col tile'>
<div class='tile-title'><?php echo $title;?></div>
<div class='tile-amount'><?php echo zget($personalData, $key, 0);?></div>
</div>
<?php endforeach;?>
</div>
</div>
</div>
<table class='table table-borderless table-data'>
<tr>
<th class='rowhead w-100px'><?php echo $lang->user->dept;?></th>
<td>
<?php
if(empty($deptPath))
{
echo "/";
}
else
{
foreach($deptPath as $key => $dept)
{
if($dept->name) echo $dept->name;
if(isset($deptPath[$key + 1])) echo $lang->arrow;
}
}
?>
</td>
</tr>
<tr>
<th><?php echo $lang->user->account;?></th>
<td><?php echo $user->account;?></td>
</tr>
<tr>
<th><?php echo $lang->user->realname;?></th>
<td><?php echo $user->realname;?></td>
</tr>
<tr>
<th><?php echo $lang->user->role;?></th>
<td><?php echo $lang->user->roleList[$user->role];?></td>
</tr>
<tr>
<th><?php echo $lang->group->priv;?></th>
<td><?php foreach($groups as $group) echo $group->name . ' '; ?></td>
</tr>
<tr>
<th><?php echo $lang->user->commiter;?></th>
<td><?php echo $user->commiter;?></td>
</tr>
<tr>
<th><?php echo $lang->user->email;?></th>
<td><?php echo $user->email;?></td>
</tr>
<tr>
<th><?php echo $lang->user->join;?></th>
<td><?php echo formatTime($user->join);?></td>
</tr>
<tr>
<th><?php echo $lang->user->visits;?></th>
<td><?php echo $user->visits;?></td>
</tr>
<tr>
<th><?php echo $lang->user->ip;?></th>
<td><?php echo $user->ip;?></td>
</tr>
<tr>
<th><?php echo $lang->user->last;?></th>
<td><?php echo $user->last;?></td>
</tr>
<?php foreach(explode(',', $config->user->contactField) as $field):?>
<tr>
<th><?php echo $lang->user->$field;?></th>
<td>
<?php
if($field == 'skype' and $user->$field)
{
echo html::a("callto://$user->skype", $user->skype);
}
elseif($field == 'qq' and $user->$field)
{
echo html::a("tencent://message/?uin=$user->qq", $user->qq);
}
else
{
echo $user->$field;
}
?>
</td>
</tr>
<?php endforeach;?>
<tr>
<th><?php echo $lang->user->address;?></th>
<td><?php echo $user->address;?></td>
</tr>
<tr>
<th><?php echo $lang->user->zipcode;?></th>
<td><?php echo $user->zipcode;?></td>
</tr>
<?php if($user->ranzhi):?>
<tr>
<th><?php echo $lang->user->ranzhi;?></th>
<td>
<?php echo $user->ranzhi . ' ';?>
<?php if(common::hasPriv('my', 'unbind')) echo html::a($this->createLink('my', 'unbind'), "<i class='icon-unlink'></i>", 'hiddenwin', "class='bin-icon' title='{$lang->user->unbind}'");?>
</td>
</tr>
<?php endif;?>
</table>
</div>
<?php include '../../common/view/footer.html.php';?>

View File

@@ -48,6 +48,9 @@ $lang->user->originalPassword = 'Password';
$lang->user->verifyPassword = 'Password';
$lang->user->resetPassword = 'Forgot Password?';
$lang->user->legendBasic = '基本资料';
$lang->user->legendContribution = '个人贡献';
$lang->user->index = "Home";
$lang->user->view = "Overview";
$lang->user->create = "Add User";
@@ -126,6 +129,15 @@ $lang->user->passwordStrengthList[0] = "<span style='color:red'>Weak</span>";
$lang->user->passwordStrengthList[1] = "<span style='color:#000'>Good</span>";
$lang->user->passwordStrengthList[2] = "<span style='color:green'>Strong</span>";
$lang->user->statusList['active'] = '正常';
$lang->user->statusList['delete'] = '删除';
$lang->user->personalData['createdTodo'] = '创建的待办数';
$lang->user->personalData['createdStory'] = '创建的需求数';
$lang->user->personalData['finishedTask'] = '完成的任务数';
$lang->user->personalData['resolvedBug'] = '解决的Bug数';
$lang->user->personalData['createdCase'] = '创建的用例数';
$lang->user->statusList['active'] = 'Activated';
$lang->user->statusList['delete'] = 'Deleted';

View File

@@ -48,6 +48,9 @@ $lang->user->originalPassword = '原密码';
$lang->user->verifyPassword = '您的系统登录密码';
$lang->user->resetPassword = '忘记密码';
$lang->user->legendBasic = '基本资料';
$lang->user->legendContribution = '个人贡献';
$lang->user->index = "用户视图首页";
$lang->user->view = "用户详情";
$lang->user->create = "添加用户";
@@ -129,6 +132,12 @@ $lang->user->passwordStrengthList[2] = "<span style='color:green'>强</span>";
$lang->user->statusList['active'] = '正常';
$lang->user->statusList['delete'] = '删除';
$lang->user->personalData['createdTodo'] = '创建的待办数';
$lang->user->personalData['createdStory'] = '创建的需求数';
$lang->user->personalData['finishedTask'] = '完成的任务数';
$lang->user->personalData['resolvedBug'] = '解决的Bug数';
$lang->user->personalData['createdCase'] = '创建的用例数';
$lang->user->keepLogin['on'] = '保持登录';
$lang->user->loginWithDemoUser = '使用demo帐号登录';

View File

@@ -1550,4 +1550,25 @@ class userModel extends model
->orderBy('id')
->fetchAll();
}
/**
* Get personal data.
*
* @param string $account
* @access public
* @return array
*/
public function getPersonalData($account = '')
{
if(empty($account)) $account = $this->app->user->account;
$personalData = array();
$personalData['createdTodo'] = $this->dao->select('count(*) as count')->from(TABLE_TODO)->where('account')->eq($account)->fetch('count');
$personalData['createdStory'] = $this->dao->select('count(*) as count')->from(TABLE_STORY)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count');
$personalData['finishedTask'] = $this->dao->select('count(*) as count')->from(TABLE_TASK)->where('finishedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count');
$personalData['resolvedBug'] = $this->dao->select('count(*) as count')->from(TABLE_BUG)->where('resolvedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count');
$personalData['createdCase'] = $this->dao->select('count(*) as count')->from(TABLE_CASE)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count');
return $personalData;
}
}