Skip to content
Snippets Groups Projects
Commit 1285d0e3 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

dev #13296 add settings form to formations widget

parent 3a66c272
Branches
Tags
4 merge requests!258Dev/13872 Orphee Allow Hold Available Items,!180Master,!104Sprint3 Dev #13296 Formation Widget,!98Sprint3 Dev #13296 Formation Widget
......@@ -126,6 +126,12 @@ class Admin_AccueilController extends Zend_Controller_Action {
}
public function formationsAction() {
$this->view->module_settings = $this->profil->getModuleAccueilConfig($this->id_module)['preferences'];
$this->_simpleAction();
}
public function newsAction() {
if (1 == $this->_getParam('styles_reload')) {
$this->view->preferences = $this->_request->getPost();
......
<?php
echo ZendAfi_Form_Configuration_FormationsWidget::newWith($this->module_settings);
?>
<?php
/**
* Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
*
* AFI-OPAC 2.0 is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* AFI-OPAC 2.0 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_Form_Configuration_FormationsWidget extends ZendAfi_Form {
public static function newWith($module_settings) {
$form = new self();
$form->populate($module_settings);
return $form;
}
public function init() {
parent::init();
$this
->setAttrib('id',
'configuration_formationsWidget')
->addElement('text',
'titre',
['label' => $this->_('Titre'),
'size' => $this->_text_size])
->addElement('select',
'boite',
['label' => $this->_('Style de boite'),
'multiOptions' => (
new Class_Profil_Templates(
Class_Profil::getCurrentProfil()))->toArray()])
->addElement('submit',
'submit',
['label' => $this->_('Valider')]);
}
}
?>
\ No newline at end of file
<?php
/**
* Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved.
*
* AFI-OPAC 2.0 is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* AFI-OPAC 2.0 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Admin_AccueilControllerFormationsTestWithDefaultSettings extends Admin_AbstractControllerTestCase {
public function setUp() {
parent::setUp();
$this->fixture('Class_Profil',
['id' => 1,
'libelle' => 'Afibre'])
->updateModuleConfigAccueil(1, ['type_module' => 'FORMATIONS',
'division' => 1,
'id_module' => 1])
->beCurrentProfil();
$this->dispatch('admin/accueil/formations?config=accueil&id_profil=1&id_module=1&type_module=FORMATIONS', true);
}
/** @test */
public function styleDeBoiteShouldBeBoiteParDefautDeLaDivision() {
$this->assertXPathContentContains('//select/option', 'Boite par défaut de la division', $this->_response->getBody());
}
}
?>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment