Commit c94524e1 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

bouton d'edition, privilege

parent bb33a5cd
Loading
Loading
Loading
Loading
+37 −0
Changes for data/SQL/information.sql: 37 added lines, 0 removed lines.
Original line number Diff line number Diff line
-- STRUCTURE DE LA TABLE
create table INFORMATION
(
	ID NUMBER not null,
	TITRE VARCHAR2(256) not null,
	HISTO_CREATION DATE default SYSDATE not null,
	HISTO_CREATEUR_ID NUMBER not null
		constraint INFORMATION_HCFK
			references UTILISATEUR,
	HISTO_MODIFICATION DATE default SYSDATE not null,
	HISTO_MODIFICATEUR_ID NUMBER not null
		constraint INFORMATION_HMFK
			references UTILISATEUR,
	HISTO_DESTRUCTION DATE,
	HISTO_DESTRUCTEUR_ID NUMBER
		constraint INFORMATION_HDFK
			references UTILISATEUR,
	CONTENU CLOB not null,
	PRIORITE NUMBER default 0 not null,
	EST_VISIBLE NUMBER default 1 not null
)
/

create unique index INFORMATION_ID_UINDEX
	on INFORMATION (ID)
/

alter table INFORMATION
	add constraint INFORMATION_PK
		primary key (ID)
;

-- LES DONNÉES DOIVENT ÊTRE REPRISES EN BASES SINON C'EST LE BAZAR

-- PRIVILEGE
INSERT INTO SYGAL_TEST.PRIVILEGE (ID, CATEGORIE_ID, CODE, LIBELLE, ORDRE) VALUES (10, 23, 'modifier-information', 'Modifier les pages d''information ', 50);
INSERT INTO SYGAL_TEST.ROLE_PRIVILEGE (ROLE_ID, PRIVILEGE_ID) VALUE (1 , 10);
 No newline at end of file
