+ add dailyreminder to zentao.

This commit is contained in:
wangyidong
2013-02-20 01:39:44 +00:00
parent 634d78b3bb
commit 58132a7e2a
8 changed files with 236 additions and 4 deletions
+89
View File
@@ -470,4 +470,93 @@ EOT;
unset($assign['closed']);
return $assign;
}
/**
* Get System URL.
*
* @access public
* @return void
*/
public function getSysURL()
{
/* Ger URL when run in shell. */
if(defined('IN_SHELL'))
{
$url = parse_url(trim($this->server->argv[1]));
$port = (empty($url['port']) or $url['port'] == 80) ? '' : $url['port'];
$host = empty($port) ? $url['host'] : $url['host'] . ':' . $port;
return $url['scheme'] . '://' . $host;
}
else
{
return common::getSysURL();
}
}
/**
* Get user bugs.
*
* @access public
* @return void
*/
public function getUserBugs()
{
$bugs = $this->dao->select('t1.id, t1.title, t2.account as user')
->from(TABLE_BUG)->alias('t1')
->leftJoin(TABLE_USER)->alias('t2')
->on('t1.assignedTo = t2.account')
->where('t1.assignedTo')->ne('')
->andWhere('t1.assignedTo')->ne('closed')
->andWhere('t1.deleted')->eq(0)
->andWhere('t2.deleted')->eq(0)
->fetchGroup('user');
return $bugs;
}
/**
* Get user tasks.
*
* @access public
* @return void
*/
public function getUserTasks()
{
$tasks = $this->dao->select('t1.id, t1.name, t2.account as user')
->from(TABLE_TASK)->alias('t1')
->leftJoin(TABLE_USER)->alias('t2')
->on('t1.assignedTo = t2.account')
->where('t1.assignedTo')->ne('')
->andWhere('t1.deleted')->eq(0)
->andWhere('t2.deleted')->eq(0)
->andWhere('t1.status')->in('wait, doing')
->fetchGroup('user');
return $tasks;
}
/**
* Get user todos.
*
* @access public
* @return void
*/
public function getUserTodos()
{
$stmt = $this->dao->select('t1.*, t2.account as user')
->from(TABLE_TODO)->alias('t1')
->leftJoin(TABLE_USER)->alias('t2')
->on('t1.account = t2.account')
->where('t1.status')->eq('wait')
->orWhere('t1.status')->eq('doing')
->query();
$todos = array();
while($todo = $stmt->fetch())
{
if($todo->type == 'task') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TASK)->fetch('name');
if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_BUG)->fetch('title');
$todos[$todo->user][] = $todo;
}
return $todos;
}
}