使用禅道开源版本的小伙伴注意了!你是不是一个月过去了,还不了解自己的工时是否填完?是否还在一天天的计算你的工时?翻到这篇文章,你就有福了。那么接下来看看到底该如何设置才能看到自己本月的工时总计吧!
1.修改zh-cn.php页面
进入/opt/zbox/app/zentao/module/block/lang/下,在zh-cn.php文件71行后新增以下代码:
$lang->block->effort = '本月工时数';
322行添加
$lang->block->default['full']['my']['8']['params']['effortCount'] = '20';
2.修改contribute.html.php页面
进入/opt/zbox/app/zentao/module/block/view/下,在contribute.html.php文件61行后新增以下代码:
/**
* create by gaojianqiong.
*/
<div class="col-xs-4 tile">
<div class="tile-title"><?php echo $lang->block->effort;?></div>
<div class="tile-amount"><?php echo empty($data['effort']) ? 0 : html::a($this->createLink('my', 'work', 'mode=task'), (int)$data['effort']);?></div>
</div>
修改后效果:
3.修改config.php页面
进入/opt/zbox/app/zentao/module/block/下,在config.php文件69行后新增以下代码:
$config->block->modules['execution']->moreLinkList->effort = 'my|effort|type=%s';
41行添加
,effort
91行添加
$config->block->modules['effort'] = new stdclass();
$config->block->modules['effort']->moreLinkList = new stdclass();
$config->block->modules['effort']->moreLinkList->effort = 'my|effort|type=%s';
4.修改model.php页面
进入/opt/zbox/app/zentao/module/user/下,在model.php文件2888行后新增以下代码:
/**
* create by gaojianqiong.
*/
$today = date("Y-m");
$personalData['effort'] = $this->dao->select('SUBSTR(e.date,1,7) as month,u.realname,p.name,sum(e.consumed) as hours')->from(TABLE_EFFORT)->alias('e')
->leftjoin(TABLE_USER)->alias('u')->on("e.account=u.account")
->leftjoin(TABLE_TASK)->alias('t')->on("t.id=e.objectID")
->leftjoin(TABLE_PROJECT)->alias('p')->on("p.id=t.execution")
->where('e.deleted')->eq('0')
->andWhere('t.deleted')->eq('0')
->andWhere('p.deleted')->eq('0')
->andWhere('e.account')->eq($account)
->andWhere("e.date>='$today-01' and e.date<='$today-31'")
->fetch('hours');
修改后效果