+28 −15
Changes for module/Information/config/module.config.php: 28 added lines, 15 removed lines.
Original line number Diff line number Diff line
@@ -201,25 +201,37 @@ return [
                'label' => 'Accueil',
                'route' => 'home',
                'pages' => [
                    'doctorat' => [
//                    'doctorat' => [
//                        'label' => 'Le doctorat',
//                        'route' => 'information/doctorat',
//                        'title' => "Informations sur le doctorat et sa gestion"
//                    ],
//                    'ecoles-doctorales' => [
//                        'label' => 'Les Écoles Doctorales',
//                        'route' => 'information/ecoles-doctorales',
//                        'title' => "Informations sur les Ecoles Doctorales et le Collège des Ecoles doctorales"
//                    ],
//                    'guide-these' => [
//                        'label' => 'Guide de la thèse',
//                        'route' => 'information/guide-these',
//                        'title' => "Informations sur le déroulement de la thèse et formulaires administratifs à l’intention du doctorant et de ses encadrants"
//                    ],
                    'tinymce-doctorat' => [
                        'label' => 'Le doctorat',
                        'route' => 'information/doctorat',
                        'route' => 'informations/afficher',
                        'params'=> ['id' => 61],
                        'title' => "Informations sur le doctorat et sa gestion"
                    ],
                    'ecoles-doctorales' => [
                        'label' => 'Les Écoles Doctorales',
                        'route' => 'information/ecoles-doctorales',
                        'title' => "Informations sur les Ecoles Doctorales et le Collège des Ecoles doctorales"
                    'tinymce-ecoles' => [
                        'label' => 'Les écoles doctorales',
                        'route' => 'informations/afficher',
                        'params'=> ['id' => 81],
                        'title' => "Informations sur les Écoles Doctorales et le Collège des Écoles doctorales"
                    ],
                    'guide-these' => [
                    'tinymce-guide' => [
                        'label' => 'Guide de la thèse',
                        'route' => 'information/guide-these',
                        'title' => "Informations sur le déroulement de la thèse et formulaires administratifs à l’intention du doctorant et de ses encadrants"
                    ],
                    'tinymce-doctorat' => [
                        'label' => 'Le doctorat',
                        'route' => 'informations/afficher',
                        'params'=> ['id' => 61],
                        'params'=> ['id' => 82],
                        'title' => "Informations sur le déroulement de la thèse et formulaires administratifs à l’intention du doctorant et de ses encadrants"
                    ],
                ],
@@ -256,10 +268,11 @@ return [
            __DIR__ . '/../view',
        ],
    ],

    'public_files' => [
        'inline_scripts' => [
            '100_' => 'js/tinymce/js/tinymce/tinymce.min.js',
            '101_' => 'js/form_fiche.js',
            '902_' => 'js/tinymce/js/tinymce/tinymce.js',
            '903_' => 'js/form_fiche.js',
        ],
    ]
];
 No newline at end of file
+52 −2
Changes for module/Information/src/Information/Form/InformationForm.php: 52 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -2,12 +2,14 @@

namespace Information\Form;

use Zend\Filter\StripTags;
use Zend\Form\Element\Button;
use Zend\Form\Element\Radio;
use Zend\Form\Element\Text;
use Zend\Form\Form;
use Zend\InputFilter\InputFilterProviderInterface;

class InformationForm extends Form {
class InformationForm extends Form implements InputFilterProviderInterface {

    public function init()
    {
@@ -58,7 +60,7 @@ class InformationForm extends Form {
                ],
            ],
            'attributes' => [
                'class' => 'type2 form-control',
                'class' => 'contenu-page form-control',
//                'class' => 'form-control',
            ]
        ]);
@@ -79,4 +81,52 @@ class InformationForm extends Form {
            ],
        ]);
    }

    /**
     * Should return an array specification compatible with
     * {@link Zend\InputFilter\Factory::createInputFilter()}.
     *
     * @return array
     */
    public function getInputFilterSpecification()
    {
        return [
            'titre' => [
                'required' => true,
                'filters' => [
                    ['name' => 'StripTags'],
                    ['name' => 'StringTrim'],
                ],
                'validators' => [
                    [
                        'name' => 'StringLength',
                        'options' => [
                            'encoding' => 'UTF-8',
                            'min' => 1,
                            'max' => 100,
                        ],
                    ],
                ],
            ],
            'contenu' => [
                'required' => false,
                'filters' => [
                    [
                        'name' => 'StringTrim'
                    ],
                    [
                        'name' => StripTags::class,
                        'options' => [
                            'allowTags' => [
                                'p', 'strong', 'em', 'ul', 'ol', 'li', 'a', 'h2', 'h3', 'h4', 'table', 'theader', 'th', 'tbody', 'tr', 'td'
                            ],
                            'allowAttribs' => [
                                'href', 'title', 'target'
                            ]
                        ]
                    ]
                ]
            ],
        ];
    }
}
 No newline at end of file
+15 −0
Changes for module/Information/src/Information/Provider/Privilege/InformationPrivileges.php: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Information\Provider\Privilege;

use UnicaenAuth\Provider\Privilege\Privileges;

/**
 * Liste des privilèges utilisables.
 *
 * @author UnicaenCode
 */
class InformationPrivileges extends Privileges
{
    const INFORMATION_MODIFIER          = 'faq-modifier-information';
}
 No newline at end of file
+26 −0
Changes for module/Information/view/information/information/afficher.phtml: 26 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -5,13 +5,39 @@
 */

use Information\Entity\Db\Information;
use Information\Provider\Privilege\InformationPrivileges;

$this->headTitle($information->getTitre());

$canEdit = $this->isAllowed(InformationPrivileges::getResourceId(InformationPrivileges::INFORMATION_MODIFIER));
?>

<h1 class="page-header">
    <?php echo $information->getTitre(); ?>
</h1>

<?php if($canEdit) : ?>
    <a href="<?php echo $this->url('informations/modifier', ['id' => $information->getId()], [], true); ?>"
       class="btn btn-primary"
       >
        <span class="glyphicon glyphicon-pencil"></span>
        Modifier la page d'information
    </a>
<?php endif; ?>

<?php echo $information->getContenu(); ?>

<style>
    table {
        width:80%;
    }

    td {
        border-bottom: 1px solid #666666;
    }

    th {
        border-bottom: 2px solid #666666;
        font-weight: bold;
    }
</style>
Loading