/** * @param \Application\Controller\AbstractActionController $controller */ public function sendNewActivityMail($controller, $lang_code = 'en-US') { // initial data for email template //$lang_code = $controller->params()->fromRoute('lang'); $projectLink = $controller->getBaseUrl() . '/' . $lang_code . '/admin/project/detail?id=' . $this->project->getId(); $data = array('project' => $this->project->getData(), 'type' => $this->type, 'sender' => $this->sender->getData(), 'message' => $this->message, 'projectLink' => $projectLink); $emails = []; $emails[] = $controller->getUser(array("staff" => $this->project->getData()['pm']['id']))->getData()['email']; $emails[] = $controller->getUser(array("employer" => $this->project->getData()['client']['id']))->getData()['email']; if ($this->project->getData()['sale']) { $emails[] = $controller->getUser(array("staff" => $this->project->getData()['sale']['id']))->getData()['email']; } // Uncomment to remove current user from mail list to send // $user = $controller->getCurrentUser(); // if(($key = array_search($user->getEmail(), $emails)) !== false) { // unset($emails[$key]); // } $tpl = "ACTIVITY_NEW"; switch ($this->type) { case 'accept_quote': case 'create_quote': case 'create_task': case 'message': } foreach ($emails as $email) { Mail::sendMail($controller, $tpl, $email, $data); } }
public function getData() { return ['id' => $this->id, 'name' => $this->name, 'path' => $this->path, 'size' => $this->size, 'project' => $this->project ? $this->project->getData() : null, 'task' => $this->task ? $this->task->getData() : null, 'language' => $this->language ? $this->language->getData() : null, 'token' => $this->token, 'time' => $this->time, 'filetype' => $this->filetype]; }