BUG Page Talent
This commit is contained in:
@@ -73,8 +73,12 @@
|
||||
</h2>
|
||||
{# À modifier par Laurent : Nouveau format d'adresse Géoloc Google Maps #}
|
||||
{% if user.geoloc is defined %}
|
||||
<p class="lead font-weight-normal">{{ user.geoloc[0].locality }}-
|
||||
{{ user.geoloc[0].country }}</p>
|
||||
<p class="lead font-weight-normal">
|
||||
{% if user.geoloc %}
|
||||
{{ user.geoloc[0].locality }}-
|
||||
{{ user.geoloc[0].country }}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% elseif company.addresses.billing is defined %}
|
||||
<p class="lead font-weight-normal">{{ company.addresses.billing.city }}
|
||||
-
|
||||
|
||||
@@ -318,87 +318,8 @@ class TalentController extends Controller
|
||||
* This route must stay at the end
|
||||
***********************/
|
||||
|
||||
/**
|
||||
* @Route("/talent/{alias}/", name="talent_show")
|
||||
* @ParamConverter("company", options={"mapping": {"alias": "alias"}})
|
||||
*/
|
||||
public function talentShowAction(Request $request, Company $talent)
|
||||
{
|
||||
setlocale(LC_ALL, 'fr_FR.utf-8');
|
||||
$user = $talent->getUsers();
|
||||
$subject = "Demande de contact";
|
||||
$form = $this->createForm(ContactTalentType::class, array("subject" => false));
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$userCompany = $this->getUser();
|
||||
$message = $form['message']->getData();
|
||||
$htmlView = $this->renderView('email/contact_default.html.twig', array(
|
||||
'type' => 'html',
|
||||
'message' => $message,
|
||||
'user' => $user{0},
|
||||
));
|
||||
$plainView = $this->renderView('email/contact_default.html.twig', array(
|
||||
'type' => 'plain',
|
||||
'message' => $message,
|
||||
'user' => $user{0},
|
||||
));
|
||||
$email = \Swift_Message::newInstance()
|
||||
->setSubject('Une entreprise vous a contacter sur Talents Tube')
|
||||
->setFrom($userCompany->getEmail())
|
||||
->setTo($user{0}->getEmail())
|
||||
->setBody($htmlView, 'text/html')
|
||||
->addPart($plainView, 'text/plain');
|
||||
$this->get('mailer')->send($email);
|
||||
$this->addFlash(
|
||||
'notice',
|
||||
$this->get('translator')->trans('talent.mail.contact.send')
|
||||
);
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$messageObj = new message($subject, $message, $userCompany, $user{0}, 'CONTACT_TALENT');
|
||||
$em->persist($messageObj);
|
||||
$em->flush();
|
||||
$em->close();
|
||||
return $this->redirectToRoute('talent_show', ['alias' => $talent->getAlias()]);
|
||||
}
|
||||
$mustLogin = true;
|
||||
if ($this->getUser() && $this->getUser()->hasRole('ROLE_TALENT')) {
|
||||
$mustLogin = false;
|
||||
if ($this->getUser() && ($this->getUser()->getCompany()->getId() == $talent->getId())) {
|
||||
$showRecommendation = false;
|
||||
}
|
||||
}
|
||||
|
||||
$showRecommendation = true;
|
||||
if ($this->getUser() && !$this->getUser()->hasRole('ROLE_TALENT')) {
|
||||
$showRecommendation = false;
|
||||
}
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$recommendations = $em->getRepository('AppBundle:Recommendation')->findBy(
|
||||
array('isEnabled'=>true, 'status'=> 'SENDED', 'user'=> $talent->getMainUser()),
|
||||
array('uTime' => 'DESC')
|
||||
);
|
||||
/*Definition des urls de destination pour oauth login et register pour la recommandation vidéo*/
|
||||
$destination = $this->generateUrl('recommandation_create', array('alias' => $talent->getAlias()));
|
||||
$this->get('twig')->addGlobal('destination_login', $destination);
|
||||
$session = $request->getSession();
|
||||
$session->set('registration_destination', $destination);
|
||||
$res = $this->render('talent/talent_show.html.twig', [
|
||||
'talent' => $talent,
|
||||
'user' => $user{0},
|
||||
'form' => $form->createView(),
|
||||
'mustLogin' => $mustLogin,
|
||||
'showRecommendation' => $showRecommendation,
|
||||
'urlRecommendation' => $destination,
|
||||
'recommendations' => $recommendations
|
||||
]);
|
||||
$res->headers->setCookie(new Cookie('redirect_register', $destination));
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/talent2/{alias}/", name="talent_show2")
|
||||
* @Route("/talent/{alias}/", name="talent_show2")
|
||||
* @ParamConverter("company", options={"mapping": {"alias": "alias"}})
|
||||
*/
|
||||
public function talent2ShowAction(Request $request, Company $talent)
|
||||
|
||||
Reference in New Issue
Block a user