diff --git a/application/modules/admin/views/scripts/accueil/sitotheque.phtml b/application/modules/admin/views/scripts/accueil/sitotheque.phtml index c8327846e3555e8a5e1b375e21bcb2d65dc1858f..7d075cca7e334607aca029121d0492dfe583f4d0 100644 --- a/application/modules/admin/views/scripts/accueil/sitotheque.phtml +++ b/application/modules/admin/views/scripts/accueil/sitotheque.phtml @@ -15,15 +15,15 @@ toggleDisplayTypeDependents(); '); ?> <center> - <h1>Propriétés du module sitothèque</h1><br> + <h1><?php echo $this->_('Propriétés du module sitothèque'); ?></h1><br> <div class="formTable"> <form method="post" action="<?php echo $this->url; ?>"> <fieldset> - <legend>Affichage</legend> + <legend><?php echo $this->_('Affichage'); ?></legend> <table cellspacing="2"> <tr> - <td class="droite">Style de boite </td> + <td class="droite"><?php echo $this->_('Style de boite'); ?> </td> <td class="gauche"><?php echo $this->combo_templates; ?></td> </tr> </table> @@ -31,14 +31,14 @@ toggleDisplayTypeDependents(); <br> <fieldset> - <legend>Généralités</legend> + <legend><?php echo $this->_('Généralités'); ?></legend> <table cellspacing="2"> <tr> - <td class="droite">Titre </td> + <td class="droite"><?php echo $this->_('Titre'); ?> </td> <td class="gauche"><input type="text" name="titre" size="50" value="<?php print($this->preferences['titre']); ?>"></td> </tr> <tr> - <td class="droite">Proposer un fil Rss </td> + <td class="droite"><?php echo $this->_('Proposer un fil Rss'); ?> </td> <td class="gauche"> <?php echo $this->formCheckbox('rss', $this->preferences['rss'], @@ -51,10 +51,10 @@ toggleDisplayTypeDependents(); <br> <fieldset> - <legend>Sites à afficher</legend> + <legend><?php echo $this->_('Sites à afficher'); ?></legend> <table cellspacing="2" width="100%"> <tr> - <td class="droite" width="90px">Type </td> + <td class="droite" width="90px"><?php echo $this->_('Type'); ?> </td> <td class="gauche"> <?php echo $this->formSelect('type_aff', @@ -80,7 +80,7 @@ toggleDisplayTypeDependents(); <table cellspacing="2" width="100%"> <tr id='option_display_order'> - <td class="droite" width="90px">Ordre d'affichage </td> + <td class="droite" width="90px"><?php echo $this->_('Ordre d\'affichage'); ?> </td> <td class="gauche"> <?php echo $this->formRadio('display_order', @@ -94,7 +94,7 @@ toggleDisplayTypeDependents(); </tr> <tr id='option_nb_aff'> - <td class="droite" width="90px">Nbre de sites par page </td> + <td class="droite" width="90px"><?php echo $this->_('Nbre de sites par page'); ?> </td> <td class="gauche"><input type="text" name="nb_aff" size="3" maxlength="3" value="<?php print($this->preferences['nb_aff']); ?>"></td> </tr> @@ -102,7 +102,7 @@ toggleDisplayTypeDependents(); </fieldset> <br /> - <?php echo $this->formSubmit('Valider', 'Valider', ['class' => 'bouton']); ?> + <?php echo $this->formSubmit('Valider', <?php echo $this->_('Valider'); ?>, ['class' => 'bouton']); ?> </form> </div> </center> diff --git a/library/Class/Migration/SitoConfigMigration.php b/library/Class/Migration/SitoConfigMigration.php index c1c0fa7a2635d9f507d14c2fccfc8211d6ed30bd..257a63944303c032351841db334494c8fd5a6636 100644 --- a/library/Class/Migration/SitoConfigMigration.php +++ b/library/Class/Migration/SitoConfigMigration.php @@ -39,8 +39,8 @@ class Class_Migration_SitoConfigMigration { protected function migratePreferences($preferences) { - $preferences = array_merge(['type_aff' => '1', - 'display_order' => 'Random', + $preferences = array_merge(['type_aff' => Class_Systeme_ModulesAccueil_Sitotheque::DISPLAY_PAGINATED, + 'display_order' => Class_Systeme_ModulesAccueil_Sitotheque::ORDER_RANDOM, 'group_by_categorie' => false], $preferences); $group = $preferences['group_by_categorie']; @@ -49,19 +49,19 @@ class Class_Migration_SitoConfigMigration { unset($preferences['group_by_categorie']); if ($order == '') - $preferences['display_order'] = 'Random'; + $preferences['display_order'] = Class_Systeme_ModulesAccueil_Sitotheque::ORDER_RANDOM; if ($group) - $preferences['type_aff'] = 2; + $preferences['type_aff'] = Class_Systeme_ModulesAccueil_Sitotheque::DISPLAY_GROUPED; - if ($type == 2) { - $preferences['type_aff'] = 1; - $preferences['display_order'] = 'Recent'; + if ($type == Class_Systeme_ModulesAccueil_Sitotheque::DISPLAY_GROUPED) { + $preferences['type_aff'] = Class_Systeme_ModulesAccueil_Sitotheque::DISPLAY_PAGINATED; + $preferences['display_order'] = Class_Systeme_ModulesAccueil_Sitotheque::ORDER_RECENT; } - if ($type == 2 && $group) { - $preferences['type_aff'] = 2; - $preferences['display_order'] = 'Recent'; + if ($type == Class_Systeme_ModulesAccueil_Sitotheque::DISPLAY_GROUPED && $group) { + $preferences['type_aff'] = Class_Systeme_ModulesAccueil_Sitotheque::DISPLAY_GROUPED; + $preferences['display_order'] = Class_Systeme_ModulesAccueil_Sitotheque::ORDER_RECENT; } return $preferences; diff --git a/library/Class/Systeme/ModulesAccueil/Sitotheque.php b/library/Class/Systeme/ModulesAccueil/Sitotheque.php index 4999b4755ddde246166e6a9fbd2cf22014052aeb..f003255193d8fd3936c8908135e7e5106ad72777 100644 --- a/library/Class/Systeme/ModulesAccueil/Sitotheque.php +++ b/library/Class/Systeme/ModulesAccueil/Sitotheque.php @@ -19,6 +19,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Class_Systeme_ModulesAccueil_Sitotheque extends Class_Systeme_ModulesAccueil_Null{ + const ORDER_RANDOM = 'Random'; + const ORDER_SELECTION = 'Selection'; + const ORDER_RECENT = 'Recent'; + + const DISPLAY_PAGINATED = 1; + const DISPLAY_GROUPED = 2; + const DISPLAY_HIERARCHY = 3; + /** @var string */ protected $_group = Class_Systeme_ModulesAccueil::GROUP_INFO; @@ -40,12 +48,12 @@ class Class_Systeme_ModulesAccueil_Sitotheque extends Class_Systeme_ModulesAccue /** @var array */ protected $_defaultValues = [ 'titre' => 'Sitothèque', // Titre de la boite - 'type_aff' => 1, // Type a afficher: 1=paginé, 2=groupe, 3=hiérarchique + 'type_aff' => self::DISPLAY_PAGINATED, 'id_categorie' => '', // Liste d'id_categorie séparés par des tirets 'id_items' => '', // Liste d'id_site séparés par des tirets 'nb_aff' => '2', // Nombre à afficher par page 'rss' => '0', - 'display_order' => 'Random' //ordre d'aff: Random, Selection, Recent + 'display_order' => self::ORDER_RANDOM ]; } ?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Accueil/Sito.php b/library/ZendAfi/View/Helper/Accueil/Sito.php index 681f8aae5f7a9810f3c5132a23a5adb963196e47..18b1a67689d20dc7f6c979e123c52d2d097cbbd0 100644 --- a/library/ZendAfi/View/Helper/Accueil/Sito.php +++ b/library/ZendAfi/View/Helper/Accueil/Sito.php @@ -20,13 +20,6 @@ */ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base { - const ORDER_RANDOM = 'Random'; - const ORDER_SELECTION = 'Selection'; - - const DISPLAY_PAGINATED = 1; - const DISPLAY_GROUPED = 2; - const DISPLAY_HIERARCHY = 3; - protected $strategy, $page; protected function _renderHeadScriptsOn($script_loader) { @@ -76,17 +69,17 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base public function isPaginatedDisplay() { - return $this->_isDisplayType(static::DISPLAY_PAGINATED); + return $this->_isDisplayType(Class_Systeme_ModulesAccueil_Sitotheque::DISPLAY_PAGINATED); } public function isGroupedDisplay() { - return $this->_isDisplayType(static::DISPLAY_GROUPED); + return $this->_isDisplayType(Class_Systeme_ModulesAccueil_Sitotheque::DISPLAY_GROUPED); } public function isHierarchicalDisplay() { - return $this->_isDisplayType(static::DISPLAY_HIERARCHY); + return $this->_isDisplayType(Class_Systeme_ModulesAccueil_Sitotheque::DISPLAY_HIERARCHY); } @@ -103,10 +96,6 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base class SitoDisplayStrategy { - const ORDER_RANDOM = 'Random'; - const ORDER_SELECTION = 'Selection'; - const ORDER_RECENT = 'Recent'; - protected $view, $preferences, @@ -207,7 +196,7 @@ class SitoDisplayStrategy { protected function _loadSites() { - if (static::ORDER_RECENT == $this->getPreference('display_order')) + if (Class_Systeme_ModulesAccueil_Sitotheque::ORDER_RECENT == $this->getPreference('display_order')) return Class_Sitotheque::getLastSitos($this->getPreference('id_categorie'), $this->getPreference('id_items'), null); @@ -230,7 +219,7 @@ class PaginatedStrategy extends SitoDisplayStrategy { $nb_aff = $this->getPreference('nb_aff') ? $this->getPreference('nb_aff') : $this->_getDefaultNbAff(); $sites = $this->_loadSites(); - if (static::ORDER_RANDOM == $this->getPreference('display_order')) + if (Class_Systeme_ModulesAccueil_Sitotheque::ORDER_RANDOM == $this->getPreference('display_order')) shuffle($sites); return @@ -255,7 +244,7 @@ class PaginatedStrategy extends SitoDisplayStrategy { 'id_module' => $this->id_module, 'id_division' => $this->division]; - if (static::ORDER_RANDOM == $this->getPreference('display_order')) + if (Class_Systeme_ModulesAccueil_Sitotheque::ORDER_RANDOM == $this->getPreference('display_order')) return $this->view->tagAnchor($reload_link, '', ['data-ajax-reload' => 'true',