+ add dailyreminder to zentao.
This commit is contained in:
@@ -119,4 +119,46 @@ class report extends control
|
||||
$this->view->submenu = 'staff';
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send daily reminder mail.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function remind()
|
||||
{
|
||||
if($this->config->report->dailyreminder->bug) $bugs = $this->report->getUserBugs();
|
||||
if($this->config->report->dailyreminder->task) $tasks = $this->report->getUserTasks();
|
||||
if($this->config->report->dailyreminder->todo) $todos = $this->report->getUserTodos();
|
||||
|
||||
$reminder = array();
|
||||
if(!empty($bugs)) foreach($bugs as $user => $bug) $reminder[$user]->bugs = $bug;
|
||||
if(!empty($tasks)) foreach($tasks as $user => $task) $reminder[$user]->tasks = $task;
|
||||
if(!empty($todos)) foreach($todos as $user => $todo) $reminder[$user]->todos = $todo;
|
||||
|
||||
$this->loadModel('mail');
|
||||
foreach($reminder as $user => $mail)
|
||||
{
|
||||
/* Get email content and title.*/
|
||||
$this->view->mail = $mail;
|
||||
$mailContent = $this->parse('report', 'dailyreminder');
|
||||
$mailTitle = $this->lang->report->mailtitle->begin;
|
||||
$mailTitle .= isset($mail->bugs) ? sprintf($this->lang->report->mailtitle->bug, count($mail->bugs)) : '';
|
||||
$mailTitle .= isset($mail->tasks) ? sprintf($this->lang->report->mailtitle->task, count($mail->tasks)) : '';
|
||||
$mailTitle .= isset($mail->todos) ? sprintf($this->lang->report->mailtitle->todo, count($mail->todos)) : '';
|
||||
$mailTitle = rtrim($mailTitle, ',');
|
||||
$this->clear();
|
||||
|
||||
/* Send email.*/
|
||||
echo date('Y-m-d H:i:s') . " sending to $user, ";
|
||||
$this->mail->send($user, $mailTitle, $mailContent, '', true);
|
||||
if($this->mail->isError())
|
||||
{
|
||||
echo "fail: \n" ;
|
||||
a($this->mail->getError());
|
||||
}
|
||||
echo "ok\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user