Fix sur la creation de controle
This commit is contained in:
parent
20f5541d41
commit
8fe95ee094
6 changed files with 62 additions and 44 deletions
|
@ -42,7 +42,7 @@ class ApiController extends YesWikiController
|
||||||
/**
|
/**
|
||||||
* @Route("/api/meeo/controle",methods={"POST"},options={"acl":{"public"}})
|
* @Route("/api/meeo/controle",methods={"POST"},options={"acl":{"public"}})
|
||||||
*/
|
*/
|
||||||
public function control(Request $request) {
|
public function controle(Request $request) {
|
||||||
$noteManager = $this->getService(NoteManager::class);
|
$noteManager = $this->getService(NoteManager::class);
|
||||||
$content = $request->getContent();
|
$content = $request->getContent();
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ class ApiController extends YesWikiController
|
||||||
|
|
||||||
$controle = new Controle($parameters['intitule'], $parameters['matiere'], $parameters['coef'], $eleves);
|
$controle = new Controle($parameters['intitule'], $parameters['matiere'], $parameters['coef'], $eleves);
|
||||||
$controle->createNotes($noteManager);
|
$controle->createNotes($noteManager);
|
||||||
return $this->wiki->redirect('?Notes', 200);
|
// return ApiResponse($controle);
|
||||||
|
return $this->wiki->redirect('?Bulletin', 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,19 @@
|
||||||
$(document).ready(function(){
|
function filterClasse() {
|
||||||
$("#classe").on("change", function() {
|
var value = $("#classe").val().toLowerCase();
|
||||||
var value = $(this).val().toLowerCase();
|
|
||||||
$("#eleves div.form-group").filter(function() {
|
$("#eleves div.form-group").filter(function() {
|
||||||
var text = $(this).attr('classe').toLowerCase();
|
var text = $(this).attr('classe').toLowerCase();
|
||||||
$(this).toggle(text.indexOf(value) > -1);
|
$(this).toggle(text.indexOf(value) > -1);
|
||||||
|
if (text.indexOf(value) > -1)
|
||||||
|
$(this).find('.form-control').removeAttr('required');
|
||||||
|
else
|
||||||
|
$(this).find('.form-control').addAttr('required');
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
jQuery(function(){
|
||||||
|
$("#classe").on("change", function() {
|
||||||
|
filterClasse();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
filterClasse();
|
||||||
});
|
});
|
|
@ -5,34 +5,34 @@ namespace YesWiki\Meeo\Bulletin;
|
||||||
include 'tools/meeo/libs/bulletin/Matiere.lib.php';
|
include 'tools/meeo/libs/bulletin/Matiere.lib.php';
|
||||||
|
|
||||||
use YesWiki\Bazar\Service\ListManager;
|
use YesWiki\Bazar\Service\ListManager;
|
||||||
|
use YesWiki\Meeo\Eleve\Eleve;
|
||||||
|
|
||||||
class Bulletin {
|
class Bulletin {
|
||||||
private $eleve;
|
private $eleve;
|
||||||
private $classe;
|
|
||||||
private $matieres = [];
|
private $matieres = [];
|
||||||
|
|
||||||
public function __construct($wiki, $eleve, $classe) {
|
public function __construct($wiki, Eleve $eleve) {
|
||||||
$this->eleve = $eleve;
|
$this->eleve = $eleve;
|
||||||
// echo var_dump($eleve);
|
// echo var_dump($eleve);
|
||||||
$this->classe = $classe;
|
|
||||||
|
|
||||||
$listManager = $wiki->services->get(ListManager::class);
|
$listManager = $wiki->services->get(ListManager::class);
|
||||||
$matieres = $listManager->getOne('ListeMatiere');
|
$matieres = $listManager->getOne('ListeMatiere');
|
||||||
foreach ($matieres['label'] as $id => $nom) {
|
// echo "<p>".var_dump($matieres)."</p>";
|
||||||
$this->matieres[] = new Matiere($wiki, $this, $id, $nom);
|
foreach ($matieres['nodes'] as $matiere) {
|
||||||
|
$this->matieres[] = new Matiere($wiki, $this, $matiere["id"], $matiere["label"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId() {
|
public function getId() {
|
||||||
return $this->eleve['id_fiche'];
|
return $this->eleve->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNom() {
|
public function getNom() {
|
||||||
return $this->eleve['bf_nom'];
|
return $this->eleve->getNom();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getClass() {
|
public function getClass() {
|
||||||
return $this->classe;
|
return $this->eleve->classe;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMoyenne() {
|
public function getMoyenne() {
|
||||||
|
|
|
@ -17,6 +17,7 @@ class Matiere {
|
||||||
$this->nom = $nom;
|
$this->nom = $nom;
|
||||||
|
|
||||||
$eleveId = $bulletin->getId();
|
$eleveId = $bulletin->getId();
|
||||||
|
// echo "<p>".$eleveId."</p>";
|
||||||
|
|
||||||
$noteManager = $wiki->services->get(NoteManager::class);
|
$noteManager = $wiki->services->get(NoteManager::class);
|
||||||
$entries = $noteManager->getNotes($eleveId, $id);
|
$entries = $noteManager->getNotes($eleveId, $id);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace YesWiki\Meeo\Service;
|
namespace YesWiki\Meeo\Service;
|
||||||
|
|
||||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use YesWiki\Bazar\Service\EntryManager;
|
use YesWiki\Bazar\Service\EntryManager;
|
||||||
use YesWiki\Bazar\Service\ListManager;
|
use YesWiki\Bazar\Service\ListManager;
|
||||||
|
@ -33,17 +32,25 @@ class NoteManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewBulletins() {
|
public function viewBulletins() {
|
||||||
|
$eleveManager = $this->wiki->services->get(EleveManager::class);
|
||||||
$username = $this->authController->getLoggedUserName();
|
$username = $this->authController->getLoggedUserName();
|
||||||
|
// echo "<p>".$username."</p>";
|
||||||
|
|
||||||
$eleves = $this->wiki->services->get(EleveManager::class)->getAll();
|
|
||||||
// $eleves = $ $this->entryManager->search(['formsIds' => $meeo_config['elevesFormId']]);
|
|
||||||
$entries = $this->entryManager->search(['formsIds' => $this->formId]);
|
|
||||||
include 'tools/meeo/libs/bulletin/Bulletin.lib.php';
|
include 'tools/meeo/libs/bulletin/Bulletin.lib.php';
|
||||||
|
|
||||||
|
$currentEleve = $eleveManager->getCurrentEleve($username);
|
||||||
|
// echo "<p>".var_dump($currentEleve)."</p>";
|
||||||
|
// if ($currentEleve == null) {
|
||||||
|
$eleves = $eleveManager->getAll();
|
||||||
|
// $eleves = $ $this->entryManager->search(['formsIds' => $meeo_config['elevesFormId']]);
|
||||||
|
// $entries = $this->entryManager->search(['formsIds' => $this->formId]);
|
||||||
|
|
||||||
$bulletins = [];
|
$bulletins = [];
|
||||||
foreach ( $eleves as $eleve) {
|
foreach ( $eleves as $eleve) {
|
||||||
//TODO enlever "Passerelle"
|
//TODO enlever "Passerelle"
|
||||||
$bulletins[] = new Bulletin($this->wiki, $eleve, "Passerelle");
|
$bulletin = new Bulletin($this->wiki, $eleve, "Passerelle");
|
||||||
|
if ($bulletin->isVisible())
|
||||||
|
$bulletins[] = $bulletin;
|
||||||
}
|
}
|
||||||
// echo "<p>".var_dump($eleves)."</p>";
|
// echo "<p>".var_dump($eleves)."</p>";
|
||||||
// echo "<p>".var_dump($entries)."</p>";
|
// echo "<p>".var_dump($entries)."</p>";
|
||||||
|
@ -53,8 +60,7 @@ class NoteManager {
|
||||||
"bulletins" => $bulletins,
|
"bulletins" => $bulletins,
|
||||||
]);
|
]);
|
||||||
// } else {
|
// } else {
|
||||||
// $entries = $entryManager->search(['formsIds' => $this->formId]);
|
// $bulletin = new Bulletin($this->wiki, $currentEleve);
|
||||||
|
|
||||||
// return $this->wiki->render('@meeo/eleve_notes.twig', [
|
// return $this->wiki->render('@meeo/eleve_notes.twig', [
|
||||||
// "bulletin" => $bulletin,
|
// "bulletin" => $bulletin,
|
||||||
// ]);
|
// ]);
|
||||||
|
@ -68,7 +74,7 @@ class NoteManager {
|
||||||
// echo var_dump($matieres);
|
// echo var_dump($matieres);
|
||||||
$classes = $this->listManager->getOne('ListeClasses');
|
$classes = $this->listManager->getOne('ListeClasses');
|
||||||
// echo var_dump($classes);
|
// echo var_dump($classes);
|
||||||
return $this->wiki->render('@meeo/edu_controle.twig', ['matieres' => $matieres['label'], 'classes' => $classes['label'], 'eleves' => $eleves]);
|
return $this->wiki->render('@meeo/edu_controle.twig', ['matieres' => $matieres['nodes'], 'classes' => $classes['nodes'], 'eleves' => $eleves]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createNote($intitule, $eleve, $matiere, $note, $coef) {
|
public function createNote($intitule, $eleve, $matiere, $note, $coef) {
|
||||||
|
@ -85,11 +91,11 @@ class NoteManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNotes($eleveId, $matiereId) {
|
public function getNotes($eleveId, $matiereId) {
|
||||||
// echo "<p>".$eleveId."</p>";
|
echo "<p>".$eleveId."</p>";
|
||||||
// echo "<p>".$matiereId."</p>";
|
echo "<p>".$matiereId."</p>";
|
||||||
$entries = $this->entryManager->search(['formsIds' => $this->formId,
|
$entries = $this->entryManager->search(['formsIds' => $this->formId,
|
||||||
'queries' =>[
|
'queries' =>[
|
||||||
'listefiche'.$this->eleveFormId.'bf_eleve' => $eleveId,
|
'listefiche'.$this->eleveFormId.'bf_eleve' => \strtolower($eleveId),
|
||||||
'listeListeMatierebf_matiere' => $matiereId
|
'listeListeMatierebf_matiere' => $matiereId
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
<label class="control-label col-sm-2" for="matiere">Matière:</label>
|
<label class="control-label col-sm-2" for="matiere">Matière:</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<select class="form-control" id="matiere" name="matiere" required>
|
<select class="form-control" id="matiere" name="matiere" required>
|
||||||
{% for clef, matiere in matieres %}
|
{% for matiere in matieres %}
|
||||||
<option value="{{ clef }}">{{ matiere }}</option>
|
<option value="{{ matiere['id'] }}">{{ matiere['label'] }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<select class="form-control" id="classe" name="classe" required>
|
<select class="form-control" id="classe" name="classe" required>
|
||||||
{% for classe in classes %}
|
{% for classe in classes %}
|
||||||
<option>{{ classe }}</option>
|
<option value="{{ classe['id'] }}" >{{ classe['label'] }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
@ -37,10 +37,10 @@
|
||||||
<h2>Eleves</h2>
|
<h2>Eleves</h2>
|
||||||
<div id="eleves" name="eleves">
|
<div id="eleves" name="eleves">
|
||||||
{% for eleve in eleves %}
|
{% for eleve in eleves %}
|
||||||
<div class="form-group" classe="{{ eleve['listeListeClassesbf_classe'] }}" hidden>
|
<div class="form-group" classe="{{ eleve.getClasse() }}">
|
||||||
<label class="control-label col-sm-2" for="{{ eleve['id_fiche'] }}">{{ eleve['bf_nom'] }}</label>
|
<label class="control-label col-sm-2" for="eleve_{{ eleve.getId() }}">{{ eleve.getNom() }}</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<input type="number" class="form-control" id="{{ eleve['id_fiche'] }}" name="eleve_{{ eleve['id_fiche'] }}" min="0" max="20" step="0.1" required>
|
<input type="number" class="form-control" id="eleve_{{ eleve.getId() }}" name="eleve_{{ eleve.getId() }}" min="0" max="20" step="0.1" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in a new issue