diff --git a/module/user/control.php b/module/user/control.php
index 8308db97b5..2d9a2e1466 100644
--- a/module/user/control.php
+++ b/module/user/control.php
@@ -39,15 +39,18 @@ class user extends control
}
/* 用户的todo列表。*/
- public function todo($account, $date = 'today', $status = 'all')
+ public function todo($account, $type = 'today', $status = 'all')
{
/* 加载todo model。*/
$this->loadModel('todo');
$this->lang->set('menugroup.user', 'company');
$user = $this->dao->findByAccount($account)->from(TABLE_USER)->fetch();
- $todos = $this->todo->getList($date, $account, $status);
- if((int)$date == 0) $date = $this->todo->today();
+ /* 设置菜单。*/
+ $this->user->setMenu($this->user->getPairs($this->app->company->id, 'noempty|noclosed'), $account);
+
+ $todos = $this->todo->getList($type, $account, $status);
+ $date = (int)$type == 0 ? $this->todo->today() : $type;
/* 设定header和position信息。*/
$header['title'] = $this->lang->company->orgView . $this->lang->colon . $this->lang->user->todo;
@@ -61,6 +64,8 @@ class user extends control
$this->assign('date', $date);
$this->assign('todos', $todos);
$this->assign('user', $user);
+ $this->assign('account', $account);
+ $this->assign('type', $type);
$this->display();
}
@@ -72,6 +77,9 @@ class user extends control
$this->loadModel('task');
$this->lang->set('menugroup.user', 'company');
$user = $this->dao->findByAccount($account)->from(TABLE_USER)->fetch();
+
+ /* 设置菜单。*/
+ $this->user->setMenu($this->user->getPairs($this->app->company->id, 'noempty|noclosed'), $account);
/* 设定header和position信息。*/
$header['title'] = $this->lang->user->common . $this->lang->colon . $this->lang->user->task;
@@ -95,6 +103,9 @@ class user extends control
$this->lang->set('menugroup.user', 'company');
$user = $this->dao->findByAccount($account)->from(TABLE_USER)->fetch();
+ /* 设置菜单。*/
+ $this->user->setMenu($this->user->getPairs($this->app->company->id, 'noempty|noclosed'), $account);
+
/* 设定header和position信息。*/
$header['title'] = $this->lang->user->common . $this->lang->colon . $this->lang->user->bug;
$position[] = $this->lang->user->bug;
@@ -117,6 +128,9 @@ class user extends control
$this->lang->set('menugroup.user', 'company');
$user = $this->dao->findByAccount($account)->from(TABLE_USER)->fetch();
+ /* 设置菜单。*/
+ $this->user->setMenu($this->user->getPairs($this->app->company->id, 'noempty|noclosed'), $account);
+
/* 设定header和position信息。*/
$header['title'] = $this->lang->user->common . $this->lang->colon . $this->lang->user->project;
$position[] = $this->lang->user->project;
@@ -131,6 +145,21 @@ class user extends control
$this->display();
}
+ /* 查看个人档案。*/
+ public function profile($account)
+ {
+ $header['title'] = $this->lang->user->common . $this->lang->colon . $this->lang->user->profile;
+ $position[] = $this->lang->user->profile;
+
+ /* 设置菜单。*/
+ $this->user->setMenu($this->user->getPairs($this->app->company->id, 'noempty|noclosed'), $account);
+
+ $this->assign('header', $header);
+ $this->assign('position', $position);
+ $this->assign('user', $this->user->getById($account));
+
+ $this->display();
+ }
/* 设置referer信息。*/
private function setReferer($referer = 0)
@@ -146,7 +175,7 @@ class user extends control
}
/* 创建一个用户。*/
- public function create($companyID = 0, $from = 'admin')
+ public function create($companyID = 0, $deptID = 0, $from = 'admin')
{
if($companyID == 0) $companyID = $this->app->company->id;
$this->lang->set('menugroup.user', $from);
@@ -171,6 +200,7 @@ class user extends control
$this->assign('header', $header);
$this->assign('position', $position);
$this->assign('depts', $this->dept->getOptionMenu());
+ $this->assign('deptID', $deptID);
$this->display();
}
@@ -179,6 +209,7 @@ class user extends control
public function edit($userID, $from = 'admin')
{
$this->lang->set('menugroup.user', $from);
+ $this->lang->user->menu = $this->lang->company->menu;
if(!empty($_POST))
{
$this->user->update($userID);
diff --git a/module/user/lang/zh-cn.php b/module/user/lang/zh-cn.php
index 3152d3e89a..2179cd3f70 100644
--- a/module/user/lang/zh-cn.php
+++ b/module/user/lang/zh-cn.php
@@ -39,6 +39,7 @@ $lang->user->confirmDelete = "鎮ㄧ‘璁ゅ垹闄よ鐢ㄦ埛鍚楋紵";
$lang->user->relogin = "閲嶆柊鐧婚檰";
$lang->user->asGuest = "娓稿璁块棶";
$lang->user->goback = "杩斿洖鍓嶄竴椤�";
+$lang->user->allUsers = '鍏ㄩ儴鐢ㄦ埛';
$lang->user->profile = '鐢ㄦ埛妗f';
$lang->user->project = '鐢ㄦ埛椤圭洰';
diff --git a/module/user/model.php b/module/user/model.php
index 081c4bbf65..ef746ddbbb 100644
--- a/module/user/model.php
+++ b/module/user/model.php
@@ -25,6 +25,18 @@
lang->user->menu, 'account', $selectHtml);
+ common::setMenuVars($this->lang->user->menu, 'todo', $account);
+ common::setMenuVars($this->lang->user->menu, 'task', $account);
+ common::setMenuVars($this->lang->user->menu, 'bug', $account);
+ common::setMenuVars($this->lang->user->menu, 'project', $account);
+ common::setMenuVars($this->lang->user->menu, 'profile', $account);
+ }
+
/* 获得某一个公司的用户列表。*/
public function getList($companyID)
{
@@ -69,16 +81,23 @@ class userModel extends model
/* 新增一个用户。*/
function create($companyID)
{
+ /* 先检查密码是否符合规则。*/
+ if(!$this->checkPassword()) return;
+
$user = fixer::input('post')
->add('company', (int)$companyID)
->setDefault('join', '0000-00-00')
- ->setForce('password', md5($this->post->password))
+ ->setIF($this->post->password1 != false, 'password', md5($this->post->password1))
+ ->setIF($this->post->password1 == false, 'password', '')
+ ->remove('password1, password2')
->get();
+
$this->dao->insert(TABLE_USER)->data($user)
->autoCheck()
->batchCheck('account, realname, password', 'notempty')
->check('account', 'unique')
->check('account', 'account')
+ ->checkIF($this->post->email != false, 'email', 'email')
->exec();
}
@@ -92,15 +111,16 @@ class userModel extends model
$userID = (int)$userID;
$user = fixer::input('post')
->setDefault('join', '0000-00-00')
- ->setIF($this->post->password1 != '', 'password', md5($this->post->password1))
+ ->setIF($this->post->password1 != false, 'password', md5($this->post->password1))
->remove('password1, password2')
->get();
$this->dao->update(TABLE_USER)->data($user)
->autoCheck()
- ->batchCheck('account, realname, password', 'notempty')
+ ->batchCheck('account, realname', 'notempty')
->check('account', 'unique', "id != '$userID'")
->check('account', 'account')
+ ->checkIF($this->post->email != false, 'email', 'email')
->where('id')->eq((int)$userID)
->exec();
}
@@ -110,8 +130,8 @@ class userModel extends model
{
if($this->post->password1 != false)
{
- if($this->post->password1 != $this->post->password2) dao::$errors['password'] = $this->lang->error->passwordsame;
- if(!validater::checkReg($this->post->password1, '|(.){6,}|')) dao::$errors['password'] = $this->lang->error->passwordrule;
+ if($this->post->password1 != $this->post->password2) dao::$errors['password'][] = $this->lang->error->passwordsame;
+ if(!validater::checkReg($this->post->password1, '|(.){6,}|')) dao::$errors['password'][] = $this->lang->error->passwordrule;
}
return !dao::isError();
}
diff --git a/module/user/view/bug.html.php b/module/user/view/bug.html.php
index b6a9a271bc..d98321d92d 100644
--- a/module/user/view/bug.html.php
+++ b/module/user/view/bug.html.php
@@ -22,31 +22,34 @@
* @link http://www.zentao.cn
*/
?>
-
-
-
-
- | bug->id;?> |
- bug->severity;?> |
- bug->title;?> |
- bug->openedBy;?> |
- bug->assignedTo;?> |
- bug->resolvedBy;?> |
- bug->resolution;?> |
-
-
-
-
-
- | createLink('bug', 'view', "bugID=$bug->id"), $bug->id, '_blank');?> |
- severity?> |
- title;?> |
- openedBy;?> |
- assignedTo;?> |
- resolvedBy;?> |
- resolution;?> |
-
-
-
-
-
+
+
+
+
+
+
+ | bug->id;?> |
+ bug->severity;?> |
+ bug->title;?> |
+ bug->openedBy;?> |
+ bug->assignedTo;?> |
+ bug->resolvedBy;?> |
+ bug->resolution;?> |
+
+
+
+
+
+ | createLink('bug', 'view', "bugID=$bug->id"), $bug->id, '_blank');?> |
+ severity?> |
+ title;?> |
+ openedBy;?> |
+ assignedTo;?> |
+ resolvedBy;?> |
+ resolution;?> |
+
+
+
+
+
+
diff --git a/module/user/view/create.html.php b/module/user/view/create.html.php
index 8db57ee8c9..5b7e7339d9 100644
--- a/module/user/view/create.html.php
+++ b/module/user/view/create.html.php
@@ -23,15 +23,14 @@
*/
?>
-