- {{ job.id }} |
{{ job.name }} |
{{ job.color }} |
@@ -34,6 +33,11 @@
playlist_add_check
{% endif %}
|
+
+ {% if job.url is not empty %}
+ lien
+ {% endif %}
+ |
{{ job.periods | length }} |
editediter
diff --git a/src/AppBundle/Controller/JobController.php b/src/AppBundle/Controller/JobController.php
index d2d800981..06a3a54ff 100644
--- a/src/AppBundle/Controller/JobController.php
+++ b/src/AppBundle/Controller/JobController.php
@@ -27,10 +27,11 @@ class JobController extends Controller
* @Method("GET")
* @Security("has_role('ROLE_ADMIN')")
*/
- public function listAction(Request $request){
-
+ public function listAction(Request $request)
+ {
$em = $this->getDoctrine()->getManager();
$jobs = $em->getRepository('AppBundle:Job')->findAll();
+
return $this->render('admin/job/list.html.twig', array(
'jobs' => $jobs
));
@@ -55,22 +56,20 @@ public function newAction(Request $request){
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
-
$em->persist($job);
$em->flush();
$session->getFlashBag()->add('success', 'Le nouveau poste a été créé !');
-
return $this->redirectToRoute('job_list');
}
+
return $this->render('admin/job/new.html.twig', array(
'form' => $form->createView()
));
-
}
/**
- * add new job.
+ * Edit job.
*
* @Route("/edit/{id}", name="job_edit")
* @Method({"GET","POST"})
@@ -85,24 +84,22 @@ public function editAction(Request $request, Job $job){
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
-
$em->persist($job);
$em->flush();
$session->getFlashBag()->add('success', 'Le poste a bien été édité !');
-
return $this->redirectToRoute('job_list');
}
+
return $this->render('admin/job/edit.html.twig', array(
'form' => $form->createView(),
'delete_form' => $this->getDeleteForm($job)->createView()
));
-
}
/**
- * job delete
+ * Delete job.
*
* @Route("/{id}", name="job_delete")
* @Method({"DELETE"})
@@ -113,12 +110,14 @@ public function removeAction(Request $request,Job $job)
$session = new Session();
$form = $this->getDeleteForm($job);
$form->handleRequest($request);
+
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->remove($job);
$em->flush();
$session->getFlashBag()->add('success', 'Le poste a bien été supprimée !');
}
+
return $this->redirectToRoute('job_list');
}
@@ -132,5 +131,4 @@ protected function getDeleteForm(Job $job){
->setMethod('DELETE')
->getForm();
}
-
}
diff --git a/src/AppBundle/Controller/ServiceController.php b/src/AppBundle/Controller/ServiceController.php
index a18064930..d95d45618 100644
--- a/src/AppBundle/Controller/ServiceController.php
+++ b/src/AppBundle/Controller/ServiceController.php
@@ -19,7 +19,7 @@
/**
- * Task controller.
+ * Service controller.
*
* @Route("services")
*/
@@ -136,7 +136,7 @@ public function editAction(Request $request,Service $service)
/**
- * edit service.
+ * delete service.
*
* @Route("/{id}", name="service_remove")
* @Method({"DELETE"})
diff --git a/src/AppBundle/Entity/Job.php b/src/AppBundle/Entity/Job.php
index 2064024f8..fe0491de6 100644
--- a/src/AppBundle/Entity/Job.php
+++ b/src/AppBundle/Entity/Job.php
@@ -46,6 +46,13 @@ class Job
*/
private $description;
+ /**
+ * @var string
+ *
+ * @ORM\Column(name="url", type="string", length=255, nullable=true)
+ */
+ private $url;
+
/**
* @var int
*
@@ -291,6 +298,30 @@ public function setDescription(string $description): Job
return $this;
}
+ /**
+ * Set url
+ *
+ * @param string $url
+ *
+ * @return Job
+ */
+ public function setUrl($url)
+ {
+ $this->url = $url;
+
+ return $this;
+ }
+
+ /**
+ * Get url
+ *
+ * @return string
+ */
+ public function getUrl()
+ {
+ return $this->url;
+ }
+
/**
* Get createdAt
*
diff --git a/src/AppBundle/Entity/Service.php b/src/AppBundle/Entity/Service.php
index cabfce7d7..0531a6a72 100644
--- a/src/AppBundle/Entity/Service.php
+++ b/src/AppBundle/Entity/Service.php
@@ -106,6 +106,14 @@ class Service
*/
private $clients;
+ /**
+ * Constructor
+ */
+ public function __construct()
+ {
+ $this->users = new \Doctrine\Common\Collections\ArrayCollection();
+ }
+
/**
* @ORM\PrePersist
*/
@@ -220,13 +228,6 @@ public function getUrl()
{
return $this->url;
}
- /**
- * Constructor
- */
- public function __construct()
- {
- $this->users = new \Doctrine\Common\Collections\ArrayCollection();
- }
/**
* Add user
diff --git a/src/AppBundle/Form/JobType.php b/src/AppBundle/Form/JobType.php
index ea143df9e..09fd4de23 100644
--- a/src/AppBundle/Form/JobType.php
+++ b/src/AppBundle/Form/JobType.php
@@ -22,6 +22,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->add('min_shifter_alert', IntegerType::class, array('label' => 'Nombre minimum de bénévoles inscrits sur le créneau pour ne pas envoyer d\'alerte', 'required' => true, 'data' => 2, 'empty_data' => 2))
->add('color', TextType::class, array('label'=>'Couleur des créneaux dans le planning'))
->add('description', MarkdownEditorType::class, array('label' => 'Description', 'required' => false, 'empty_data' => ''))
+ ->add('url', TextType::class, array('label'=>'Lien vers une documentation', 'required' => false))
->add('enabled', CheckboxType::class, array('required' => false, 'label' => 'Poste activé', 'attr' => array('class' => 'filled-in')));
}
|