/** * Start searching for overdue tasks/goals/... * Email will send if found */ public function actionIndex() { $goals = Dashboard::getGoalsOverdue(); $tasks = Dashboard::getTasksOverdue(); if ($goals or $tasks) { $email = \Yii::$app->params['adminEmail']; $domain = \Yii::$app->params['domain']; $text = \Yii::$app->view->render('/dashboard/email.txt.php', ['tasks' => $tasks, 'goals' => $goals]); \Yii::$app->mailer->compose()->setFrom('noreplay@' . $domain)->setTo($email)->setSubject(\Yii::t('dashboard', 'Overdue for {0} at {1}', [$domain, date('Y.m.d')]))->setTextBody($text)->send(); } }
public function actionIndex() { // nearest tasks $tasks = Dashboard::getTasksNearest($tasksCount); // tasks without date $tasksWithoutDate = Dashboard::getTasksWithoutDate($tasksWithoutDateCount); // overdue tasks $tasksOverdue = Dashboard::getTasksOverdue($tasksOverdueCount); /********************************************************************/ // nearest goals $goals = Dashboard::getGoalsNearest($goalsCount); // goals without date $goalsWithoutDate = Dashboard::getGoalsWithoutDate($goalsWithoutDateCount); // overdue goals $goalsOverdue = Dashboard::getGoalsOverdue($goalsOverdueCount); return $this->render('index', ['tasks' => $tasks, 'tasksCount' => $tasksCount, 'tasksWithoutDate' => $tasksWithoutDate, 'tasksWithoutDateCount' => $tasksWithoutDateCount, 'tasksOverdue' => $tasksOverdue, 'tasksOverdueCount' => $tasksOverdueCount, 'goals' => $goals, 'goalsCount' => $goalsCount, 'goalsWithoutDate' => $goalsWithoutDate, 'goalsWithoutDateCount' => $goalsWithoutDateCount, 'goalsOverdue' => $goalsOverdue, 'goalsOverdueCount' => $goalsOverdueCount]); }