Commit 78da2ab0 authored by Patrick Etcheverry's avatar Patrick Etcheverry

- Création de la notion de Formation et ajout dans le menu + traduction + crudage

parent 66741e99
......@@ -13,6 +13,7 @@ position: "Position"
referentLecturer: "Referent Teacher"
project: "Project"
formation: "Formation"
user: "User"
pedagogicalScenario: "Pedagogical Scenario"
......@@ -43,6 +44,7 @@ actions: "Actions"
menu:
scenariopedagogique: "Pedagogical Scenarios"
projets: "Projects"
formations: "Formations"
utilisateurs: "Users"
parametres: "Settings"
scenarisationProcess: "Scenarisation Process"
......
......@@ -13,6 +13,7 @@ position: "Position"
referentTeacher: ""
project: ""
formation: ""
user: ""
pedagogicalScenario: ""
......@@ -43,6 +44,7 @@ actions: "Actions"
menu:
scenariopedagogique: "escenario pedagogicos"
projets: "Proyectos"
formations: ""
utilisateurs: "Utilizadores"
parametres: "Configuraciones"
scenarisationProcess: "Scenarisation Processus"
......
......@@ -13,6 +13,7 @@ position: "Position"
referentTeacher: "Enseignant Référent"
project: "Projet"
formation: "Formation"
user: "Utilisateur"
pedagogicalScenario: "Scénario Pédagogique"
......@@ -43,6 +44,7 @@ actions: "Actions"
menu:
scenariopedagogique: "Scénarios Pédagogiques"
projets: "Projets"
formations: "Formations"
utilisateurs: "Utilisateurs"
parametres: "Paramètres"
scenarisationProcess: "Démarches de scénarisation"
......
......@@ -15,10 +15,17 @@
{% if currentRole == "pedagogical-engineer" %}
<li>
<a class="lienNonBleu" href="{{ path('project_index', { 'userRole': currentRole })}}">
<img src="https://maxcdn.icons8.com/windows8/PNG/26/Business/graduation_cap-26.png" title="Chapeau de diplôme" width="16" height="16">
<i class="fa fa-briefcase" aria-hidden="true"></i>
<span class="couleurBleuLien">{{'menu.projets'|trans}} </span>
</a>
</li>
<li>
<a class="lienNonBleu" href="{{ path('formation_index', { 'userRole': currentRole })}}">
<img src="https://maxcdn.icons8.com/windows8/PNG/26/Business/graduation_cap-26.png" title="Chapeau de diplôme" width="16" height="16">
<span class="couleurBleuLien">{{'menu.formations'|trans}} </span>
</a>
</li>
<li>
<a class="lienNonBleu" href="{{ path('user_index')}}">
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
......
......@@ -13,8 +13,8 @@ security:
property: email
access_control:
- { path: ^/%languages%/engineer/, roles: ROLE_PEDAGOGICAL_ENGINEER }
- { path: ^/%languages%/lecturer/, roles: ROLE_TEACHER }
- { path: ^/%languages%/pedagogical-engineer/, roles: ROLE_PEDAGOGICAL_ENGINEER }
- { path: ^/%languages%/teacher/, roles: ROLE_TEACHER }
firewalls:
# disables authentication for assets and the profiler
......
<?php
namespace ScenarioBundle\Controller;
use ScenarioBundle\Entity\Formation;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
/**
* Formation controller.
*
*/
class FormationController extends Controller
{
/**
* Lists all formation entities.
*
*/
public function indexAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
//$formations = $em->getRepository('ScenarioBundle:Formation')->findAll();
$queryBuilder = $em->getRepository('ScenarioBundle:Formation')->createQueryBuilder('formations');
$query = $queryBuilder->getQuery();
$paginator = $this->get('knp_paginator');
$formations = $paginator->paginate(
$query,
$request->query->getInt('page', 1)/*page number*/,
5/*limit per page*/
);
return $this->render('ScenarioBundle:formation:index.html.twig', array(
'formations' => $formations,
));
}
/**
* Creates a new formation entity.
*
*/
public function newAction(Request $request)
{
$formation = new Formation();
$form = $this->createForm('ScenarioBundle\Form\FormationType', $formation);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($formation);
$em->flush();
return $this->redirectToRoute('formation_show', array('id' => $formation->getId(), 'userRole' => "pedagogical-engineer"));
}
return $this->render('ScenarioBundle:formation:new.html.twig', array(
'formation' => $formation,
'form' => $form->createView(),
));
}
/**
* Finds and displays a formation entity.
*
*/
public function showAction(Formation $formation)
{
$deleteForm = $this->createDeleteForm($formation);
return $this->render('ScenarioBundle:formation:show.html.twig', array(
'formation' => $formation,
'delete_form' => $deleteForm->createView(),
));
}
/**
* Displays a form to edit an existing formation entity.
*
*/
public function editAction(Request $request, Formation $formation)
{
$deleteForm = $this->createDeleteForm($formation);
$editForm = $this->createForm('ScenarioBundle\Form\FormationType', $formation);
$editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('formation_edit', array('id' => $formation->getId(), 'userRole' => "pedagogical-engineer"));
}
return $this->render('ScenarioBundle:formation:edit.html.twig', array(
'formation' => $formation,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
'userRole' => "pedagogical-engineer"
));
}
/**
* Deletes a formation entity.
*
*/
public function deleteAction(Request $request, Formation $formation)
{
$form = $this->createDeleteForm($formation);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->remove($formation);
$em->flush();
}
return $this->redirectToRoute('formation_index', array('userRole' => 'pedagogical-engineer'));
}
/**
* Creates a form to delete a formation entity.
*
* @param Formation $formation The formation entity
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm(Formation $formation)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('formation_delete', array('id' => $formation->getId(), 'userRole' => "pedagogical-engineer")))
->setMethod('DELETE')
->getForm()
;
}
}
......@@ -92,7 +92,7 @@ class ProjectController extends Controller
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('project_edit', array('id' => $project->getId()));
return $this->redirectToRoute('project_edit', array('id' => $project->getId(), 'userRole' => "pedagogical-engineer"));
}
return $this->render('ScenarioBundle:project:edit.html.twig', array(
......
......@@ -54,7 +54,7 @@ class LoadPedagogicalScenarioData implements FixtureInterface, ContainerAwareInt
$m1102->setShortname("M1102");
$m1102->setFullname("Initiation à l'algorithmique et à la programmation");
$m1102->updateReferentLecturer($enseignantReferent);
$m1102->updateReferentTeacher($enseignantReferent);
//$m1102->setProject($projet);
......@@ -72,7 +72,7 @@ class LoadPedagogicalScenarioData implements FixtureInterface, ContainerAwareInt
$m1103->setShortname("M1103");
$m1103->setFullname("Gestion de projets");
$m1103->updateReferentLecturer($enseignantReferent);
$m1103->updateReferentTeacher($enseignantReferent);
$m1103->setProject($projet);
......
<?php
namespace ScenarioBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Formation
*
* @ORM\Table(name="formation")
* @ORM\Entity(repositoryClass="ScenarioBundle\Repository\FormationRepository")
*/
class Formation
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="shortname", type="string", length=255)
*/
private $shortname;
/**
* @var string
*
* @ORM\Column(name="fullname", type="text")
*/
private $fullname;
/**
* @ORM\OneToMany(targetEntity="ScenarioBundle\Entity\PedagogicalScenarioFormation", mappedBy="formation")
* @ORM\JoinColumn(nullable=true)
*/
private $pedagogicalScenarioFormation;
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set shortname
*
* @param string $shortname
*
* @return Formation
*/
public function setShortname($shortname)
{
$this->shortname = $shortname;
return $this;
}
/**
* Get shortname
*
* @return string
*/
public function getShortname()
{
return $this->shortname;
}
/**
* Set fullname
*
* @param string $fullname
*
* @return Formation
*/
public function setFullname($fullname)
{
$this->fullname = $fullname;
return $this;
}
/**
* Get fullname
*
* @return string
*/
public function getFullname()
{
return $this->fullname;
}
/**
* Add pedagogicalScenarioFormation
*
* @param \ScenarioBundle\Entity\PedagogicalScenarioFormation $pedagogicalScenarioFormation
*
* @return Formation
*/
public function addPedagogicalScenarioFormation(\ScenarioBundle\Entity\PedagogicalScenarioFormation $pedagogicalScenarioFormation)
{
$this->pedagogicalScenarioFormation[] = $pedagogicalScenarioFormation;
$pedagogicalScenarioFormation->setFormation($this);
return $this;
}
/**
* Remove pedagogicalScenarioFormation
*
* @param \ScenarioBundle\Entity\PedagogicalScenarioFormation PedagogicalScenarioFormation
*/
public function removePedagogicalScenarioFormation(\ScenarioBundle\Entity\PedagogicalScenarioFormation $pedagogicalScenarioFormation)
{
$this->pedagogicalScenarioFormation->removeElement($pedagogicalScenarioFormation);
}
/**
* Get pedagogicalScenarioFormation
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPedagogicalScenarioFormation()
{
return $this->pedagogicalScenarioFormation;
}
}
......@@ -65,6 +65,12 @@ class PedagogicalScenario
*/
private $generalAnswers;
/**
* @ORM\OneToMany(targetEntity="ScenarioBundle\Entity\PedagogicalScenarioFormation", mappedBy="pedagogicalScenario")
* @ORM\JoinColumn(nullable=true)
*/
private $pedagogicalScenarioFormation;
/**
* Get id
*
......@@ -314,4 +320,39 @@ class PedagogicalScenario
{
return $this->generalAnswers;
}
/**
* Add pedagogicalScenarioFormation
*
* @param \ScenarioBundle\Entity\PedagogicalScenarioFormation $pedagogicalScenarioFormation
*
* @return PedagogicalScenario
*/
public function addPedagogicalScenarioFormation(\ScenarioBundle\Entity\PedagogicalScenarioFormation $pedagogicalScenarioFormation)
{
$this->pedagogicalScenarioFormation[] = $pedagogicalScenarioFormation;
$pedagogicalScenarioFormation->setPedagogicalScenario($this);
return $this;
}
/**
* Remove pedagogicalScenarioFormation
*
* @param \ScenarioBundle\Entity\PedagogicalScenarioFormation PedagogicalScenarioFormation
*/
public function removePedagogicalScenarioFormation(\ScenarioBundle\Entity\PedagogicalScenarioFormation $pedagogicalScenarioFormation)
{
$this->pedagogicalScenarioFormation->removeElement($pedagogicalScenarioFormation);
}
/**
* Get pedagogicalScenarioFormation
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPedagogicalScenarioFormation()
{
return $this->pedagogicalScenarioFormation;
}
}
<?php
namespace ScenarioBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* PedagogicalScenarioFormation
*
* @ORM\Table(name="pedagogical_Scenario_formation")
* @ORM\Entity(repositoryClass="ScenarioBundle\Repository\PedagogicalScenarioFormationRepository")
*/
class PedagogicalScenarioFormation
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="ScenarioBundle\Entity\PedagogicalScenario", inversedBy="pedagogicalScenarioFormation")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $pedagogicalScenario;
/**
* @ORM\ManyToOne(targetEntity="ScenarioBundle\Entity\Formation", inversedBy="pedagogicalScenarioFormation")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $formation;
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set pedagogicalScenario
*
* @param \ScenarioBundle\Entity\PedagogicalScenario $pedagogicalScenario
*
* @return PedagogicalScenarioFormation
*/
public function setPedagogicalScenario(\ScenarioBundle\Entity\PedagogicalScenario $pedagogicalScenario)
{
$this->pedagogicalScenario = $pedagogicalScenario;
return $this;
}
/**
* Get pedagogicalScenario
*
* @return \ScenarioBundle\Entity\PedagogicalScenario
*/
public function getPedagogicalScenario()
{
return $this->pedagogicalScenario;
}
/**
* Set formation
*
* @param \ScenarioBundle\Entity\Formation $formation
*
* @return PedagogicalScenarioFormation
*/
public function setFormation(\ScenarioBundle\Entity\Formation $formation)
{
$this->formation = $formation;
return $this;
}
/**
* Get formation
*
* @return \ScenarioBundle\Entity\Formation
*/
public function getFormation()
{
return $this->formation;
}
}
<?php
namespace ScenarioBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class FormationType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('shortname','text', array( 'label' => 'shortname'));
$builder->add('fullname','text', array( 'label' => 'fullname'));
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'ScenarioBundle\Entity\Formation'
));
}
/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'scenariobundle_formation';
}
}
<?php
namespace ScenarioBundle\Repository;
/**
* FormationRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class FormationRepository extends \Doctrine\ORM\EntityRepository
{
}
<?php
namespace ScenarioBundle\Repository;
/**
* PedagogicalScenarionFormationRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class PedagogicalScenarionFormationRepository extends \Doctrine\ORM\EntityRepository
{
}
......@@ -5,3 +5,7 @@ scenario_pedagogicalscenario:
scenario_project:
resource: "@ScenarioBundle/Resources/config/routing/project.yml"
prefix: /project