示例#1
0
 /**
  * save offer as news function
  *
  */
 public function saveNewUser($user)
 {
     $news = new News();
     $news->setTitle($offer->getCompany() . ' ' . $offer->getPosition());
     $news->setWhat($offer->getDescription());
     //$em = $this->getDoctrine()->getEntityManager();
     $this->insert($news);
     $this->flush();
 }
示例#2
0
 /**
  *
  *
  */
 public function newOfferAdSaveOpenAction(Request $request)
 {
     //$form = $this->createForm(new OfferType(), new Offer());
     //$request->get('position')->set($request->request->get('company') .', '. $request->request->get('position'));
     $form = $this->createForm(OfferAdType::class, new OfferAdOpen());
     if ($request->getMethod() == 'POST') {
         $form->handleRequest($request);
         //$form->submit($request->request->get($form->getName()));
         if ($form->isValid()) {
             $offer = $form->getData();
             $newsContent = '<p>' . $offer->getDescription() . '</p>';
             $newsContent .= '<div><b>Localidad</b><p>' . $offer->getLocation() . '</p></div>';
             $newsContent .= '<div><b>Vacantes</b><p>' . $offer->getPositionNo() . '</p></div>';
             $newsContent .= '<div><b>Jornada</b><p>' . $offer->getWorkday() . '</p></div>';
             $newsContent .= '<div><b>Estudios</b><p>' . $offer->getRequiredStudiesString() . '</p></div>';
             $newsContent .= '<div><b>Otros conocimientos</b><p>' . $offer->getOtherKnowledges() . '</p></div>';
             $newsContent .= '<div><b>Observaciones</b><p>' . $offer->getObservations() . '</p></div>';
             $newsContent .= '<div><b>Contacto</b><p>' . $offer->getContact() . '</p></div>';
             $news = new News();
             $news->setTitle($offer->getCompany() . ' ' . $offer->getPosition());
             $news->setPermalink($this->permalink($news->getTitle()));
             $news->setWhat(base64_encode($newsContent));
             $news->setTags($offer->getRequiredStudiesString());
             $news->setNewsdate(time());
             $news->setWho(1);
             $news->setStatus(0);
             $em = $this->getDoctrine()->getEntityManager();
             $em->merge($news);
             $em->flush();
             $this->sendEmail($offer);
             $response = $this->render('CuatrovientosArteanBundle:OfferAd:newAdSave.html.twig', array('offer' => $offer));
         } else {
             $response = $this->render('CuatrovientosArteanBundle:OfferAd:newAdOpen.html.twig', array('form' => $form->createView()));
         }
     }
     return $response;
 }
示例#3
0
 /**
  * publish offer as
  *
  */
 public function newOfferPublishAction($id)
 {
     $offer = $this->getDoctrine()->getRepository("CuatrovientosArteanBundle:OfferOpen")->findOffer($id);
     $news = new News();
     $news->setTitle($offer->getCompany() . ' ' . $offer->getPosition());
     $news->setPermalink($this->get("cuatrovientos_artean.utils.permalink")->permalink($news->getTitle()));
     $news->setWhat(base64_encode($offer->getDescription()));
     $news->setNewsdate(time());
     $news->setWho(1);
     $news->setStatus(1);
     $em = $this->getDoctrine()->getEntityManager();
     $em->persist($news);
     $offer->setPublished(1);
     $em->persist($offer);
     $em->flush();
     $form = $this->createForm(NewsType::class, $news);
     return $this->render('CuatrovientosArteanBundle:News:update.html.twig', array('form' => $form->createView(), 'id' => $news->getId()));
     return $response;
 }