Example #1
0
 /**
  * @Route("/mail/{id}")
  */
 public function mailAction($id)
 {
     $t = new Test();
     $t->setId(-1);
     $t->setDate(new \DateTime());
     $t->setName("Exam de test");
     $t->setNumReminder($id);
     $teacher = new Teacher();
     $teacher->setId(-1);
     $teacher->setName("Prénom");
     $teacher->setSurname("Nom");
     $t->setTeacher($teacher);
     $c = new Classroom();
     $c->setName("Class_A");
     $t->addClassroom($c);
     $c = new Classroom();
     $c->setName("Class_B");
     $t->addClassroom($c);
     $html = $this->renderView("CorrigeatonMailerBundle:Mail:mail-" . $id . ".html.twig", array("test" => $t));
     $css = file_get_contents($this->get("templating.helper.assets")->getUrl('bundles/corrigeatonmailer/css/main.css'));
     $inline = new CssToInlineStyles($html, $css);
     return new Response($inline->convert());
 }
Example #2
0
 /**
  * @Route("/mails/{id}", name="mail_show")
  */
 public function mailAction($id)
 {
     if (!in_array($id, array("1", "2", "3", "4", "5", "6", "7", "corrected"))) {
         throw $this->createAccessDeniedException("Not found");
     }
     $t = new Test();
     $t->setId(-1);
     $t->setDate(new \DateTime());
     $t->setName("Exam de test");
     $t->setNumReminder($id);
     $teacher = new Teacher();
     $teacher->setId(-1);
     $teacher->setName("Prénom");
     $teacher->setSurname("Nom");
     $t->setTeacher($teacher);
     $c = new Classroom();
     $c->setName("Class A");
     $t->addClassroom($c);
     $c = new Classroom();
     $c->setName("Class B");
     $t->addClassroom($c);
     $html = $this->renderView("CorrigeatonMailerBundle:Mail:mail-" . $id . ".html.twig", array("test" => $t));
     $css = file_get_contents($this->get("templating.helper.assets")->getUrl('bundles/corrigeatonmailer/css/main.css'));
     $inline = new CssToInlineStyles($html, $css);
     return new Response($inline->convert());
 }