point pages to user injected navbar controller
This commit is contained in:
parent
17d8e1413b
commit
f838943827
@ -19,7 +19,7 @@ use Symfony\Component\Mime\Address;
|
|||||||
class ComplaintController extends AbstractController
|
class ComplaintController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route('/complaint/anon', name: 'complaint')]
|
#[Route('/complaint/anon', name: 'complaint')]
|
||||||
public function Index(Request $request, TransportTransportInterface $mailer,LoggerInterface $log) : Response
|
public function Index(Request $request, TransportTransportInterface $mailer,LoggerInterface $log, NavbarController $_navbar) : Response
|
||||||
{
|
{
|
||||||
$form = $this->createForm(AnonymousComplaintType::class);
|
$form = $this->createForm(AnonymousComplaintType::class);
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
@ -33,7 +33,7 @@ class ComplaintController extends AbstractController
|
|||||||
{
|
{
|
||||||
$sendMail = null;
|
$sendMail = null;
|
||||||
}
|
}
|
||||||
return $this->render('complaint.html.twig',['form' => $form, 'isSubmitted' => $sendMail, 'complaintReceiverName' => $_SERVER['COMPLAINT_RECIPIENT_NAME']]);
|
return new Response($_navbar->navbar() . $this->renderView('complaint.html.twig',['form' => $form, 'isSubmitted' => $sendMail, 'complaintReceiverName' => $_SERVER['COMPLAINT_RECIPIENT_NAME']]));
|
||||||
}
|
}
|
||||||
public function sendEmail(TransportTransportInterface $mailer, string $message, LoggerInterface $log) : bool
|
public function sendEmail(TransportTransportInterface $mailer, string $message, LoggerInterface $log) : bool
|
||||||
{
|
{
|
||||||
|
|||||||
21
src/Controller/NavbarController.php
Normal file
21
src/Controller/NavbarController.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
use Symfony\Component\HttpKernel\Attribute\AsController;
|
||||||
|
use Twig\Environment;
|
||||||
|
|
||||||
|
#[AsController]
|
||||||
|
class NavbarController
|
||||||
|
{
|
||||||
|
public function __construct(private Environment $twig){}
|
||||||
|
public function navbar() : string
|
||||||
|
{
|
||||||
|
$contentFile = Yaml::parseFile('../config/navbar.yaml', 2, 2, Yaml::PARSE_OBJECT_FOR_MAP);
|
||||||
|
$content = $this->twig->render('_navbar.html.twig', $contentFile);
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,10 +8,12 @@ use jv\intranet\Types\NavbarItem;
|
|||||||
class PortalController extends AbstractController
|
class PortalController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route('/')]
|
#[Route('/')]
|
||||||
public function page() : Response
|
public function page(NavbarController $navbar) : Response
|
||||||
{
|
{
|
||||||
|
$navbar = $navbar->navbar();
|
||||||
$contentFile = Yaml::parseFile('../config/portalLinks.yaml', 2, 2, Yaml::PARSE_OBJECT_FOR_MAP);
|
$contentFile = Yaml::parseFile('../config/portalLinks.yaml', 2, 2, Yaml::PARSE_OBJECT_FOR_MAP);
|
||||||
return $this->render('portal.html.twig',$contentFile);
|
$page = $this->render('portal.html.twig',$contentFile);
|
||||||
|
return new Response($navbar . $page->getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -14,14 +14,17 @@ use function PHPUnit\Framework\containsIdentical;
|
|||||||
|
|
||||||
class SafetyController extends AbstractController
|
class SafetyController extends AbstractController
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#[Route('/training/safety', name: 'safetyHome')]
|
#[Route('/training/safety', name: 'safetyHome')]
|
||||||
public function Index() : Response
|
public function Index(NavbarController $_navbar) : Response
|
||||||
{
|
{
|
||||||
$contentFile = Yaml::parseFile('../config/safetyLinks.yaml', 2, 2, Yaml::PARSE_OBJECT_FOR_MAP);
|
$contentFile = Yaml::parseFile('../config/safetyLinks.yaml', 2, 2, Yaml::PARSE_OBJECT_FOR_MAP);
|
||||||
return $this->render('Training/Safety/safetyHome.html.twig',['content' => $contentFile]);
|
$navbar = $_navbar->navbar();
|
||||||
|
return new Response($navbar . $this->renderView('Training/Safety/safetyHome.html.twig',['content' => $contentFile]));
|
||||||
}
|
}
|
||||||
#[Route('/training/safety/quiz')]
|
#[Route('/training/safety/quiz')]
|
||||||
public function Quiz(Request $request, LoggerInterface $log)
|
public function Quiz(Request $request, LoggerInterface $log, NavbarController $_navbar)
|
||||||
{
|
{
|
||||||
$form = $this->createForm(SafetyQuizType::class);
|
$form = $this->createForm(SafetyQuizType::class);
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
@ -43,10 +46,10 @@ class SafetyController extends AbstractController
|
|||||||
return $this->render('Training/Safety/quizResults.html.twig', ['testerName'=>$testerName,
|
return $this->render('Training/Safety/quizResults.html.twig', ['testerName'=>$testerName,
|
||||||
'correctAnswers'=>$correctAnswers, 'totalAnswers'=>count($data)]);
|
'correctAnswers'=>$correctAnswers, 'totalAnswers'=>count($data)]);
|
||||||
}
|
}
|
||||||
return $this->render('Training/Safety/SafetyQuiz.html.twig',['quiz'=>$form]);
|
return new Response($navbar = $_navbar->navbar() . $this->renderView('Training/Safety/SafetyQuiz.html.twig',['quiz'=>$form]));
|
||||||
}
|
}
|
||||||
#[Route('/Training/Safety/Topics/{topic?}')]
|
#[Route('/Training/Safety/Topics/{topic?}')]
|
||||||
public function Topics(?string $topic, LoggerInterface $log) : Response
|
public function Topics(?string $topic, LoggerInterface $log, NavbarController $navbar) : Response
|
||||||
{
|
{
|
||||||
//We want to show the safety homepage if this is blank
|
//We want to show the safety homepage if this is blank
|
||||||
if($topic == null)
|
if($topic == null)
|
||||||
@ -96,7 +99,7 @@ class SafetyController extends AbstractController
|
|||||||
|
|
||||||
$topic = strtolower($topic);
|
$topic = strtolower($topic);
|
||||||
//Render the page header
|
//Render the page header
|
||||||
$header = $this->renderView('_header.html.twig') . $this->renderView ('_navbar.html.twig');
|
$header = $navbar->navbar();
|
||||||
//prepare navButton data
|
//prepare navButton data
|
||||||
$navButtonData = ['previous'=> $previousTopic, 'next' => $nextTopic];
|
$navButtonData = ['previous'=> $previousTopic, 'next' => $nextTopic];
|
||||||
$contents = $this->renderView('Training/Safety/Topics/'.$topic.".html.twig"); //render main page contents
|
$contents = $this->renderView('Training/Safety/Topics/'.$topic.".html.twig"); //render main page contents
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
{{ include('_header.html.twig') }}
|
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{{ include('_navbar.html.twig')}}
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h4>Complete the Safety Quiz below</h4>
|
<h4>Complete the Safety Quiz below</h4>
|
||||||
<p>When you're finished, click 'Submit' at the bottom and print your results.
|
<p>When you're finished, click 'Submit' at the bottom and print your results.
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
{{ include('_header.html.twig') }}
|
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{{ include('_navbar.html.twig')}}
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
{{ include('_header.html.twig') }}
|
||||||
<!-- Navigation -->
|
<!-- Navigation -->
|
||||||
<div class="siteNavbar">
|
<div class="siteNavbar">
|
||||||
<ul class="list-group list-group-horizontal-md">
|
<ul class="list-group list-group-horizontal-md">
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
{{ include('_header.html.twig') }}
|
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{{ include('_navbar.html.twig')}}
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h2>Anonymous Complaint Page
|
<h2>Anonymous Complaint Page
|
||||||
<h4 class="text-bold">Instructions</h4>
|
<h4 class="text-bold">Instructions</h4>
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
{{ include('_header.html.twig') }}
|
|
||||||
<body>
|
<body>
|
||||||
{{ include('_navbar.html.twig')}}
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row g-1 my-2">
|
<div class="row g-1 my-2">
|
||||||
<!--Emergency Card -->
|
<!--Emergency Card -->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user