route to safety topic pages
This commit is contained in:
parent
511975b8cd
commit
83ac942bbd
@ -10,9 +10,11 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
use function PHPUnit\Framework\containsIdentical;
|
||||||
|
|
||||||
class SafetyController extends AbstractController
|
class SafetyController extends AbstractController
|
||||||
{
|
{
|
||||||
#[Route('/training/safety')]
|
#[Route('/training/safety', name: 'safetyHome')]
|
||||||
public function Index() : Response
|
public function Index() : Response
|
||||||
{
|
{
|
||||||
$headerFile = Yaml::parseFile('../config/portalLinks.yaml', 2, 2, Yaml::PARSE_OBJECT_FOR_MAP);
|
$headerFile = Yaml::parseFile('../config/portalLinks.yaml', 2, 2, Yaml::PARSE_OBJECT_FOR_MAP);
|
||||||
@ -46,4 +48,29 @@ class SafetyController extends AbstractController
|
|||||||
}
|
}
|
||||||
return $this->render('Training/Safety/SafetyQuiz.html.twig',['header' => $headerFile, 'quiz'=>$form]);
|
return $this->render('Training/Safety/SafetyQuiz.html.twig',['header' => $headerFile, 'quiz'=>$form]);
|
||||||
}
|
}
|
||||||
|
#[Route('/Training/Safety/Topics/{topic?}')]
|
||||||
|
public function Topics(?string $topic) : Response
|
||||||
|
{
|
||||||
|
//We want to show the safety homepage if this is blank
|
||||||
|
if($topic == null)
|
||||||
|
{
|
||||||
|
return $this->redirectToRoute('safetyHome');
|
||||||
|
}
|
||||||
|
$headerFile = Yaml::parseFile('../config/portalLinks.yaml', 2, 2, Yaml::PARSE_OBJECT_FOR_MAP);
|
||||||
|
$topicsFile = Yaml::parseFile('../config/safetyLinks.yaml', 2, 2, Yaml::PARSE_OBJECT_FOR_MAP);
|
||||||
|
$topic = strtolower($topic);
|
||||||
|
return $this->render('Training/Safety/Topics/'.$topic.".html.twig", ['headerFile'=> $headerFile]);
|
||||||
|
/* //Scan through each link file If we see what we need, then let's get it.
|
||||||
|
foreach($topicsFile['Cards'] as $card)
|
||||||
|
{
|
||||||
|
foreach($card as $item)
|
||||||
|
{
|
||||||
|
if($item['url']== $topic)
|
||||||
|
{
|
||||||
|
return $this->render('Training/Safety/Topics/'.$topic.".html.twig", ['headerFile'=> $headerFile]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@
|
|||||||
<div class="card-text">
|
<div class="card-text">
|
||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush">
|
||||||
{% for link in links %}
|
{% for link in links %}
|
||||||
<a class="list-group-item list-group-item-action list-item" href="{{link.url}}">{{link.title}}</a>
|
<a class="list-group-item list-group-item-action list-item" href="/Training/Safety/Topics/{{link.url}}">{{link.title}}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user