/** * Return a list of users that should receive the report. * @return array */ public function getUsersForReport() { $users = $this->db->fetchAll('select `user`, `interval`, UNIX_TIMESTAMP(`last_report`) as last_report from tiki_user_reports'); $ret = array(); foreach ($users as $user) { if ($user['interval'] == "daily" && $user['last_report'] + 86400 <= $this->dt->format('U')) { $ret[] = $user['user']; } if ($user['interval'] == "weekly" && $user['last_report'] + 604800 <= $this->dt->format('U')) { $ret[] = $user['user']; } if ($user['interval'] == "monthly" && $user['last_report'] + 2419200 <= $this->dt->format('U')) { $ret[] = $user['user']; } } return $ret; }