Beispiel #1
0
 public function postular(Oferta $oferta)
 {
     $mailOferta = $oferta->getEmail();
     $firma = ucwords(strtolower($this->_nombre)) . ' ' . ucwords(strtolower($this->_apellido));
     $asunto = "CV " . $firma . '| ' . $oferta->getTitulo();
     if ($this->_preferencias["salario"]) {
         $remuneracion = '$' . $this->_preferencias["salario"] . ' netos';
     }
     if (!empty($remuneracion)) {
         $remuneracion = "&nbsp;&nbsp;&nbsp;&nbsp;<strong>Remuneracion pretendida:" . $remuneracion . "</strong><br /><br />\r\n";
     } else {
         $remuneracion = "";
     }
     $hash = sha1($this->_id . $oferta->getId() . $oferta->getTitulo() . $oferta->getEmail());
     $body = "<p>Ante quien corresponda:<br /><br />\n\t\t\t\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Espero tenga a bien contemplar mi curriculum vitae.\r\n<br /><br />\n\t\t\t\t{$remuneracion}\n\t\t\t\t&nbsp;&nbsp;&nbsp;Desde ya muchas gracias.<br /><br />\n\t\t\t\t<img src=\"http://tebuscolaburo.no-ip.org/oferta/reply/hash/{$hash}\" />;\n\t\t\t\t{$firma}\r\n</p>";
     try {
         $mail = \Mail\Factory::getInstance($this->_email, $this->_email, $this->_preferencias["clave"]);
         $mail->Subject = $asunto;
         $mail->addAddress($oferta->getEmail(), "");
         $mail->setFrom($this->_email, ucwords($this->_nombre) . ' ' . ucwords($this->_apellido));
         $mail->MsgHTML($body);
         $mail->AddAttachment("files/" . $this->_cvFile);
         $mail->Send();
         //Si el mail se envia correctamente, entonces inserto
         $table = new \apf\db\mysql5\Table("usuarios_postulaciones");
         $replace = new \apf\db\mysql5\Replace($table);
         $replace->id_usuario = $this->_id;
         $replace->id_oferta = $oferta->getId();
         $replace->momento_postulacion = array("value" => "NOW()", "quote" => FALSE);
         //Con este hash luego podemos comprobar si a la persona/entidad a la cual le enviamos el mail
         //Lo recibio o no, siempre y cuando acepte imagenes en su correo.
         $replace->hash = $hash;
         $replace->execute();
     } catch (Exception $e) {
         echo $e->getMessage() . "\n";
         //Boring error messages from anything else!
     }
 }
Beispiel #2
0
 public function moverAHistorico()
 {
     $table = new \apf\db\mysql5\Table("uri_queue_hist");
     $insert = new \apf\db\mysql5\Replace($table);
     $insert->id = $this->_id;
     $insert->id_oferta = $this->_idOferta;
     $insert->categoria = $this->_categoria;
     $insert->pais = $this->_pais;
     $insert->provincia = $this->_provincia;
     $insert->uri = $this->_uri;
     $insert->estado = $this->_estado;
     $insert->pid = $this->_pid;
     $insert->error = $this->_error;
     $insert->mensaje_error = $this->_msgError;
     $insert->momento_proceso = $this->_momentoProceso;
     if ($insert->execute()) {
         $this->delete();
         return TRUE;
     }
     return FALSE;
 }