webcron/src/Controller/JobController.php

27 lines
765 B
PHP
Raw Normal View History

2021-04-06 23:19:51 +02:00
<?php
namespace JeroenED\Webcron\Controller;
use JeroenED\Framework\Controller;
2021-04-08 12:54:49 +02:00
use JeroenED\Webcron\Repository\Job;
2021-04-06 23:19:51 +02:00
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
2021-04-08 14:54:30 +02:00
class JobController extends Controller
2021-04-06 23:19:51 +02:00
{
2021-04-08 14:54:30 +02:00
public function DefaultAction()
{
2021-04-06 23:19:51 +02:00
if(!isset($_SESSION['isAuthenticated']) || !$_SESSION['isAuthenticated']) {
return new RedirectResponse($this->generateRoute('login'));
}
2021-04-08 12:54:49 +02:00
$jobRepo = new Job($this->getDbCon());
$jobs = $jobRepo->getAllJobs();
return $this->render('job/index.html.twig', ['jobs' => $jobs]);
2021-04-06 23:19:51 +02:00
}
2021-04-08 14:54:30 +02:00
public function viewAction($id)
{
return new Response('Not implemented yet', Response::HTTP_TOO_EARLY);
}
2021-04-06 23:19:51 +02:00
}