Skip to content

Commit

Permalink
Revert "Merge branch 'master' of github.com:InnovaLangues/self into p…
Browse files Browse the repository at this point in the history
…ilote3"

This reverts commit 6c76dc5, reversing
changes made to 4fca7b5.

Conflicts:
	src/Innova/SelfBundle/Entity/Typology.php
  • Loading branch information
ericvincenterv committed Oct 29, 2014
1 parent 8f7e168 commit 3bfc590
Show file tree
Hide file tree
Showing 53 changed files with 10,262 additions and 15,477 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ php app/console cache:clear --no-debug --env=prod

### Create needed dirs and Set up rights
``` bash
mkdir -p web/upload
sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx web/upload/ app/cache app/logs app/sessions app/data/export
sudo setfacl -R -m u:www-data:rwx -m u:`whoami`:rwx web/upload/ app/cache app/logs app/sessions app/data/export
```
Expand Down
30 changes: 0 additions & 30 deletions app/DoctrineMigrations/Version20141014164644.php

This file was deleted.

10 changes: 6 additions & 4 deletions app/Resources/views/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
<title>{% block title %}SELF{% endblock %}</title>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet"/>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="{{ asset('bundles/innovaself/js/mediaelement-and-player.min.js') }}"></script>
<link href="{{ asset('bundles/innovaself/css/main.css') }}" rel="stylesheet"/>

{% block stylesheets %}{% endblock %}
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
</head>
Expand Down Expand Up @@ -43,12 +46,11 @@
{% include 'InnovaSelfBundle::Main/creditModale.html.twig' %}

{% block javascripts %}
<script src="{{ asset('bundles/innovaself/js/lib/jquery-1.10.1.min.js') }}"></script>
<script src="{{ asset('bundles/innovaself/js/lib/jquery-ui-1.10.3.js') }}"></script>
<script src="{{ asset('bundles/innovaself/js/lib/bootstrap-3.1.1.min.js') }}"></script>
<script src="{{ asset("bundles/innovaself/js/lib/jquery.restfulizer.js") }}"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
<script src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData"}) }}"></script>
<script src="{{ asset("bundles/innovaself/js/jquery.restfulizer.js") }}"></script>
<script src="{{ asset('bundles/innovaself/js/main.js') }}"></script>
{% endblock %}
</body>
Expand Down
112 changes: 42 additions & 70 deletions src/Innova/SelfBundle/Command/FixtureCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,64 +37,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
$start = time();
$em = $this->getContainer()->get('doctrine')->getEntityManager('default');

/* TYPOLOGY */
$typologies = array(
array("TVF", "Vrai-Faux"), array("TQRU", "Question à Réponse Unique"),
array("TQRM", "Question à Réponses Multiples"), array("TLCMLDM", "Liste de mots"),
array("APP", "Appariemment"), array("TVFNM", "Vrai-Faux-Non Mentionné"),
array("TLCMLMULT", "Listes de choix multiple"), array("TLQROC", "Question Réponse Ouverte Courte")
);
foreach ($typologies as $typology) {
if (!$typo = $em->getRepository('InnovaSelfBundle:Typology')->findOneByName($typology[0])) {
$typo = new Typology();
$typo->setName($typology[0]);
$typo->setDescription($typology[1]);
$em->persist($typo);
$output->writeln("Add new Typology (".$typology[0]." : ".$typology[1].").");
} else {
if ($typo->getDescription() != $typology[1]) {
$typo->setDescription($typology[1]);
$em->persist($typo);
$output->writeln("Edit ".$typology[0]." description (".$typology[1].").");
}
}
}
$em->flush();

/* SKILLS */
$questionnaireSkills = array("CO", "CE", "EEC");
foreach ($questionnaireSkills as $questionnaireSkill) {
if (!$em->getRepository('InnovaSelfBundle:Skill')->findOneByName($questionnaireSkill)) {
$skill = new Skill();
$skill->setName($questionnaireSkill);
$em->persist($skill);
$output->writeln("Add new Skill (".$questionnaireSkill.").");
}
}
$em->flush();

/* SKILL / TYPO */
$skills2typos = array(
array("CO", array("APP", "TQRM", "TQRU", "TVF", "TVFNM")),
array("CE", array("APP", "TQRM", "TQRU", "TVF", "TVFNM")),
array("EEC", array("TLCMLMULT", "TLQROC", "TLCMLDM"))
);
foreach ($skills2typos as $skills2typo) {
$skillName = $skills2typo[0];
$typoNames = $skills2typo[1];
if ($skill = $em->getRepository('InnovaSelfBundle:Skill')->findOneByName($skillName)) {
foreach ($typoNames as $typoName) {
$skillTypos = $skill->getTypologys();
if ($typo = $em->getRepository('InnovaSelfBundle:Typology')->findOneByName($typoName)) {
if (!$skillTypos->contains($typo)){
$skill->addTypology($typo);
$em->persist($skill);
}
}
}
}
}

