Loading module/UnicaenNote/src/UnicaenNote/Controller/NoteController.php +8 −6 Original line number Diff line number Diff line Loading @@ -36,17 +36,19 @@ class NoteController extends AbstractActionController { { $portenote = $this->getPorteNoteService()->getRequestePorteNote($this); $note = new Note(); if ($portenote) $note->setPortenote($portenote); if ($portenote) { $note->setPortenote($portenote); } $form = $this->getNoteForm(); $form->setAttribute('action', $this->url()->fromRoute('unicaen-note/note/ajouter', ['porte-note' => (($portenote)?$portenote->getId():null)], [], true)); $form->bind($note); if ($portenote !== null) { $form->get('porte-note')->setAttribute('style','display:none;'); } // if ($portenote !== null) { // $form->get('porte-note')->setAttribute('style','display:none;'); // } $request = $this->getRequest(); if ($request->getPost()) { if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { Loading @@ -70,7 +72,7 @@ class NoteController extends AbstractActionController { $form = $this->getNoteForm(); $form->setAttribute('action', $this->url()->fromRoute('unicaen-note/note/modifier', ['note' => $note->getId()], [], true)); $form->bind($note); $form->get('porte-note')->setAttribute('style','display:none;'); //$form->get('porte-note')->setAttribute('style','display:none;'); $request = $this->getRequest(); if ($request->getPost()) { Loading module/UnicaenNote/src/UnicaenNote/Form/Note/NoteForm.php +15 −14 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace UnicaenNote\Form\Note; use UnicaenNote\Service\PorteNote\PorteNoteServiceAwareTrait; use UnicaenNote\Service\Type\TypeServiceAwareTrait; use Zend\Form\Element\Button; use Zend\Form\Element\Hidden; use Zend\Form\Element\Select; use Zend\Form\Element\Textarea; use Zend\Form\Form; Loading @@ -17,18 +18,18 @@ class NoteForm extends Form { public function init() { //PORTE NOTE $this->add([ 'type' => Select::class, 'name' => 'porte-note', 'options' => [ 'label' => "Porte-notes * :", 'empty_option' => "Aucun porte-notes", 'value_options' => $this->getPorteNoteService()->getPortesNotesAsOptions(), ], 'attributes' => [ 'id' => 'porte-note', ], ]); // $this->add([ // 'type' => Hidden::class, // 'name' => 'porte-note', // 'options' => [ // 'label' => "Porte-notes * :", // 'empty_option' => "Aucun porte-notes", // 'value_options' => $this->getPorteNoteService()->getPortesNotesAsOptions(), // ], // 'attributes' => [ // 'id' => 'porte-note', // ], // ]); //TYPE $this->add([ 'type' => Select::class, Loading @@ -53,7 +54,7 @@ class NoteForm extends Form { ], ], 'attributes' => [ 'class' => 'description form-control', 'class' => 'type2 form-control', ] ]); //bouton Loading @@ -73,7 +74,7 @@ class NoteForm extends Form { ]); $this->setInputFilter((new Factory())->createInputFilter([ 'porte-note' => [ 'required' => true, ], // 'porte-note' => [ 'required' => false, ], 'type' => [ 'required' => false, ], 'description' => [ 'required' => false, ], ])); Loading module/UnicaenNote/src/UnicaenNote/Form/Note/NoteHydrator.php +3 −3 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ class NoteHydrator implements HydratorInterface { public function extract($object) { $data = [ 'porte-note' => ($object->getPortenote())?$object->getPortenote()->getId():null, // 'porte-note' => ($object->getPortenote())?$object->getPortenote()->getId():null, 'type' => ($object->getType())?$object->getType()->getId():null, 'description' => ($object->getTexte())?:null, ]; Loading @@ -32,11 +32,11 @@ class NoteHydrator implements HydratorInterface { */ public function hydrate(array $data, $object) { $portenote = (isset($data['porte-note']))?$this->getPorteNoteService()->getPorteNote($data['porte-note']):null; // $portenote = (isset($data['porte-note']))?$this->getPorteNoteService()->getPorteNote($data['porte-note']):null; $type = (isset($data['type']))?$this->getTypeService()->getType($data['type']):null; $description = (isset($data['description']) AND trim($data['description']) !== "")?trim($data['description']):null; $object->setPortenote($portenote); // $object->setPortenote($portenote); $object->setType($type); $object->setTexte($description); return $object; Loading module/UnicaenNote/src/UnicaenNote/View/Helper/partial/note.phtml +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ $canSupprimer = $this->isAllowed(NotePrivileges::getResourceId(NotePrivileges:: <div class="row"> <!-- <div class="col-md-10 --><?php //echo $note->getType()->getStyle(); ?><!--">--> <div class="<?php echo $note->getType()->getStyle(); ?>" style="width: 95%; display: inline-block;"> <div class="<?php echo ($note->getType())?$note->getType()->getStyle():""; ?>" style="width: 95%; display: inline-block;"> <?php echo $note->getTexte(); ?> </div> <!-- <div class="col-md-1">--> Loading Loading
module/UnicaenNote/src/UnicaenNote/Controller/NoteController.php +8 −6 Original line number Diff line number Diff line Loading @@ -36,17 +36,19 @@ class NoteController extends AbstractActionController { { $portenote = $this->getPorteNoteService()->getRequestePorteNote($this); $note = new Note(); if ($portenote) $note->setPortenote($portenote); if ($portenote) { $note->setPortenote($portenote); } $form = $this->getNoteForm(); $form->setAttribute('action', $this->url()->fromRoute('unicaen-note/note/ajouter', ['porte-note' => (($portenote)?$portenote->getId():null)], [], true)); $form->bind($note); if ($portenote !== null) { $form->get('porte-note')->setAttribute('style','display:none;'); } // if ($portenote !== null) { // $form->get('porte-note')->setAttribute('style','display:none;'); // } $request = $this->getRequest(); if ($request->getPost()) { if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { Loading @@ -70,7 +72,7 @@ class NoteController extends AbstractActionController { $form = $this->getNoteForm(); $form->setAttribute('action', $this->url()->fromRoute('unicaen-note/note/modifier', ['note' => $note->getId()], [], true)); $form->bind($note); $form->get('porte-note')->setAttribute('style','display:none;'); //$form->get('porte-note')->setAttribute('style','display:none;'); $request = $this->getRequest(); if ($request->getPost()) { Loading
module/UnicaenNote/src/UnicaenNote/Form/Note/NoteForm.php +15 −14 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace UnicaenNote\Form\Note; use UnicaenNote\Service\PorteNote\PorteNoteServiceAwareTrait; use UnicaenNote\Service\Type\TypeServiceAwareTrait; use Zend\Form\Element\Button; use Zend\Form\Element\Hidden; use Zend\Form\Element\Select; use Zend\Form\Element\Textarea; use Zend\Form\Form; Loading @@ -17,18 +18,18 @@ class NoteForm extends Form { public function init() { //PORTE NOTE $this->add([ 'type' => Select::class, 'name' => 'porte-note', 'options' => [ 'label' => "Porte-notes * :", 'empty_option' => "Aucun porte-notes", 'value_options' => $this->getPorteNoteService()->getPortesNotesAsOptions(), ], 'attributes' => [ 'id' => 'porte-note', ], ]); // $this->add([ // 'type' => Hidden::class, // 'name' => 'porte-note', // 'options' => [ // 'label' => "Porte-notes * :", // 'empty_option' => "Aucun porte-notes", // 'value_options' => $this->getPorteNoteService()->getPortesNotesAsOptions(), // ], // 'attributes' => [ // 'id' => 'porte-note', // ], // ]); //TYPE $this->add([ 'type' => Select::class, Loading @@ -53,7 +54,7 @@ class NoteForm extends Form { ], ], 'attributes' => [ 'class' => 'description form-control', 'class' => 'type2 form-control', ] ]); //bouton Loading @@ -73,7 +74,7 @@ class NoteForm extends Form { ]); $this->setInputFilter((new Factory())->createInputFilter([ 'porte-note' => [ 'required' => true, ], // 'porte-note' => [ 'required' => false, ], 'type' => [ 'required' => false, ], 'description' => [ 'required' => false, ], ])); Loading
module/UnicaenNote/src/UnicaenNote/Form/Note/NoteHydrator.php +3 −3 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ class NoteHydrator implements HydratorInterface { public function extract($object) { $data = [ 'porte-note' => ($object->getPortenote())?$object->getPortenote()->getId():null, // 'porte-note' => ($object->getPortenote())?$object->getPortenote()->getId():null, 'type' => ($object->getType())?$object->getType()->getId():null, 'description' => ($object->getTexte())?:null, ]; Loading @@ -32,11 +32,11 @@ class NoteHydrator implements HydratorInterface { */ public function hydrate(array $data, $object) { $portenote = (isset($data['porte-note']))?$this->getPorteNoteService()->getPorteNote($data['porte-note']):null; // $portenote = (isset($data['porte-note']))?$this->getPorteNoteService()->getPorteNote($data['porte-note']):null; $type = (isset($data['type']))?$this->getTypeService()->getType($data['type']):null; $description = (isset($data['description']) AND trim($data['description']) !== "")?trim($data['description']):null; $object->setPortenote($portenote); // $object->setPortenote($portenote); $object->setType($type); $object->setTexte($description); return $object; Loading
module/UnicaenNote/src/UnicaenNote/View/Helper/partial/note.phtml +1 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ $canSupprimer = $this->isAllowed(NotePrivileges::getResourceId(NotePrivileges:: <div class="row"> <!-- <div class="col-md-10 --><?php //echo $note->getType()->getStyle(); ?><!--">--> <div class="<?php echo $note->getType()->getStyle(); ?>" style="width: 95%; display: inline-block;"> <div class="<?php echo ($note->getType())?$note->getType()->getStyle():""; ?>" style="width: 95%; display: inline-block;"> <?php echo $note->getTexte(); ?> </div> <!-- <div class="col-md-1">--> Loading