Compare commits
2 commits
5fde53b4c5
...
2fb6059eeb
Author | SHA1 | Date | |
---|---|---|---|
|
2fb6059eeb | ||
|
3f328d55a6 |
7 changed files with 37 additions and 10 deletions
|
@ -73,7 +73,7 @@ class ApiController extends YesWikiController
|
||||||
return strpos($key, 'eleve_') === 0;
|
return strpos($key, 'eleve_') === 0;
|
||||||
}, ARRAY_FILTER_USE_KEY);
|
}, ARRAY_FILTER_USE_KEY);
|
||||||
|
|
||||||
$controle = new Controle($parameters['intitule'], $parameters['matiere'], $parameters['coef'], $eleves);
|
$controle = new Controle($parameters['intitule'], $parameters['matiere'], $parameters['max'], $parameters['coef'], $eleves);
|
||||||
$controle->createNotes($noteManager);
|
$controle->createNotes($noteManager);
|
||||||
// return new ApiResponse($controle);
|
// return new ApiResponse($controle);
|
||||||
return $this->wiki->redirect($redirectParams['controle'], 200);
|
return $this->wiki->redirect($redirectParams['controle'], 200);
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Matiere {
|
||||||
// echo "<p>".var_dump($entries)."</p>";
|
// echo "<p>".var_dump($entries)."</p>";
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
if (!empty($entry['bf_note']))
|
if (!empty($entry['bf_note']))
|
||||||
$this->notes[] = new Note($entry['bf_intitule'], $entry['bf_note'], $entry['bf_coef']);
|
$this->notes[] = new Note($entry['bf_intitule'], $entry['bf_note'], $entry['listeListeNotemaxbf_notemax'], $entry['bf_coef']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,13 @@ class Note {
|
||||||
private $intitule;
|
private $intitule;
|
||||||
private $note;
|
private $note;
|
||||||
private $coef;
|
private $coef;
|
||||||
|
private $max;
|
||||||
|
|
||||||
public function __construct(string $intitule, int $note, float $coef = 1.0) {
|
public function __construct(string $intitule, int $note, int $max, float $coef = 1.0) {
|
||||||
$this->intitule = $intitule;
|
$this->intitule = $intitule;
|
||||||
$this->note = $note;
|
$this->note = $note;
|
||||||
$this->coef = $coef;
|
$this->coef = $coef;
|
||||||
|
$this->max = $max;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIntitule() {
|
public function getIntitule() {
|
||||||
|
@ -24,4 +26,8 @@ class Note {
|
||||||
public function getCoef() {
|
public function getCoef() {
|
||||||
return $this->coef;
|
return $this->coef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMax() {
|
||||||
|
return $this->max;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -7,12 +7,14 @@ use YesWiki\Meeo\Service\NoteManager;
|
||||||
class Controle {
|
class Controle {
|
||||||
public $intitule;
|
public $intitule;
|
||||||
public $matiere;
|
public $matiere;
|
||||||
|
public $max;
|
||||||
public $coef;
|
public $coef;
|
||||||
public $eleves;
|
public $eleves;
|
||||||
|
|
||||||
public function __construct($intitule, $matiere, $coef, $eleves) {
|
public function __construct($intitule, $matiere, $max, $coef, $eleves) {
|
||||||
$this->intitule = $intitule;
|
$this->intitule = $intitule;
|
||||||
$this->matiere = $matiere;
|
$this->matiere = $matiere;
|
||||||
|
$this->max = $max;
|
||||||
$this->coef = $coef;
|
$this->coef = $coef;
|
||||||
$this->eleves = $this->removePrefixFromKeys($eleves, "eleve_");
|
$this->eleves = $this->removePrefixFromKeys($eleves, "eleve_");
|
||||||
}
|
}
|
||||||
|
@ -33,7 +35,7 @@ class Controle {
|
||||||
public function createNotes(NoteManager $noteManager) {
|
public function createNotes(NoteManager $noteManager) {
|
||||||
foreach ($this->eleves as $eleve => $note) {
|
foreach ($this->eleves as $eleve => $note) {
|
||||||
if (!empty($note))
|
if (!empty($note))
|
||||||
$noteManager->createNote($this->intitule, $eleve, $this->matiere, $note, $this->coef);
|
$noteManager->createNote($this->intitule, $eleve, $this->matiere, $note, $this->max, $this->coef);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -60,7 +60,7 @@ class EleveManager {
|
||||||
$all = $this->getAll();
|
$all = $this->getAll();
|
||||||
foreach ($all as $eleve) {
|
foreach ($all as $eleve) {
|
||||||
// echo "<p>".var_dump($eleve)."</p>";
|
// echo "<p>".var_dump($eleve)."</p>";
|
||||||
if ($eleve->getUserId() == $username)
|
if ($eleve->getUserId() == $username || $eleve->isParent($username))
|
||||||
return $eleve;
|
return $eleve;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,6 @@ class NoteManager {
|
||||||
|
|
||||||
public function viewBulletins() {
|
public function viewBulletins() {
|
||||||
$eleveManager = $this->wiki->services->get(EleveManager::class);
|
$eleveManager = $this->wiki->services->get(EleveManager::class);
|
||||||
|
|
||||||
// echo "<p>".$username."</p>";
|
|
||||||
|
|
||||||
include 'tools/meeo/libs/bulletin/Bulletin.lib.php';
|
include 'tools/meeo/libs/bulletin/Bulletin.lib.php';
|
||||||
|
|
||||||
|
@ -76,11 +74,17 @@ class NoteManager {
|
||||||
$matieres = $this->listManager->getOne('ListeMatiere');
|
$matieres = $this->listManager->getOne('ListeMatiere');
|
||||||
// echo var_dump($matieres);
|
// echo var_dump($matieres);
|
||||||
$classes = $this->listManager->getOne('ListeClasses');
|
$classes = $this->listManager->getOne('ListeClasses');
|
||||||
|
$notesMax = $this->listManager->getOne('ListeNoteMax');
|
||||||
// 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['label'],
|
||||||
|
'classes' => $classes['label'],
|
||||||
|
'notesMax' => $notesMax['label'],
|
||||||
|
'eleves' => $eleves,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createNote($intitule, $eleve, $matiere, $note, $coef) {
|
public function createNote($intitule, $eleve, $matiere, $note, $max, $coef) {
|
||||||
if ($note == 0)
|
if ($note == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -88,6 +92,7 @@ class NoteManager {
|
||||||
'bf_titre' => "Note : ".$intitule." - ".$eleve." - ".$matiere,
|
'bf_titre' => "Note : ".$intitule." - ".$eleve." - ".$matiere,
|
||||||
'bf_intitule' => $intitule,
|
'bf_intitule' => $intitule,
|
||||||
'listeListeMatierebf_matiere' => $matiere,
|
'listeListeMatierebf_matiere' => $matiere,
|
||||||
|
'listListeNotemaxbf_notemax' => $max,
|
||||||
'listefiche'.$this->eleveFormId.'bf_eleve' => $eleve,
|
'listefiche'.$this->eleveFormId.'bf_eleve' => $eleve,
|
||||||
'bf_note' => $note,
|
'bf_note' => $note,
|
||||||
'bf_coef' => $coef,
|
'bf_coef' => $coef,
|
||||||
|
|
|
@ -27,6 +27,20 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-sm-2" for="max">Note max:</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<select class="form-control" id="max" name="max" required>
|
||||||
|
{% for id, note in notesMax %}
|
||||||
|
{% if (id == 20) %}
|
||||||
|
<option value="{{ id }}" selected>{{ note }}</option>
|
||||||
|
{% else %}
|
||||||
|
<option value="{{ id }}">{{ note }}</option>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-sm-2" for="coef">Coefficient:</label>
|
<label class="control-label col-sm-2" for="coef">Coefficient:</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
|
|
Loading…
Reference in a new issue