Commit 3fbc584b authored by Mat's avatar Mat

mail infolettre, améliore le tableau passé dans le template

parent 59bb00af
...@@ -60,7 +60,6 @@ class DefaultController extends MasterController ...@@ -60,7 +60,6 @@ class DefaultController extends MasterController
if ($form->isSubmitted() && $form->isValid()) if ($form->isSubmitted() && $form->isValid())
{ {
$retour = $newsletter->sendLettreToGroup($lettre); $retour = $newsletter->sendLettreToGroup($lettre);
} }
return $this->render('@Potage/Default/test.html.twig', array( return $this->render('@Potage/Default/test.html.twig', array(
......
...@@ -19,10 +19,19 @@ ...@@ -19,10 +19,19 @@
<span>Potage</span> <span>Potage</span>
</div> </div>
<h1>Mon template twig</h1> <h1>{{ subject }}</h1>
<h2>{{ subject }}</h2> <h2>Période du {{ body.lettre.start|date('d-m-Y') }} au {{ body.lettre.end|date('d-m-Y') }}</h2>
<h3>{{ to }}</h3>
{{ dump(body) }} <h3>Bonjour {{ to.fullName }},</h3>
<p>{{ body.groupe.nom }}<br>
{{ body.depot.localisation }}</p>
{% for i in body.lettre.sorted %}
{{ i }}
{% endfor %}
{{ dump() }}
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -72,11 +72,16 @@ class Newsletter ...@@ -72,11 +72,16 @@ class Newsletter
$lettre->getOffre()->getId(), $lettre->getOffre()->getId(),
$lettre->getOffre()->getSorted() $lettre->getOffre()->getSorted()
); );
return array( $infolettre = array(
'id' => $lettre->getId(),
'reference' => $lettre->getReference(), 'reference' => $lettre->getReference(),
'start' => $lettre->getStartedAt(), 'start' => $lettre->getStartedAt(),
'end' => $lettre->getEndedAt(), 'end' => $lettre->getEndedAt(),
'status' => $lettre->getStatus(), 'status' => $lettre->getStatus(),
'sorted' => $lettre->getSorted(),
);
return array(
'lettre' => $infolettre,
'groupe' => $groupe, 'groupe' => $groupe,
'depot' => $depot, 'depot' => $depot,
'infos' => $infos, 'infos' => $infos,
...@@ -112,9 +117,9 @@ class Newsletter ...@@ -112,9 +117,9 @@ class Newsletter
->setSubject($subject) ->setSubject($subject)
->setBody( ->setBody(
$twig->render('@Potage/Mail/bodyMail.html.twig', array( $twig->render('@Potage/Mail/bodyMail.html.twig', array(
'to' => $to,
'subject' => $subject,
'body' => $body, 'body' => $body,
'to' => $this->parseMail($to),
'subject' => $subject
)), )),
'text/html' 'text/html'
); );
...@@ -158,7 +163,9 @@ class Newsletter ...@@ -158,7 +163,9 @@ class Newsletter
{ {
$to = array( $to = array(
'fullName' => $utilisateurs[$i]['prenom'] .' '. $utilisateurs[$i]['nom'], 'fullName' => $utilisateurs[$i]['prenom'] .' '. $utilisateurs[$i]['nom'],
'email' => $utilisateurs[$i]['email'] 'email' => $utilisateurs[$i]['email'],
'token' => $utilisateurs[$i]['id']
//encodePotageAccess($utilisateurs[$i]['id'], $lettre->getId())
); );
$ret[$i] = array( $ret[$i] = array(
'to' => $this->parseMail($to), 'to' => $this->parseMail($to),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment