diff --git a/.gitattributes b/.gitattributes index 02af0bba9ac4a67c67c98e8f9c667e0bac836340..4e43514d16708f315d3c9f3d3f98f5e0f48eb1eb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -296,6 +296,7 @@ application/modules/admin/controllers/MultimediaController.php -text application/modules/admin/controllers/NewsletterController.php -text application/modules/admin/controllers/OaiController.php -text application/modules/admin/controllers/OpdsController.php -text +application/modules/admin/controllers/OuverturesController.php -text application/modules/admin/controllers/ProfilController.php -text application/modules/admin/controllers/RssController.php -text application/modules/admin/controllers/SitoController.php -text @@ -460,6 +461,9 @@ application/modules/admin/views/scripts/opds/add.phtml -text application/modules/admin/views/scripts/opds/browse.phtml -text application/modules/admin/views/scripts/opds/edit.phtml -text application/modules/admin/views/scripts/opds/index.phtml -text +application/modules/admin/views/scripts/ouvertures/add.phtml -text +application/modules/admin/views/scripts/ouvertures/edit.phtml -text +application/modules/admin/views/scripts/ouvertures/index.phtml -text application/modules/admin/views/scripts/profil/_erreur_profil.phtml -text application/modules/admin/views/scripts/profil/_formProfil.phtml -text application/modules/admin/views/scripts/profil/_page_row.phtml -text @@ -1741,6 +1745,7 @@ library/Class/NoticeHtml.php -text library/Class/NoticeOAI.php -text library/Class/NoticeUnimarc.php -text library/Class/OpdsCatalog.php -text +library/Class/Ouverture.php -text library/Class/PanierNotice.php -text library/Class/Pcdm4.php -text library/Class/Pdf/font/courier.php -text @@ -3580,6 +3585,7 @@ tests/application/modules/admin/controllers/MultimediaControllerTest.php -text tests/application/modules/admin/controllers/NewsletterControllerTest.php -text tests/application/modules/admin/controllers/OaiControllerTest.php -text tests/application/modules/admin/controllers/OpdsControllerTest.php -text +tests/application/modules/admin/controllers/OuverturesControllerTest.php -text tests/application/modules/admin/controllers/ProfilControllerIndexTest.php -text tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php -text tests/application/modules/admin/controllers/ProfilControllerProfilJeunesseAndAdultesWithMenusTest.php -text diff --git a/application/modules/admin/controllers/OuverturesController.php b/application/modules/admin/controllers/OuverturesController.php new file mode 100644 index 0000000000000000000000000000000000000000..3a383fc69d8e1d2d7522fd4ba008c8b106177d20 --- /dev/null +++ b/application/modules/admin/controllers/OuverturesController.php @@ -0,0 +1,50 @@ +<?php +/** + * Copyright (c) 2012, 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_OuverturesController extends ZendAfi_Controller_Action { + public function getRessourceDefinitions() { + return array( + 'model' => array('class' => 'Class_Ouverture', + 'name' => 'ouverture', + 'order' => 'debut_matin'), + 'messages' => array('successful_add' => 'Plage d\'ouverture %s ajoutée', + 'successful_save' => 'Plage d\'ouverture %s sauvegardée', + 'successful_delete' => 'Plage d\'ouverture %s supprimée'), + + 'actions' => array('edit' => array('title' => 'Modifier une plage d\'ouverture'), + 'add' => array('title' => 'Ajouter une plage d\'ouverture'), + 'index' => array('title' => 'Plages d\'ouverture')), + + 'display_groups' => array('plage_ouverture' => array('legend' => 'Plage d\'ouverture', + 'elements' => array( + 'debut_matin' => array('element' => 'select', + 'options' => array('label' => 'Début matinée', + 'multiOptions' => Class_Multimedia_Location::getLoader()->getPossibleHours(30)) + ) + ) + ) + ) + ); + } + +} + +?> \ No newline at end of file diff --git a/application/modules/admin/views/scripts/ouvertures/add.phtml b/application/modules/admin/views/scripts/ouvertures/add.phtml new file mode 100644 index 0000000000000000000000000000000000000000..dc46f2831c7f803cf1fe92106a4a72f2e9d8c066 --- /dev/null +++ b/application/modules/admin/views/scripts/ouvertures/add.phtml @@ -0,0 +1 @@ +<?php echo $this->renderForm($this->form); ?> \ No newline at end of file diff --git a/application/modules/admin/views/scripts/ouvertures/edit.phtml b/application/modules/admin/views/scripts/ouvertures/edit.phtml new file mode 100644 index 0000000000000000000000000000000000000000..dc46f2831c7f803cf1fe92106a4a72f2e9d8c066 --- /dev/null +++ b/application/modules/admin/views/scripts/ouvertures/edit.phtml @@ -0,0 +1 @@ +<?php echo $this->renderForm($this->form); ?> \ No newline at end of file diff --git a/application/modules/admin/views/scripts/ouvertures/index.phtml b/application/modules/admin/views/scripts/ouvertures/index.phtml new file mode 100644 index 0000000000000000000000000000000000000000..52d3eff9666adcf44137841544210db8a4a03860 --- /dev/null +++ b/application/modules/admin/views/scripts/ouvertures/index.phtml @@ -0,0 +1,8 @@ +<?php + echo $this->tagModelTable($this->ouvertures, + array($this->_('Début matin')), + array('debut_matin'), + array(array('action' => 'edit', 'content' => $this->boutonIco('type=edit')), + array('action' => 'delete', 'content' => $this->boutonIco('type=del'))), + 'ouvertures'); +?> \ No newline at end of file diff --git a/categories.org b/categories.org index 95ed417516785ce0fbe1c2a12160ee7822f91af9..45f7a604322edd98fc04b1fc5c3abf629ee13556 100644 --- a/categories.org +++ b/categories.org @@ -2,9 +2,10 @@ * AFI Multimedia ** Planning des ouvertures + [[file:library/Class/Ouverture.php::class%20Class_Ouverture%20extends%20Storm_Model_Abstract%20{][Modele Ouverture]] [[file:tests/application/modules/admin/controllers/OuverturesControllerTest.php::abstract%20class%20OuverturesControllerTestCase%20extends%20Admin_AbstractControllerTestCase%20{][Tests Controller Ouvertures]] - [[file:application/modules/admin/controllers/OuverturesController.php::class%20Admin_OuverturesController%20extends%20Zend_Controller_Action%20{][Controller Ouvertures]] - [[file:application/modules/admin/views/scripts/ouvertures/edit.phtml::<?php%20?][Vue edit ouverture]] + [[file:application/modules/admin/controllers/OuverturesController.php::class%20Admin_OuverturesController%20extends%20ZendAfi_Controller_Action%20{][Controller Ouvertures]] + [[file:application/modules/admin/views/scripts/ouvertures/edit.phtml::<?php%20echo%20$this->renderForm($this->form)%3B%20?][Vue edit ouverture]] - [[http://localhost/afi-opac3/admin/ouvertures/edit/site_id/1/id/2][Page édition d'une ouverture]] ** Skin réservation timeline [[http://localhost/afi-opac3/abonne/multimedia-hold-location][url page réservation]] [[file:public/opac/css/global.css::.timeline%20{][CSS .timeline]] diff --git a/library/Class/Multimedia/Location.php b/library/Class/Multimedia/Location.php index 565d7796f33e8bbe8a8c99ebeb8ccf88c41cfd7f..afd971c0d9ba6738cf5850584dfac734782804ef 100644 --- a/library/Class/Multimedia/Location.php +++ b/library/Class/Multimedia/Location.php @@ -111,10 +111,6 @@ class Class_Multimedia_Location extends Storm_Model_Abstract { protected $_default_attribute_values = array('days' => ''); - public static function getLoader() { - return self::getLoaderFor(__CLASS__); - } - /** * @param $date string (YYYY-MM-DD) diff --git a/library/Class/Ouverture.php b/library/Class/Ouverture.php new file mode 100644 index 0000000000000000000000000000000000000000..2cfc2c9895695c14c6fbd059f3ca46911552557d --- /dev/null +++ b/library/Class/Ouverture.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright (c) 2012, 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 Class_Ouverture extends Storm_Model_Abstract { + protected $_table_name = 'ouvertures'; + + public function getLibelle() { + return ''; + } +} + +?> \ No newline at end of file diff --git a/library/Class/Profil.php b/library/Class/Profil.php index 8d83c2b62338399f58b8592b1d122ce0f26d5e89..c345da63f9e35eeaf03ba4ac6ba641efacc80371 100644 --- a/library/Class/Profil.php +++ b/library/Class/Profil.php @@ -83,11 +83,6 @@ class Class_Profil extends Storm_Model_Abstract { protected $_translator; - public static function getLoader() { - return self::getLoaderFor(__CLASS__); - } - - /** * @return Class_Profil */ diff --git a/library/ZendAfi/Controller/Action/RessourceDefinitions.php b/library/ZendAfi/Controller/Action/RessourceDefinitions.php index 3b72b2a9fe57f30d96658fa33e070ca99bdf005d..25d2977e5aff495155801d9e36e86d101d3c0b83 100644 --- a/library/ZendAfi/Controller/Action/RessourceDefinitions.php +++ b/library/ZendAfi/Controller/Action/RessourceDefinitions.php @@ -38,7 +38,8 @@ class ZendAfi_Controller_Action_RessourceDefinitions { public function findAll() { - return $this->getModelLoader()->findAllBy(array('order' => 'libelle')); + + return $this->getModelLoader()->findAllBy(array('order' => $this->getOrder())); } @@ -84,6 +85,13 @@ class ZendAfi_Controller_Action_RessourceDefinitions { return $this->_definitions['model']['class']; } + + public function getOrder() { + if (isset($this->_definitions['model']['order'])) + return $this->_definitions['model']['order']; + return 'libelle'; + } + public function getModelName() { return $this->_definitions['model']['name']; diff --git a/tests/application/modules/admin/controllers/OuverturesControllerTest.php b/tests/application/modules/admin/controllers/OuverturesControllerTest.php new file mode 100644 index 0000000000000000000000000000000000000000..8762676522ebdff3a79f4453b82ed8f8838f0747 --- /dev/null +++ b/tests/application/modules/admin/controllers/OuverturesControllerTest.php @@ -0,0 +1,83 @@ +<?php +/** + * Copyright (c) 2012, 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 + */ +require_once 'AdminAbstractControllerTestCase.php'; + +abstract class OuverturesControllerTestCase extends Admin_AbstractControllerTestCase { + public function setUp() { + parent::setUp(); + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Ouverture') + ->whenCalled('findAll') + ->answers(array( + Class_Ouverture::getLoader() + ->newInstanceWithId(2) + ->setDebutMatin('08h00'))); + } +} + + + +class OuverturesControllerIndexActionTest extends OuverturesControllerTestCase { + public function setUp() { + parent::setUp(); + $this->dispatch('/admin/ouvertures', true); + } + + /** @test */ + public function ouvertureAtHeightShouldBeVisible() { + $this->assertXPath('//td', '08h00'); + } +} + + + + +class OuverturesControllerEditOuvertureMardiTest extends OuverturesControllerTestCase { + public function setUp() { + parent::setUp(); + $this->dispatch('/admin/ouvertures/edit/site_id/1/id/2', true); + } + + + /** @test */ + public function formShouldContainsSelectForDebutMatin() { + $this->assertXPath('//form//select'); + } +} + + + + +class OuverturesControllerAddOuvertureTest extends OuverturesControllerTestCase { + public function setUp() { + parent::setUp(); + $this->dispatch('/admin/ouvertures/add/site_id/1', true); + } + + + /** @test */ + public function formShouldContainsSelectForDebutMatin() { + $this->assertXPath('//form//select'); + } +} + + + +?> \ No newline at end of file