$mediaTypes = array("audio", "video", "texte", "image");
foreach ($mediaTypes as $mediaType) {
if (!$em->getRepository('InnovaSelfBundle:MediaType')->findOneByName($mediaType)) {
Expand Down Expand Up @@ -125,6 +67,39 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
}

$questionnaireSkills = array("CO", "CE", "EEC");
foreach ($questionnaireSkills as $questionnaireSkill) {
if (!$em->getRepository('InnovaSelfBundle:Skill')->findOneByName($questionnaireSkill)) {
$skill = new Skill();
$skill->setName($questionnaireSkill);
$em->persist($skill);
$output->writeln("Add new Skill (".$questionnaireSkill.").");
}
}

$typologies = array(
array("TVF", "Tableau de Vrai-Faux"), array("QRU", "Question à Réponse Unique"), array("VF", "Vrai-Faux"),
array("QRM", "Question à Réponse Multiple"), array("TQRU", "Tableau de QRU"), array("TQRM", "Tableau de QRM"),
array("APP", "Appariemment"), array("TVFNM", "Tableau de Vrai-Faux-Non Mentionné"),
array("VFNM", "Vrai-Faux-Non Mentionné"), array("TLCMLDM", "Liste de mots"),
array("TLCMLMULT", "Listes de choix multiple"), array("TLQROC", "QROC")
);
foreach ($typologies as $typology) {
if (!$typo = $em->getRepository('InnovaSelfBundle:Typology')->findOneByName($typology[0])) {
$typo = new Typology();
$typo->setName($typology[0]);
$typo->setDescription($typology[1]);
$em->persist($typo);
$output->writeln("Add new Typology (".$typology[0]." : ".$typology[1].").");
} else {
if ($typo->getDescription() != $typology[1]) {
$typo->setDescription($typology[1]);
$em->persist($typo);
$output->writeln("Edit ".$typology[0]." description (".$typology[1].").");
}
}
}

$typologiesToDelete = array("TLCMQRU", "TLCMTQRU", "TLQROCDCTU", "TLQROCDCTM");
foreach ($typologiesToDelete as $typology) {
if ($typo = $em->getRepository('InnovaSelfBundle:Typology')->findOneByName($typology)) {
Expand All @@ -151,29 +126,24 @@ protected function execute(InputInterface $input, OutputInterface $output)
array("TLQROCSYL", "TLQROC"), array("TLQROCTRANS", "TLQROC"),
array("TLQROCDERIV", "TLQROC"), array("APPAT", "APP"),
array("APPIT", "APP"), array("APPAA", "APP"), array("APPAI", "APP"),
array("APPTT", "APP"), array("QRU", "TQRU"), array("QRM", "TQRM"),
array("VF", "TVF"), array("VFNM", "TVFNM")
array("APPTT", "APP"),
);
foreach ($typologiesToReplace as $typology) {
if ($typo = $em->getRepository('InnovaSelfBundle:Typology')->findOneByName($typology[0])) {
$newTypo = $em->getRepository('InnovaSelfBundle:Typology')->findOneByName($typology[1]);

if($questions = $em->getRepository('InnovaSelfBundle:Question')->findByTypology($typo)){
foreach ($questions as $question) {
$question->setTypology($newTypo);
$em->persist($question);
foreach ($question->getSubquestions() as $subquestion) {
$subquestion->setTypology($newTypo);
$em->persist($subquestion);
}
}
}

if($subquestions = $em->getRepository('InnovaSelfBundle:Subquestion')->findByTypology($typo)){
foreach ($subquestions as $subquestion) {
$subquestion->setTypology($newTypo);
$em->persist($subquestion);
}
}

$em->remove($typo);
$output->writeln(" Typo ".$typology[0]." replaced by ".$typology[1]);
$typoName = $typo->getName();
$output->writeln(" Typo ".$typoName." removed");
}
}

Expand Down Expand Up @@ -253,6 +223,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
}



/* Gestion du statut des tâches */
$status = array("Ecriture", "Révision", "Validation", "Modification post-pilotage");
foreach ($status as $s) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,11 @@ public function setSkillAction()
$em->persist($questionnaire);
$em->flush();

$template = $this->templating->render('InnovaSelfBundle:Editor/partials:general-infos.html.twig',array('questionnaire' => $questionnaire));

$this->editorLogManager->createEditorLog("editor_edit", "skill", $questionnaire);

return new JsonResponse(
array(
'template' => $template,
'skill' => $skill,
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ public function createSubquestionAction()

$questionnaire = $em->getRepository('InnovaSelfBundle:Questionnaire')->find($questionnaireId);
$question = $questionnaire->getQuestions()[0];
$arrayLikeTypos = array("TQRU", "TQRM", "TVFNM", "TVF");

$typology = $em->getRepository('InnovaSelfBundle:Typology')->findOneByName($questionnaireTypology);

if (!in_array($questionnaireTypology, $arrayLikeTypos)) {
$typology = $em->getRepository('InnovaSelfBundle:Typology')->findOneByName($questionnaireTypology);
} else {
$typology = $em->getRepository('InnovaSelfBundle:Typology')->findOneByName(mb_substr($questionnaireTypology, 1));
}
$subquestion = $this->subquestionManager->createSubquestion($typology, $question);

$this->propositionManager->createVfPropositions($questionnaire, $subquestion, $questionnaireTypology);
Expand Down
42 changes: 1 addition & 41 deletions src/Innova/SelfBundle/Entity/Skill.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ class Skill
*/
protected $questionnaires;

/**
* @ORM\ManyToMany(targetEntity="Typology", inversedBy="skills")
*/
protected $typologys;

/**
* Constructor
*/
Expand Down Expand Up @@ -153,39 +148,4 @@ public function getUsers()
{
return $this->users;
}



/**
* Add typologys
*
* @param \Innova\SelfBundle\Entity\Typology $typologys
* @return Skill
*/
public function addTypology(\Innova\SelfBundle\Entity\Typology $typologys)
{
$this->typologys[] = $typologys;

return $this;
}

/**
* Remove typologys
*
* @param \Innova\SelfBundle\Entity\Typology $typologys
*/
public function removeTypology(\Innova\SelfBundle\Entity\Typology $typologys)
{
$this->typologys->removeElement($typologys);
}

/**
* Get typologys
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getTypologys()
{
return $this->typologys;
}
}
}
39 changes: 0 additions & 39 deletions src/Innova/SelfBundle/Entity/Typology.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ class Typology
*/
protected $subquestions;

/**
* @ORM\ManyToMany(targetEntity="Skill", mappedBy="typologys")
*/
protected $skills;

/**
* Get id
*
Expand Down Expand Up @@ -179,38 +174,4 @@ public function getDescription()
{
return $this->description;
}


/**
* Add skills
*
* @param \Innova\SelfBundle\Entity\Skill $skills
* @return Typology
*/
public function addSkill(\Innova\SelfBundle\Entity\Skill $skills)
{
$this->skills[] = $skills;

return $this;
}

/**
* Remove skills
*
* @param \Innova\SelfBundle\Entity\Skill $skills
*/
public function removeSkill(\Innova\SelfBundle\Entity\Skill $skills)
{
$this->skills->removeElement($skills);
}

/**
* Get skills
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getSkills()
{
return $this->skills;
}
}
4 changes: 2 additions & 2 deletions src/Innova/SelfBundle/Manager/PropositionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ public function createProposition(Subquestion $subquestion, Media $media, $right

public function createVfPropositions(Questionnaire $questionnaire, Subquestion $subquestion, $questionnaireTypology)
{
if($questionnaireTypology == "TVF" || $questionnaireTypology == "TVFNM") {
if($questionnaireTypology == "VF" || $questionnaireTypology == "TVF" || $questionnaireTypology == "TVFNM" || $questionnaireTypology == "VFNM") {
$true = $this->mediaManager->createMedia($questionnaire, "texte", "VRAI", "VRAI", null, 0, "proposition");
$this->createProposition($subquestion, $true, false);
$false = $this->mediaManager->createMedia($questionnaire, "texte", "FAUX", "FAUX", null, 0, "proposition");
$this->createProposition($subquestion, $false, false);
}
if($questionnaireTypology == "TVFNM") {
if($questionnaireTypology == "TVFNM" || $questionnaireTypology == "VFNM") {
$nd = $this->mediaManager->createMedia($questionnaire, "texte", "ND", "ND", null, 0, "proposition");
$this->createProposition($subquestion, $nd, false);
}
Expand Down
15 changes: 12 additions & 3 deletions src/Innova/SelfBundle/Manager/QuestionnaireManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function createQuestionnaire()
public function setTypology(Questionnaire $questionnaire, $typologyName)
{
$em = $this->entityManager;
$arrayLikeTypos = array("TQRU", "TQRM", "TVFNM", "TVF");

if (!$typology = $em->getRepository('InnovaSelfBundle:Typology')->findOneByName($typologyName)) {
$typology = null;
Expand All @@ -46,9 +47,17 @@ public function setTypology(Questionnaire $questionnaire, $typologyName)
$em->persist($subquestion);
}
} else {
foreach ($questionnaire->getQuestions()[0]->getSubquestions() as $subquestion) {
$subquestion->setTypology($typology);
$em->persist($subquestion);
if (!in_array($typology->getName(), $arrayLikeTypos)) {
foreach ($questionnaire->getQuestions()[0]->getSubquestions() as $subquestion) {
$subquestion->setTypology($typology);
$em->persist($subquestion);
}
} else {
$typologySubquestion = $em->getRepository('InnovaSelfBundle:Typology')->findOneByName(mb_substr($typologyName, 1));
foreach ($questionnaire->getQuestions()[0]->getSubquestions() as $subquestion) {
$subquestion->setTypology($typologySubquestion);
$em->persist($subquestion);
}
}
}

Expand Down
Loading

0 comments on commit 3bfc590

Please sign in to comment.