* code for task #3663.

This commit is contained in:
wangyidong
2018-03-28 13:52:26 +08:00
parent 3877c7f111
commit f459f4a3da
13 changed files with 184 additions and 121 deletions
+26
View File
@@ -540,6 +540,13 @@ class todoModel extends model
return !dao::isError();
}
/**
* Assign todo.
*
* @param int $todoID
* @access public
* @return bool
*/
public function assignTo($todoID)
{
$todo = fixer::input('post')
@@ -555,4 +562,23 @@ class todoModel extends model
$this->loadModel('action')->create('todo', $todoID, 'assigned', '', $todo->assignedTo);
return !dao::isError();
}
/**
* Get todo count.
*
* @param string $account
* @access public
* @return int
*/
public function getCount($account = '')
{
if(empty($account)) $account = $this->app->user->account;
return $this->dao->select('count(*) as count')->from(TABLE_TODO)
->where('cycle')->eq('0')
->andWhere('account', true)->eq($account)
->orWhere('assignedTo')->eq($account)
->orWhere('finishedBy')->eq($account)
->markRight(1)
->fetch('count');
}
}