src/Controller/HomeController.php line 235

Open in your IDE?
  1. <?php
  2. /*
  3. * Ce fichier est la propriété de l'association (c) Projets Métiers
  4. *
  5. * (c) crée par Jean-Marc CATALA <jeanmmarccatala@gmail.com>
  6. *
  7. */
  8. namespace App\Controller;
  9. use App\Entity\User;
  10. use Dompdf\Dompdf;
  11. use Dompdf\Options;
  12. use Symfony\Component\Routing\Annotation\Route;
  13. class HomeController extends BaseController
  14. {
  15. /**
  16. * @Route("/", name="app_homepage")
  17. */
  18. public function homepage(){
  19. return $this->render('general/homepage.html.twig');
  20. }
  21. /**
  22. * @Route("/inscritption", name="app_loginPage")
  23. */
  24. public function loginpage(){
  25. return $this->render('general/loginpage.html.twig');
  26. }
  27. /**
  28. * @Route("/redirect", name="app_redirect")
  29. */
  30. public function redirection(){
  31. $user = $this->getUser();
  32. if (!$user){
  33. return $this->redirectToRoute('app_login');
  34. }
  35. $role= $user->getRoles();
  36. //dd($role);
  37. if ($this->isGranted('ROLE_ADMIN')) {
  38. return $this->redirectToRoute('administrateur');
  39. }
  40. if ($this->isGranted('ROLE_PROF')) {
  41. if ($this->isGranted('ROLE_MENTOR')) {
  42. if ($this->isGranted('ROLE_VALIDEUR')) {
  43. return $this->redirectToRoute('mentorer');
  44. }
  45. else
  46. return $this->redirectToRoute('mentor');
  47. }
  48. else
  49. return $this->redirectToRoute('prof');
  50. }
  51. if ($this->isGranted('ROLE_CONSEILLER')) {
  52. return $this->redirectToRoute('conseiller');
  53. }
  54. if ($this->isGranted('ROLE_MENTOR')) {
  55. return $this->redirectToRoute('mentor');
  56. }
  57. if ($this->isGranted('ROLE_VALIDEUR')) {
  58. return $this->redirectToRoute('mentorer');
  59. }
  60. if ($this->isGranted('ROLE_COLLEGE')) {
  61. return $this->redirectToRoute('college');
  62. }
  63. if ($this->isGranted('ROLE_LYCEE')) {
  64. return $this->redirectToRoute('lycee');
  65. }
  66. if ($this->isGranted('ROLE_ADULTE')) {
  67. return $this->redirectToRoute('reconversion');
  68. }
  69. if ($this->isGranted('ROLE_PARENT')) {
  70. return $this->redirectToRoute('parent');
  71. }
  72. if ($this->isGranted('ROLE_EXPERT')) {
  73. return $this->redirectToRoute('expert');
  74. }
  75. if ($this->isGranted('ROLE_USER')) {
  76. return $this->redirectToRoute('accueil');
  77. }
  78. return $this->render('general/homepage.html.twig');
  79. }
  80. /**
  81. * @Route("/accueil", name="accueil")
  82. */
  83. public function accueil(){
  84. return $this->render('general/homepage.html.twig');
  85. }
  86. /**
  87. * @Route("/accueil-parent", name="accueilParent")
  88. */
  89. public function accueilParent(){
  90. return $this->render('profil/accueilParent.html.twig');
  91. }
  92. /**
  93. * @Route("/accueil-eleve", name="accueilEleve")
  94. */
  95. public function accueilEleve(){
  96. return $this->render('profil/accueilEleve.html.twig');
  97. }
  98. /**
  99. * @Route("/accueil-professeur", name="accueilProf")
  100. */
  101. public function accueilProf(){
  102. return $this->render('profil/accueilProf.html.twig');
  103. }
  104. /**
  105. * @Route("/accueil-mentor", name="accueilMentor")
  106. */
  107. public function accueilMentor(){
  108. return $this->render('profil/accueilMentor.html.twig');
  109. }
  110. /**
  111. * @Route("/accueil-expert", name="accueilExpe
  112. * rt")
  113. */
  114. public function accueilExpert(){
  115. return $this->render('profil/accueilExpert.html.twig');
  116. }
  117. /**
  118. * @Route("/accueil-conseiller", name="accueilConseiller")
  119. */
  120. public function accueilConseiller(){
  121. return $this->render('profil/accueilConseiller.html.twig');
  122. }
  123. /**
  124. * @Route("/accueil-adultes", name="accueilAdultes")
  125. */
  126. public function accueilAdultes(){
  127. return $this->render('profil/accueilAdultes.html.twig');
  128. }
  129. /**
  130. * @Route("/l-histoire-de-projets-metiers", name="histoire")
  131. */
  132. public function histoire()
  133. {
  134. return $this->render('general/histoire.html.twig');
  135. }
  136. /**
  137. * @Route("/qui-sommes-nous", name="qui")
  138. */
  139. public function qui()
  140. {
  141. return $this->render('general/qui.html.twig');
  142. }
  143. /**
  144. * @Route("/financement", name="financement")
  145. */
  146. public function financement()
  147. {
  148. return $this->render('general/financement.html.twig');
  149. }
  150. /**
  151. * @Route("/partage-des-taches", name="partage")
  152. */
  153. public function partage(){
  154. return $this->render('general/partage.html.twig');
  155. }
  156. /**
  157. * @Route("/actions", name="actions")
  158. */
  159. public function actions()
  160. {
  161. return $this->render('general/actions.html.twig');
  162. }
  163. /**
  164. * @Route("/equipe", name="equipe")
  165. */
  166. public function equipe()
  167. {
  168. return $this->render('general/equipe.html.twig');
  169. }
  170. /**
  171. * @Route("/ou-intervenons-nous", name="implantation")
  172. */
  173. public function implantation()
  174. {
  175. return $this->render('general/implantation.html.twig');
  176. }
  177. /**
  178. * @Route("/partenaires", name="partenaires")
  179. */
  180. public function partenaires(){
  181. return $this->render('general/partenaires.html.twig');
  182. }
  183. /**
  184. * @Route("/methode", name="methode")
  185. */
  186. public function methode(){
  187. return $this->render('general/methode.html.twig');
  188. }
  189. /**
  190. * @Route("/methode/projet-metiers", name="methodeMenu")
  191. */
  192. public function methodeMenu(){
  193. return $this->render('general/methodeMenu.html.twig');
  194. }
  195. /**
  196. * @Route("/bases-scientifiques", name="bases")
  197. */
  198. public function bases(){
  199. return $this->render('general/bases.html.twig');
  200. }
  201. /**
  202. * @Route("/temoignages", name="temoignages")
  203. */
  204. public function temoignages(){
  205. return $this->render('general/temoignages.html.twig');
  206. }
  207. /**
  208. * @Route("/profession-de-foi", name="profession")
  209. */
  210. public function profession(){
  211. return $this->render('general/profession.html.twig');
  212. }
  213. /**
  214. * @Route("/actualites-de-l-orientation", name="actualites")
  215. */
  216. public function actualites(){
  217. return $this->render('general/bases.html.twig');
  218. }
  219. /**
  220. * @Route("/vies-professionnelles-reussies", name="vies")
  221. */
  222. public function vies(){
  223. return $this->render('general/vies.html.twig');
  224. }
  225. /**
  226. * @Route("/muhammad-yunus", name="vie1")
  227. */
  228. public function vie1(){
  229. return $this->render('general/vie1.html.twig');
  230. }
  231. /**
  232. * @Route("/max-fischl", name="vie2")
  233. */
  234. public function vie2(){
  235. return $this->render('general/vie2.html.twig');
  236. }
  237. /**
  238. * @Route("/jerome-laurens", name="vie3")
  239. */
  240. public function vie3(){
  241. return $this->render('general/vie3.html.twig');
  242. }
  243. /**
  244. * @Route("/thomas", name="vie4")
  245. */
  246. public function vie4(){
  247. return $this->render('general/vie4.html.twig');
  248. }
  249. /**
  250. * @Route("/yvon-chouinard", name="vie5")
  251. */
  252. public function vie5(){
  253. return $this->render('general/vie5.html.twig');
  254. }
  255. /**
  256. * @Route("/noro-ravoavahy", name="vie6")
  257. */
  258. public function vie6(){
  259. return $this->render('general/vie6.html.twig');
  260. }
  261. /**
  262. * @Route("/christophe-perrot", name="vie7")
  263. */
  264. public function vie7(){
  265. return $this->render('general/vie7.html.twig');
  266. }
  267. /**
  268. * @Route("/CGU/partenaires", name="cgupartenaires")
  269. */
  270. public function cguPartenaire(){
  271. return $this->render('general/cguPartenaires.html.twig');
  272. }
  273. /**
  274. * @Route("/CGU/non-partenaires", name="cgu")
  275. */
  276. public function cgu(){
  277. return $this->render('general/cgu.html.twig');
  278. }
  279. /**
  280. * @Route("/mentions-legales", name="mentions")
  281. */
  282. public function mentions(){
  283. return $this->render('general/mentions.html.twig');
  284. }
  285. /**
  286. * @Route("/donnes-personnelle", name="donnesPerso")
  287. */
  288. public function donnesPerso(){
  289. return $this->render('general/donneesPersonnelles.html.twig');
  290. }
  291. /**
  292. * @Route("/politique-confidentialite", name="confidentialite")
  293. */
  294. public function confidentialite(){
  295. return $this->render('general/confidentialite.html.twig');
  296. }
  297. /**
  298. * @Route("/ONG", name="ong")
  299. */
  300. public function ong(){
  301. return $this->render('ressources/ong.html.twig');
  302. }
  303. /**
  304. * @Route("/independant", name="independant")
  305. */
  306. public function independant(){
  307. return $this->render('ressources/independant.html.twig');
  308. }
  309. /**
  310. * @Route("/Start-Up", name="StartUp")
  311. */
  312. public function StartUp(){
  313. return $this->render('ressources/StartUp.html.twig');
  314. }
  315. /**
  316. * @Route("/Multinationale", name="multinationale")
  317. */
  318. public function multinationale(){
  319. return $this->render('ressources/multinationale.html.twig');
  320. }
  321. /**
  322. * @Route("/PME", name="pme")
  323. */
  324. public function pme(){
  325. return $this->render('ressources/pme.html.twig');
  326. }
  327. /**
  328. * @Route("/Fonction-Publique", name="fonctionPublique")
  329. */
  330. public function fonctionPublique(){
  331. return $this->render('ressources/fonctionPublique.html.twig');
  332. }
  333. /**
  334. * @Route("/Jean-Marc.CATALA", name="cv")
  335. */
  336. public function cv(){
  337. return $this->render('ressources/Jean-Marc.CATALA.html.twig');
  338. }
  339. /**
  340. * @Route("/mode-operatoire-college", name="modeOperatoireCollege")
  341. */
  342. public function modeOperatoireCollege(){
  343. $pdfOptions = new Options();
  344. $pdfOptions->set('defaultFont', 'JosefinSansRegular');
  345. $pdfOptions->set('isRemoteEnabled', TRUE);
  346. $pdfOptions->set('debugKeepTemp', TRUE);
  347. $pdfOptions->set('isHtml5ParserEnabled', true);
  348. // Instantiate Dompdf with our options
  349. $dompdf = new Dompdf($pdfOptions);
  350. // Retrieve the HTML generated in our twig file
  351. $html = $this->renderView('ressources/modeoperatoireCollege.html.twig');
  352. // Load HTML to Dompdf
  353. $dompdf->loadHtml($html);
  354. // (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
  355. $dompdf->setPaper('A4', 'portrait');
  356. // Render the HTML as PDF
  357. $dompdf->render();
  358. // Output the generated PDF to Browser (inline view)
  359. $dompdf->stream("mypdf.pdf", [
  360. "Attachment" => false
  361. ]);
  362. }
  363. /**
  364. * @Route("/mode-operatoire-lycee", name="modeOperatoireLycee")
  365. */
  366. public function modeOperatoireLycee(){
  367. $pdfOptions = new Options();
  368. $pdfOptions->set('defaultFont', 'JosefinSansRegular');
  369. $pdfOptions->set('isRemoteEnabled', TRUE);
  370. $pdfOptions->set('debugKeepTemp', TRUE);
  371. $pdfOptions->set('isHtml5ParserEnabled', true);
  372. // Instantiate Dompdf with our options
  373. $dompdf = new Dompdf($pdfOptions);
  374. // Retrieve the HTML generated in our twig file
  375. $html = $this->renderView('ressources/modeoperatoireLycee.html.twig');
  376. // Load HTML to Dompdf
  377. $dompdf->loadHtml($html);
  378. // (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
  379. $dompdf->setPaper('A4', 'portrait');
  380. // Render the HTML as PDF
  381. $dompdf->render();
  382. // Output the generated PDF to Browser (inline view)
  383. $dompdf->stream("mypdf.pdf", [
  384. "Attachment" => false
  385. ]);
  386. }
  387. /**
  388. * @Route("/mode-operatoire-adulte", name="modeOperatoireAdulte")
  389. */
  390. public function modeOperatoireAdulte(){
  391. $pdfOptions = new Options();
  392. $pdfOptions->set('defaultFont', 'JosefinSansRegular');
  393. $pdfOptions->set('isRemoteEnabled', TRUE);
  394. $pdfOptions->set('debugKeepTemp', TRUE);
  395. $pdfOptions->set('isHtml5ParserEnabled', true);
  396. // Instantiate Dompdf with our options
  397. $dompdf = new Dompdf($pdfOptions);
  398. // Retrieve the HTML generated in our twig file
  399. $html = $this->renderView('ressources/modeoperatoireAdulte.html.twig');
  400. // Load HTML to Dompdf
  401. $dompdf->loadHtml($html);
  402. // (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
  403. $dompdf->setPaper('A4', 'portrait');
  404. // Render the HTML as PDF
  405. $dompdf->render();
  406. // Output the generated PDF to Browser (inline view)
  407. $dompdf->stream("mypdf.pdf", [
  408. "Attachment" => false
  409. ]);
  410. }
  411. /**
  412. * @Route("/mode-operatoire-profs", name="modeOperatoireProfs")
  413. */
  414. public function modeOperatoireProfs(){
  415. $pdfOptions = new Options();
  416. $pdfOptions->set('defaultFont', 'JosefinSansRegular');
  417. $pdfOptions->set('isRemoteEnabled', TRUE);
  418. $pdfOptions->set('debugKeepTemp', TRUE);
  419. $pdfOptions->set('isHtml5ParserEnabled', true);
  420. // Instantiate Dompdf with our options
  421. $dompdf = new Dompdf($pdfOptions);
  422. // Retrieve the HTML generated in our twig file
  423. $html = $this->renderView('ressources/modeoperatoireProfs.html.twig');
  424. // Load HTML to Dompdf
  425. $dompdf->loadHtml($html);
  426. // (Optional) Setup the paper size and orientation 'portrait' or 'portrait'
  427. $dompdf->setPaper('A4', 'portrait');
  428. // Render the HTML as PDF
  429. $dompdf->render();
  430. // Output the generated PDF to Browser (inline view)
  431. $dompdf->stream("mypdf.pdf", [
  432. "Attachment" => false
  433. ]);
  434. }
  435. }