Exemplo n.º 1
0
 /**
  * @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);
     }
 }
Exemplo n.º 2
0
 public function contactPostAction()
 {
     $data = $this->params()->fromQuery();
     $json = ['result' => false, 'message' => $this->getTranslator()->translate('There is some error, please try again later.', 'Landing'), 'data' => $data];
     // check data
     if ($data['firstName'] && $data['lastName'] && $data['email']) {
         // validate email
         if (filter_var($data['email'], FILTER_VALIDATE_EMAIL)) {
             Mail::sendContactMail($this, $data);
             $json['result'] = true;
             $json['data'] = '';
             $json['message'] = $this->getTranslator()->translate('Your contact has been sent, we will contact you as soon as possible, thank you!.', 'Landing');
         } else {
             $json['message'] = $this->getTranslator()->translate('Your email is not correct, please input again.', 'Landing');
         }
     }
     return new JsonModel($json);
 }
Exemplo n.º 3
0
 /**
  * @param \Application\Controller\AbstractActionController $controller
  */
 public function sendResetPasswordEmail($controller, $user, $newpass)
 {
     //var_dump($user->email);
     // initial data for email template
     $data = array('firstName' => $user->firstName, 'lastName' => $user->lastName, 'newpass' => $newpass);
     Mail::sendMail($controller, "ADMIN_RESET", $user->email, $data);
 }
Exemplo n.º 4
0
 static function addFormEntryMessage($messageDto)
 {
     $transaction = NULL;
     $result = array();
     $dwoo = new Core();
     try {
         $transaction = GenericDao::beginTransaction();
         $message = new FormEntryMessage(null, date("Y-m-d H:i:s", time()), true, $messageDto->proveedorId, $messageDto->entryId, $messageDto->formId, $messageDto->message, $messageDto->sender);
         FormDao::addFormEntryMessage($message, $transaction);
         $entry = FormAdmin::getFormEntryDetailById($messageDto->formId, $messageDto->entryId);
         if ($messageDto->sender == MessageSender::cliente) {
             FormAdmin::changeProveedorEntryState($messageDto->proveedorId, $messageDto->formId, $messageDto->entryId, \entities\ClienteState::enviada, \entities\ProveedorState::recibida);
             $transaction->commit();
             $proveedor = ProveedorDao::getProveedorById($messageDto->proveedorId);
             $user = SecurityDao::getUserById($proveedor->usuarioId);
             $dest = 'proveedor';
         } else {
             FormAdmin::changeProveedorEntryState($messageDto->proveedorId, $messageDto->formId, $messageDto->entryId, \entities\ClienteState::enProceso, \entities\ProveedorState::enProceso);
             $transaction->commit();
             $user = SecurityDao::getUserById($entry->userId);
             $dest = 'cliente';
         }
         $user->logo = AppConfig::logoUrl;
         $user->producto = $entry->producto;
         $code = base64_encode($user->id . '|' . $user->createDate . '|' . $user->mail . '|' . $dest . '|' . date("Y-m-d H:i:s", time()));
         $link = 'http://' . getenv('HTTP_HOST') . APP_FOLDER . '/views/client/AutoLoginManager.php?c=' . $code;
         $user->link = $link;
         $template = $dwoo->get($_SERVER["DOCUMENT_ROOT"] . '/views/shared/templates/mails/newMessage.tpl', (array) $user);
         Mail::Send($user->mail, 'Aladinnus, nuevo mensaje', $template);
     } catch (\Exception $ex) {
         $transaction->rollBack();
         $result = array($ex->getMessage());
     }
     return $result;
 }
Exemplo n.º 5
0
 static function sendMail($to, $subject, $name, $title, $detail)
 {
     $dwoo = new Core();
     $data = new \stdClass();
     $data->name = $name;
     $data->title = $title;
     $data->detail = $detail;
     try {
         $template = $dwoo->get($_SERVER["DOCUMENT_ROOT"] . '/views/shared/templates/mails/solicitud.tpl', (array) $data);
         Mail::Send($to, $subject, $template);
     } catch (\Exception $ex) {
     }
 }
Exemplo n.º 6
0
 static function processRecuperoClave($mail)
 {
     $errors = array();
     try {
         $user = SecurityDao::getUserByMail($mail);
         $code = base64_encode($user->id . '|' . $user->createDate . '|' . $user->mail);
         $link = 'https://servicios.diarco.com.ar/turnos/views/generarClave.php?c=' . $code;
         $user->link = $link;
         $subject = 'Diarco, proceso de recupero de contraseña';
         $dwoo = new Core();
         $template = $dwoo->get($_SERVER["DOCUMENT_ROOT"] . '/views/shared/templates/mails/passwordRecovery.tpl', (array) $user);
         Mail::Send($user->mail, $subject, $template);
     } catch (\Exception $ex) {
         array_push($errors, $ex->getMessage());
     }
     return $errors;
 }
Exemplo n.º 7
0
 static function processContacto($contactoDto)
 {
     $errors = array();
     $contacto = new Contacto(NULL, date("Y-m-d H:i:s", time()), true, $contactoDto->nombre, $contactoDto->mail, $contactoDto->telefono, $contactoDto->celular, $contactoDto->asunto, $contactoDto->mensaje, false, false, $contactoDto->tipo);
     $transaction = GenericDao::beginTransaction();
     try {
         BaseDao::createContacto($contacto, $transaction);
         $transaction->commit();
         $dwoo = new Core();
         $contactoDto->logo = AppConfig::logoUrl;
         $template = $dwoo->get($_SERVER["DOCUMENT_ROOT"] . '/views/shared/templates/mails/contact.tpl', (array) $contactoDto);
         Mail::Send('*****@*****.**', BaseAdmin::getContactoMailTitle($contactoDto->tipo), $template);
     } catch (\Exception $ex) {
         $transaction->rollBack();
         $errors = array('Se produjo un error, por favor intentelo más tarde.');
     }
     return $errors;
 }