diff --git a/VERSIONS_HOTLINE/137747 b/VERSIONS_HOTLINE/137747 new file mode 100644 index 0000000000000000000000000000000000000000..26eed284fb4191ba43acbed52b47a1a72b18e7a9 --- /dev/null +++ b/VERSIONS_HOTLINE/137747 @@ -0,0 +1 @@ + - ticket #137747 : Performances : Amélioration des performances de l'espace d'administration et du magasin de thèmes \ No newline at end of file diff --git a/application/modules/admin/views/scripts/activity/index.phtml b/application/modules/admin/views/scripts/activity/index.phtml index 274086004b3d88a08e6bc3775683db3ef0bc4921..2c4e665451fc95a21289c20dfeafb9a8716d9821 100644 --- a/application/modules/admin/views/scripts/activity/index.phtml +++ b/application/modules/admin/views/scripts/activity/index.phtml @@ -1,10 +1,10 @@ <?php if ((new ZendAfi_Acl_AdminControllerGroup)->isAllowed(Class_Users::getIdentity(), 'activity', 'add')) - echo $this->Button_New((new Class_Entity()) + echo $this->Button_New((new Class_Button) ->setText($this->_('Ajouter une activité'))); -echo $this->button((new Class_Entity) +echo $this->button((new Class_Button) ->setText($this->_('Exporter les activités de l\'année %s (.csv)', $this->selected_year)) ->setUrl($this->url(['module' => 'admin', diff --git a/application/modules/admin/views/scripts/album/edit-images.phtml b/application/modules/admin/views/scripts/album/edit-images.phtml index 2b1ce288cd56ae8944cc66e017044162c2a97f92..983a0182e3d548f2f65e0abd78846290591c3201 100644 --- a/application/modules/admin/views/scripts/album/edit-images.phtml +++ b/application/modules/admin/views/scripts/album/edit-images.phtml @@ -1,10 +1,8 @@ <?php -$button = (new Class_Entity) - ->setText($this->_('Ajouter un media')) - ->setUrl($this->url(['action' => 'add-ressource', - 'id' => $this->album->getId()])); - -echo $this->button_New($button); +echo $this->button_New((new Class_Button) + ->setText($this->_('Ajouter un media')) + ->setUrl($this->url(['action' => 'add-ressource', + 'id' => $this->album->getId()]))); echo $this->tagUploadMultiple('albumRessourcesUpload', $this->_('Ajouter des medias'), @@ -164,7 +162,7 @@ echo $this->tagUploadMultiple('albumRessourcesUpload', </fieldset> <?php } ?> <?php - echo $this->button_Back((new Class_Entity()) + echo $this->button_Back((new Class_Button) ->setText($this->_('Retour')) ->setUrl($this->url(['controller' => 'album', 'action' => 'index', diff --git a/application/modules/admin/views/scripts/bib/delete.phtml b/application/modules/admin/views/scripts/bib/delete.phtml index 0c5af55ab17c3ac1974d6b89f11ba3aca298419e..688c098a7d2245d1c5db1208bbccff43a96b1308 100644 --- a/application/modules/admin/views/scripts/bib/delete.phtml +++ b/application/modules/admin/views/scripts/bib/delete.phtml @@ -22,11 +22,11 @@ $infos = [ <div class="boutons"> <?php - echo $this->button( - (new Class_Entity())->setText($this->_('Supprimer')) - ->setUrl($this->url(['action' => 'force-delete'])) - ->setImage($this->tagImg(Class_Admin_Skin::current()->getIconUrl('buttons', - 'delete')))); + echo $this->button((new Class_Button) + ->setText($this->_('Supprimer')) + ->setUrl($this->url(['action' => 'force-delete'])) + ->setImage($this->tagImg(Class_Admin_Skin::current()->getIconUrl('buttons', + 'delete')))); echo $this->button_Back(); ?> </div> diff --git a/application/modules/admin/views/scripts/bib/localisations.phtml b/application/modules/admin/views/scripts/bib/localisations.phtml index 6dcbb05b75145bc558ac024e7a0740ab2c6ccc6a..075ac5ffce43d0b0daaf8b9d69eaa191b56803dc 100644 --- a/application/modules/admin/views/scripts/bib/localisations.phtml +++ b/application/modules/admin/views/scripts/bib/localisations.phtml @@ -4,10 +4,10 @@ <?php -echo $this->button_New( - (new Class_Entity())->setText($this->_('Ajouter une localisation')) - ->setUrl($this->url(['action' => 'addlocalisation', - 'id_bib' => $this->id_bib]))); +echo $this->button_New((new Class_Button) + ->setText($this->_('Ajouter une localisation')) + ->setUrl($this->url(['action' => 'addlocalisation', + 'id_bib' => $this->id_bib]))); if($this->localisations) { diff --git a/application/modules/admin/views/scripts/bib/localisationsmaj.phtml b/application/modules/admin/views/scripts/bib/localisationsmaj.phtml index b418c794ee1886bcd7fb6a06647b0b3dd62ce20e..34ff42d69b0c65bb272018f84119b48ca2624d85 100644 --- a/application/modules/admin/views/scripts/bib/localisationsmaj.phtml +++ b/application/modules/admin/views/scripts/bib/localisationsmaj.phtml @@ -188,8 +188,8 @@ Class_ScriptLoader::getInstance()->addTagSelection(); </fieldset> </form> <?php - $back_buttton_settings = (new Class_Entity())->setUrl($this->url(['action' => 'localisations', - 'id_bib' => $this->id_bib])); + $back_buttton_settings = (new Class_Button)->setUrl($this->url(['action' => 'localisations', + 'id_bib' => $this->id_bib])); echo $this->tag('div', $this->button_Submit() . $this->button_Back($back_buttton_settings), ['class' => 'admin-buttons']); diff --git a/application/modules/admin/views/scripts/bib/plans.phtml b/application/modules/admin/views/scripts/bib/plans.phtml index d481ca8f7aa527f77034b2b994f12f7540ac43db..b4ab6c09826801408748069b209e2a44ee5d5883 100644 --- a/application/modules/admin/views/scripts/bib/plans.phtml +++ b/application/modules/admin/views/scripts/bib/plans.phtml @@ -3,7 +3,7 @@ <script type="text/javascript" src="<?php echo URL_ADMIN_JS?>slimbox/autoload_image_simple.js"> </script> <?php -echo $this->Button_New((new Class_Entity()) +echo $this->Button_New((new Class_Button) ->setUrl($this->url(['action' => 'addplan'])) ->setText($this->_('Ajouter un plan'))); ?> diff --git a/application/modules/admin/views/scripts/bib/plansmaj.phtml b/application/modules/admin/views/scripts/bib/plansmaj.phtml index c0b862edfbf4e24e636333d265ea4aca6b3b4ac2..fdd695c6ea31e4b554b350cbdc0157eaa7ca6bf4 100644 --- a/application/modules/admin/views/scripts/bib/plansmaj.phtml +++ b/application/modules/admin/views/scripts/bib/plansmaj.phtml @@ -36,8 +36,8 @@ <table> <tr> <td align="right" style="padding-right:5px;"><?php echo $this->Button_Submit(); ?> </td> - <td align="left" style="padding-left:5px;"> <?php echo $this->Button_Back((new Class_Entity()) - ->setUrl($this->url(['action' => 'plans']))); ?></td> + <td align="left" style="padding-left:5px;"> <?php echo $this->Button_Back((new Class_Button) + ->setUrl($this->url(['action' => 'plans']))); ?></td> </tr> </table> </form> diff --git a/application/modules/admin/views/scripts/bibnum/index.phtml b/application/modules/admin/views/scripts/bibnum/index.phtml index 80b22e8daf2a752ebba92b8316d58cffc7b2e87b..0bcc1a2fe531a04d589013187d8931854f695444 100644 --- a/application/modules/admin/views/scripts/bibnum/index.phtml +++ b/application/modules/admin/views/scripts/bibnum/index.phtml @@ -69,16 +69,16 @@ $datas = json_decode(json_encode($datas)); $label = $this->_('Activé'); $class .= ' enabled'; } - echo $this->button((new Class_Entity) - ->setText($label) - ->setAttribs(['disabled' => 'disabled', - 'onclick' => 'return;', - 'class' => $class])); + echo $this->button((new Class_Button) + ->setText($label) + ->setAttribs(['disabled' => 'disabled', + 'onclick' => 'return;', + 'class' => $class])); if(isset($connector->dashboard_url)) - echo $this->button((new Class_Entity) - ->setUrl($connector->dashboard_url) - ->setText($this->_('Tableau de bord'))); + echo $this->button((new Class_Button) + ->setUrl($connector->dashboard_url) + ->setText($this->_('Tableau de bord'))); ?> </td> </tr> diff --git a/application/modules/admin/views/scripts/catalogue/index.phtml b/application/modules/admin/views/scripts/catalogue/index.phtml index 19c5a9ba7e45f8031d549a625c1e52850f52edd8..e952257b4e8c04406bd379705b61b6b8e1f75498 100644 --- a/application/modules/admin/views/scripts/catalogue/index.phtml +++ b/application/modules/admin/views/scripts/catalogue/index.phtml @@ -4,8 +4,8 @@ Class_ScriptLoader::getInstance()->addSearchInputInPath($this->_('Filtrer les do if (Class_Users::getIdentity()->hasRightAccessDomaines()) { ?> <center> <div align="center"><br> - <?php echo $this->Button_New((new Class_Entity()) - ->setText($this->_('Ajouter un domaine')));?> + <?php echo $this->Button_New((new Class_Button) + ->setText($this->_('Ajouter un domaine')));?> </div> </center> <?php } ?> diff --git a/application/modules/admin/views/scripts/catalogue/tester.phtml b/application/modules/admin/views/scripts/catalogue/tester.phtml index a69b81bf66c507842ae290884ac2c2d82764deeb..12660cff50cd7837c8bb885ab4b79b686af53825 100644 --- a/application/modules/admin/views/scripts/catalogue/tester.phtml +++ b/application/modules/admin/views/scripts/catalogue/tester.phtml @@ -48,14 +48,13 @@ else { true)); if (!$this->isPopup()) - echo $this->button((new Class_Entity()) - ->setText($this->_('Modifier le domaine ')) - ->setAttribs(['title' => $this->_('Modifier le domaine : %s', - $this->catalogue->getLibelle())]) - ->setUrl($this->url(['action' => 'edit', - 'id_catalogue' => $this->catalogue->getId()])) - ->setImage($this->tagImg(Class_Admin_Skin::current() - ->getIconUrl('buttons', 'configuration')))); + echo $this->button((new Class_Button) + ->setText($this->_('Modifier le domaine ')) + ->setTitle($this->_('Modifier le domaine : %s', $this->catalogue->getLibelle())) + ->setUrl($this->url(['action' => 'edit', + 'id_catalogue' => $this->catalogue->getId()])) + ->setImage($this->tagImg(Class_Admin_Skin::current() + ->getIconUrl('buttons', 'configuration')))); } echo $this->pager($this->nb_notices, diff --git a/application/modules/admin/views/scripts/cms/delete.phtml b/application/modules/admin/views/scripts/cms/delete.phtml index 8cb05e5dcffe86fda939593e4c695e615f742e1c..e04c76019c3dfbbec30ae1af24f0851f2c4d918d 100644 --- a/application/modules/admin/views/scripts/cms/delete.phtml +++ b/application/modules/admin/views/scripts/cms/delete.phtml @@ -32,15 +32,15 @@ echo $this->tag('p', $this->_('Toutes les données de l\'article seront effacée echo $this ->tag('div', - $this->Button((new Class_Entity()) - ->setUrl($this->url(['action' => 'force-delete'])) - ->setText($this->_('Supprimer')) - ->setImage($this->tagImg(Class_Admin_Skin::current() - ->getIconUrl('buttons', 'remove')))) - . $this->Button_Back((new Class_Entity()) - ->setUrl($this->url(['module' => 'admin', - 'controller' => 'cms', - 'action' => 'index', - 'id_cat' => $this->model->getIdCat()], - null, true))), + $this->button((new Class_Button) + ->setUrl($this->url(['action' => 'force-delete'])) + ->setText($this->_('Supprimer')) + ->setImage($this->tagImg(Class_Admin_Skin::current() + ->getIconUrl('buttons', 'remove')))) + . $this->Button_Back((new Class_Button) + ->setUrl($this->url(['module' => 'admin', + 'controller' => 'cms', + 'action' => 'index', + 'id_cat' => $this->model->getIdCat()], + null, true))), ['class' => 'boutons']); diff --git a/application/modules/admin/views/scripts/custom-fields-meta/index.phtml b/application/modules/admin/views/scripts/custom-fields-meta/index.phtml index 43e4df5144daabc7ecafca89e10a355b3646adae..1343d79c9852430eb9ad24e384a9ce55aef923f8 100644 --- a/application/modules/admin/views/scripts/custom-fields-meta/index.phtml +++ b/application/modules/admin/views/scripts/custom-fields-meta/index.phtml @@ -1,9 +1,9 @@ <?php -echo $this->Button_Back((new Class_Entity()) +echo $this->Button_Back((new Class_Button) ->setText($this->_('Retour à la liste')) ->setUrl($this->url(['controller' => 'custom-fields']))); -echo $this->Button_New((new Class_Entity()) +echo $this->Button_New((new Class_Button) ->setText($this->_('Nouveau type de champ '))); $indexable_renderer = function($model, $attrib) { diff --git a/application/modules/admin/views/scripts/custom-fields-report/edit.phtml b/application/modules/admin/views/scripts/custom-fields-report/edit.phtml index 92ba235c820ba175f5912c71518d3a1d9281dc36..35d5b2d5e456fba80b69f7ef99e11690409ed03b 100644 --- a/application/modules/admin/views/scripts/custom-fields-report/edit.phtml +++ b/application/modules/admin/views/scripts/custom-fields-report/edit.phtml @@ -1,11 +1,12 @@ <?php +$button = $this->button((new Class_Button) + ->setText($this->_('Générer')) + ->setAttribs(['id' => 'generate']) + ->setImage($this->tagImg(Class_Admin_Skin::current()->getIconUrl('actions', + 'test'), + ['style' => 'filter: invert();']))); echo $this->renderForm($this->form, - ['prepend' => [$this->button( - (new Class_Entity())->setText($this->_('Générer')) - ->setAttribs(['id' => 'generate']) - ->setImage($this->tagImg(Class_Admin_Skin::current()->getIconUrl('actions', - 'test'), - ['style' => 'filter: invert();'])))]]); + ['prepend' => [$button]]); Class_ScriptLoader::getInstance() ->addAdminScript('custom-fields/custom_fields') @@ -26,5 +27,3 @@ $('#menu_itemgenerate a').click(function() { eval($('textarea[name=\"script\"]').val()); }); "); - -?> diff --git a/application/modules/admin/views/scripts/custom-fields-report/index.phtml b/application/modules/admin/views/scripts/custom-fields-report/index.phtml index 1c15a0a2087d1c7efda336b7e7a9b9d56517c638..db75446bf42abd0fafd0bc35bd15fdc794ba9649 100644 --- a/application/modules/admin/views/scripts/custom-fields-report/index.phtml +++ b/application/modules/admin/views/scripts/custom-fields-report/index.phtml @@ -1,6 +1,6 @@ <?php -echo $this->Button_New((new Class_Entity()) +echo $this->Button_New((new Class_Button) ->setText($this->_('Nouveau rapport'))); echo $this->tagModelTable( diff --git a/application/modules/admin/views/scripts/custom-fields/index.phtml b/application/modules/admin/views/scripts/custom-fields/index.phtml index 16df233e50a44fb5f9afd6cad153b664a540c1e2..14705b731b1d4252cd5f4541fd6c0b4bf9eccd99 100644 --- a/application/modules/admin/views/scripts/custom-fields/index.phtml +++ b/application/modules/admin/views/scripts/custom-fields/index.phtml @@ -1,5 +1,5 @@ <?php -echo $this->button((new Class_Entity()) +echo $this->button((new Class_Button) ->setText($this->_('Types de champs personnalisés')) ->setUrl($this->url(['controller' => 'custom-fields-meta'])) ->setImage($this->tagImg(Class_Admin_Skin::current()->getIconUrl('buttons', 'configuration')))); diff --git a/application/modules/admin/views/scripts/drive-checkout/list.phtml b/application/modules/admin/views/scripts/drive-checkout/list.phtml index 1a6acb73cf876f83e370166ddd64f286ad09935a..597f7d656a9193e3c2386305f7ab26d28acc936a 100644 --- a/application/modules/admin/views/scripts/drive-checkout/list.phtml +++ b/application/modules/admin/views/scripts/drive-checkout/list.phtml @@ -1,6 +1,6 @@ <?php $skin = Class_Admin_Skin::current(); -echo $this->Button((new Class_Entity()) +echo $this->Button((new Class_Button) ->setUrl($this->url(['action' => 'items-csv'])) ->setText($this->_('Exporter les documents (.csv)')) ->setImage($this->tagImg($skin->getIconUrl('actions', 'test'), @@ -8,7 +8,7 @@ echo $this->Button((new Class_Entity()) ->setAttribs(['style' => 'float:right'])); -echo $this->Button((new Class_Entity()) +echo $this->Button((new Class_Button) ->setUrl($this->url(['action' => 'list-csv'])) ->setText($this->_('Exporter les rendez-vous (.csv)')) ->setImage($this->tagImg($skin->getIconUrl('actions', 'test'), diff --git a/application/modules/admin/views/scripts/external-agendas/import.phtml b/application/modules/admin/views/scripts/external-agendas/import.phtml index e93eb452d80bb94c25ac58a7c236b732b7145e6d..2e0e4b2b5903e0e2cbdc623effc5d0ea5163285a 100644 --- a/application/modules/admin/views/scripts/external-agendas/import.phtml +++ b/application/modules/admin/views/scripts/external-agendas/import.phtml @@ -1,6 +1,6 @@ <?php -echo $this->Button_Back((new Class_Entity()) +echo $this->Button_Back((new Class_Button) ->setText($this->_('Retour à la liste des agendas')) ->setUrl($this->url(['module' => 'admin', 'controller' => 'external-agendas', diff --git a/application/modules/admin/views/scripts/external-agendas/index.phtml b/application/modules/admin/views/scripts/external-agendas/index.phtml index f5dbe321d1f2770e133d6c9ec4f0d0009c84bbe9..3d12d4e31ee21997737e86c25a1b7394478603cb 100644 --- a/application/modules/admin/views/scripts/external-agendas/index.phtml +++ b/application/modules/admin/views/scripts/external-agendas/index.phtml @@ -1,5 +1,5 @@ <?php -echo $this->Button_New((new Class_Entity()) +echo $this->Button_New((new Class_Button) ->setText($this->_('Ajouter un agenda')) ->setUrl($this->url(['action' => 'add', 'id' => null]))); diff --git a/application/modules/admin/views/scripts/federation-reviews/index.phtml b/application/modules/admin/views/scripts/federation-reviews/index.phtml index cf5402612f183200241c8a2500040cbbebffbaae..430909e1a381ae01d428f79b1ce916d2838813cf 100644 --- a/application/modules/admin/views/scripts/federation-reviews/index.phtml +++ b/application/modules/admin/views/scripts/federation-reviews/index.phtml @@ -7,18 +7,18 @@ $this->disable_onchange = true; $federation_review = Class_FederationReview::getInstance(); echo $federation_review->isDisplayEnabled() - ? $this->Button_Cancel((new Class_Entity()) + ? $this->Button_Cancel((new Class_Button) ->setText($this->_('Désactiver l\'affichage des avis communautaires')) ->setUrl($this->url(['action' => 'disable-display']))) - : $this->Button_New((new Class_Entity()) + : $this->Button_New((new Class_Button) ->setText($this->_('Activer l\'affichage des avis communautaires')) ->setUrl($this->url(['action' => 'enable-display']))); echo $federation_review->isShareEnabled() - ? $this->Button_Cancel((new Class_Entity()) + ? $this->Button_Cancel((new Class_Button) ->setText($this->_('Désactiver l\'envoi des avis de ce portail à la communauté')) ->setUrl($this->url(['action' => 'disable-share']))) - : $this->Button_New((new Class_Entity()) + : $this->Button_New((new Class_Button) ->setText($this->_('Activer l\'envoi des avis de ce portail à la communauté')) ->setUrl($this->url(['action' => 'enable-share']))); diff --git a/application/modules/admin/views/scripts/file-manager/create.phtml b/application/modules/admin/views/scripts/file-manager/create.phtml index fa82045565e6597e61e5fae66470a90f7d6d3f83..64f8d7581fa2655be28e353699211549b38b5bdf 100644 --- a/application/modules/admin/views/scripts/file-manager/create.phtml +++ b/application/modules/admin/views/scripts/file-manager/create.phtml @@ -1,8 +1,9 @@ <?php -$buttons = [$this->Button_Submit((new Class_Entity) +$buttons = [$this->Button_Submit((new Class_Button) ->setText('Créer') ->setTitle($this->_('Créer le nouveau dossier'))), - $this->button((new Class_Entity) + + $this->button((new Class_Button) ->setText('Annuler') ->setTitle($this->_('Ne pas créer de nouveau dossier')) ->setAttribs(['onclick' => 'opacDialogClose();return false;']))]; diff --git a/application/modules/admin/views/scripts/file-manager/delete.phtml b/application/modules/admin/views/scripts/file-manager/delete.phtml index 8722bb6d7a374307c448f01263907eae6f698e51..2489ce517d16bab12d0adfd54839d34b76136020 100644 --- a/application/modules/admin/views/scripts/file-manager/delete.phtml +++ b/application/modules/admin/views/scripts/file-manager/delete.phtml @@ -1,18 +1,22 @@ <?php -$disabled = $this->models ? ['disabled' => 'disabled'] : []; echo $this->FileManager_Models($this->models, $this->tag('p', - $this->_('Vous ne pouvez pas supprimer le fichier "%s" car il est utilisé dans les documents suivants :', $this->item->getPath()), + $this->_('Vous ne pouvez pas supprimer le fichier "%s" car il est utilisé dans les documents suivants :', + $this->item->getPath()), ['class' => 'error'])); -echo $this->button((new Class_Entity) +$disabled = $this->models + ? ['disabled' => 'disabled'] + : []; + +echo $this->button((new Class_Button) ->setText('Supprimer') ->setUrl($this->url(['action' => 'force-delete'])) ->setTitle($this->titre) ->setAttribs(array_merge(['data-popup' => 'true'], $disabled))); -echo $this->button((new Class_Entity) +echo $this->button((new Class_Button) ->setText('Annuler') - ->setAttribs(['onclick' => 'opacDialogClose();return false;', - 'title' => $this->_('Ne rien faire')])); \ No newline at end of file + ->setTitle($this->_('Ne rien faire')) + ->setAttrib('onclick', 'opacDialogClose();return false;')); \ No newline at end of file diff --git a/application/modules/admin/views/scripts/file-manager/drop.phtml b/application/modules/admin/views/scripts/file-manager/drop.phtml index 22bcc524b147accef16dc32552850510d2d1b555..1443bf3f6dc544a2e5da440901a2728c9ba1eaca 100644 --- a/application/modules/admin/views/scripts/file-manager/drop.phtml +++ b/application/modules/admin/views/scripts/file-manager/drop.phtml @@ -1,23 +1,23 @@ <?php -$move_button_attribs = $this->disable_move - ? $move_button_attribs = ['disabled' => 'disabled', - 'title' => $this->_('Rien à déplacer')] - : []; - -echo $this->button((new Class_Entity) +echo $this->button((new Class_Button) ->setText('Copier') ->setUrl($this->url(['action' => 'copy'])) ->setAttribs(['data-popup' => 'true', 'title' => $this->_('Copier %s', $this->titre)])); -echo $this->button((new Class_Entity) +$move_button_attribs = $this->disable_move + ? $move_button_attribs = ['disabled' => 'disabled', + 'title' => $this->_('Rien à déplacer')] + : []; + +echo $this->button((new Class_Button) ->setText('Déplacer') ->setUrl($this->url(['action' => 'move'])) ->setAttribs(array_merge(['data-popup' => 'true', 'title' => $this->_('Déplacer %s', $this->titre)], $move_button_attribs))); -echo $this->button((new Class_Entity) +echo $this->button((new Class_Button) ->setText('Annuler') ->setAttribs(['onclick' => 'opacDialogClose();return false;', 'title' => $this->_('Ne rien faire')])); \ No newline at end of file diff --git a/application/modules/admin/views/scripts/file-manager/import.phtml b/application/modules/admin/views/scripts/file-manager/import.phtml index 43455bdade6829dc7065fa851d07b71ec3196d99..29ea2accb6f974937c2b41d4ffb71f5d4eaa1e0f 100644 --- a/application/modules/admin/views/scripts/file-manager/import.phtml +++ b/application/modules/admin/views/scripts/file-manager/import.phtml @@ -1,8 +1,8 @@ <?php -$buttons = [$this->Button_Submit((new Class_Entity) +$buttons = [$this->Button_Submit((new Class_Button) ->setText('Téléverser') ->setTitle($this->_('Téléverser le fichier'))), - $this->button((new Class_Entity) + $this->button((new Class_Button) ->setText('Annuler') ->setTitle($this->_('Ne rien importer')) ->setAttribs(['onclick' => 'opacDialogClose();return false;']))]; @@ -10,12 +10,12 @@ $buttons = [$this->Button_Submit((new Class_Entity) echo $this->renderForm($this->form, $buttons); foreach($this->dimensions as $dimension) - echo $this->button((new Class_Entity) - ->setText($dimension) - ->setAttribs(['style' => 'display: none;', - 'class' => 'resize_image', - 'onclick' => sprintf("$(this).resizeAndUpload('%s');", $dimension), - 'title' => $this->_('Redimensionner en %s pixels puis téléverser', $dimension)])); + echo $this->button((new Class_Button) + ->setText($dimension) + ->setTitle($this->_('Redimensionner en %s pixels puis téléverser', $dimension)) + ->setAttribs(['style' => 'display: none;', + 'class' => 'resize_image', + 'onclick' => sprintf("$(this).resizeAndUpload('%s');", $dimension)])); echo $this->tag('p', $this->_('Dimensions actuelles de l\'image en pixels: %s', $this->tag('span', null)), diff --git a/application/modules/admin/views/scripts/file-manager/properties.phtml b/application/modules/admin/views/scripts/file-manager/properties.phtml index 4f7d2df4089221344a27369ecdda8ab9b5eebba2..bfb953a174532d26367e511a47b15778fc6d07af 100644 --- a/application/modules/admin/views/scripts/file-manager/properties.phtml +++ b/application/modules/admin/views/scripts/file-manager/properties.phtml @@ -1,6 +1,6 @@ <?php -echo $this->FileManager_File($this->item); -echo $this->button((new Class_Entity) - ->setText('Fermer') - ->setTitle($this->_('Fermer cette fenêtre.')) - ->setAttribs(['onclick' => 'opacDialogClose();return false;'])); +echo $this->FileManager_File($this->item) + . $this->button((new Class_Button) + ->setText('Fermer') + ->setTitle($this->_('Fermer cette fenêtre.')) + ->setAttribs(['onclick' => 'opacDialogClose();return false;'])); diff --git a/application/modules/admin/views/scripts/file-manager/purge.phtml b/application/modules/admin/views/scripts/file-manager/purge.phtml index 5259359dba3bdcdfa378442f00a821b3445eb7b9..77c83a59e1759d8c0bf41fd98bdc9393bd94eacb 100644 --- a/application/modules/admin/views/scripts/file-manager/purge.phtml +++ b/application/modules/admin/views/scripts/file-manager/purge.phtml @@ -1,15 +1,17 @@ <?php -$disabled = $this->models ? ['disabled' => 'disabled'] : []; - echo $this->tag('p', $this->_('Seuls les fichiers non utilisés dans les contenus du site seront supprimés.')); -echo $this->button((new Class_Entity) +$disabled = $this->models + ? ['disabled' => 'disabled'] + : []; + +echo $this->button((new Class_Button) ->setText($this->message) ->setUrl($this->url(['action' => 'force-purge'])) ->setAttribs(array_merge(['data-popup' => 'true'], $disabled))); -echo $this->button((new Class_Entity) +echo $this->button((new Class_Button) ->setText('Annuler') - ->setAttribs(['onclick' => 'opacDialogClose();return false;', - 'title' => $this->_('Ne rien faire')])); + ->setTitle($this->_('Ne rien faire')) + ->setAttrib('onclick', 'opacDialogClose();return false;')); diff --git a/application/modules/admin/views/scripts/file-manager/rename.phtml b/application/modules/admin/views/scripts/file-manager/rename.phtml index 6476f7913a2c3cec84075c18a061f4664e732a6a..78734d89c6180d8acfafd01a7c5df6ae13803f65 100644 --- a/application/modules/admin/views/scripts/file-manager/rename.phtml +++ b/application/modules/admin/views/scripts/file-manager/rename.phtml @@ -1,10 +1,10 @@ <?php -$buttons = [$this->Button_Submit((new Class_Entity) +$buttons = [$this->Button_Submit((new Class_Button) ->setText('Renommer') ->setTitle($this->_('Renommer l\'élément'))), - $this->button((new Class_Entity) + $this->button((new Class_Button) ->setText('Annuler') ->setTitle($this->_('Ne pas renommer et fermer')) ->setAttribs(['onclick' => 'opacDialogClose();return false;']))]; -echo $this->renderForm($this->form, $buttons); \ No newline at end of file +echo $this->renderForm($this->form, $buttons); diff --git a/application/modules/admin/views/scripts/file-manager/resize.phtml b/application/modules/admin/views/scripts/file-manager/resize.phtml index 9de3182039ac070c9e77be063e39d0943f819a9b..901e0b2b51059df66bd6ea10b708dfc6b9200770 100644 --- a/application/modules/admin/views/scripts/file-manager/resize.phtml +++ b/application/modules/admin/views/scripts/file-manager/resize.phtml @@ -3,24 +3,25 @@ echo $this->tag('p', $this->_('Vous pouvez modifier la dimension actuelle qui es $this->item->getDimensions(), $this->item->getSize())); -echo $this->button((new Class_Entity) +echo $this->button((new Class_Button) ->setText('Compresser') + ->setTitle($this->_('Compresser l\'image "%s" en gardant les mêmes dimensions.', + $this->item->getName())) ->setUrl($this->url(['action' => 'compress-image', 'item' => $this->item->getPath()])) - ->setAttribs(['data-popup' => 'true', - 'title' => $this->_('Compresser l\'image "%s" en gardant les mêmes dimensions.', $this->item->getName())])); + ->setAttrib('data-popup', 'true')); foreach($this->dimensions as $dimension) - echo $this->button((new Class_Entity) + echo $this->button((new Class_Button) ->setText($dimension) + ->setTitle($this->_('%s en %s pixels', $this->titre, $dimension)) ->setUrl($this->url(['action' => 'resize-image', 'item' => $this->item->getPath(), 'dimensions' => $dimension])) - ->setAttribs(['data-popup' => 'true', - 'title' => $this->_('%s en %s pixels', $this->titre, $dimension)])); + ->setAttrib('data-popup', 'true')); -echo $this->button((new Class_Entity) +echo $this->button((new Class_Button) ->setText('Non') - ->setAttribs(['onclick' => 'location.reload();return false;', - 'title' => $this->_('Ne rien faire et garder la dimension originale de "%s"', - $this->item->getDimensions())])); + ->setTitle($this->_('Ne rien faire et garder la dimension originale de "%s"', + $this->item->getDimensions())) + ->setAttrib('onclick', 'location.reload();return false;')); diff --git a/application/modules/admin/views/scripts/frbr-link/index.phtml b/application/modules/admin/views/scripts/frbr-link/index.phtml index 946e1288a0b3ac9adfae8264427107f40b79bbf8..e9bb19ab5d9c57ca0ac24c02e7be8ecc6bbda6da 100644 --- a/application/modules/admin/views/scripts/frbr-link/index.phtml +++ b/application/modules/admin/views/scripts/frbr-link/index.phtml @@ -1,11 +1,11 @@ <?php -echo $this->button((new Class_Entity()) +echo $this->button((new Class_Button) ->setText($this->_('Gérer les types de relation')) ->setUrl($this->url(['controller' => 'frbr-linktype'])) - ->setImage($this->tagImg(Class_Admin_Skin::current()->getIconUrl('buttons', - 'configuration')))); + ->setImage($this->tagImg(Class_Admin_Skin::current() + ->getIconUrl('buttons', 'configuration')))); -echo $this->Button_New((new Class_Entity()) +echo $this->Button_New((new Class_Button) ->setText($this->_('Ajouter une relation'))); $label = function ($link, $attrib) { @@ -30,4 +30,3 @@ echo $this->tagModelTable($this->relations, 'link_complete_label' => function($model, $attrib) { return '<pre>' . $model->callGetterByAttributeName($attrib) . '</pre>'; },]); -?> diff --git a/application/modules/admin/views/scripts/frbr-linktype/index.phtml b/application/modules/admin/views/scripts/frbr-linktype/index.phtml index 274934d85670c232545216a4bc5809aa2f03392b..80cf8a3532c47c781a6d808c24e80a75661885a0 100644 --- a/application/modules/admin/views/scripts/frbr-linktype/index.phtml +++ b/application/modules/admin/views/scripts/frbr-linktype/index.phtml @@ -1,9 +1,9 @@ <?php -echo $this->Button_Back((new Class_Entity()) - ->setText($this->_('Retour aux liens')) - ->setUrl($this->url(['controller' => 'frbr-link']))); +echo $this->Button_Back((new Class_Button) + ->setText($this->_('Retour aux liens')) + ->setUrl($this->url(['controller' => 'frbr-link']))); -echo $this->Button_New((new Class_Entity()) +echo $this->Button_New((new Class_Button) ->setText($this->_('Ajouter un type de relation'))); echo $this->tagModelTable($this->relations, diff --git a/application/modules/admin/views/scripts/identity-providers/index.phtml b/application/modules/admin/views/scripts/identity-providers/index.phtml index 887301a9cfbe9ec8849ae116a544717d9c06a8c1..0ff46700631a4d627cb53de06d30998e1294b7b9 100644 --- a/application/modules/admin/views/scripts/identity-providers/index.phtml +++ b/application/modules/admin/views/scripts/identity-providers/index.phtml @@ -1,6 +1,6 @@ <?php -echo $this->Button_New((new Class_Entity()) +echo $this->Button_New((new Class_Button) ->setText($this->_('Ajouter un fournisseur d\'identité'))); echo $this diff --git a/application/modules/admin/views/scripts/lieu/index.phtml b/application/modules/admin/views/scripts/lieu/index.phtml index 8403cfa75cbba711cc670b7adbe2e7dd86826a8c..08d223e9b601612f471c98b421985b3495187d81 100644 --- a/application/modules/admin/views/scripts/lieu/index.phtml +++ b/application/modules/admin/views/scripts/lieu/index.phtml @@ -1,12 +1,11 @@ <?php -echo $this->Button_New((new Class_Entity()) - ->setText($this->_('Créer un lieu'))); +echo $this->Button_New((new Class_Button)->setText($this->_('Créer un lieu'))); -echo $this->button((new Class_Entity()) - ->setText($this->_('Mettre à jour les coordonnées des lieux')) - ->setUrl($this->url(['action' => 'update-coordinates'])) - ->setImage($this->tagImg(Class_Admin_Skin::current()->getIconUrl('buttons', - 'generate')))); +echo $this->button((new Class_Button) + ->setText($this->_('Mettre à jour les coordonnées des lieux')) + ->setUrl($this->url(['action' => 'update-coordinates'])) + ->setImage($this->tagImg(Class_Admin_Skin::current()->getIconUrl('buttons', + 'generate')))); echo $this->renderTable( @@ -22,4 +21,3 @@ echo $this->renderTable( ->addRowAction(['action' => 'edit', 'content' => $this->boutonIco("type=edit")]) ->addRowAction(['action' => 'delete', 'content' => $this->boutonIco("type=del")]), $this->lieux); -?> diff --git a/application/modules/admin/views/scripts/modo/avisnotice.phtml b/application/modules/admin/views/scripts/modo/avisnotice.phtml index ff52530a205c5cc3abcc1ab4ede9db37d7c00c14..062e215c28a78d59dae5b91f17fa72467d621ca5 100644 --- a/application/modules/admin/views/scripts/modo/avisnotice.phtml +++ b/application/modules/admin/views/scripts/modo/avisnotice.phtml @@ -15,7 +15,7 @@ if (!$this->display_all) 'page' => null], $this->_('Afficher tous les avis modérés')); -echo $this->button((new Class_Entity) +echo $this->button((new Class_Button) ->setText($this->_('Gérer les avis orphelins')) ->setUrl($this->url(['action' => 'manage-orphan-reviews', 'active_tab' => null, diff --git a/application/modules/admin/views/scripts/modo/formulaires.phtml b/application/modules/admin/views/scripts/modo/formulaires.phtml index 10eec9a12c70b2e842da80eb8e11f7c96695b868..821fb6d1b658f903c2c6ed6a78a96a0130968dc1 100644 --- a/application/modules/admin/views/scripts/modo/formulaires.phtml +++ b/application/modules/admin/views/scripts/modo/formulaires.phtml @@ -17,13 +17,13 @@ $label = ('all' === $this->liste) ? $this->_('Afficher uniquement les réponses à valider') : $this->_('Afficher toutes les réponses'); -echo $this->button((new Class_Entity) +echo $this->button((new Class_Button) ->setText($label) ->setUrl($this->url($params)) ->setImage($this->tagImg($current_skin->getIconUrl('actions', 'view'), ['style' => 'filter: invert();']))); -echo $this->button((new Class_Entity) +echo $this->button((new Class_Button) ->setText($this->_('Tout exporter au format CSV')) ->setUrl($this->url(['action' => 'export-csv-formulaire', 'id_article' => $id_article, @@ -31,7 +31,7 @@ echo $this->button((new Class_Entity) ->setImage($this->tagImg($current_skin->getIconUrl('actions', 'shopping'), ['style' => 'filter: invert();']))); -echo $this->button((new Class_Entity) +echo $this->button((new Class_Button) ->setText($this->_('Choisir les colonnes à afficher')) ->setUrl($this->url(['module' => 'admin', 'controller' => 'modo', diff --git a/application/modules/admin/views/scripts/modo/manage-orphan-reviews.phtml b/application/modules/admin/views/scripts/modo/manage-orphan-reviews.phtml index b3311916782274dee061977dffe0892ff1d4bf4f..80c0cd61d63802596721ba88829ad144011571af 100644 --- a/application/modules/admin/views/scripts/modo/manage-orphan-reviews.phtml +++ b/application/modules/admin/views/scripts/modo/manage-orphan-reviews.phtml @@ -1,7 +1,7 @@ <?php echo $this->tag('h1', $this->_('Gérer les avis orphelins')); -echo $this->button((new Class_Entity) +echo $this->button((new Class_Button) ->setText($this->_('Resynchroniser les titres pour les avis ayant des notices liées')) ->setUrl($this->url(['action' => 'resync-title-orphan-reviews', 'active_tab' => null, diff --git a/application/modules/admin/views/scripts/multimedia/browse.phtml b/application/modules/admin/views/scripts/multimedia/browse.phtml index fd25ab2110bace0c4c98269fff0c4e0834a28516..0664af77758677bc1a09b577b99e18c562e6853f 100644 --- a/application/modules/admin/views/scripts/multimedia/browse.phtml +++ b/application/modules/admin/views/scripts/multimedia/browse.phtml @@ -4,7 +4,7 @@ if (0 == count($this->devices)) { return; } -echo $this->button((new Class_Entity()) +echo $this->button((new Class_Button) ->setText('Changer d\'affichage') ->setAttribs(['onclick' => '$(this).siblings(\'div.table-view, div.timeline-view\').toggle()'])); @@ -25,6 +25,7 @@ echo $this->tag('div', 'style' => 'display: none']); echo $this->tag('div', - $this->tag('h2', $this->_('Liste des réservations du site "%s"', $this->location->getLibelle())) + $this->tag('h2', $this->_('Liste des réservations du site "%s"', + $this->location->getLibelle())) . $this->tagTimeline($this->holds), ['class' => 'timeline-view']); \ No newline at end of file diff --git a/application/modules/admin/views/scripts/newsletter/edit-subscribers.phtml b/application/modules/admin/views/scripts/newsletter/edit-subscribers.phtml index 11d116719451188b721b6c808251c7fb9513a29d..77184e6282396aa5daa3fe20ae60ac83e9f6aae1 100644 --- a/application/modules/admin/views/scripts/newsletter/edit-subscribers.phtml +++ b/application/modules/admin/views/scripts/newsletter/edit-subscribers.phtml @@ -1,7 +1,7 @@ <?php $skin = Class_Admin_Skin::current(); -echo $this->button((new Class_Entity()) +echo $this->button((new Class_Button) ->setText($this->_('Sélectionner les groupes destinaires')) ->setUrl($this->url(['module' => 'admin', 'controller' => 'newsletter', @@ -11,8 +11,7 @@ echo $this->button((new Class_Entity()) ->setAttribs(['data-popup' => 'true', 'onclick' => '']) ->setImage($this->tagImg(Class_Admin_Skin::current() - ->getIconUrl('actions', - 'add_user'), + ->getIconUrl('actions', 'add_user'), ['style' => 'filter: invert();']))); $build_url = function($action, $controller) { diff --git a/application/modules/admin/views/scripts/newsletter/index.phtml b/application/modules/admin/views/scripts/newsletter/index.phtml index 84c8d933dc3dc54681f4cb475fe57e8fa153312d..d007df5927eeab826b38f599029489ead2705954 100644 --- a/application/modules/admin/views/scripts/newsletter/index.phtml +++ b/application/modules/admin/views/scripts/newsletter/index.phtml @@ -1,5 +1,5 @@ <?php -echo $this->Button_New((new Class_Entity()) +echo $this->Button_New((new Class_Button) ->setText($this->_('Créer une lettre d\'information'))); diff --git a/application/modules/admin/views/scripts/oai/index.phtml b/application/modules/admin/views/scripts/oai/index.phtml index 42b33f692f166b6a41d78733577e49e31a32dc11..3557ceeb9482ba0fa9a8edbc9436a84bffaa8400 100644 --- a/application/modules/admin/views/scripts/oai/index.phtml +++ b/application/modules/admin/views/scripts/oai/index.phtml @@ -1,5 +1,5 @@ <?php -echo $this->Button_New((new Class_Entity()) +echo $this->Button_New((new Class_Button) ->setText($this->_('Ajouter un entrepôt'))); echo $this->tagModelTable($this->entrepots, diff --git a/application/modules/admin/views/scripts/opds/index.phtml b/application/modules/admin/views/scripts/opds/index.phtml index 4c0711196a78770c21b8ce6ba99bb42a0105349b..f251f6db88404643b186a725964025db23317628 100644 --- a/application/modules/admin/views/scripts/opds/index.phtml +++ b/application/modules/admin/views/scripts/opds/index.phtml @@ -1,7 +1,7 @@ <?php if (Class_Users::getIdentity()->isAdmin()) - echo $this->Button_New((new Class_Entity()) - ->setText($this->_('Ajouter un catalogue'))); + echo $this->Button_New((new Class_Button) + ->setText($this->_('Ajouter un catalogue'))); echo $this->tagModelTable($this->catalogs, [$this->_('Libellé'), 'URL'], diff --git a/application/modules/admin/views/scripts/ouvertures/list.phtml b/application/modules/admin/views/scripts/ouvertures/list.phtml index 33001fad8bca608fdfd613fba73bb219dec184b2..d71a539e7ec1d341351c5a1510e8b69066a6ffcd 100644 --- a/application/modules/admin/views/scripts/ouvertures/list.phtml +++ b/application/modules/admin/views/scripts/ouvertures/list.phtml @@ -10,14 +10,14 @@ if ($this->used_for === Class_Ouverture::USED_FOR_DRIVE) $button_text = $this->_('Ajouter une plage d\'ouverture du drive'); -echo $this->button_New( - (new Class_Entity())->setText( $button_text) - ->setUrl($this->url(['action' => 'add', - 'id' => null]))); -echo $this->button_Back( - (new Class_Entity())->setText($this->_('Retour à la liste des bibliothèques')) - ->setUrl($this->url(['module' => 'admin', - 'controller' => 'bib', - 'action' => 'index'], null, true))); +echo $this->button_New((new Class_Button) + ->setText( $button_text) + ->setUrl($this->url(['action' => 'add', + 'id' => null]))); +echo $this->button_Back((new Class_Button) + ->setText($this->_('Retour à la liste des bibliothèques')) + ->setUrl($this->url(['module' => 'admin', + 'controller' => 'bib', + 'action' => 'index'], null, true))); echo $this->libraryOpeningsAdmin($this->library, $this->used_for); diff --git a/application/modules/admin/views/scripts/print/index.phtml b/application/modules/admin/views/scripts/print/index.phtml index 2e5e11bcbb543ba88beb5b6272801683b8857632..2abbc364a509bae671d789580576e6f892309100 100644 --- a/application/modules/admin/views/scripts/print/index.phtml +++ b/application/modules/admin/views/scripts/print/index.phtml @@ -1,13 +1,13 @@ <?php -echo $this->Button_New((new Class_Entity())->setText($this->_('Créer'))); +echo $this->Button_New((new Class_Button)->setText($this->_('Créer'))); -echo $this->button((new Class_Entity()) - ->setImage($this->tagImg(Class_Admin_Skin::current() - ->getIconUrl('buttons', - 'generate'))) - ->setText($this->_('Générer')) - ->setUrl($this->url(['controller' => 'print', - 'action' => 'generate']))); +echo $this->button((new Class_Button) + ->setImage($this->tagImg(Class_Admin_Skin::current() + ->getIconUrl('buttons', + 'generate'))) + ->setText($this->_('Générer')) + ->setUrl($this->url(['controller' => 'print', + 'action' => 'generate']))); echo $this->tagModelTable($this->models, [$this->_('libelle'), @@ -21,4 +21,3 @@ echo $this->tagModelTable($this->models, return $this->renderPluginsActions($model); }], 'model_fusion'); -?> diff --git a/application/modules/admin/views/scripts/profil/index.phtml b/application/modules/admin/views/scripts/profil/index.phtml index c3e02332c68dcc54702333a367e403034fe6c321..6fd2f3f24413e807e5fa770988d6fee50ef98660 100644 --- a/application/modules/admin/views/scripts/profil/index.phtml +++ b/application/modules/admin/views/scripts/profil/index.phtml @@ -5,7 +5,7 @@ print($this->profileSelect('profil',$this->id_zone,$this->id_bib,'zb',0,true)); // Role admin portail -> on peut creer des profils if ($this->can_add_profil) - echo $this->Button_New((new Class_Entity()) + echo $this->Button_New((new Class_Button) ->setText($this->_('Ajouter un profil'))); foreach ($this->profils_by_bib as $bib_libelle => $profils) { ?> diff --git a/application/modules/admin/views/scripts/profil/menusindex.phtml b/application/modules/admin/views/scripts/profil/menusindex.phtml index e2c6a4a28b894b8a665b742b7e7eb26ac34ddb81..a54274502a0871ed02c7441cc76402d9cf71cc93 100644 --- a/application/modules/admin/views/scripts/profil/menusindex.phtml +++ b/application/modules/admin/views/scripts/profil/menusindex.phtml @@ -3,7 +3,7 @@ Class_ScriptLoader::getInstance()->addSearchInputToContent($this->_('Filtrer les echo $this->partial('profil/_profil_panel.phtml', ['profil' => $this->profil]); -echo $this->Button_New((new Class_Entity()) +echo $this->Button_New((new Class_Button) ->setUrl($this->url(['module' => 'admin', 'controller' => 'widget', 'action' => 'add-menu'], null, true)) diff --git a/application/modules/admin/views/scripts/registration/index.phtml b/application/modules/admin/views/scripts/registration/index.phtml index d9d58780b13878b664dabfcee292fa46876f4743..1fd5161e95fc3850b5a2c090e560e9d2c7273643 100644 --- a/application/modules/admin/views/scripts/registration/index.phtml +++ b/application/modules/admin/views/scripts/registration/index.phtml @@ -8,7 +8,8 @@ $description = new Class_TableDescription_Registrations('registration'); echo $this->renderTable($description, $this->registrations); if ($description->hasOneExpired()) - echo $this->button( - (new Class_Entity())->setText($this->_('Supprimer les demandes expirées')) + echo $this->button((new Class_Button) + ->setText($this->_('Supprimer les demandes expirées')) ->setUrl($this->url(['action' => 'delete-expired'])) - ->setImage($this->tagImg(Class_Admin_Skin::current()->getIconUrl('buttons', 'delete')))); + ->setImage($this->tagImg(Class_Admin_Skin::current() + ->getIconUrl('buttons', 'delete')))); diff --git a/application/modules/admin/views/scripts/rendez-vous/index.phtml b/application/modules/admin/views/scripts/rendez-vous/index.phtml index 397b3365eedd2298347f8bc4470959d0dd2eb90b..dee571b2b0a398c62261f6099bbfe0676af8c6b9 100644 --- a/application/modules/admin/views/scripts/rendez-vous/index.phtml +++ b/application/modules/admin/views/scripts/rendez-vous/index.phtml @@ -1,8 +1,8 @@ <?php -echo $this->button_New((new Class_Entity()) +echo $this->button_New((new Class_Button) ->setText($this->_('Ajouter un rendez-vous'))); -echo $this->button_Back((new Class_Entity()) +echo $this->button_Back((new Class_Button) ->setText($this->_('Retour aux agendas')) ->setUrl($this->url(['module' => 'admin', 'controller' => 'usergroup-agenda'], null, true))); diff --git a/application/modules/admin/views/scripts/rss/index.phtml b/application/modules/admin/views/scripts/rss/index.phtml index ee59972a3291f802eeea5f4f626632bfa9b42a0d..eb0d4c05a7ad5df133ab4ca6ed126042d844ecd7 100644 --- a/application/modules/admin/views/scripts/rss/index.phtml +++ b/application/modules/admin/views/scripts/rss/index.phtml @@ -8,9 +8,9 @@ echo $this->profileSelect('rss',$this->id_zone,$this->id_bib,'zb',0,true,false); if(!$this->id_bib) echo ("<br /><p align='center' class='error'>Aucune bibliothèque trouvée dans ce territoire</b></p>"); else echo -$this->Button_New((new Class_Entity()) - ->setText('Ajouter une catégorie') - ->setUrl($this->url(['action' => 'catadd']))); +$this->Button_New((new Class_Button) + ->setText('Ajouter une catégorie') + ->setUrl($this->url(['action' => 'catadd']))); if(!$this->class_rss and $this->id_bib) echo ("<br /><p align='center' class='error'>Aucune catégorie trouvée pour le critères spécifiés.</b></p>"); diff --git a/application/modules/admin/views/scripts/search-form/delete.phtml b/application/modules/admin/views/scripts/search-form/delete.phtml index 646bf2fe45721f5837c0f6a7cb1a6196cef966d1..8bb6f84526d7188f89572a994d07b2acef326194 100644 --- a/application/modules/admin/views/scripts/search-form/delete.phtml +++ b/application/modules/admin/views/scripts/search-form/delete.phtml @@ -5,7 +5,7 @@ echo $this->links->isEmpty() ? ($this->tag('p', $this->_('Ce formulaire peut être supprimé car il n\'est pas utilisé')) . $this->tag('br') . $this->button_Back() - . $this->button((new Class_Entity) + . $this->button((new Class_Button) ->setText($this->_('Supprimer')) ->setImage($this->tagImg(Class_Admin_Skin::current() ->getIconUrl('buttons', 'delete'))) diff --git a/application/modules/admin/views/scripts/search-form/index.phtml b/application/modules/admin/views/scripts/search-form/index.phtml index 2583081c597bdbbd586b6cf7509b0399f5d95fa3..3bb6238f6c5211307a97a445d40ad8f3eac412a6 100644 --- a/application/modules/admin/views/scripts/search-form/index.phtml +++ b/application/modules/admin/views/scripts/search-form/index.phtml @@ -1,5 +1,5 @@ <?php -echo $this->Button_New((new Class_Entity()) +echo $this->Button_New((new Class_Button) ->setText($this->_('Ajouter un formulaire de recherche')) ->setUrl($this->url(['action' => 'add', 'id' => null]))); diff --git a/application/modules/admin/views/scripts/session-activity/linked-article.phtml b/application/modules/admin/views/scripts/session-activity/linked-article.phtml index 691ae64de38f0343343a217394a469d878470bfe..0a6f675ad909d94f5b1e81319473273708e3a4d1 100644 --- a/application/modules/admin/views/scripts/session-activity/linked-article.phtml +++ b/application/modules/admin/views/scripts/session-activity/linked-article.phtml @@ -42,7 +42,7 @@ $description->addRowAction($actions); echo $this->renderTable($description, [$this->article]); -echo $this->Button_Back((new Class_Entity()) +echo $this->Button_Back((new Class_Button) ->setUrl($this->url(['module' => 'admin', 'controller' => 'session-activity', 'action' => 'index', diff --git a/application/modules/admin/views/scripts/systeme/cacheimages.phtml b/application/modules/admin/views/scripts/systeme/cacheimages.phtml index ad7e4072951d5ad00a03a52e06fc72894fb765d6..ffd5a75ce3e9b93547c6d244dbe21b73fc7f7147 100644 --- a/application/modules/admin/views/scripts/systeme/cacheimages.phtml +++ b/application/modules/admin/views/scripts/systeme/cacheimages.phtml @@ -1,5 +1,4 @@ <?php - echo $this->tag('h2', $this->_('Base de données')); echo $this->ligneInfos($this->_('Nombre de vignettes reconnues'), $this->nb_reconnu); echo $this->ligneInfos($this->_('Nombre de vignettes non reconnues'), $this->nb_pas_reconnu); @@ -7,14 +6,17 @@ echo $this->ligneInfos($this->_('Nombre de notices hors cache'), $this->nb_notices-($this->nb_reconnu + $this->nb_pas_reconnu)); echo $this->tag('h2', $this->_('Actions')); -echo $this->button( - (new Class_Entity())->setText($this->_('Vider la totalité du cache')) - ->setUrl($this->url(['mode' => 'reset_all'])) - ->setImage($this->tagImg(Class_Admin_Skin::current()->getIconUrl('actions', 'delete'), - ['style' => 'filter: invert();']))); -echo $this->button( - (new Class_Entity())->setText($this->_('Réinitialiser les vignettes non reconnues')) - ->setUrl($this->url(['mode' => 'reset_no'])) - ->setImage($this->tagImg(Class_Admin_Skin::current()->getIconUrl('buttons', 'generate')))); +echo $this->button((new Class_Button) + ->setText($this->_('Vider la totalité du cache')) + ->setUrl($this->url(['mode' => 'reset_all'])) + ->setImage($this->tagImg(Class_Admin_Skin::current() + ->getIconUrl('actions', 'delete'), + ['style' => 'filter: invert();']))); + +echo $this->button((new Class_Button) + ->setText($this->_('Réinitialiser les vignettes non reconnues')) + ->setUrl($this->url(['mode' => 'reset_no'])) + ->setImage($this->tagImg(Class_Admin_Skin::current() + ->getIconUrl('buttons', 'generate')))); echo $this->Admin_GenerateImageCache(); diff --git a/application/modules/admin/views/scripts/url-manager/index.phtml b/application/modules/admin/views/scripts/url-manager/index.phtml index e6ed63dd0cab3bde06ca3125912a65fca75d7b36..ffc572ee4ed197c3719b87f82813f36704546cd6 100644 --- a/application/modules/admin/views/scripts/url-manager/index.phtml +++ b/application/modules/admin/views/scripts/url-manager/index.phtml @@ -14,19 +14,22 @@ $html = BR, - $this->button((new Class_Entity(['Text' => $this->_('Tester les URL affichées'), - 'Attribs' => ['onclick' => '', - 'id' => 'test_all_http_protocol']]))), + $this->button((new Class_Button) + ->setText($this->_('Tester les URL affichées')) + ->setAttribs(['onclick' => '', + 'id' => 'test_all_http_protocol'])), - $this->button((new Class_Entity(['Text' => $this->_('Sélectionner les URL acceptant le HTTPS'), - 'Attribs' => ['onclick' => '', - 'id' => 'select_all_https_protocol']]))), + $this->button((new Class_Button) + ->setText($this->_('Sélectionner les URL acceptant le HTTPS')) + ->setAttribs(['onclick' => '', + 'id' => 'select_all_https_protocol'])), - $this->button((new Class_Entity(['Text' => $this->_('Mettre à jour les URL selectionnées en HTTPS dans les contenus'), - 'Attribs' => ['onclick' => '', - 'id' => 'convert_all_http_to_https']]))), + $this->button((new Class_Button) + ->setText($this->_('Mettre à jour les URL selectionnées en HTTPS dans les contenus')) + ->setAttribs(['onclick' => '', + 'id' => 'convert_all_http_to_https'])), BR, diff --git a/application/modules/admin/views/scripts/usergroup-agenda/index.phtml b/application/modules/admin/views/scripts/usergroup-agenda/index.phtml index 9638c1e1f6b9e034fe6caa74644448f69eda1c05..49a3b562dba8a0bc578228959166420b5f5912ec 100644 --- a/application/modules/admin/views/scripts/usergroup-agenda/index.phtml +++ b/application/modules/admin/views/scripts/usergroup-agenda/index.phtml @@ -1,8 +1,7 @@ <?php -echo $this->button_New((new Class_Entity()) - ->setText($this->_('Créer un agenda'))); +echo $this->button_New((new Class_Button)->setText($this->_('Créer un agenda'))); -echo $this->button((new Class_Entity()) +echo $this->button((new Class_Button) ->setText($this->_('Tous les rendez-vous')) ->setUrl($this->url(['module' => 'admin', 'controller' => 'usergroup-agenda', diff --git a/application/modules/admin/views/scripts/usergroup/editmembers.phtml b/application/modules/admin/views/scripts/usergroup/editmembers.phtml index 4c183a124b571df3e0658a3fc44b10d4fb7c364a..59225c5a9ae6e5b4a25fe47cb9659c427f37d763 100644 --- a/application/modules/admin/views/scripts/usergroup/editmembers.phtml +++ b/application/modules/admin/views/scripts/usergroup/editmembers.phtml @@ -1,6 +1,5 @@ <?php echo $this->userGroupMemberShip($this->group_id,$this->search, $this->page); -echo $this->Button_Back((new Class_Entity()) +echo $this->Button_Back((new Class_Button) ->setUrl($this->back_url)); -?> diff --git a/application/modules/admin/views/scripts/users/index.phtml b/application/modules/admin/views/scripts/users/index.phtml index 9ff564788b2319a6c37b7522197efa7c1834e452..3e56303f1e16809aad671940d63abd315ece39ea 100644 --- a/application/modules/admin/views/scripts/users/index.phtml +++ b/application/modules/admin/views/scripts/users/index.phtml @@ -1,14 +1,13 @@ <?php if (Class_Users::isCurrentUserAdmin()) - echo $this->Button_New((new Class_Entity()) + echo $this->Button_New((new Class_Button) ->setText($this->_('Ajouter un utilisateur'))); $double_finder = (new Class_User_DbDoubleFinder); $has_double = $double_finder->hasDouble(); -echo $this->button( - (new Class_Entity()) +echo $this->button((new Class_Button) ->setText($this->_('Gérer les doublons')) ->setAttribs($has_double ? ['title' => $this->_('Il y a %s doublons', $double_finder->countDouble())] diff --git a/application/modules/admin/views/scripts/users/manage-double-manual.phtml b/application/modules/admin/views/scripts/users/manage-double-manual.phtml index a9dac65ca9474f5c661077176837203c802bba60..8ffd96a27c830b5dc1c38fede7e5a3acacaae09d 100644 --- a/application/modules/admin/views/scripts/users/manage-double-manual.phtml +++ b/application/modules/admin/views/scripts/users/manage-double-manual.phtml @@ -7,7 +7,7 @@ echo $this->tag('p', $this->tag('small', $this->_('Requête d\'identification des doublons : %s', $this->tag('b', $this->double_manager->getRequest())))); -echo $this->button((new Class_Entity()) - ->setUrl($this->url(['action' => 'manage-double-user', - 'id_user' => $this->double_manager->getFirstDouble()])) +echo $this->button((new Class_Button) + ->setUrl($this->url(['action' => 'manage-double-user', + 'id_user' => $this->double_manager->getFirstDouble()])) ->setText($this->_('Gérer manuellement les doublons'))); diff --git a/application/modules/admin/views/scripts/users/manage-double-user.phtml b/application/modules/admin/views/scripts/users/manage-double-user.phtml index a3a08d8b44df3adc5cdf71db0f4f3b4aed711c82..947a2867768abb4e47b0138bda716708b41f31e7 100644 --- a/application/modules/admin/views/scripts/users/manage-double-user.phtml +++ b/application/modules/admin/views/scripts/users/manage-double-user.phtml @@ -28,7 +28,7 @@ $description = (new Class_TableDescription('double-users')) ->collect('id_user') ->getArrayCopy(); $id_users = array_diff($id_users, [$model->getId()]); - return $this->button((new Class_Entity()) + return $this->button((new Class_Button) ->setUrl($this->url(['module' => 'admin', 'controller' => 'users', 'action' => 'manage-double-merge', @@ -43,7 +43,7 @@ $attribs = []; if ($this->previous == '') $attribs = ['disabled' => 'disabled']; -echo $this->button((new Class_Entity()) +echo $this->button((new Class_Button) ->setUrl($this->url(['module' => 'admin', 'controller' => 'users', 'action' => 'index' @@ -54,7 +54,7 @@ echo $this->button((new Class_Entity()) ['style' => 'filter: invert();'])) ->setText($this->_('Retour à la gestion des utilisateurs'))); -echo $this->button((new Class_Entity()) +echo $this->button((new Class_Button) ->setUrl($this->url(['module' => 'admin', 'controller' => 'users', 'action' => 'manage-double' @@ -65,7 +65,7 @@ echo $this->button((new Class_Entity()) ['style' => 'filter: invert();'])) ->setText($this->_('Retour à la gestion des doublons'))); -echo $this->button((new Class_Entity()) +echo $this->button((new Class_Button) ->setUrl($this->url(['module' => 'admin', 'controller' => 'users', 'action' => 'manage-double-user', @@ -83,7 +83,7 @@ $attribs = []; if ($this->next == '') $attribs = ['disabled' => 'disabled']; -echo $this->button((new Class_Entity()) +echo $this->button((new Class_Button) ->setUrl($this->url(['module' => 'admin', 'controller' => 'users', 'action' => 'manage-double-user', diff --git a/application/modules/admin/views/scripts/users/manage-double.phtml b/application/modules/admin/views/scripts/users/manage-double.phtml index 36d21803f3af86eca94fcc23cb8992ea879ea055..94d18e746e94b33ee93f1a85f21cdbcf82fefcb6 100644 --- a/application/modules/admin/views/scripts/users/manage-double.phtml +++ b/application/modules/admin/views/scripts/users/manage-double.phtml @@ -3,40 +3,37 @@ echo $this->tag('p', $this->_('Vous avez %s comptes abonnés possédant au moins un doublon dans votre base de données.', $this->tag('b', $this->double_manager->countDouble()))); -echo $this->button((new Class_Entity()) +echo $this->button((new Class_Button) ->setUrl($this->url(['module' => 'admin', 'controller' => 'users', 'action' => 'index' ])) ->setImage($this->tagImg(Class_Admin_Skin::current() - ->getIconUrl('actions', - 'back'), + ->getIconUrl('actions', 'back'), ['style' => 'filter: invert();'])) ->setText($this->_('Retour à la gestion des utilisateurs'))); -echo $this->button((new Class_ButtonDescription()) - ->beProgressbar($this, Class_Url::relative('/admin/users/delete-double'), +echo $this->button((new Class_ButtonDescription) + ->beProgressbar($this, + Class_Url::relative('/admin/users/delete-double'), $this->double_manager->countDouble(), $this->_('Lancer le dédoublonnage automatique'))); -echo $this->button((new Class_Entity()) +echo $this->button((new Class_Button) ->setUrl($this->url(['action' => 'manage-double-user', 'id_user' => $this->double_manager->getFirstDouble()])) ->setImage($this->tagImg(Class_Admin_Skin::current() - ->getIconUrl('actions', - 'users'), + ->getIconUrl('actions', 'users'), ['style' => 'filter: invert();'])) ->setText($this->_('Gérer manuellement les doublons'))); -echo $this->button((new Class_Entity()) - ->setAttribs([ - 'onclick' => '$(this).next().toggle();']) +echo $this->button((new Class_Button) + ->setAttribs(['onclick' => '$(this).next().toggle();']) ->setImage($this->tagImg(Class_Admin_Skin::current() - ->getIconUrl('actions', - 'help'), + ->getIconUrl('actions', 'help'), ['style' => 'filter: invert();'])) ->setText($this->_('Voir la requete'))); diff --git a/application/modules/admin/views/scripts/users/mass-delete-run.phtml b/application/modules/admin/views/scripts/users/mass-delete-run.phtml index ec1035177e9c22af357d3f84e5a5f27683c970aa..378411069e1fad1655b0ee8063a1147fd256ae15 100644 --- a/application/modules/admin/views/scripts/users/mass-delete-run.phtml +++ b/application/modules/admin/views/scripts/users/mass-delete-run.phtml @@ -39,7 +39,7 @@ runNext(0); echo $this->tag('br') - . $this->button_Back((new Class_Entity) + . $this->button_Back((new Class_Button) ->setUrl($this->url(['module' => 'admin', 'controller' => 'users', 'action' => 'index'], diff --git a/application/modules/admin/views/scripts/users/mass-delete.phtml b/application/modules/admin/views/scripts/users/mass-delete.phtml index 1e3a3b0285b541c614120b2f671f142952030bac..f396fb13c72c48acf58bad05f3471e427d2ce28a 100644 --- a/application/modules/admin/views/scripts/users/mass-delete.phtml +++ b/application/modules/admin/views/scripts/users/mass-delete.phtml @@ -38,14 +38,14 @@ echo echo $this->tag('br') - . $this->button_Back((new Class_Entity) + . $this->button_Back((new Class_Button) ->setUrl($this->url(['module' => 'admin', 'controller' => 'users', 'action' => 'index'], null, true) . '?' . http_build_query($this->criteria_params))) - . $this->button((new Class_Entity) + . $this->button((new Class_Button) ->setText($this->_('Lancer la suppression')) ->setImage($this->tagImg(Class_Admin_Skin::current() ->getIconUrl('buttons', 'validate'))) diff --git a/application/modules/admin/views/scripts/zone/index.phtml b/application/modules/admin/views/scripts/zone/index.phtml index 32256b6e772202625d484dda06560d33faa4fc6c..66a098198e3c7b24cc15afed9edc31123936aee0 100644 --- a/application/modules/admin/views/scripts/zone/index.phtml +++ b/application/modules/admin/views/scripts/zone/index.phtml @@ -3,7 +3,7 @@ <script type="text/javascript" src="<?php echo URL_ADMIN_JS?>slimbox/autoload_image_simple.js"> </script> <?php -echo $this->Button_New((new Class_Entity()) +echo $this->Button_New((new Class_Button) ->setText($this->_('Ajouter un territoire'))); ?> <br /><table cellpadding="0" cellspacing="0"> diff --git a/application/modules/opac/views/scripts/abonne/delete-review.phtml b/application/modules/opac/views/scripts/abonne/delete-review.phtml index 6e4e52aba21b1fcbcfc583803dbd9ecb79b4c8ad..710a1194e7eef27dce0dacf6d4c8fb29e8465d4d 100644 --- a/application/modules/opac/views/scripts/abonne/delete-review.phtml +++ b/application/modules/opac/views/scripts/abonne/delete-review.phtml @@ -10,9 +10,10 @@ $html = [$this->div(['class' => 'col-10'], $this->div(['class' => 'col-10'], $this->div(['class' => 'm-2 p-2 btn-group text-white'], - $this->Button_Back(new Class_Entity(['Attribs' => ['class' => 'btn btn-info']])) + $this->Button_Back((new Class_Button) + ->setAttrib('class', 'btn btn-info')) . $this->tagAnchor(['delete' => '1'], - $this->_('Oui'), - ['class' => 'btn btn-danger'])))]; + $this->_('Oui'), + ['class' => 'btn btn-danger'])))]; echo $this->grid(implode($html), [], ['class' => 'justify-content-center text-center']); diff --git a/application/modules/opac/views/scripts/abonne/exporter-la-selection.phtml b/application/modules/opac/views/scripts/abonne/exporter-la-selection.phtml index 420feec78b71970396385170561e25c707ec48fc..79f91bbc192128794692c53711d8d614b60af4ad 100644 --- a/application/modules/opac/views/scripts/abonne/exporter-la-selection.phtml +++ b/application/modules/opac/views/scripts/abonne/exporter-la-selection.phtml @@ -1,6 +1,7 @@ <?php -$buttons = [$this->Button_Back(new Class_Entity(['Attribs' => ['class' => 'btn btn-light']])), +$buttons = [$this->Button_Back((new Class_Button) + ->setAttrib('class', 'btn btn-light')), $this->tagAnchor(['format' => 'unimarc', 'render' => null], diff --git a/application/modules/opac/views/scripts/abonne/supprimer-de-la-selection.phtml b/application/modules/opac/views/scripts/abonne/supprimer-de-la-selection.phtml index ce847a17a31345d763d8c5d8e1db3c6fb9d66766..924e2f59f80f07912f362a922983ed48702ef33e 100644 --- a/application/modules/opac/views/scripts/abonne/supprimer-de-la-selection.phtml +++ b/application/modules/opac/views/scripts/abonne/supprimer-de-la-selection.phtml @@ -11,9 +11,10 @@ $html = [$this->div(['class' => 'col-10'], $this->div(['class' => 'col-10'], $this->div(['class' => 'm-2 p-2 btn-group text-white'], - $this->Button_Back(new Class_Entity(['Attribs' => ['class' => 'btn btn-info']])) + $this->Button_Back((new Class_Button) + ->setAttrib('class', 'btn btn-info')) . $this->tagAnchor(['delete' => '1'], - $this->_('Oui'), - ['class' => 'btn btn-danger'])))]; + $this->_('Oui'), + ['class' => 'btn btn-danger'])))]; echo $this->grid(implode($html), [], ['class' => 'justify-content-center text-center']); diff --git a/application/modules/opac/views/scripts/bib-numerique/consult-book.phtml b/application/modules/opac/views/scripts/bib-numerique/consult-book.phtml index 4e78a0ec4ed8eeb5f74e729c0e9fa32d87355050..6c80467ff2dfd8c133dd6ec6dae81e6383fedb28 100644 --- a/application/modules/opac/views/scripts/bib-numerique/consult-book.phtml +++ b/application/modules/opac/views/scripts/bib-numerique/consult-book.phtml @@ -1,14 +1,14 @@ <?php $html = [$this->tag('p', $this->_('Êtes vous sûr de vouloir consulter ce document ?')), - $this->button((new Class_Entity()) - ->setUrl($this->url(['action' => 'consult-book-open-ajax'])) - ->setText($this->_('Oui')) - ->setAttribs(['data-popup' => 'true', - 'class' => 'bouton validate'])), - $this->Button_Back((new Class_Entity()) - ->setUrl($this->url(['controller' => 'recherche', - 'action' => 'viewnotice'])) - ->setAttribs(['title' => $this->_('Non je ne veux pas')]) - ->setText($this->_('Non')))]; + $this->button((new Class_Button) + ->setUrl($this->url(['action' => 'consult-book-open-ajax'])) + ->setText($this->_('Oui')) + ->setAttribs(['data-popup' => 'true', + 'class' => 'bouton validate'])), + $this->Button_Back((new Class_Button) + ->setUrl($this->url(['controller' => 'recherche', + 'action' => 'viewnotice'])) + ->setText($this->_('Non')) + ->setTitle($this->_('Non je ne veux pas')))]; echo $this->tag('div', implode($html), ['class' => 'popup-content']); diff --git a/application/modules/opac/views/scripts/bib/selection.phtml b/application/modules/opac/views/scripts/bib/selection.phtml index e56e98fd6af43b9ecd9670aebf05f78a38b73989..4417c9e16dedc16902712616425c6ccb69107a42 100644 --- a/application/modules/opac/views/scripts/bib/selection.phtml +++ b/application/modules/opac/views/scripts/bib/selection.phtml @@ -4,13 +4,15 @@ $html .= $this->tag('p', $this->_('Vous pouvez sélectionner une ou plusieurs bibliothèques pour effectuer une recherche ')); $form_content = [$this->formHidden('update_bib_select', '1'), - $this->Button_Submit((new Class_Entity())->setText($this->_('Valider la sélection'))), - $this->Button((new Class_Entity())->setText($this->_('Tout cocher')) - ->setAttribs(['class' => 'bouton', - 'onclick' => '$(this).closest(form).find(\'input:checkbox\').prop(\'checked\', true); return false;'])), - $this->Button((new Class_Entity())->setText($this->_('Tout décocher')) - ->setAttribs(['class' => 'bouton', - 'onclick' => '$(this).closest(form).find(\'input:checkbox\').prop(\'checked\', false);return false;']))]; + $this->Button_Submit((new Class_Button)->setText($this->_('Valider la sélection'))), + $this->button((new Class_Button) + ->setText($this->_('Tout cocher')) + ->setAttribs(['class' => 'bouton', + 'onclick' => '$(this).closest(form).find(\'input:checkbox\').prop(\'checked\', true); return false;'])), + $this->button((new Class_Button) + ->setText($this->_('Tout décocher')) + ->setAttribs(['class' => 'bouton', + 'onclick' => '$(this).closest(form).find(\'input:checkbox\').prop(\'checked\', false);return false;']))]; $form_li = ''; @@ -38,4 +40,3 @@ $form = $this->tag('form', implode($form_content), ['name' => 'selection', $html .= $form; echo $this->tag('div', $html, ['class' => 'bib_selection_popup']); -?> diff --git a/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/data-profile/index.phtml b/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/data-profile/index.phtml index fa2d0301bb45c437f33406a0793d65e10f2add39..16501c5a2e4442396a0366c27714135bf8ce2d3e 100644 --- a/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/data-profile/index.phtml +++ b/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/data-profile/index.phtml @@ -1,7 +1,7 @@ <?php echo $this->tag('h1', $this->titre); -echo $this->Button_New((new Class_Entity()) - ->setText($this->_('Ajouter un profil'))); +echo $this->Button_New((new Class_Button) + ->setText($this->_('Ajouter un profil'))); $isUsed = function($model, $attrib) { if(!$labels = $model->getIntegrationLabels()) diff --git a/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/emplacement/index.phtml b/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/emplacement/index.phtml index 4fe9152882a20c6fd6f97a65dddb6a67b51191eb..c0a04cbdf8c9f16058c87d90563afa505509c88a 100644 --- a/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/emplacement/index.phtml +++ b/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/emplacement/index.phtml @@ -1,8 +1,8 @@ <?php echo $this->tag('h1', $this->titre); -echo $this->Button_New((new Class_Entity()) - ->setText($this->_('Ajouter un emplacement'))); +echo $this->Button_New((new Class_Button) + ->setText($this->_('Ajouter un emplacement'))); $description = (new Class_TableDescription('emplacements')) ->addColumn($this->_('libellé'), 'libelle') diff --git a/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/facets/index.phtml b/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/facets/index.phtml index d4f57fbf8891e53a4ba85f7ed01eec471b2d835d..b29ba4c308d49e784972767d2e30d39b010721f4 100644 --- a/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/facets/index.phtml +++ b/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/facets/index.phtml @@ -1,7 +1,7 @@ <?php echo $this->tag('h1', $this->titre); -echo $this->Button_New((new Class_Entity()) - ->setText($this->_('Ajouter une facette dynamique'))); +echo $this->Button_New((new Class_Button) + ->setText($this->_('Ajouter une facette dynamique'))); $description = (new Class_TableDescription('facets')) ->addColumn($this->_('Libellé'), 'libelle') diff --git a/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/genre/index.phtml b/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/genre/index.phtml index 7243564ee52f66f4650490e703ac0d9147a02e87..242b187b963f0f381449ee0c540d593fb45cb059 100644 --- a/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/genre/index.phtml +++ b/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/genre/index.phtml @@ -1,8 +1,8 @@ <?php echo $this->tag('h1', $this->titre); -echo $this->Button_New((new Class_Entity()) - ->setText($this->_('Ajouter un genre'))); +echo $this->Button_New((new Class_Button) + ->setText($this->_('Ajouter un genre'))); echo $this->renderTable(new Class_TableDescription_CosmoCodification('genres'), $this->genres); diff --git a/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/section/index.phtml b/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/section/index.phtml index a7eb9d5c41281ea88c9a978d59db3700e0be3fcc..2fe1249d8bb4a5885df6c96ca8ec90429a3e3820 100644 --- a/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/section/index.phtml +++ b/cosmogramme/cosmozend/application/modules/cosmo/views/scripts/section/index.phtml @@ -1,7 +1,7 @@ <?php echo $this->tag('h1', $this->titre); -echo $this->Button_New((new Class_Entity()) - ->setText($this->_('Ajouter une section'))); +echo $this->Button_New((new Class_Button) + ->setText($this->_('Ajouter une section'))); echo $this->renderTable(new Class_TableDescription_CosmoSection('sections'), $this->sections); diff --git a/library/Class/Button.php b/library/Class/Button.php index 2bf862177f6058489c2591295bf74773f797e90d..66ba7fc0cd5c32f6089e6fa5052d1485aec0ab88 100644 --- a/library/Class/Button.php +++ b/library/Class/Button.php @@ -20,35 +20,147 @@ */ -class Class_Button extends Class_Entity { - +class Class_Button { protected - $_attribs = ['Element' => 'button', - 'Attribs' => []]; + $_element = 'button', + $_text = '', + $_image = '', + $_title = '', + $_url = '', + $_confirm = '', + $_on_form_change = '', + $_disable_popup = false, + $_attribs = []; - public function getAttribs() { - return $this->get('Attribs'); + public function getElement() { + return $this->_element; } - public function setAttribs($button_attribs) { - return $this->set('Attribs', $button_attribs); + public function setElement($element) { + $this->_element = $element; + return $this; } public function getTitle() { - return $this->get('Title'); + return $this->_title; + } + + + public function setTitle($title) { + $this->_title = $title; + return $this; } public function getUrl() { - return $this->get('Url'); + return $this->_url; } - public function getElement() { - return $this->get('Element'); + public function setUrl($url) { + $this->_url = $url; + return $this; + } + + + public function getText() { + return $this->_text; + } + + + public function setText($text) { + $this->_text = $text; + return $this; + } + + + public function getImage() { + return $this->_image; + } + + + public function setImage($image) { + $this->_image = $image; + return $this; + } + + + public function getConfirm() { + return $this->_confirm; + } + + + public function setConfirm($message) { + $this->_confirm = $message; + return $this; + } + + + public function getOnFormChange() { + return $this->_on_form_change; } + + public function setOnFormChange($on_form_change) { + $this->_on_form_change = $on_form_change; + return $this; + } + + + public function getDisablePopup() { + return $this->_disable_popup; + } + + + public function setDisablePopup($flag) { + $this->_disable_popup = (bool) $flag; + return $this; + } + + + public function getAttribs() { + return $this->_attribs; + } + + + public function setAttribs($attribs) { + $this->_attribs = $attribs; + return $this; + } + + + public function getAttrib($name, $default=null) { + return $this->hasAttrib($name) + ? $this->_attribs[$name] + : $default; + } + + + public function setAttrib($name, $value) { + $this->_attribs[$name] = $value; + return $this; + } + + + public function hasAttrib($name) { + return isset($this->_attribs[$name]); + } + + + public function adoptDefaultsFrom($other) { + foreach(['_text', + '_image', + '_title', + '_url', + '_confirm', + '_on_form_change', + '_disable_popup'] as $property) + if (!$this->$property) + $this->$property = $other->$property; + + return $this->setAttribs(array_merge($other->getAttribs(), $this->getAttribs())); + } } diff --git a/library/Class/ButtonDescription.php b/library/Class/ButtonDescription.php index c55089245620a6a5ece5d93cc4b541b3910a7faf..00d2658460c3fa7245bf5cae2109be3071d22441 100644 --- a/library/Class/ButtonDescription.php +++ b/library/Class/ButtonDescription.php @@ -20,9 +20,8 @@ */ -class Class_ButtonDescription extends Class_Entity { +class Class_ButtonDescription extends Class_Button { public function beProgressbar($view, $url, $total, $text) { - Class_ScriptLoader::getInstance()->addAdminScript('progressbar.js'); $id = md5(implode(',',$this->_attribs)); $this->setAttribs([ @@ -35,7 +34,7 @@ class Class_ButtonDescription extends Class_Entity { 'test'), ['style' => 'filter: invert();'])) ->setText($text.$view->tag('span', '')); + return $this; } } -?> \ No newline at end of file diff --git a/library/ZendAfi/Controller/Action/Helper/ListViewMode/Abstract.php b/library/ZendAfi/Controller/Action/Helper/ListViewMode/Abstract.php index 6b3190ec56dd9e8d316443b6aa59c426449a6dc8..6516269fb36e5ca26e4b18c887b332286f2599df 100644 --- a/library/ZendAfi/Controller/Action/Helper/ListViewMode/Abstract.php +++ b/library/ZendAfi/Controller/Action/Helper/ListViewMode/Abstract.php @@ -424,16 +424,16 @@ abstract class ZendAfi_Controller_Action_Helper_ListViewMode_Abstract public function renderSearchFormOn($view) { $form = $this->_getSearchForm($view); $form = $view->renderForm($form, - [$view->button((new Class_Entity()) + [$view->button((new Class_Button) ->setText($this->_form_settings->getSearchText()) + ->setTitle($this->_form_settings->getSearchTitle()) ->setImage($view->tagImg(Class_Admin_Skin::current() ->getIconUrl('actions', 'loupe'), ['style' => 'filter: invert();'])) ->setAttribs(['onclick' => "var form=$(this).parents('form'); if (!form.length) form=$(this).parents('.boutons, .admin-buttons').prevAll('form');if (!form.length) form=$(this).parents('.boutons, .admin-buttons').nextAll('form');form.submit(); return false;", 'type' => 'submit', - 'class' => 'search', - 'title' => $this->_form_settings->getSearchTitle()]))]); + 'class' => 'search']))]); return $view->tag('div', $form, diff --git a/library/ZendAfi/Controller/Plugin/InspectorGadget.php b/library/ZendAfi/Controller/Plugin/InspectorGadget.php index d1a0a4bc6d74f0b7cc46b41436ca1822a5529779..ac2b36bb1f8ef7174724f9df0e8cd9a9bebaa26c 100644 --- a/library/ZendAfi/Controller/Plugin/InspectorGadget.php +++ b/library/ZendAfi/Controller/Plugin/InspectorGadget.php @@ -187,13 +187,13 @@ class ZendAfi_Controller_Plugin_InspectorGadget extends Zend_Controller_Plugin_A $datas['content'] = $this->_view->tag('div', $datas['content'], ['class' => 'inspector-gadget']); - $button = (new Class_Entity) + $button = (new Class_Button) ->setText($label) ->setImage(Class_Admin_Skin::current()->renderActionIconOn('loupe', $this->_view)) - ->setAttribs(['onclick' => 'opacDialogFromData('. $this->_view->escape(json_encode($datas)) .');' - . '$(\'.ig-tabs\').tabs({activate: function(event, ui) {if (ui.newPanel.hasClass(\'ig-accordion\')) ui.newPanel.accordion();}, -create: function(event, ui) { if (ui.panel.hasClass(\'ig-accordion\')) ui.panel.accordion();}});' - ]); + ->setAttrib('onclick', + 'opacDialogFromData('. $this->_view->escape(json_encode($datas)) .');' + . '$(\'.ig-tabs\').tabs({activate: function(event, ui) {if (ui.newPanel.hasClass(\'ig-accordion\')) ui.newPanel.accordion();}, +create: function(event, ui) { if (ui.panel.hasClass(\'ig-accordion\')) ui.panel.accordion();}});'); return $this->_view->Admin_Button($button); } diff --git a/library/ZendAfi/Form/Decorator/AuthorityPicker.php b/library/ZendAfi/Form/Decorator/AuthorityPicker.php index e4c344983f38b69881dd4a9f2be5e02e1cf7cbd8..c95718ad918fa868c8d17440b9d4bc8ab27a2431 100644 --- a/library/ZendAfi/Form/Decorator/AuthorityPicker.php +++ b/library/ZendAfi/Form/Decorator/AuthorityPicker.php @@ -44,11 +44,11 @@ pick_url:' . json_encode($view->url($this->_getParams(), null, true)) .' . $view->tag('span', $this->_element->getRecordLabel(), ['id' => 'authority_subject_selected_value_'.$input_id]) - . $view->button_New((new Class_Entity) + . $view->button_New((new Class_Button) ->setText($this->_element->getPickButtonLabel()) ->setAttribs(['onclick' => 'return false;'])) - . $view->button_Cancel((new Class_Entity) + . $view->button_Cancel((new Class_Button) ->setText($this->_element->getResetButtonLabel()) ->setAttribs(['onclick' => 'return false;'])) diff --git a/library/ZendAfi/Form/Decorator/UserSelection.php b/library/ZendAfi/Form/Decorator/UserSelection.php index 67298fd12c5c3914ef6402df7c49e0b9e8f47bc9..fd51df3bbea0d6f2414c77f7f8fc84b8af5c1048 100644 --- a/library/ZendAfi/Form/Decorator/UserSelection.php +++ b/library/ZendAfi/Form/Decorator/UserSelection.php @@ -56,9 +56,9 @@ delete_message:' . json_encode($this->_element->getDeleteMessage()). '})'); . $view->tag('div', $view->formHidden($this->_element->getName(), $this->_element->getValue()) - . $view->button_New((new Class_Entity) - ->setText($this->_element->getButtonLabel()) - ->setAttribs(['onclick' => 'return false;'])) + . $view->button_New((new Class_Button) + ->setText($this->_element->getButtonLabel()) + ->setAttribs(['onclick' => 'return false;'])) . $view->renderTable($description, $this->_element->getModels()) , diff --git a/library/ZendAfi/View/Helper/Abonne/NewSuggestion.php b/library/ZendAfi/View/Helper/Abonne/NewSuggestion.php index 113d940d22e828ffaf8138642bd7fabb7c654370..cc2acf966c60571bef86659984b5d808aecdebaa 100644 --- a/library/ZendAfi/View/Helper/Abonne/NewSuggestion.php +++ b/library/ZendAfi/View/Helper/Abonne/NewSuggestion.php @@ -27,15 +27,19 @@ class ZendAfi_View_Helper_Abonne_NewSuggestion extends ZendAfi_View_Helper_BaseH $send_form_button = ''; if ($records) { - $html [] = $this->view->tag('p', $this->_('Les documents suivants sont dans le catalogue.')); - $html [] = $this->view->tag('p', $this->_('Votre suggestion en fait-elle partie ?')); + $html [] = $this->_tag('p', $this->_('Les documents suivants sont dans le catalogue.')); + $html [] = $this->_tag('p', $this->_('Votre suggestion en fait-elle partie ?')); - $html [] = $this->view->button(new Class_Entity(['Text' => $this->_('Oui'), - 'Url' => $this->view->url(['action' => 'suggestion-achat']), - 'Attribs' => ['title' => $this->_('Annuler et revenir à la liste des suggestions.')]])); - $send_form_button = new Class_Entity(['Text' => $this->_('Non'), - 'Attribs' => ['title' => $this->_('Envoyer la suggestion'), - 'onclick' => "var form = $('#suggestion'); form.attr('action', form.attr('action') + '?validate_suggestion=1'); $('#submit').click();"]]); + $html [] = $this->view + ->button((new Class_Button) + ->setText($this->_('Oui')) + ->setUrl($this->view->url(['action' => 'suggestion-achat'])) + ->setTitle($this->_('Annuler et revenir à la liste des suggestions.'))); + + $send_form_button = (new Class_Button) + ->setText($this->_('Non')) + ->setTitle($this->_('Envoyer la suggestion')) + ->setAttrib('onclick', "var form = $('#suggestion'); form.attr('action', form.attr('action') + '?validate_suggestion=1'); $('#submit').click();"); $html [] = $this->view->button($send_form_button); diff --git a/library/ZendAfi/View/Helper/Admin/Button.php b/library/ZendAfi/View/Helper/Admin/Button.php index 32662d2cd536910520ca6dda471ed4cb5ca03b3a..f98d6cc8a393a1be759e23ce070d67bc5f978032 100644 --- a/library/ZendAfi/View/Helper/Admin/Button.php +++ b/library/ZendAfi/View/Helper/Admin/Button.php @@ -27,7 +27,7 @@ class ZendAfi_View_Helper_Admin_Button extends ZendAfi_View_Helper_Button { public function button($button) { - if(!$button) + if (!$button) return ''; Class_Admin_Skin::current()->renderButtonCssOn(Class_ScriptLoader::getInstance()); @@ -38,37 +38,33 @@ class ZendAfi_View_Helper_Admin_Button extends ZendAfi_View_Helper_Button { protected function _setDefaultAttribs($button) { parent::_setDefaultAttribs($button); - if(!isset($button->getAttribs()['class'])) - $button->setAttribs(array_merge($button->getAttribs(), - ['class' => ''])); + $button->setAttrib('class', + $button->getAttrib('class', '') . ' admin-button'); - $button->setAttribs(array_merge($button->getAttribs(), - ['title' => $button->getTitle() ? $button->getTitle() : (isset($button->getAttribs()['title']) ? $button->getAttribs()['title'] : ''), - 'class' => $button->getAttribs()['class'] . ' admin-button'])); return $this; } protected function _injectJavascript($button) { - if(!$callback = $button->getOnFormChange()) + if (!$callback = $button->getOnFormChange()) return $this; - if(isset($button->getAttribs()['onclick'])) - $button->setAttribs(array_merge($button->getAttribs(), - ['data-script' => $button->getAttribs()['onclick']])); + if ($button->hasAttrib('onclick')) + $button->setAttrib('data-script', $button->getAttribs('onclick')); Class_ScriptLoader::getInstance() ->onFormChangeDo($this->_getIdentifier($button), $callback); + return $this; } protected function _getIdentifier($button) { - if(isset($button->getAttribs()['id'])) - return '#' . $button->getAttribs()['id']; + if ($button->hasAttrib('id')) + return '#' . $button->getAttrib('id'); - if(isset($button->getAttribs()['class'])) - return str_replace('..', '.', ('.' . str_replace(' ', '.', $button->getAttribs()['class']))); + if ($button->hasAttrib('class')) + return str_replace('..', '.', ('.' . str_replace(' ', '.', $button->getAttrib('class')))); return $button->getElement(); } diff --git a/library/ZendAfi/View/Helper/Admin/FileManager.php b/library/ZendAfi/View/Helper/Admin/FileManager.php index 61b6d73b752153ca95f3f8463261b39abef5dfdd..67bed77302ac19c94421c8216852319d095d92ac 100644 --- a/library/ZendAfi/View/Helper/Admin/FileManager.php +++ b/library/ZendAfi/View/Helper/Admin/FileManager.php @@ -95,7 +95,7 @@ class ZendAfi_View_Helper_Admin_FileManager extends ZendAfi_View_Helper_BaseHelp 'controller' => 'file-manager'], ($this->view->isPopup() ? ['render' => 'popup'] : [])), null, true); - return $this->view->button((new Class_Entity) + return $this->view->button((new Class_Button) ->setText($this->_tag('i', '', ['class' => 'fa fa-home'])) ->setTitle($this->_('Retourner à l\'état original de l\'explorateur.')) ->setUrl($url)); @@ -104,19 +104,22 @@ class ZendAfi_View_Helper_Admin_FileManager extends ZendAfi_View_Helper_BaseHelp protected function _displayMode($item, $key, $settings) { $function = 'getDisplayMode' . Storm_Inflector::camelize($key); - if('wall' == $settings->{$function}()) - return $this->view->button((new Class_Entity) - ->setText($this->_tag('i', '', ['class' => 'fa fa-th-list'])) - ->setTitle($this->_('Afficher en mode détaillé les éléments de la fenêtre d\'exploration sélectionnée')) - ->setAttribs($key == $settings->getFocusedBrowser() ? [] : ['disabled' => 'disabled']) - ->setUrl($this->view->url(['display_mode_' . $key => 'details']))); - - return - $this->view->button((new Class_Entity) - ->setText($this->_tag('i', '', ['class' => 'fa fa-th'])) - ->setTitle($this->_('Afficher en mode mur les éléments de la fenêtre d\'exploration sélectionnée')) - ->setAttribs($key == $settings->getFocusedBrowser() ? [] : ['disabled' => 'disabled']) - ->setUrl($this->view->url(['display_mode_' . $key => 'wall']))); + if ('wall' == call_user_func([$settings, $function])) + return $this->view + ->button((new Class_Button) + ->setText($this->_tag('i', '', ['class' => 'fa fa-th-list'])) + ->setTitle($this->_('Afficher en mode détaillé les éléments de la fenêtre d\'exploration sélectionnée')) + ->setUrl($this->view->url(['display_mode_' . $key => 'details'])) + ->setAttribs($key == $settings->getFocusedBrowser() + ? [] + : ['disabled' => 'disabled'])); + + return $this->view + ->button((new Class_Button) + ->setText($this->_tag('i', '', ['class' => 'fa fa-th'])) + ->setTitle($this->_('Afficher en mode mur les éléments de la fenêtre d\'exploration sélectionnée')) + ->setUrl($this->view->url(['display_mode_' . $key => 'wall'])) + ->setAttribs($key == $settings->getFocusedBrowser() ? [] : ['disabled' => 'disabled'])); } @@ -135,7 +138,7 @@ class ZendAfi_View_Helper_Admin_FileManager extends ZendAfi_View_Helper_BaseHelp ? $this->view->url(['full_screen' => 0]) : $this->view->url(['full_screen' => 1]); - return $this->view->button((new Class_Entity) + return $this->view->button((new Class_Button) ->setText($text) ->setTitle($this->_('Agrandir ou réduire la taille de l\'explorateur')) ->setUrl($url)); @@ -155,10 +158,11 @@ class ZendAfi_View_Helper_Admin_FileManager extends ZendAfi_View_Helper_BaseHelp : $this->view->url(['splitted_browser' => $settings->getBrowser(), 'search_splitted_browser' => $settings->getSearchBrowser()]); - return $this->view->button((new Class_Entity) - ->setText($text) - ->setTitle($this->_('Scinder ou souder la fenêtre d\'exploration sélectionnée')) - ->setUrl($url)); + return $this->view + ->button((new Class_Button) + ->setText($text) + ->setTitle($this->_('Scinder ou souder la fenêtre d\'exploration sélectionnée')) + ->setUrl($url)); } @@ -446,19 +450,21 @@ class ZendAfi_View_Helper_Admin_FileManager extends ZendAfi_View_Helper_BaseHelp ? sprintf("var value = encodeURIComponent($(this).closest('div').find('input').val());opacDialogFromUrl(addPath('%s=' + value, '&render=popup'));", $this->_escapeJsAttrib($url)) : sprintf("var value = encodeURIComponent($(this).closest('div').find('input').val());document.location = '%s=' + value;", $this->_escapeJsAttrib($url)); + $search_button = (new Class_Button) + ->setText($this->_tag('i', '', ['class' => 'fa fa-search'])) + ->setTitle($this->_('Rechercher le terme saisi')) + ->setAttribs(array_merge(['onclick' => $onclick], + ($key == $settings->getFocusedBrowser() + ? [] + : ['disabled' => 'disabled']))); + return $this->_tag('input', null, ['type' => 'text', 'value' => $term, 'placeholder' => $term ? $term : $this->_('Rechercher dans "%s"', $item->getPath()), 'name' => 'search_' . $key, - 'onkeypress' => sprintf('if (event.keyCode==13) {%s}', $onclick)]) . - - $this->view->button((new Class_Entity) - ->setText($this->_tag('i', '', ['class' => 'fa fa-search'])) - ->setTitle($this->_('Rechercher le terme saisie')) - ->setAttribs(array_merge( - ['onclick' => $onclick], - $key == $settings->getFocusedBrowser() ? [] : ['disabled' => 'disabled']))); + 'onkeypress' => sprintf('if (event.keyCode==13) {%s}', $onclick)]) + . $this->view->button($search_button); } } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Admin/FrontNav.php b/library/ZendAfi/View/Helper/Admin/FrontNav.php index 733efc2f3e5a5be120b05e80db136415fa04b9d1..68ffa7b55ef9f6cbaa370df232c3ebfe15ddd0ae 100644 --- a/library/ZendAfi/View/Helper/Admin/FrontNav.php +++ b/library/ZendAfi/View/Helper/Admin/FrontNav.php @@ -33,7 +33,7 @@ class ZendAfi_View_Helper_Admin_FrontNav extends ZendAfi_View_Helper_BaseHelper $instance->addJQueryReady('$("#site_web_wrapper").mousedown(function() {$(".menu_admin_front").addClass("hidden");});'); - $html = [$this->view->Admin_Button((new Class_Entity()) + $html = [$this->view->Admin_Button((new Class_Button) ->setText($this->_('Administration')) ->setImage($this->view->tagImg(Class_Admin_Skin::current() ->getIconUrl('buttons', diff --git a/library/ZendAfi/View/Helper/Admin/GenerateImageCache.php b/library/ZendAfi/View/Helper/Admin/GenerateImageCache.php index ad2c03e13ce50a6c29c7811580b189619eebdbd8..caa6890734887b8594390b5e538496e20a195215 100644 --- a/library/ZendAfi/View/Helper/Admin/GenerateImageCache.php +++ b/library/ZendAfi/View/Helper/Admin/GenerateImageCache.php @@ -29,10 +29,11 @@ class ZendAfi_View_Helper_Admin_GenerateImageCache extends ZendAfi_View_Helper_B : ''); return - $this->view->button( - (new Class_Entity())->setText($this->_('Générer les vignettes')) - ->setAttribs(['onclick' => $onclick]) - ->setImage($this->view->tagImg(Class_Admin_Skin::current()->getIconUrl('actions', 'down'), + $this->view->button((new Class_Button) + ->setText($this->_('Générer les vignettes')) + ->setAttrib('onclick', $onclick) + ->setImage($this->view->tagImg(Class_Admin_Skin::current() + ->getIconUrl('actions', 'down'), ['style' => 'filter: invert();']))) . $this->_tag('div', diff --git a/library/ZendAfi/View/Helper/Admin/GroupsPermissions.php b/library/ZendAfi/View/Helper/Admin/GroupsPermissions.php index 4d46c510dea7a124d251edc4f8215e58ee3f0b3e..5725e45c40efc2764faebf94ccefa572b2348a3b 100644 --- a/library/ZendAfi/View/Helper/Admin/GroupsPermissions.php +++ b/library/ZendAfi/View/Helper/Admin/GroupsPermissions.php @@ -38,7 +38,7 @@ class ZendAfi_View_Helper_Admin_GroupsPermissions extends Zend_View_Helper_Abstr . $this->tag('tbody', $this->permissionsRows($model, $permissions, $groups)), ['style' => 'border-collapse:collapse;margin-bottom:15px;']) - . $this->view->Button_Submit((new Class_Entity()) + . $this->view->Button_Submit((new Class_Button) ->setText($this->_('Valider les permissions'))), ['action' => $action, 'method' => 'post']); diff --git a/library/ZendAfi/View/Helper/Admin/Libraries.php b/library/ZendAfi/View/Helper/Admin/Libraries.php index 1f28e62ecab7f16f621292b13d06389dbf8eaa26..57c24362c65280ad917adbbb2b6751a2888c0403 100644 --- a/library/ZendAfi/View/Helper/Admin/Libraries.php +++ b/library/ZendAfi/View/Helper/Admin/Libraries.php @@ -40,7 +40,7 @@ class ZendAfi_View_Helper_Admin_Libraries extends ZendAfi_View_Helper_BaseHelper return ''; return $this->view->profileSelect('bib', $id_zone, $id_bib, 'z') - . $this->view->Button_New((new Class_Entity())->setText($this->_('Ajouter une bibliothèque'))); + . $this->view->Button_New((new Class_Button)->setText($this->_('Ajouter une bibliothèque'))); } } ?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Admin/RenderVersionForm.php b/library/ZendAfi/View/Helper/Admin/RenderVersionForm.php index b84f3d39a101f2a6adafe51001f791f769f1b52a..bc41e42c2ed11d0d1fb868eca2d446dd807697f9 100644 --- a/library/ZendAfi/View/Helper/Admin/RenderVersionForm.php +++ b/library/ZendAfi/View/Helper/Admin/RenderVersionForm.php @@ -79,12 +79,12 @@ $('#" . $form->getId() . "').find('fieldset').each(function(i, elem) { protected function _prevButton() { - $back = (new Class_Entity()) + $back = (new Class_Button) ->setText($this->_('Précédente')) ->setImage($this->view->tagImg(Class_Admin_Skin::current() ->getIconUrl('buttons', 'left'))) - ->setAttribs(['disabled' => 'disabled', - 'title' => $this->_('Pas de version précédente')]); + ->setTitle($this->_('Pas de version précédente')) + ->setAttrib('disabled', 'disabled'); if ($previous = $this->_version->previous()) { $back @@ -94,17 +94,17 @@ $('#" . $form->getId() . "').find('fieldset').each(function(i, elem) { : []); } - return $this->view->Button($back); + return $this->view->button($back); } protected function _nextButton() { - $forward = (new Class_Entity()) + $forward = (new Class_Button) ->setText($this->_('Suivante')) ->setImage($this->view->tagImg(Class_Admin_Skin::current() ->getIconUrl('buttons', 'right'))) - ->setAttribs(['disabled' => 'disabled', - 'title' => $this->_('Pas de version suivante')]); + ->setTitle($this->_('Pas de version suivante')) + ->setAttrib('disabled', 'disabled'); if ($next = $this->_version->next()) $forward @@ -113,22 +113,21 @@ $('#" . $form->getId() . "').find('fieldset').each(function(i, elem) { ? ['onclick' => 'opacDialogFromUrl(\''.$forward->getUrl().'\'); return false;'] : []); - return $this->view->Button($forward); + return $this->view->button($forward); } protected function _listButton($form) { - $list = (new Class_Entity()) + $list = (new Class_Button) ->setUrl($this->view->url(['key' => null, 'action' => 'versions'])) ->setText($this->_('Liste complète')) - ->setImage($this->view->tagImg(Class_Admin_Skin::current() - ->getIconUrl('actions', 'liste'), + ->setImage($this->view->tagImg(Class_Admin_Skin::current()->getIconUrl('actions', 'liste'), ['style' => 'filter: invert();'])); if ($this->view->isPopup()) - $list->setAttribs(['onclick' => 'opacDialogFromUrl(\''.$list->getUrl().'\'); return false;']); + $list->setAttrib('onclick', 'opacDialogFromUrl(\''.$list->getUrl().'\'); return false;'); - return $this->view->Button($list); + return $this->view->button($list); } @@ -136,16 +135,16 @@ $('#" . $form->getId() . "').find('fieldset').each(function(i, elem) { $url = $this->view->url(['key' => $this->_version->getId(), 'action' => 'version-apply']); - $apply = (new Class_Entity()) + $apply = (new Class_Button) ->setText($this->_('Rétablir')) - ->setImage($this->view->tagImg(Class_Admin_Skin::current() - ->getIconUrl('actions', 'rollback'), + ->setImage($this->view->tagImg(Class_Admin_Skin::current()->getIconUrl('actions', 'rollback'), ['style' => 'filter: invert();'])); if (!$this->_isModified()) { - $apply->setAttribs(['disabled' => 'disabled', - 'title' => $this->_('Aucune différence avec les donnnées actuelles')]); - return $this->view->Button($apply); + $apply->setTitle($this->_('Aucune différence avec les donnnées actuelles')) + ->setAttrib('disabled', 'disabled'); + + return $this->view->button($apply); } $apply @@ -153,7 +152,7 @@ $('#" . $form->getId() . "').find('fieldset').each(function(i, elem) { ->setConfirm($this->_('Êtes-vous sur de vouloir rétablir cette version ?')) ; - return $this->view->Button($apply); + return $this->view->button($apply); } @@ -161,13 +160,13 @@ $('#" . $form->getId() . "').find('fieldset').each(function(i, elem) { $url = $this->view->url(['key' => $this->_version->getId(), 'action' => 'version-delete']); - $delete = (new Class_Entity()) + $delete = (new Class_Button()) ->setText($this->_('Supprimer')) ->setUrl($url) ->setConfirm($this->_('Êtes-vous sur de vouloir supprimer cette version de l\\\'historique ?')) ->setImage($this->view->tagImg(Class_Admin_Skin::current() ->getIconUrl('buttons', 'remove'))); - return $this->view->Button($delete); + return $this->view->button($delete); } } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Admin/SearchPnb.php b/library/ZendAfi/View/Helper/Admin/SearchPnb.php index c32e793000492da0e52ce5f557d3c3111800e565..8a1bdd038e871824c45d0d8e4ef2dd102c481d05 100644 --- a/library/ZendAfi/View/Helper/Admin/SearchPnb.php +++ b/library/ZendAfi/View/Helper/Admin/SearchPnb.php @@ -32,20 +32,22 @@ class ZendAfi_View_Helper_Admin_SearchPnb extends ZendAfi_View_Helper_Admin_Sear protected function _headerLine() { - $export_button = $this->view->button((new Class_Entity()) - ->setText($this->_('Exporter le tableau en CSV')) - - ->setUrl($this->view->url(['module' => 'admin', - 'controller' => 'pnb', - 'action' => 'export-csv'], - null, true) - . '?' - . http_build_query(array_filter($this->_context->getParams()))) - ->setImage($this->view->tagImg(Class_Admin_Skin::current() - ->getIconUrl('actions', - 'test'), - ['style' => 'filter: invert();'])) - ->setAttribs(['style' => 'vertical-align: middle;'])); + $export_button = $this->view + ->button((new Class_Button) + ->setText($this->_('Exporter le tableau en CSV')) + + ->setUrl($this->view->url(['module' => 'admin', + 'controller' => 'pnb', + 'action' => 'export-csv'], + null, true) + . '?' + . http_build_query(array_filter($this->_context->getParams()))) + + ->setImage($this->view->tagImg(Class_Admin_Skin::current() + ->getIconUrl('actions', + 'test'), + ['style' => 'filter: invert();'])) + ->setAttribs(['style' => 'vertical-align: middle;'])); return $this->_tag('p', $this->_resultMessage($this->_context->getTotal()) . $export_button); diff --git a/library/ZendAfi/View/Helper/Admin/SearchPnbLoans.php b/library/ZendAfi/View/Helper/Admin/SearchPnbLoans.php index ff91a1b87a9970763ac36b239f42c368c3f381a0..1e7b06654ec7b8a0f55ebeae776839a15262cd9d 100644 --- a/library/ZendAfi/View/Helper/Admin/SearchPnbLoans.php +++ b/library/ZendAfi/View/Helper/Admin/SearchPnbLoans.php @@ -31,22 +31,23 @@ class ZendAfi_View_Helper_Admin_SearchPnbLoans extends ZendAfi_View_Helper_Admin } - protected function _headerLine() { - $export_button = $this->view->button((new Class_Entity()) - ->setText($this->_('Exporter le tableau en CSV')) - - ->setUrl($this->view->url(['module' => 'admin', - 'controller' => 'pnb', - 'action' => 'export-loans-csv'], - null, true) - . '?' - . http_build_query(array_filter($this->_context->getParams()))) - ->setImage($this->view->tagImg(Class_Admin_Skin::current() - ->getIconUrl('actions', - 'test'), - ['style' => 'filter: invert();'])) - ->setAttribs(['style' => 'vertical-align: middle;'])); + $export_button = $this->view + ->button((new Class_Button) + ->setText($this->_('Exporter le tableau en CSV')) + + ->setUrl($this->view->url(['module' => 'admin', + 'controller' => 'pnb', + 'action' => 'export-loans-csv'], + null, true) + . '?' + . http_build_query(array_filter($this->_context->getParams()))) + + ->setImage($this->view->tagImg(Class_Admin_Skin::current() + ->getIconUrl('actions', + 'test'), + ['style' => 'filter: invert();'])) + ->setAttribs(['style' => 'vertical-align: middle;'])); return $this->_tag('p', $this->_resultMessage($this->_context->getTotal()) . $export_button); diff --git a/library/ZendAfi/View/Helper/Admin/SearchRendezVous.php b/library/ZendAfi/View/Helper/Admin/SearchRendezVous.php index 5e53665ca7d895108975d67f647334d5489a0c69..c1fa9abcd69c09d05fcfa1efec1fcdc6affaf98d 100644 --- a/library/ZendAfi/View/Helper/Admin/SearchRendezVous.php +++ b/library/ZendAfi/View/Helper/Admin/SearchRendezVous.php @@ -38,7 +38,7 @@ class ZendAfi_View_Helper_Admin_SearchRendezVous return parent::_headerLine(); - $export = $this->view->button((new Class_Entity()) + $export = $this->view->button((new Class_Button) ->setText($this->_('Exporter cette liste')) ->setUrl($this->view->url(['module' => 'admin', 'controller' => 'usergroup-agenda', @@ -49,7 +49,7 @@ class ZendAfi_View_Helper_Admin_SearchRendezVous ->getIconUrl('buttons', 'export'), ['style' => 'filter: invert();'])) - ->setAttribs(['style' => 'vertical-align: middle;'])); + ->setAttrib('style', 'vertical-align: middle;')); return $this->_tag('p', $this->_resultMessage($total) . $export); } diff --git a/library/ZendAfi/View/Helper/Admin/SearchUsers.php b/library/ZendAfi/View/Helper/Admin/SearchUsers.php index 8958980357ffb767affbe30c9303038f8ed267c3..6c3d1a134dab2e367617743f57f2659a42d4e042 100644 --- a/library/ZendAfi/View/Helper/Admin/SearchUsers.php +++ b/library/ZendAfi/View/Helper/Admin/SearchUsers.php @@ -41,7 +41,7 @@ class ZendAfi_View_Helper_Admin_SearchUsers $total = $this->_context->getTotal(); $mass_delete = 1 < $total && Class_Users::isCurrentUserAdmin() - ? $this->view->button((new Class_Entity()) + ? $this->view->button((new Class_Button) ->setText($this->_('Supprimer ces utilisateurs ...')) ->setUrl($this->view->url(['module' => 'admin', 'controller' => 'users', @@ -52,7 +52,7 @@ class ZendAfi_View_Helper_Admin_SearchUsers ->getIconUrl('buttons', 'delete'), ['style' => 'filter: invert();'])) - ->setAttribs(['style' => 'vertical-align: middle;'])) + ->setAttrib('style', 'vertical-align: middle;')) : ''; return $this->_tag('p', $this->_resultMessage($total) . $mass_delete); diff --git a/library/ZendAfi/View/Helper/Admin/UpdateSkins.php b/library/ZendAfi/View/Helper/Admin/UpdateSkins.php index f530f47175408aca7d5ea3caaae95e8b5813d63a..a6a1c1b84fbb216ad7bdd47336497cb4ce36cbc9 100644 --- a/library/ZendAfi/View/Helper/Admin/UpdateSkins.php +++ b/library/ZendAfi/View/Helper/Admin/UpdateSkins.php @@ -24,7 +24,6 @@ class ZendAfi_View_Helper_Admin_UpdateSkins extends ZendAfi_View_Helper_BaseHelp public function Admin_UpdateSkins($reader) { $skins = $reader->getUpdatableSkins(); - $html = $this->_tag('p', $this->_('Cette fonctionnalité nécessite la mise en place d\'une tâche planifiée sur le serveur d\'hébergement pour fonctionner.')); if (Class_Users::isCurrentUserSuperAdmin()) @@ -37,7 +36,7 @@ class ZendAfi_View_Helper_Admin_UpdateSkins extends ZendAfi_View_Helper_BaseHelp 'allowEmpty' => false]) ->setAction('/admin/index/update-skin/git/clone')); - $html .= $this->view->button((new Class_Entity()) + $html .= $this->view->button((new Class_Button) ->setText($this->_('Demander la mise à jour')) ->setUrl($this->view->url(['git' => 'pull'])) ->setImage($this->view->tagImg(Class_Admin_Skin::current() diff --git a/library/ZendAfi/View/Helper/AdvancedSearch.php b/library/ZendAfi/View/Helper/AdvancedSearch.php index 1272b2964ab2e8bd47bbd31f16c93e24850f9045..d28e360f74b55929e11cfc172ce9a2ac43969e91 100644 --- a/library/ZendAfi/View/Helper/AdvancedSearch.php +++ b/library/ZendAfi/View/Helper/AdvancedSearch.php @@ -76,15 +76,16 @@ class ZendAfi_View_Helper_AdvancedSearch extends ZendAfi_View_Helper_BaseHelper protected function _clearFormButton($form_id) { - return $this->view->button((new Class_Entity()) - ->setUrl($this->view->url(['module' => 'opac', - 'controller' => 'recherche' , - 'action' => 'avancee', - 'statut' => 'reset', - 'form_id' => $form_id], null,true)) - ->setAttribs(['class' => 'bouton init', - 'title' => $this->_('Réinitialiser le formulaire')]) - ->setText($this->_('Réinitialiser'))); + return $this->view + ->button((new Class_Button) + ->setUrl($this->view->url(['module' => 'opac', + 'controller' => 'recherche' , + 'action' => 'avancee', + 'statut' => 'reset', + 'form_id' => $form_id], null,true)) + ->setText($this->_('Réinitialiser')) + ->setTitle($this->_('Réinitialiser le formulaire')) + ->setAttrib('class', 'bouton init')); } diff --git a/library/ZendAfi/View/Helper/AuthoritySearch/Record.php b/library/ZendAfi/View/Helper/AuthoritySearch/Record.php index a7299a9c0ac5a8dff91137efeb0f51111b495385..cd23bdee2a82936da83c092e7f47b2ad2fa7f960 100644 --- a/library/ZendAfi/View/Helper/AuthoritySearch/Record.php +++ b/library/ZendAfi/View/Helper/AuthoritySearch/Record.php @@ -42,7 +42,7 @@ class ZendAfi_View_Helper_AuthoritySearch_Record extends ZendAfi_View_Helper_Bas $label = $record->getTitrePrincipal(); if ($select_for) { $label .= ' ' . $this->view - ->button((new Class_Entity) + ->button((new Class_Button) ->setText($this->_('Choisir')) ->setAttribs(['onclick' => 'return false;', 'data-record' => $record->getId(), diff --git a/library/ZendAfi/View/Helper/Biography/UpdateButtons.php b/library/ZendAfi/View/Helper/Biography/UpdateButtons.php index ef2a603d27e4514facf7eba41d16299390571bcd..a8150782f43f095ad61b670dfdce05c26f43d6d0 100644 --- a/library/ZendAfi/View/Helper/Biography/UpdateButtons.php +++ b/library/ZendAfi/View/Helper/Biography/UpdateButtons.php @@ -59,10 +59,10 @@ class ZendAfi_View_Helper_Biography_UpdateButtons extends ZendAfi_View_Helper_Ba true); return $this->view - ->Admin_Button((new Class_Entity()) + ->Admin_Button((new Class_Button) ->setText($this->_('Modifier la biographie')) ->setUrl($url) - ->setAttribs(['data-popup' => 'true']) + ->setAttrib('data-popup', 'true') ->setImage(Class_Admin_Skin::current() ->renderButtonIconOn('configuration', $this->view))); } @@ -84,7 +84,7 @@ class ZendAfi_View_Helper_Biography_UpdateButtons extends ZendAfi_View_Helper_Ba 'disable-biography'); return $this->view - ->Admin_Button((new Class_Entity()) + ->Admin_Button((new Class_Button) ->setText($this->_('Désactiver la biographie pour %s', $author_description->getLabel())) ->setUrl($url) @@ -98,7 +98,7 @@ class ZendAfi_View_Helper_Biography_UpdateButtons extends ZendAfi_View_Helper_Ba 'enable-biography'); return $this->view - ->Admin_Button((new Class_Entity()) + ->Admin_Button((new Class_Button) ->setText($this->_('Activer la biographie pour %s', $author_description->getLabel())) ->setUrl($url) diff --git a/library/ZendAfi/View/Helper/Button.php b/library/ZendAfi/View/Helper/Button.php index 7f8d955b078a2caf7fb4cb8af7342f9156c79ee9..c0202d8c722e959c31b26b20a7ec0aa04566d1fc 100644 --- a/library/ZendAfi/View/Helper/Button.php +++ b/library/ZendAfi/View/Helper/Button.php @@ -21,12 +21,11 @@ class ZendAfi_View_Helper_Button extends ZendAfi_View_Helper_BaseHelper { + /** @param $button Class_Button */ public function button($button) { - if(!$button) + if (!$button) return ''; - $button = new Class_Button($button->toArray()); - return $this ->_setDefaultAttribs($button) ->_injectJavascript($button) @@ -38,17 +37,14 @@ class ZendAfi_View_Helper_Button extends ZendAfi_View_Helper_BaseHelper { protected function _setDefaultAttribs($button) { - $button->setAttribs(array_merge($button->getAttribs(), - ['title' => ($button->getTitle() - ? $button->getTitle() - : (isset($button->getAttribs()['title']) - ? $button->getAttribs()['title'] - : ''))])); + $button->setAttrib('title', + $button->getTitle() + ? $button->getTitle() + : $button->getAttrib('title', '')) - $button->setAttribs(array_merge($button->getAttribs(), - ['data-url' => $button->getUrl()])); + ->setAttrib('data-url', $button->getUrl()); - if (isset($button->getAttribs()['onclick'])) + if ($button->hasAttrib('onclick')) return $this; if ($button->getConfirm()) @@ -57,9 +53,9 @@ class ZendAfi_View_Helper_Button extends ZendAfi_View_Helper_BaseHelper { if ($this->view->isPopup() && ! $button->getDisablePopup()) return $this; - $button->setAttribs(array_merge($button->getAttribs(), - ['onclick' => sprintf('window.location.href = \'%s\';', - $this->_escapeJsAttrib($button->getUrl()))])); + $button->setAttrib('onclick', sprintf('window.location.href = \'%s\';', + $this->_escapeJsAttrib($button->getUrl()))); + return $this; } @@ -69,10 +65,9 @@ class ZendAfi_View_Helper_Button extends ZendAfi_View_Helper_BaseHelper { ? "opacDialogClose(); opacDialogFromUrl('" . $this->_escapeJsAttrib($button->getUrl()) ."');" : "window.location.href='" . $this->_escapeJsAttrib($button->getUrl()) ."'"; - $button->setAttribs(array_merge($button->getAttribs(), - ['onclick' => sprintf("if (confirm('%s')) { %s }; return false;", - $this->_escapeJsAttrib($button->getConfirm()), - $action)])); + $button->setAttrib('onclick', sprintf("if (confirm('%s')) { %s }; return false;", + $this->_escapeJsAttrib($button->getConfirm()), + $action)); return $this; } @@ -80,4 +75,4 @@ class ZendAfi_View_Helper_Button extends ZendAfi_View_Helper_BaseHelper { protected function _injectJavascript($button) { return $this; } -} \ No newline at end of file +} diff --git a/library/ZendAfi/View/Helper/Button/Back.php b/library/ZendAfi/View/Helper/Button/Back.php index 06cc6a0cb268b895899050102a671af2cc340b5e..a757cade5157f621eea0c25f28e71e5fd64ddc3e 100644 --- a/library/ZendAfi/View/Helper/Button/Back.php +++ b/library/ZendAfi/View/Helper/Button/Back.php @@ -37,7 +37,7 @@ class ZendAfi_View_Helper_Button_Back extends ZendAfi_View_Helper_Button_Helper protected function _getDefaultButton() { - return (new Class_Entity()) + return (new Class_Button) ->setUrl($this->view->url(['action' => 'index', 'render' => null])) ->setAttribs($this->_getDefaultAttribs()) diff --git a/library/ZendAfi/View/Helper/Button/Cancel.php b/library/ZendAfi/View/Helper/Button/Cancel.php index 5adaec2862f0d38703c911aec0978c3d5963aa50..eeae7b4c7e0bedd67ba4a125227844b596f62fcf 100644 --- a/library/ZendAfi/View/Helper/Button/Cancel.php +++ b/library/ZendAfi/View/Helper/Button/Cancel.php @@ -39,7 +39,7 @@ class ZendAfi_View_Helper_Button_Cancel extends ZendAfi_View_Helper_Button_Helpe protected function _getDefaultButton() { - return (new Class_Entity()) + return (new Class_Button) ->setText($this->_('Annuler')) ->setAttribs($this->_getDefaultAttribs()) ->setUrl($this->view->url(['render' => null])); diff --git a/library/ZendAfi/View/Helper/Button/Helper.php b/library/ZendAfi/View/Helper/Button/Helper.php index 038af13d21c1d374b9cad2b8d3910f9a3c65f016..5d4e31bbec414680afc9c3055ec096175dbce4a9 100644 --- a/library/ZendAfi/View/Helper/Button/Helper.php +++ b/library/ZendAfi/View/Helper/Button/Helper.php @@ -21,20 +21,12 @@ class ZendAfi_View_Helper_Button_Helper extends ZendAfi_View_Helper_BaseHelper { - public function render($settings) { - $button = $this->_getDefaultButton(); - if(!$settings) - return $this->view->button($button); + public function render($button) { + $default_button = $this->_getDefaultButton(); - if(!$settings->getAttribs()) { - $button->updateAttributes($settings->toArray()); - return $this->view->button($button); - } - - $settings->setAttribs(array_merge($button->getAttribs(), - $settings->getAttribs())); - $button->updateAttributes($settings->toArray()); - - return $this->view->button($button); + return $this->view + ->button($button + ? $button->adoptDefaultsFrom($default_button) + : $default_button); } } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Button/IdentityProviderConnect.php b/library/ZendAfi/View/Helper/Button/IdentityProviderConnect.php index 029f76bf34a9bc3b1797c13f594294f9883aeb42..5e54b8a6e9417d5fe90e22ab36146ccb893b8336 100644 --- a/library/ZendAfi/View/Helper/Button/IdentityProviderConnect.php +++ b/library/ZendAfi/View/Helper/Button/IdentityProviderConnect.php @@ -40,7 +40,7 @@ class ZendAfi_View_Helper_Button_IdentityProviderConnect extends ZendAfi_View_He protected function _getDefaultButton() { - $button = (new Class_Entity()); + $button = new Class_Button; if (!empty($this->_provider->getButtonLogin())) $button->setImage($this->view->tagImg(Class_Admin_Skin::current() @@ -57,9 +57,7 @@ class ZendAfi_View_Helper_Button_IdentityProviderConnect extends ZendAfi_View_He ? $this->view->refererUrl() : $this->view->absoluteUrl()], null, true); - return - $button - ->setUrl($url) - ->setDisablePopup(true); + return $button->setUrl($url) + ->setDisablePopup(true); } } diff --git a/library/ZendAfi/View/Helper/Button/IdentityProviderLogout.php b/library/ZendAfi/View/Helper/Button/IdentityProviderLogout.php index 7212f0d7399e72056e18eda1fa7ff6f4d830a711..af835bf7ae28a6d663ef3751deac44e872a3f69f 100644 --- a/library/ZendAfi/View/Helper/Button/IdentityProviderLogout.php +++ b/library/ZendAfi/View/Helper/Button/IdentityProviderLogout.php @@ -40,7 +40,8 @@ class ZendAfi_View_Helper_Button_IdentityProviderLogout extends ZendAfi_View_Hel protected function _getDefaultButton() { - $button = (new Class_Entity()); + $button = new Class_Button; + if (Class_Users::getIdentity()) { $button->setText($this->_('Se déconnecter de %s', $this->_provider->getLabel())); $button->setUrl($this->view->url(['controller' => 'auth', diff --git a/library/ZendAfi/View/Helper/Button/New.php b/library/ZendAfi/View/Helper/Button/New.php index e078b864b255a75e9b29a9124e46a12d316e33c4..478155273d7b5ded0e63bb9f2429607ec32f0b65 100644 --- a/library/ZendAfi/View/Helper/Button/New.php +++ b/library/ZendAfi/View/Helper/Button/New.php @@ -37,7 +37,7 @@ class ZendAfi_View_Helper_Button_New extends ZendAfi_View_Helper_Button_Helper { protected function _getDefaultButton() { - return (new Class_Entity()) + return (new Class_Button) ->setAttribs($this->_getDefaultAttribs()) ->setUrl($this->view->url(['action' => 'add', 'render' => null])); diff --git a/library/ZendAfi/View/Helper/Button/Submit.php b/library/ZendAfi/View/Helper/Button/Submit.php index 1b37f6808223c447726da08892b558fea0bfdc87..0629290d7f69e16666bc0180776a1cfa06077370 100644 --- a/library/ZendAfi/View/Helper/Button/Submit.php +++ b/library/ZendAfi/View/Helper/Button/Submit.php @@ -48,7 +48,7 @@ class ZendAfi_View_Helper_Button_Submit extends ZendAfi_View_Helper_Button_Helpe protected function _getDefaultButton() { - return (new Class_Entity()) + return (new Class_Button) ->setText($this->view->isPopup() ? $this->_('Valider et fermer') : $this->_('Valider')) diff --git a/library/ZendAfi/View/Helper/CoreFiveFileInput.php b/library/ZendAfi/View/Helper/CoreFiveFileInput.php index 42a9c7f7e868a904347363f588fca21d84849387..4e54fbd97c773078043025e9636acdae7721abe4 100644 --- a/library/ZendAfi/View/Helper/CoreFiveFileInput.php +++ b/library/ZendAfi/View/Helper/CoreFiveFileInput.php @@ -45,8 +45,8 @@ class ZendAfi_View_Helper_CoreFiveFileInput extends ZendAfi_View_Helper_BaseHelp "</script>"; return $html.= $this->view->formText($name, $value, $attribs) . - $this->view->Button((new Class_Entity()) + $this->view->Button((new Class_Button) ->setText($this->_('Explorer le serveur')) - ->setAttribs(['onclick' => "openFileManagerFor_$name();return false;"])); + ->setAttrib('onclick', "openFileManagerFor_$name();return false;")); } } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/DigitalResource/Dashboard/Harvest.php b/library/ZendAfi/View/Helper/DigitalResource/Dashboard/Harvest.php index 2b9fcf52e833a645d1a8ad3bce6ce49f1953d249..bb3ed791f9e472cddca788d09e6e47fd21d136b5 100644 --- a/library/ZendAfi/View/Helper/DigitalResource/Dashboard/Harvest.php +++ b/library/ZendAfi/View/Helper/DigitalResource/Dashboard/Harvest.php @@ -71,14 +71,14 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard_Harvest extends ZendAfi_View protected function _getBatchHtml($config) { $batch_name = $config->getBatch(); - if(!$batch = $config->isHarvestingEnabled()) + if (!$batch = $config->isHarvestingEnabled()) return implode([$this->_tagWarning($this->_('Le moissonnage n\'est pas programmé')), - $this->view->button((new Class_Entity()) + $this->view->button((new Class_Button) ->setText($this->_('Activer le moissonnage')) - ->setAttribs(array_filter(['title' => $config->isEnabled() - ? $this->_('Activer le moissonnage') - : $this->_('Veuillez activer la ressource pour pouvoir activer le moissonnage.'), - 'disabled' => $config->isEnabled() + ->setTitle($config->isEnabled() + ? $this->_('Activer le moissonnage') + : $this->_('Veuillez activer la ressource pour pouvoir activer le moissonnage.')) + ->setAttribs(array_filter(['disabled' => $config->isEnabled() ? '' : 'disabled'])) ->setUrl($this->view->absoluteUrl(['module' => 'admin', diff --git a/library/ZendAfi/View/Helper/DigitalResource/Dashboard/SSO.php b/library/ZendAfi/View/Helper/DigitalResource/Dashboard/SSO.php index aa030f4fca66f27a64ab53674ef905fcbf32fe3d..b76a5db686b11b860fc7f1f71f37950494e62d80 100644 --- a/library/ZendAfi/View/Helper/DigitalResource/Dashboard/SSO.php +++ b/library/ZendAfi/View/Helper/DigitalResource/Dashboard/SSO.php @@ -71,7 +71,7 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard_SSO extends ZendAfi_View_Hel ? $diag : $this->_getSSOHtml($config, $user); - $html [] = $this->view->button((new Class_Entity) + $html [] = $this->view->button((new Class_Button) ->setUrl($config->renderTrySsoUrlOn($this->view)) ->setText($this->_('Essayer le SSO avec l\'utilisateur "%s"', $user->getLogin()))); @@ -104,7 +104,7 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard_SSO extends ZendAfi_View_Hel ['style' => 'margin-left: 1em', 'data-popup' => 'true'])) . $this->_getSSOHtml($config, $user, $album) - . $this->view->button((new Class_Entity) + . $this->view->button((new Class_Button) ->setUrl($config->renderTrySsoUrlOn($this->view, ['album_id' => $album->getId()])) ->setText($this->_('Essayer le SSO avec l\'utilisateur "%s" pour l\'album "%s"', $user->getLogin(), diff --git a/library/ZendAfi/View/Helper/DigitalResource/Dashboard/Status.php b/library/ZendAfi/View/Helper/DigitalResource/Dashboard/Status.php index be065d7f17949858b831ff8a974c10743975d9c0..8be944a8d7ce9778e8e8a2db7dfcfef175c1ba2e 100644 --- a/library/ZendAfi/View/Helper/DigitalResource/Dashboard/Status.php +++ b/library/ZendAfi/View/Helper/DigitalResource/Dashboard/Status.php @@ -42,11 +42,7 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard_Status extends ZendAfi_View_ $class .= ' enabled'; } - return $this->view->button((new Class_Entity) - ->setText($label) - ->setAttribs(['disabled' => 'disabled', - 'onclick' => 'return;', - 'class' => $class])); + return $this->_statusButton($label, $class); } @@ -61,7 +57,13 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard_Status extends ZendAfi_View_ $label = $this->_('Moissonnage activé'); $class .= ' enabled'; } - return $this->view->button((new Class_Entity) + + return $this->_statusButton($label, $class); + } + + + protected function _statusButton($label, $class) { + return $this->view->button((new Class_Button) ->setText($label) ->setAttribs(['disabled' => 'disabled', 'onclick' => 'return;', diff --git a/library/ZendAfi/View/Helper/Filters/Strategy/Reset.php b/library/ZendAfi/View/Helper/Filters/Strategy/Reset.php index ad322689057aa54e3dcc43636a748e2daa428fe9..0f3019b00327d440e5d90579b350c01d1e352764 100644 --- a/library/ZendAfi/View/Helper/Filters/Strategy/Reset.php +++ b/library/ZendAfi/View/Helper/Filters/Strategy/Reset.php @@ -29,13 +29,14 @@ class ZendAfi_View_Helper_Filters_Strategy_Reset protected function _renderTitle() { - return $this->view->tagAction(new Intonation_Library_Link(['Text' => $this->_('Réinitialiser'), - 'Image' => (Class_Template::current() - ->getIco($this->view, - 'delete', - 'utils')), - 'Class' => 'filter_reset_button', - 'Url' => $this->view->url($this->_getUrlParams(), null, true), - 'Title' => $this->_('Réinitialiser les filtres')])); + return $this->view->tagAction((new Intonation_Library_Link) + ->setText($this->_('Réinitialiser')) + ->setImage(Class_Template::current() + ->getIco($this->view, + 'delete', + 'utils')) + ->setClass('filter_reset_button') + ->setUrl($this->view->url($this->_getUrlParams(), null, true)) + ->setTitle($this->_('Réinitialiser les filtres'))); } } diff --git a/library/ZendAfi/View/Helper/Notice/Unimarc.php b/library/ZendAfi/View/Helper/Notice/Unimarc.php index 7188eb42e9ac7d34428ec13c0d67b5eff1304497..2a9d0b56041cce486f7b8cd0c1bad118904c2859 100644 --- a/library/ZendAfi/View/Helper/Notice/Unimarc.php +++ b/library/ZendAfi/View/Helper/Notice/Unimarc.php @@ -95,7 +95,7 @@ class ZendAfi_View_Helper_Notice_Unimarc extends Zend_View_Helper_HtmlElement { 'id' => $notice->getId()], null, true); - $button = (new Class_Entity) + $button = (new Class_Button) ->setText($this->_('Télécharger')) ->setImage(Class_Admin_Skin::current()->renderActionIconOn('down', $this->view)) ->setAttribs(['onclick' => 'document.location.href=\'' . $download_url .'\'']); @@ -205,7 +205,7 @@ class ZendAfi_View_Helper_Notice_Unimarc extends Zend_View_Helper_HtmlElement { 'id' => $item->getId()], null, true); - $button = (new Class_Entity) + $button = (new Class_Button) ->setText($this->_('Télécharger le fichier d\'origine')) ->setImage(Class_Admin_Skin::current()->renderActionIconOn('down', $this->view)) ->setAttribs(['style' => 'float:right;', @@ -231,10 +231,9 @@ class ZendAfi_View_Helper_Notice_Unimarc extends Zend_View_Helper_HtmlElement { 'onclick' => 'return confirm(\'' . $this->_('Supprimer cet exemplaire ?') . '\');', 'href' => $delete_url]); - $button = (new Class_Entity) + $button = (new Class_Button) ->setText($this->_('Supprimer l\'exemplaire')) - ->setImage(Class_Admin_Skin::current()->renderActionIconOn('delete', $this->view)) - ->setAttribs(); + ->setImage(Class_Admin_Skin::current()->renderActionIconOn('delete', $this->view)); return $this->view->admin_Button($button); } diff --git a/library/ZendAfi/View/Helper/Redmine/Header.php b/library/ZendAfi/View/Helper/Redmine/Header.php index d833b574a68c1e3205de8bd8f152c81c98576468..f4a1fed66f915f8eac396b90088210646ffcab54 100644 --- a/library/ZendAfi/View/Helper/Redmine/Header.php +++ b/library/ZendAfi/View/Helper/Redmine/Header.php @@ -36,7 +36,7 @@ class ZendAfi_View_Helper_Redmine_Header extends ZendAfi_View_Helper_BaseHelper return $this->shouldSelectLib(); $add_button = $user_info - ? $this->view->button_New((new Class_Entity()) + ? $this->view->button_New((new Class_Button) ->setText($this->_('Nouvelle demande')) ->setUrl($this->view->url(['action' => 'add', 'id' => null, @@ -99,16 +99,16 @@ class ZendAfi_View_Helper_Redmine_Header extends ZendAfi_View_Helper_BaseHelper $title = $this->_('Modifier le compte d\'assistance'); - return $this->view->button((new Class_Entity()) + return $this->view->button((new Class_Button) ->setText($user_info ? $user_info : $title) + ->setTitle($title) ->setUrl($this->view->url(['module' => 'admin', 'controller' => 'bib', 'action' => 'edit', 'id' => $library->getId()], null ,true) . '?backUrl=' . $this->view->url() . '#fieldset-redmine') - ->setAttribs(['class' => 'library_redmine_account', - 'title' => $title])); + ->setAttrib('class', 'library_redmine_account')); } diff --git a/library/ZendAfi/View/Helper/RenderForm.php b/library/ZendAfi/View/Helper/RenderForm.php index 1168417af911b71294de16a49dec8c957641cfe8..5b6c3dfc374d55229c230ad0939d7b704a90d062 100644 --- a/library/ZendAfi/View/Helper/RenderForm.php +++ b/library/ZendAfi/View/Helper/RenderForm.php @@ -249,10 +249,10 @@ class ZendAfi_View_Helper_RenderForm extends ZendAfi_View_Helper_BaseHelper { */ protected function _getBackUrl($form) { if($form->getAttrib('data-backurl')) - return (new Class_Entity())->setUrl($form->getAttrib('data-backurl')); + return (new Class_Button)->setUrl($form->getAttrib('data-backurl')); if($backurl = Class_Url::getParam('backUrl')) - return (new Class_Entity())->setUrl($backurl); + return (new Class_Button)->setUrl($backurl); return null; } diff --git a/library/ZendAfi/View/Helper/RenderRecord.php b/library/ZendAfi/View/Helper/RenderRecord.php index 810555cc85c320132ad51d270a086c97fb513907..4e5476e1abb5883b14fad5f99ffd9239a67be92c 100644 --- a/library/ZendAfi/View/Helper/RenderRecord.php +++ b/library/ZendAfi/View/Helper/RenderRecord.php @@ -119,18 +119,18 @@ class ZendAfi_View_Helper_RenderRecord extends ZendAfi_View_Helper_BaseHelper { ZendAfi_View_Helper_Notice_Vignette::MODE_VIEW), ($this->view->display_modifier_vignette_link - ? $this->view->Admin_Button((new Class_Entity()) + ? $this->view->Admin_Button((new Class_Button) ->setUrl($this->view->url(['module' => 'admin', 'controller' => 'records', 'action' => 'thumbnail'])) ->setText($this->_('Modifier')) - ->setAttribs(['title' => $this->_('Modifier la vignette de la notice "%s"', - $this->notice->getTitrePrincipal()), - 'data-popup' => 'true'])) + ->setTitle($this->_('Modifier la vignette de la notice "%s"', + $this->notice->getTitrePrincipal())) + ->setAttrib('data-popup', 'true')) : ''), ($this->view->show_reset_thumbnail_link - ? $this->view->Admin_Button((new Class_Entity()) + ? $this->view->Admin_Button((new Class_Button) ->setUrl($this->view->url(['module' => 'admin', 'controller' => 'records', 'action' => 'reset-thumbnail', @@ -138,8 +138,8 @@ class ZendAfi_View_Helper_RenderRecord extends ZendAfi_View_Helper_BaseHelper { null, true)) ->setText($this->_('Générer')) - ->setAttribs(['title' => $this->_('Supprimer et re-générer la vignette de la notice "%s"', - $this->notice->getTitrePrincipal())])) + ->setTitle($this->_('Supprimer et re-générer la vignette de la notice "%s"', + $this->notice->getTitrePrincipal()))) : ''), $this->_tag('div', diff --git a/library/ZendAfi/View/Helper/RendezVous/PurgeButton.php b/library/ZendAfi/View/Helper/RendezVous/PurgeButton.php index fd11ba79f1fbafea1ac373f9e0f701cbbfda7b3a..91d12315f72a403a59f2f1d46a143a059006fd08 100644 --- a/library/ZendAfi/View/Helper/RendezVous/PurgeButton.php +++ b/library/ZendAfi/View/Helper/RendezVous/PurgeButton.php @@ -25,13 +25,13 @@ class ZendAfi_View_Helper_RendezVous_PurgeButton extends ZendAfi_View_Helper_Bas if ($report->isEmpty()) return ''; - - return $this->view->Button((new Class_Entity()) - ->setUrl($this->view->url(array_filter(['action' => 'notification-purge', - 'type' => $notification_type]))) - ->setText($label) - ->setImage($this->view->tagImg(Class_Admin_Skin::current() - ->getIconUrl('buttons', 'delete'))) - ->setConfirm($label . ' ?')); + return $this->view + ->button((new Class_Button) + ->setUrl($this->view->url(array_filter(['action' => 'notification-purge', + 'type' => $notification_type]))) + ->setText($label) + ->setImage($this->view->tagImg(Class_Admin_Skin::current() + ->getIconUrl('buttons', 'delete'))) + ->setConfirm($label . ' ?')); } } diff --git a/library/ZendAfi/View/Helper/ReponseFormulaire.php b/library/ZendAfi/View/Helper/ReponseFormulaire.php index 5b9321bc06781d20bc08b5fb88d9e14fe7d9a852..785fb024b8f2d3a2b49e8b31bf262acfbfd952af 100644 --- a/library/ZendAfi/View/Helper/ReponseFormulaire.php +++ b/library/ZendAfi/View/Helper/ReponseFormulaire.php @@ -54,7 +54,7 @@ class ZendAfi_View_Helper_ReponseFormulaire extends ZendAfi_View_Helper_BaseHelp public function addActionButton() { $current_skin = Class_Admin_Skin::current(); $buttons = - [$this->view->button((new Class_Entity) + [$this->view->button((new Class_Button) ->setText($this->_('Supprimer')) ->setUrl($this->_url(['action' => 'delete-formulaire', 'id' => $this->_formulaire->getId()])) @@ -64,13 +64,13 @@ class ZendAfi_View_Helper_ReponseFormulaire extends ZendAfi_View_Helper_BaseHelp ]; if (!$this->_formulaire->isValidated()) - $buttons[] = $this->view->button((new Class_Entity) - ->setText($this->_('Valider')) - ->setUrl($this->_url(['action' => 'validate-formulaire', - 'id' => $this->_formulaire->getId()])) - ->setImage($this->view - ->tagImg($current_skin->getIconUrl('actions', 'validate'), - ['style' => 'filter: invert();']))); + $buttons[] = $this->view + ->button((new Class_Button) + ->setText($this->_('Valider')) + ->setUrl($this->_url(['action' => 'validate-formulaire', + 'id' => $this->_formulaire->getId()])) + ->setImage($this->view->tagImg($current_skin->getIconUrl('actions', 'validate'), + ['style' => 'filter: invert();']))); return $this->_div(['class' => 'action-button'], implode($buttons)); diff --git a/library/ZendAfi/View/Helper/TagUploadMultiple.php b/library/ZendAfi/View/Helper/TagUploadMultiple.php index c52116fd909bc50adb408ac93553570649c64d17..a2ec9e07919da32c6c3c83911a10a878f06e0f30 100644 --- a/library/ZendAfi/View/Helper/TagUploadMultiple.php +++ b/library/ZendAfi/View/Helper/TagUploadMultiple.php @@ -33,7 +33,7 @@ class ZendAfi_View_Helper_TagUploadMultiple extends ZendAfi_View_Helper_BaseHelp public function renderButton($name, $buttonLabel) { - $button = (new Class_Entity) + $button = (new Class_Button) ->setText($buttonLabel) ->setImage(Class_Admin_Skin::current() ->renderButtonIconOn('add_categorie', $this->view)) diff --git a/library/ZendAfi/View/Helper/Trailer.php b/library/ZendAfi/View/Helper/Trailer.php index d0b64a5dbdfb101c76db7088f546df30029a1a0e..bdc062767d64d0df4466cc6b4d09b14e2ec677ec 100644 --- a/library/ZendAfi/View/Helper/Trailer.php +++ b/library/ZendAfi/View/Helper/Trailer.php @@ -73,10 +73,10 @@ class ZendAfi_View_Helper_Trailer extends ZendAfi_View_Helper_BaseHelper { 'id' => $notice->getId()]); return $this->view - ->Admin_Button((new Class_Entity()) + ->Admin_Button((new Class_Button) ->setText($this->_('Modifier la bande-annonce')) ->setUrl($url) - ->setAttribs(['data-popup' => 'true']) + ->setAttrib('data-popup', 'true') ->setImage(Class_Admin_Skin::current() ->renderButtonIconOn('configuration', $this->view))); } diff --git a/library/digital_resources/Bibliondemand/View/Helper/Dashboard.php b/library/digital_resources/Bibliondemand/View/Helper/Dashboard.php index 78ea0fbca785e065e2369d8ed7297226ebf01d11..3802fb853f8a0c2d5df722c2024ff1f3d820a842 100644 --- a/library/digital_resources/Bibliondemand/View/Helper/Dashboard.php +++ b/library/digital_resources/Bibliondemand/View/Helper/Dashboard.php @@ -78,10 +78,10 @@ class Bibliondemand_View_Helper_Dashboard extends ZendAfi_View_Helper_BaseHelper $user->getLogin(), $record->getTitrePrincipal())), $this->_tag('pre', $this->_config->urlFor($user, ['id' => $record->getId()])), - $this->view->button((new Class_Entity) - ->setUrl($this->view->url(['action' => 'try-sso'])) - ->setText($this->_('Essayer le SSO avec l\'utilisateur "%s"', - $user->getLogin())))]; + $this->view->button((new Class_Button) + ->setUrl($this->view->url(['action' => 'try-sso'])) + ->setText($this->_('Essayer le SSO avec l\'utilisateur "%s"', + $user->getLogin())))]; return implode($html); } @@ -160,9 +160,9 @@ class Bibliondemand_View_Helper_Dashboard extends ZendAfi_View_Helper_BaseHelper return $this->_tag('h3', $this->_('Diagnostic du profil de données')) . $this->_tag('h4', $this->_('Recherche de dc:type non rattachés à un type de documents Bokeh')) - . $this->view->button((new Class_Entity) + . $this->view->button((new Class_Button) ->setText($this->_('Lancer la recherche')) - ->setAttribs(['onclick' => $launch_button_click])) + ->setAttrib('onclick', $launch_button_click)) . $this->view->ajaxRendering(Class_Url::absolute(['action' => 'missing-doc-types'])); } @@ -172,7 +172,7 @@ class Bibliondemand_View_Helper_Dashboard extends ZendAfi_View_Helper_BaseHelper if ((!$index_thesauri = $this->_config->getIndexThesauriBatchInstance()) || (!$index_thesauri->getModel())) $html [] = $this->_tagError($this->_('L\'indexation incrémentale des thesauri n\'est pas programmé')) - . $this->view->button((new Class_Entity()) + . $this->view->button((new Class_Button()) ->setText($this->_('Activer l\'indexation des Thesauri')) ->setUrl($this->view->absoluteUrl(['module' => 'admin', 'controller' => 'batch', @@ -184,7 +184,7 @@ class Bibliondemand_View_Helper_Dashboard extends ZendAfi_View_Helper_BaseHelper if ((!$index_doc_types = $this->_config->getIndexDocTypesBatchInstance()) || (!$index_doc_types->getModel())) $html [] = $this->_tagError($this->_('L\'indexation incrémentale des types de docuemnts n\'est pas programmé')) - . $this->view->button((new Class_Entity()) + . $this->view->button((new Class_Button()) ->setText($this->_('Activer l\'indexation des types de documents')) ->setUrl($this->view->absoluteUrl(['module' => 'admin', 'controller' => 'batch', diff --git a/library/digital_resources/Numel/View/Helper/Dashboard.php b/library/digital_resources/Numel/View/Helper/Dashboard.php index 9efab0718560d40f946105165c0949c0608ffb3d..e18031d15c40ab5936c08cc9371ac3a5c6345527 100644 --- a/library/digital_resources/Numel/View/Helper/Dashboard.php +++ b/library/digital_resources/Numel/View/Helper/Dashboard.php @@ -188,7 +188,7 @@ class Numel_View_Helper_Dashboard extends ZendAfi_View_Helper_BaseHelper { if ((!$index_thesauri = $this->_config->getIndexThesauriBatchInstance()) || (!$index_thesauri->getModel())) $html [] = $this->_tagError($this->_('L\'indexation incrémentale des thesauri n\'est pas programmé')) - . $this->view->button((new Class_Entity()) + . $this->view->button((new Class_Button) ->setText($this->_('Activer l\'indexation des Thesauri')) ->setUrl($this->view->absoluteUrl(['module' => 'admin', 'controller' => 'batch', @@ -200,7 +200,7 @@ class Numel_View_Helper_Dashboard extends ZendAfi_View_Helper_BaseHelper { if ((!$index_doc_types = $this->_config->getIndexDocTypesBatchInstance()) || (!$index_doc_types->getModel())) $html [] = $this->_tagError($this->_('L\'indexation incrémentale des types de documents n\'est pas programmé')) - . $this->view->button((new Class_Entity()) + . $this->view->button((new Class_Button) ->setText($this->_('Activer l\'indexation des types de documents')) ->setUrl($this->view->absoluteUrl(['module' => 'admin', 'controller' => 'batch', diff --git a/library/templates/Chili/Library/Wrapper/RichContentSection.php b/library/templates/Chili/Library/Wrapper/RichContentSection.php index 3ea3d6be5312c57e1c88f9b820c8b23637a83f3b..bcb6055aa3331283379f8cef695da486b95da143 100644 --- a/library/templates/Chili/Library/Wrapper/RichContentSection.php +++ b/library/templates/Chili/Library/Wrapper/RichContentSection.php @@ -26,9 +26,10 @@ class Chili_Library_Wrapper_RichContentSection extends Intonation_Library_View_W } public function getMainLink(){ - return new Intonation_Library_Link(['Url' => $this->_model->getNavUrl(), - 'Text' => $this->getMainTitle(), - 'Title' => $this->_model->getDBNavTitle()]); + return (new Intonation_Library_Link) + ->setUrl($this->_model->getNavUrl()) + ->setText($this->getMainTitle()) + ->setTitle($this->_model->getDBNavTitle()); } public function getEmbedMedia(){} diff --git a/library/templates/Chili/View/RenderRecord/RenderItems.php b/library/templates/Chili/View/RenderRecord/RenderItems.php index 62c48defc6ca58734c9afb21ab37d8272a29b6e0..6b577d758f9e9c6d7acfeb245e7a87f8c0472c8e 100644 --- a/library/templates/Chili/View/RenderRecord/RenderItems.php +++ b/library/templates/Chili/View/RenderRecord/RenderItems.php @@ -28,15 +28,13 @@ class Chili_View_RenderRecord_RenderItems extends Intonation_View_RenderRecord_R if ( ! $record = $first_item->getNotice()) return $this->_noHoldableItem(); - $hold = new Intonation_Library_Link(['Url' => $first_item->getHoldLink(), - 'Text' => $this->_('Réserver'), - 'Image' => (Class_Template::current() - ->getIco($this->view, - 'hold', - 'library')), - 'Title' => $this->_('Réserver le document %s', - $record->getTitreEtSousTitre(' ')), - 'Popup' => true]); + $hold = (new Intonation_Library_Link) + ->setUrl($first_item->getHoldLink()) + ->setText($this->_('Réserver')) + ->setImage(Class_Template::current()->getIco($this->view, 'hold', 'library')) + ->setTitle($this->_('Réserver le document %s', + $record->getTitreEtSousTitre(' '))) + ->setPopup(true); return $this->view->div(['class' => 'items_hold_link'], $this->view->tagAction($hold)); diff --git a/library/templates/Intonation/Library/Link.php b/library/templates/Intonation/Library/Link.php index 0c2e650ec0dd71edf79a688e82b536eee44f1973..38fabd728d5fa6f04ff4e2aff201b2eec605a15c 100644 --- a/library/templates/Intonation/Library/Link.php +++ b/library/templates/Intonation/Library/Link.php @@ -20,83 +20,86 @@ */ -class Intonation_Library_Link extends Class_Entity { - public function getUrl() { - return $this->get('Url'); - } - - - public function getText() { - return $this->get('Text'); - } - - - public function getTitle() { - return $this->get('Title'); - } +class Intonation_Library_Link extends Class_Button { + protected + $_inline_text, + $_class = '', + $_only_classes = '', + $_popup, + $_callback; - public function getImage() { - return $this->get('Image'); + public function __construct() { + $this->_element = ''; } - public function getAttribs() { - return $this->get('Attribs'); + public function setInlineText($flag) { + $this->_inline_text = (bool)$flag; + return $this; } - public function getRight() { - return $this->get('Right'); + public function getInlineText() { + return $this->_inline_text; } public function isNotResponsiveText() { - return false === $this->get('InlineText'); + return false === $this->getInlineText(); } public function beResponsiveText() { - return $this->set('InlineText', false); + return $this->setInlineText(false); } public function beNotResponsiveText() { - return $this->set('InlineText', true); + return $this->setInlineText(true); } public function getClass() { - return $this->get('Class'); + return $this->_class; } - public function getAction() { - return $this->get('Action'); + public function setClass($class) { + $this->_class = $class; + return $this; } public function getOnlyClasses() { - return $this->get('OnlyClasses'); + return $this->_only_classes; } - public function getTag() { - return $this->get('Tag'); + public function setOnlyClasses($only_classes) { + $this->_only_classes = $only_classes; + return $this; } public function getPopup() { - return $this->get('Popup'); + return $this->_popup; } - public function setCallBack($callback) { - return $this->set('Callback', $callback); + public function setPopup($popup) { + $this->_popup = $popup; + return $this; } public function getCallback() { - return $this->get('Callback'); + return $this->_callback; + } + + + public function setCallBack($callback) { + $this->_callback = $callback; + return $this; } -} \ No newline at end of file +} diff --git a/library/templates/Intonation/Library/Link/AdminSessionActivityRegistrations.php b/library/templates/Intonation/Library/Link/AdminSessionActivityRegistrations.php index 9465eaf81da8283f56bf1addcbd86af2a0712beb..4207b9cafdab79cbcdc9b3381749e7c84563fcb5 100644 --- a/library/templates/Intonation/Library/Link/AdminSessionActivityRegistrations.php +++ b/library/templates/Intonation/Library/Link/AdminSessionActivityRegistrations.php @@ -20,7 +20,7 @@ */ -class Intonation_Library_Link_AdminSessionActivityRegistrations extends Intonation_Library_Link { +class Intonation_Library_Link_AdminSessionActivityRegistrations { public static function newFor($session, $view) { if (!$session || (!$user = Class_Users::getIdentity())) return; @@ -30,7 +30,7 @@ class Intonation_Library_Link_AdminSessionActivityRegistrations extends Intonati $t = new Class_Translator; - return (new static) + return (new Intonation_Library_Link) ->setUrl($view->url(['module' => 'admin', 'controller' => 'session-activity', 'action' => 'inscriptions', @@ -40,8 +40,8 @@ class Intonation_Library_Link_AdminSessionActivityRegistrations extends Intonati ->setText($t->_('Nouvelle inscription')) ->setTitle($t->_('Nouvelle inscription à l\'activité %s', $session->getLibelleActivity())) - ->setImage(Class_Template::current()->getIco($view, 'team', 'library')) - ->setAttribs(['target' => '_blank']) + ->setImage($view->templateIco('team', 'library')) + ->setAttrib('target', '_blank') ->setClass('menu_admin_front_anchor') ; } diff --git a/library/templates/Intonation/Library/Record.php b/library/templates/Intonation/Library/Record.php index 366bf93f3faf96b291868c5801c75999db582306..ae9f62d74f3ae364f28606fd2295312814615368 100644 --- a/library/templates/Intonation/Library/Record.php +++ b/library/templates/Intonation/Library/Record.php @@ -95,24 +95,23 @@ class Intonation_Library_Record { if ( ! $first_item = $this->_getFirstHoldableItem($items)) return $this->_nullLink($view); - return new Intonation_Library_Link(['Url' => $first_item->getHoldLink(), - 'Class' => 'record_hold_link', - 'Text' => $this->_('Réserver'), - 'Image' => $view->templateIco('hold', - 'library'), - 'Title' => $this->_('Réserver le document %s', - $this->_record->getTitreEtSousTitre(' ')), - 'Popup' => true]); + return (new Intonation_Library_Link) + ->setUrl($first_item->getHoldLink()) + ->setImage($view->templateIco('hold', 'library')) + ->setText($this->_('Réserver')) + ->setTitle($this->_('Réserver le document %s', $this->_record->getTitreEtSousTitre(' '))) + ->setClass('record_hold_link') + ->setPopup(true); } protected function _nullLink($view) { - return new Intonation_Library_Link(['Text' => $this->_('Non réservable'), - 'Class' => 'record_hold_link no_holdable_item', - 'Image' => $view->templateIco('hold', - 'library'), - 'Title' => $this->_('La réservation du document %s est impossible. Il n\'y a pas d\'exemplaire réservable', - $this->_record->getTitreEtSousTitre(' '))]); + return (new Intonation_Library_Link) + ->setImage($view->templateIco('hold', 'library')) + ->setText($this->_('Non réservable')) + ->setTitle($this->_('La réservation du document %s est impossible. Il n\'y a pas d\'exemplaire réservable', + $this->_record->getTitreEtSousTitre(' '))) + ->setClass('record_hold_link no_holdable_item'); } diff --git a/library/templates/Intonation/Library/Selection.php b/library/templates/Intonation/Library/Selection.php index fde8197bd377e419c709e73bd0027775092c0507..4ca6939c2a69822fd961feb5dbb4416dc180e35c 100644 --- a/library/templates/Intonation/Library/Selection.php +++ b/library/templates/Intonation/Library/Selection.php @@ -108,16 +108,14 @@ class Intonation_Library_Selection extends Class_Entity { $popup = Class_Users::getIdentity() ? false : 'true'; - return new Intonation_Library_Link(['Url' => $url, - 'Attribs' => Class_Users::getIdentity() ? ['onclick' => $js] : [], - 'Text' => $this->getTitle(), - 'Image' => (Class_Template::current() - ->getIco($this->getView(), - $this->_getImageForContext(), - 'library')), - 'Class' => $this->getClass(), - 'Title' => $this->_getTitleForContext(), - 'Popup' => $popup]); + return (new Intonation_Library_Link) + ->setUrl($url) + ->setAttribs(Class_Users::getIdentity() ? ['onclick' => $js] : []) + ->setText($this->getTitle()) + ->setImage($this->getView()->templateIco($this->_getImageForContext(), 'library')) + ->setClass($this->getClass()) + ->setTitle($this->_getTitleForContext()) + ->setPopup($popup); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Article.php b/library/templates/Intonation/Library/View/Wrapper/Article.php index fd1f3e39e39dfba1b90c4e87bea267fb2630bbc4..8a7f8ae6d0edf09e56f7244140dba0713de59733 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Article.php +++ b/library/templates/Intonation/Library/View/Wrapper/Article.php @@ -51,12 +51,11 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr public function getMainLink() { - return new Intonation_Library_Link(['Url' => $this->_model->getUrl(), - 'Image' => Class_Template::current()->getIco($this->_view, - 'read-document', - 'library'), - 'Text' => $this->_('Lire la suite'), - 'Title' => $this->_getMainLinkTitle()]); + return (new Intonation_Library_Link) + ->setUrl($this->_model->getUrl()) + ->setImage($this->getIco('read-document', 'library')) + ->setText($this->_('Lire la suite')) + ->setTitle($this->_getMainLinkTitle()); } @@ -96,10 +95,7 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr public function getSecondaryIco() { - return Class_Template::current() - ->getIco($this->_view, - 'author', - 'library'); + return $this->getIco('author', 'library'); } @@ -124,10 +120,7 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr ->setTag('a') ->setUrl($library->getUrl()) ->setClass('badge_article_library') - ->setImage(Class_Template::current() - ->getIco($this->_view, - 'library', - 'library')) + ->setImage($this->getIco('library', 'library')) ->setText($library->getLibelle()) ->setTitle($this->_('Bibliothèque de l\'article "%s"', $title))); @@ -183,12 +176,13 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr $actions = []; if ($this->_model->hasEventsDebut()) - $actions [] = new Intonation_Library_Link(['Url' => $this->_urlForModel('opac', 'cms', 'ical'), - 'Image' => $this->getIco('ical', 'library'), - 'Text' => $this->_('ICAL'), - 'Attribs' => ['target' => '_blank'], - 'Title' => $this->_('Ajouter l\'événement %s dans mon calendrier', - $this->_model->getLibelle())]); + $actions [] = (new Intonation_Library_Link) + ->setUrl($this->_urlForModel('opac', 'cms', 'ical')) + ->setImage($this->getIco('ical', 'library')) + ->setText($this->_('ICAL')) + ->setAttrib('target', '_blank') + ->setTitle($this->_('Ajouter l\'événement %s dans mon calendrier', + $this->_model->getLibelle())); if ($print_link = $this->_view->tagPrintLink((new Class_Entity()) ->setController('cms') @@ -199,21 +193,24 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr $actions = array_merge($actions, $this->_view->socialNetworksActions($this->_model)); if (Class_Users::isCurrentUserCanAccesBackend()) { - $actions [] = new Intonation_Library_Link(['Url' => $this->_urlForModel('admin', 'cms', 'edit'), - 'Attribs' => ['class' => 'menu_admin_front_anchor'], - 'Image' => $this->_getInUtilsIco('edit'), - 'Text' => $this->_('Modifier …'), - 'Popup' => true, - 'Title' => $this->_('Modifier l\'article %s', - $this->_model->getLibelle())]); - - $actions [] = new Intonation_Library_Link(['Url' => $this->_urlForModel('admin', 'cms', 'version'), - 'Attribs' => ['class' => 'menu_admin_front_anchor'], - 'Image' => $this->getIco('history', 'library'), - 'Text' => $this->_('Historique …'), - 'Popup' => true, - 'Title' => $this->_('Historique des modifications de l\'article %s', - $this->_model->getLibelle())]); + $actions [] = (new Intonation_Library_Link) + ->setUrl($this->_urlForModel('admin', 'cms', 'edit')) + ->setImage($this->_getInUtilsIco('edit')) + ->setText($this->_('Modifier …')) + ->setTitle($this->_('Modifier l\'article %s', $this->_model->getLibelle())) + ->setClass('menu_admin_front_anchor') + ->setPopup(true) + ; + + $actions [] = (new Intonation_Library_Link) + ->setUrl($this->_urlForModel('admin', 'cms', 'version')) + ->setImage($this->getIco('history', 'library')) + ->setText($this->_('Historique …')) + ->setTitle($this->_('Historique des modifications de l\'article %s', + $this->_model->getLibelle())) + ->setClass('menu_admin_front_anchor') + ->setPopup(true) + ; } $session = Class_SessionActivity::findByArticle($this->_model); @@ -222,13 +219,17 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr $actions [] = $link; } - $button = new Intonation_Library_Link(['Text' => $this->_('Plus'), - 'Attribs' => ['class' => 'more_action'], - 'Title' => $this->_('Voir plus d\'actions pour %s', - $this->_model->getLibelle()), - 'Image' => $this->_getInUtilsIco('more')]); - - return [$this->_view->renderDropdown($this->_view->renderActions($actions), $button, 'dropleft dropup')]; + $button = (new Intonation_Library_Link) + ->setText($this->_('Plus')) + ->setClass('more_action') + ->setTitle($this->_('Voir plus d\'actions pour %s', + $this->_model->getLibelle())) + ->setImage($this->_getInUtilsIco('more')) + ; + + return [$this->_view->renderDropdown($this->_view->renderActions($actions), + $button, + 'dropleft dropup')]; } diff --git a/library/templates/Intonation/Library/View/Wrapper/Author.php b/library/templates/Intonation/Library/View/Wrapper/Author.php index 7df8468a08ace04503d3709846fbb3408260bc69..7ff32cc14b78d40cf2d57446b8d5eda685c6e041 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Author.php +++ b/library/templates/Intonation/Library/View/Wrapper/Author.php @@ -27,15 +27,13 @@ class Intonation_Library_View_Wrapper_Author extends Intonation_Library_View_Wra public function getMainLink() { - return new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'author', - 'action' => 'view', - 'id' => $this->_model->getId()]), - 'Text' => $this->_('En savoir plus'), - 'Image' => (Class_Template::current() - ->getIco($this->_view, - 'read-document', - 'library')), - 'Title' => $this->_('En savoir plus sur %s', $this->_model->getLibelle())]); + return (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'author', + 'action' => 'view', + 'id' => $this->_model->getId()])) + ->setText($this->_('En savoir plus')) + ->setImage($this->getIco('read-document', 'library')) + ->setTitle($this->_('En savoir plus sur %s', $this->_model->getLibelle())); } @@ -69,55 +67,47 @@ class Intonation_Library_View_Wrapper_Author extends Intonation_Library_View_Wra public function getActions() { - $actions = [new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'author', - 'action' => 'biography', - 'id' => $this->_model->getId()]), - 'Text' => $this->_('Biographie'), - 'Image' => (Class_Template::current() - ->getIco($this->_view, - 'author', - 'library')), - 'Title' => $this->_('Lire la biographie de %s', $this->_model->getLibelle())]), - - new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'author', - 'action' => 'collaborations', - 'id' => $this->_model->getId()]), - 'Text' => $this->_('Les collaborateurs'), - 'Image' => (Class_Template::current() - ->getIco($this->_view, - 'team', - 'library')), - 'Title' => $this->_('En savoir plus sur les collaborateurs de %s', $this->_model->getLibelle())]), - - new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'author', - 'action' => 'records', - 'id' => $this->_model->getId()]), - 'Text' => $this->_('Les documents'), - 'Image' => (Class_Template::current() - ->getIco($this->_view, - 'related', - 'library')), - 'Title' => $this->_('En savoir plus sur les documents de %s', $this->_model->getLibelle())]), - - new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'author', - 'action' => 'interviews', - 'id' => $this->_model->getId()]), - 'Text' => $this->_('Les interviews'), - 'Image' => (Class_Template::current() - ->getIco($this->_view, - 'reviews', - 'library')), - 'Title' => $this->_('Les interviews de %s', $this->_model->getLibelle())]), - - new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'author', - 'action' => 'youtube-chan', - 'id' => $this->_model->getId()]), - 'Text' => $this->_('La chaine YouTube'), - 'Image' => (Class_Template::current() - ->getIco($this->_view, - 'media', - 'library')), - 'Title' => $this->_('La chaine YouTube de %s', $this->_model->getLibelle())]) + $actions = [(new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'author', + 'action' => 'biography', + 'id' => $this->_model->getId()])) + ->setText($this->_('Biographie')) + ->setTitle($this->_('Lire la biographie de %s', $this->_model->getLibelle())) + ->setImage($this->getIco('author', 'library')) + , + (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'author', + 'action' => 'collaborations', + 'id' => $this->_model->getId()])) + ->setText($this->_('Les collaborateurs')) + ->setTitle($this->_('En savoir plus sur les collaborateurs de %s', + $this->_model->getLibelle())) + ->setImage($this->getIco('team', 'library')) + , + (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'author', + 'action' => 'records', + 'id' => $this->_model->getId()])) + ->setText($this->_('Les documents')) + ->setTitle($this->_('En savoir plus sur les documents de %s', + $this->_model->getLibelle())) + ->setImage($this->getIco('related', 'library')) + , + (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'author', + 'action' => 'interviews', + 'id' => $this->_model->getId()])) + ->setText($this->_('Les interviews')) + ->setTitle($this->_('Les interviews de %s', $this->_model->getLibelle())) + ->setImage($this->getIco('reviews', 'library')) + , + (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'author', + 'action' => 'youtube-chan', + 'id' => $this->_model->getId()])) + ->setText($this->_('La chaine YouTube')) + ->setTitle($this->_('La chaine YouTube de %s', $this->_model->getLibelle())) + ->setImage($this->getIco('media', 'library')) ]; if (!Class_Users::isCurrentUserCanAccesBackend()) @@ -130,31 +120,31 @@ class Intonation_Library_View_Wrapper_Author extends Intonation_Library_View_Wra $record = array_shift($records); - $actions_pro = [new Intonation_Library_Link(['Url' => $this->_view->url(['module' => 'admin', - 'controller' => 'records', - 'action' => 'biography', - 'auteur' => $description->getLabel(), - 'language' => Class_Profil::getCurrentProfil()->getLocale(), - 'id' => $record->getId()], null, true), - - 'Attribs' => ['class' => 'menu_admin_front_anchor'], - 'Image' => Class_Template::current()->getIco($this->_view, - 'refresh', - 'utils'), - 'Text' => $this->_('Modifier …'), - 'Popup' => true, - 'Title' => $this->_('Modifier la biographie de %s', - $this->_model->getLibelle())])]; - - $button = new Intonation_Library_Link(['Text' => $this->_('Plus'), - 'Attribs' => ['class' => 'more_action'], - 'Title' => $this->_('Voir plus d\'actions pour %s', - $this->_model->getLibelle()), - 'Image' => Class_Template::current()->getIco($this->_view, - 'more', - 'utils')]); - - $actions [] = $this->_view->renderDropdown($this->_view->renderActions($actions_pro), $button, 'dropleft dropup'); + $actions_pro = [(new Intonation_Library_Link) + ->setUrl($this->_view->url(['module' => 'admin', + 'controller' => 'records', + 'action' => 'biography', + 'auteur' => $description->getLabel(), + 'language' => Class_Profil::getCurrentProfil()->getLocale(), + 'id' => $record->getId()], null, true)) + + ->setImage($this->getIco('refresh', 'utils')) + ->setText($this->_('Modifier …')) + ->setTitle($this->_('Modifier la biographie de %s', + $this->_model->getLibelle())) + ->setClass('menu_admin_front_anchor') + ->setPopup(true) + ]; + + $button = (new Intonation_Library_Link) + ->setText($this->_('Plus')) + ->setTitle($this->_('Voir plus d\'actions pour %s', $this->_model->getLibelle())) + ->setImage($this->getIco('more', 'utils')) + ->setClass('more_action'); + + $actions [] = $this->_view->renderDropdown($this->_view->renderActions($actions_pro), + $button, + 'dropleft dropup'); return $actions; } diff --git a/library/templates/Intonation/Library/View/Wrapper/Card.php b/library/templates/Intonation/Library/View/Wrapper/Card.php index 458ce294fa756edda653bc309dfdc93a78d12681..a19946c0c1beab8400721eb335db0d76319b742b 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Card.php +++ b/library/templates/Intonation/Library/View/Wrapper/Card.php @@ -32,15 +32,14 @@ class Intonation_Library_View_Wrapper_Card extends Intonation_Library_View_Wrapp if ($this->_model->getId() == Class_Users::getIdentity()->getId()) return []; - return [new Intonation_Library_Link(['Text' => $this->_('Supprimer'), - 'Class' => 'text-danger', - 'Title' => $this->_('Ne plus gérer la carte de %s', - $this->getMainTitle()), - 'Image' => Class_Template::current()->getIco($this->_view, - 'unlink_user', - 'utils'), - 'Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'unlink-card', - 'child_id' => $this->_model->getId()])])]; + return [(new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'unlink-card', + 'child_id' => $this->_model->getId()])) + ->setImage($this->getIco('unlink_user', 'utils')) + ->setText($this->_('Supprimer')) + ->setTitle($this->_('Ne plus gérer la carte de %s', $this->getMainTitle())) + ->setClass('text-danger') + ]; } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/View/Wrapper/Domain.php b/library/templates/Intonation/Library/View/Wrapper/Domain.php index 026832505bf61ad419299c060fd7f3733715c468..e2a0daa8818025d62cde40186eb03eb93bf8be76 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Domain.php +++ b/library/templates/Intonation/Library/View/Wrapper/Domain.php @@ -50,13 +50,11 @@ class Intonation_Library_View_Wrapper_Domain extends Intonation_Library_View_Wra if ($this->_widget_context) $url ['id_module'] = $this->_widget_context->getId(); - return new Intonation_Library_Link(['Url' => $this->_view->url($url), - - 'Image' => Class_Template::current()->getIco($this->_view, - 'read-document', - 'library'), - 'Text' => $this->_('Voir les documents'), - 'Title' => $this->_getMainLinkTitle()]); + return (new Intonation_Library_Link) + ->setUrl($this->_view->url($url)) + ->setImage($this->getIco('read-document', 'library')) + ->setText($this->_('Voir les documents')) + ->setTitle($this->_getMainLinkTitle()); } diff --git a/library/templates/Intonation/Library/View/Wrapper/DriveCheckoutPlan/Library.php b/library/templates/Intonation/Library/View/Wrapper/DriveCheckoutPlan/Library.php index d4cccf333e00b666545f0390b871335765b507c5..93b83279519f3cefb99f0b536dc0c21edfab964d 100644 --- a/library/templates/Intonation/Library/View/Wrapper/DriveCheckoutPlan/Library.php +++ b/library/templates/Intonation/Library/View/Wrapper/DriveCheckoutPlan/Library.php @@ -58,41 +58,32 @@ class Intonation_Library_View_Wrapper_DriveCheckoutPlan_Library $url = implode([$this->_view->url($this->_plan->libraryUrlFor($this->_model)), '#' . Intonation_Library_View_Wrapper_DriveCheckoutPlan_RichContent_Date::htmlIdFor($this->_plan)]); - return - [new Intonation_Library_Link(['Url' => $url, - 'Image' => Class_Template::current()->getIco($this->_view, - 'available', - 'library'), - - 'Text' => $this->_messages->book(), - 'Title' => $this->_messages->bookAt($this->_model), - 'Class' => 'text-primary'])]; + return [(new Intonation_Library_Link) + ->setUrl($url) + ->setImage($this->getIco('available', 'library')) + ->setText($this->_messages->book()) + ->setTitle($this->_messages->bookAt($this->_model)) + ->setClass('text-primary')]; } protected function _existingActions($existing) { - return - [new Intonation_Library_Link(['Url' => $this->_view->url(['action' => 'ical', - 'id' => $existing->getId()]), - 'Image' => Class_Template::current()->getIco($this->_view, - 'extend-loan', - 'library'), - - 'Text' => $this->_messages->addToAgenda(), - 'Title' => $this->_messages->importFromIcal($this->_model, - $existing), - ]), - new Intonation_Library_Link(['Url' => $this->_view->url(['action' => 'delete', - 'id' => $existing->getId()]), - 'Image' => Class_Template::current()->getIco($this->_view, - 'clean', - 'utils'), - - 'Text' => $this->_messages->delete(), - 'Title' => $this->_messages->deleteExistingAt($this->_model, - $existing), - 'Class' => 'text-danger', - 'Attribs' => ['onclick' => $this->_view->confirm($this->_messages->deleteConfirm())]])]; + return [(new Intonation_Library_Link) + ->setUrl($this->_view->url(['action' => 'ical', + 'id' => $existing->getId()])) + ->setImage($this->getIco('extend-loan', 'library')) + ->setText($this->_messages->addToAgenda()) + ->setTitle($this->_messages->importFromIcal($this->_model, $existing)) + , + (new Intonation_Library_Link) + ->setUrl($this->_view->url(['action' => 'delete', + 'id' => $existing->getId()])) + ->setImage($this->getIco('clean', 'utils')) + ->setText($this->_messages->delete()) + ->setTitle($this->_messages->deleteExistingAt($this->_model, $existing)) + ->setClass('text-danger') + ->setAttrib('onclick', $this->_view->confirm($this->_messages->deleteConfirm())) + ]; } diff --git a/library/templates/Intonation/Library/View/Wrapper/DriveCheckoutPlan/LibrarySelected.php b/library/templates/Intonation/Library/View/Wrapper/DriveCheckoutPlan/LibrarySelected.php index 13aa549ed37475753d2e08a8566bea5db0abfd8c..1740020d4ccc774fe5df746a985b2491449b8880 100644 --- a/library/templates/Intonation/Library/View/Wrapper/DriveCheckoutPlan/LibrarySelected.php +++ b/library/templates/Intonation/Library/View/Wrapper/DriveCheckoutPlan/LibrarySelected.php @@ -25,15 +25,12 @@ class Intonation_Library_View_Wrapper_DriveCheckoutPlan_LibrarySelected public function getActions() { - $url = $this->_view->url($this->_plan->resetUrl()) . '#' . $this->_html_id; - - return [new Intonation_Library_Link(['Url' => $url, - 'Image' => Class_Template::current()->getIco($this->_view, - 'refresh', - 'utils'), - - 'Text' => $this->_messages->chooseAnotherLibrary(), - 'Title' => $this->_messages->backToLibraryChoice(), - 'Class' => 'text-danger'])]; + return [(new Intonation_Library_Link) + ->setUrl($this->_view->url($this->_plan->resetUrl()) + . '#' . $this->_html_id) + ->setImage($this->getIco('refresh', 'utils')) + ->setText($this->_messages->chooseAnotherLibrary()) + ->setTitle($this->_messages->backToLibraryChoice()) + ->setClass('text-danger')]; } } diff --git a/library/templates/Intonation/Library/View/Wrapper/DriveCheckoutPlan/RichContent/Date.php b/library/templates/Intonation/Library/View/Wrapper/DriveCheckoutPlan/RichContent/Date.php index d9a01a8cba6f8d9bb361f4f01e28004053956691..dd5393972305409867039adf859cbc06740c1c24 100644 --- a/library/templates/Intonation/Library/View/Wrapper/DriveCheckoutPlan/RichContent/Date.php +++ b/library/templates/Intonation/Library/View/Wrapper/DriveCheckoutPlan/RichContent/Date.php @@ -83,12 +83,11 @@ class Intonation_Library_View_Wrapper_DriveCheckoutPlan_RichContent_Date $url = implode([$this->_view->url($this->_model->dateUrlFor($date)), '#' . Intonation_Library_View_Wrapper_DriveCheckoutPlan_RichContent_Time::htmlIdFor($this->_model)]); - $action = new Intonation_Library_Link(['Url' => $url, - 'Image' => Class_Template::current()->getIco($this->_view, - 'available', - 'library'), - 'Text' => $label, - 'Title' => $this->_messages->chooseDate($label)]); + $action = (new Intonation_Library_Link) + ->setUrl($url) + ->setImage($this->getIco('available', 'library')) + ->setText($label) + ->setTitle($this->_messages->chooseDate($label)); return $this->_view->tagAction($action); } @@ -98,13 +97,15 @@ class Intonation_Library_View_Wrapper_DriveCheckoutPlan_RichContent_Date $label = $this->_dateLabel($date); $url_parts = $this->getNavUrl(); $url = $this->_view->url($url_parts) . ($url_parts ? '#' . $this->_getHtmlId() : ''); - $attribs = ['Url' => $url, - 'Image' => Class_Template::current()->getIco($this->_view, 'refresh', 'utils'), - 'Text' => $this->_messages->chooseAnotherDate(), - 'Title' => $this->_messages->backToDateChoiceOf($this->_model->selectedLibrary()), - 'Class' => 'text-danger']; - return $label . BR . $this->_view->tagAction(new Intonation_Library_Link($attribs)); + $action = (new Intonation_Library_Link) + ->setUrl($url) + ->setImage($this->getIco('refresh', 'utils')) + ->setText($this->_messages->chooseAnotherDate()) + ->setTitle($this->_messages->backToDateChoiceOf($this->_model->selectedLibrary())) + ->setClass('text-danger'); + + return $label . BR . $this->_view->tagAction($action); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Hold.php b/library/templates/Intonation/Library/View/Wrapper/Hold.php index b7ee29c554f98e2aa00900808df8696b4039ed80..307f938b402143bc7d4a2c8711620f924a41ae03 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Hold.php +++ b/library/templates/Intonation/Library/View/Wrapper/Hold.php @@ -225,14 +225,13 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp public function getActions() { - return [ new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'reservations', - 'id_delete' => $this->_model->getId()]), - 'Text' => $this->_('Supprimer'), - 'Image' => $this->getIco('delete', - 'utils'), - 'Title' => $this->_('Supprimer la réservation %s', - $this->_model->getTitre())])]; + return [(new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'reservations', + 'id_delete' => $this->_model->getId()])) + ->setImage($this->getIco('delete', 'utils')) + ->setText($this->_('Supprimer')) + ->setTitle($this->_('Supprimer la réservation %s', $this->_model->getTitre()))]; } diff --git a/library/templates/Intonation/Library/View/Wrapper/Item.php b/library/templates/Intonation/Library/View/Wrapper/Item.php index 71afb82246d1d7d419832993aa36a6e71ffdd92e..fbf55700db2d726cf3154a12246088c6aae00094 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Item.php +++ b/library/templates/Intonation/Library/View/Wrapper/Item.php @@ -38,12 +38,10 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp $dispo = $this->_model->getDisponibilite(); return $this->_view->tag('span', - Class_Template::current()->getIco($this->_view, - ($this->_model->isDisponible(true) - ? 'available' - : 'not-available'), - 'library') - + $this->getIco(($this->_model->isDisponible(true) + ? 'available' + : 'not-available'), + 'library') . $this->_view->tag('span', $dispo, ['class' => 'item_availability align-middle d-inline text-left']), ['class' => ($this->_model->isDisponible(true) ? 'text-success' @@ -70,14 +68,11 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp if (!$this->_isCheckedInSettings('bib')) return null; - return new Intonation_Library_Link(['Url' => $this->_model->getLibraryUrl(), - 'Image' => Class_Template::current()->getIco($this->_view, - 'library', - 'library'), - - 'Text' => $this->getMainTitle(), - 'Title' => $this->_('En lire plus sur la bibliothèque %s', - $this->_model->getBibLibelle())]); + return (new Intonation_Library_Link) + ->setUrl($this->_model->getLibraryUrl()) + ->setImage($this->getIco('library', 'library')) + ->setText($this->getMainTitle()) + ->setTitle($this->_('En lire plus sur la bibliothèque %s', $this->_model->getBibLibelle())); } @@ -98,18 +93,17 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp ? $this->_view->tag('span', $this->_('Réserver'), ['class' => 'align-middle']) : $this->_view->tag('span', $this->_('Non réservable'), ['class' => 'align-middle text-black-50']); - return new Intonation_Library_Link(['Url' => $hold_link, - 'Text' => $secondary_title, - 'TextHold' => $text, - 'Title' => $title, - 'Popup' => true]); + return (new Intonation_Library_Link) + ->setUrl($hold_link) + ->setText($secondary_title) + ->setTitle($title) + ->setAttrib('text-hold', $text) + ->setPopup(true); } public function getSecondaryIco() { - return Class_Template::current()->getIco($this->_view, - 'hold', - 'library'); + return $this->getIco('hold', 'library'); } @@ -153,7 +147,7 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp $action ->setImage($this->getSecondaryIco()) - ->setText($action->getTextHold()); + ->setText($action->getAttrib('text-hold', $action->getText())); return [$action]; } @@ -193,9 +187,7 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp return (new Intonation_Library_Badge) ->setTag('span') ->setClass('badge-secondary') - ->setImage(Class_Template::current()->getIco($this->_view, - 'place', - 'library')) + ->setImage($this->getIco('place', 'library')) ->setText(Class_CodifEmplacement::getLabel($this->_model->getEmplacement())) ->setTitle($this->_('Emplacement de l\'exemplaire "%s"', $this->_model->getCodeBarres())); @@ -206,9 +198,7 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp return (new Intonation_Library_Badge) ->setTag('span') ->setClass('badge-secondary') - ->setImage(Class_Template::current()->getIco($this->_view, - 'cote', - 'library')) + ->setImage($this->getIco('cote', 'library')) ->setText($this->_model->getCote()) ->setTitle($this->_('Cote de l\'exemplaire %s : %s', $this->_model->getCodeBarres(), @@ -223,9 +213,7 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp return (new Intonation_Library_Badge) ->setTag('span') ->setClass('badge-warning') - ->setImage(Class_Template::current()->getIco($this->_view, - 'return-date', - 'library')) + ->setImage($this->getIco('return-date', 'library')) ->setText($this->_model->getDateRetour()) ->setTitle($this->_('Date de retour prévue de l\'exemplaire %s', $this->_model->getCodeBarres())); @@ -239,9 +227,7 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp return (new Intonation_Library_Badge) ->setTag('span') ->setClass('item_hold_rank badge-warning') - ->setImage(Class_Template::current()->getIco($this->_view, - 'hold', - 'library')) + ->setImage($this->getIco('hold', 'library')) ->setText($this->_plural($this->_model->getNbResas(), 'Aucune réservation', 'Déjà une réservation', diff --git a/library/templates/Intonation/Library/View/Wrapper/ItemForOsm.php b/library/templates/Intonation/Library/View/Wrapper/ItemForOsm.php index 16a0ff71f854c3e91d754c79a5ba4082105286b4..65c0366c6cb0a5ad454c609d2b8e82b46a698dd2 100644 --- a/library/templates/Intonation/Library/View/Wrapper/ItemForOsm.php +++ b/library/templates/Intonation/Library/View/Wrapper/ItemForOsm.php @@ -29,9 +29,7 @@ class Intonation_Library_View_Wrapper_ItemForOsm extends Intonation_Library_View $wrapper = Class_Template::current()->newWrapper($library, $this->_view); - return - $description - . $wrapper->getDescription(); + return $description . $wrapper->getDescription(); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Library.php b/library/templates/Intonation/Library/View/Wrapper/Library.php index 513fa237f43a16214301e639d1cdc6231d86bce0..b462a0e7bade7e25d378eff9826cec884e81dd57 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Library.php +++ b/library/templates/Intonation/Library/View/Wrapper/Library.php @@ -43,13 +43,11 @@ class Intonation_Library_View_Wrapper_Library extends Intonation_Library_View_Wr public function getMainLink() { - return new Intonation_Library_Link(['Url' => $this->_model->getUrl(), - 'Image' => Class_Template::current()->getIco($this->_view, - 'read-document', - 'library'), - - 'Text' => $this->_('En savoir plus'), - 'Title' => $this->_getMainLinkTitle()]); + return (new Intonation_Library_Link) + ->setUrl($this->_model->getUrl()) + ->setImage($this->getIco('read-document', 'library')) + ->setText($this->_('En savoir plus')) + ->setTitle($this->_getMainLinkTitle()); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Loan.php b/library/templates/Intonation/Library/View/Wrapper/Loan.php index 772813d97dbe25eea765a75f53388a3619c8b356..cb535ffb3dd328046f769539a679a3d08cee44e3 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Loan.php +++ b/library/templates/Intonation/Library/View/Wrapper/Loan.php @@ -188,14 +188,13 @@ class Intonation_Library_View_Wrapper_Loan extends Intonation_Library_View_Wrapp $actions = []; if ($this->_model->isRenewable()) - $actions [] = new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'prolongerPret', - 'id_pret' => $this->_model->getId()]), - 'Text' => $this->_('Prolonger'), - 'Image' => $this->getIco('extend-loan', - 'library'), - 'Title' => $this->_('Prolonger l\'emprunt %s', - $this->_model->getTitre())]); + $actions [] = (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'prolongerPret', + 'id_pret' => $this->_model->getId()])) + ->setImage($this->getIco('extend-loan', 'library')) + ->setText($this->_('Prolonger')) + ->setTitle($this->_('Prolonger l\'emprunt %s', $this->_model->getTitre())); if (!$record = $this->_getRecord()) return $actions; diff --git a/library/templates/Intonation/Library/View/Wrapper/Newsletter.php b/library/templates/Intonation/Library/View/Wrapper/Newsletter.php index b208259e92401afddd495d89a3280d708d6a4436..8aaa45fe6d9ad3a19d06638b5f712226cd58b143 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Newsletter.php +++ b/library/templates/Intonation/Library/View/Wrapper/Newsletter.php @@ -38,43 +38,36 @@ class Intonation_Library_View_Wrapper_Newsletter extends Intonation_Library_View public function getMainLink() { - $default_register_link = ['Text' => $this->_view->_("M'inscrire"), - 'Title' => $this->_view->_("M'inscrire à la lettre d'information %s", $this->_model->getTitre()), - 'Image' => $this->getIco('no-selection', 'library')]; - - if ( ! $current_user = Class_Users::getIdentity()) { - $params = array_merge(['Url' => - $this->_view->url(['controller' => 'auth', - 'action' => 'newsletter-register', - 'id' => $this->_model->getId()], - null, - true)], - $default_register_link); - return new Intonation_Library_Link($params); - } + $default_register_link = (new Intonation_Library_Link) + ->setText($this->_("M'inscrire")) + ->setTitle($this->_("M'inscrire à la lettre d'information %s", $this->_model->getTitre())) + ->setImage($this->getIco('no-selection', 'library')); + + if ( ! $current_user = Class_Users::getIdentity()) + return $default_register_link + ->setUrl($this->_view->url(['controller' => 'auth', + 'action' => 'newsletter-register', + 'id' => $this->_model->getId()], + null, true)); if ($current_user->isNewsletterDisabled()) return null; - $params = $this->_model->hasRecipient($current_user) - ? ['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'unsubscribe-newsletter', - 'id' => $this->_model->getId()], - null, - true), - 'Text' => $this->_view->_("Me désinscrire"), - 'Title' => $this->_view->_("Me désinscrire à la lettre d'information %s", $this->_model->getTitre()), - 'Image' => Class_Template::current()->getIco($this->_view, - 'selection', - 'library')] - : array_merge(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'subscribe-newsletter', - 'id' => $this->_model->getId()], - null, - true)], - $default_register_link); - - return new Intonation_Library_Link($params); + if ($this->_model->hasRecipient($current_user)) + return (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'unsubscribe-newsletter', + 'id' => $this->_model->getId()], + null, true)) + ->setText($this->_("Me désinscrire")) + ->setTitle($this->_("Me désinscrire à la lettre d'information %s", $this->_model->getTitre())) + ->setImage($this->getIco('selection', 'library')); + + return $default_register_link + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'subscribe-newsletter', + 'id' => $this->_model->getId()], + null, true)); } diff --git a/library/templates/Intonation/Library/View/Wrapper/PNBHold.php b/library/templates/Intonation/Library/View/Wrapper/PNBHold.php index 235c4bb1e1dbd85dda79e4f2f67559a99d578d3c..0d1c2c41244ae3710b0c494cd3f7e79383b3781e 100644 --- a/library/templates/Intonation/Library/View/Wrapper/PNBHold.php +++ b/library/templates/Intonation/Library/View/Wrapper/PNBHold.php @@ -52,19 +52,19 @@ class Intonation_Library_View_Wrapper_PNBHold extends Intonation_Library_View_Wr public function getActions() { - return - [ new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'delete-pnb-hold', - 'id' => $this->_getModelId()]), - 'Text' => $this->_('Supprimer'), - 'Image' => $this->getIco('delete', - 'utils'), - 'Title' => $this->_('Supprimer la réservation du document %s', - $this->_model->getTitre()), - 'Popup' => true, - 'Confirm' => $this->_('Confirmez-vous la suppression de la réservation du document %s ? ', $this->_model->getTitre())])]; + return [(new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'delete-pnb-hold', + 'id' => $this->_getModelId()])) + ->setImage($this->getIco('delete', 'utils')) + ->setText($this->_('Supprimer')) + ->setTitle($this->_('Supprimer la réservation du document %s', $this->_model->getTitre())) + ->setPopup(true) + ->setConfirm($this->_('Confirmez-vous la suppression de la réservation du document %s ? ', + $this->_model->getTitre()))]; } + private function _getModelId() { return $this->_model->getOperationId(); } diff --git a/library/templates/Intonation/Library/View/Wrapper/PNBLoan.php b/library/templates/Intonation/Library/View/Wrapper/PNBLoan.php index 3b1458baf69f2e379201228b34faefa78f9f92da..ceb9107c46752f59324342127dc791595d9e8945 100644 --- a/library/templates/Intonation/Library/View/Wrapper/PNBLoan.php +++ b/library/templates/Intonation/Library/View/Wrapper/PNBLoan.php @@ -85,32 +85,28 @@ class Intonation_Library_View_Wrapper_PNBLoan extends Intonation_Library_View_Wr } $loan_id = $this->_model->getId(); if ($this->_model->allowExtend()) - $actions [] = new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'bib-numerique', - 'action' => 'extends-pnb-loan', - 'loan_id' => $loan_id]), - 'Text' => $this->_('Prolonger'), - 'Image' => Class_Template::current()->getIco($this->_view, - 'extend-loan', - 'library'), - 'Title' => $this->_('Prolonger l\'emprunt %s', - $this->_model->getTitre())]); + $actions [] = (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'bib-numerique', + 'action' => 'extends-pnb-loan', + 'loan_id' => $loan_id])) + ->setImage($this->_view->templateIco('extend-loan', 'library')) + ->setText($this->_('Prolonger')) + ->setTitle($this->_('Prolonger l\'emprunt %s', $this->_model->getTitre())); + if ($this->_model->allowEarlyReturn()) - $actions [] = new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'bib-numerique', - 'action' => 'return-pnb-loan', - 'loan_id' => $loan_id]), - 'Text' => $this->_('Retour anticipé'), - 'Image' => Class_Template::current()->getIco($this->_view, - 'return-date', - 'library'), - 'Title' => $this->_('Retourner l\'emprunt %s', - $this->_model->getTitre())]); - - $actions [] = new Intonation_Library_Link(['Url' => $this->_model->getLoanLink(), - 'Text' => $this->_('Télécharger'), - 'Image' => Class_Template::current()->getIco($this->_view, - 'export', - 'utils'), - 'Title' => $this->_('Télécharger')]); + $actions [] = (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'bib-numerique', + 'action' => 'return-pnb-loan', + 'loan_id' => $loan_id])) + ->setImage($this->_view->templateIco('return-date', 'library')) + ->setText($this->_('Retour anticipé')) + ->setTitle($this->_('Retourner l\'emprunt %s', $this->_model->getTitre())); + + $actions [] = (new Intonation_Library_Link) + ->setUrl($this->_model->getLoanLink()) + ->setImage($this->_view->templateIco('export', 'utils')) + ->setText($this->_('Télécharger')) + ->setTitle($this->_('Télécharger')); return $actions; } diff --git a/library/templates/Intonation/Library/View/Wrapper/ParentCard.php b/library/templates/Intonation/Library/View/Wrapper/ParentCard.php index b0bd69326e12021e785190701e986e04c0cb7e99..c90ac711d515936657e126fd6d99971d810e63a5 100644 --- a/library/templates/Intonation/Library/View/Wrapper/ParentCard.php +++ b/library/templates/Intonation/Library/View/Wrapper/ParentCard.php @@ -22,7 +22,6 @@ class Intonation_Library_View_Wrapper_ParentCard extends Intonation_Library_View_Wrapper_User { - public function getMainLink() { return null; } @@ -32,14 +31,12 @@ class Intonation_Library_View_Wrapper_ParentCard extends Intonation_Library_View if ($this->_model->getId() == Class_Users::getIdentity()->getId()) return []; - return [new Intonation_Library_Link(['Text' => $this->_('Supprimer'), - 'Title' => $this->_('Ne plus être géré par %s', - $this->getMainTitle()), - 'Image' => Class_Template::current()->getIco($this->_view, - 'unlink_user', - 'utils'), - 'Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'unlink-parent-card', - 'id' => $this->_model->getId()])])]; + return [(new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'unlink-parent-card', + 'id' => $this->_model->getId()])) + ->setImage($this->getIco('unlink_user', 'utils')) + ->setText($this->_('Supprimer')) + ->setTitle($this->_('Ne plus être géré par %s', $this->getMainTitle()))]; } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/View/Wrapper/Record.php b/library/templates/Intonation/Library/View/Wrapper/Record.php index 45d6ef8dd6752ad4fc3ce57bcde805ab078e0db9..50bae44f2b58910d9b106d4a6b5a753744be994c 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Record.php +++ b/library/templates/Intonation/Library/View/Wrapper/Record.php @@ -55,14 +55,15 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra public function getMainLink() { $url = $this->_view->urlNotice($this->_model, $this->_widget_context_params); - return new Intonation_Library_Link(['Url' => $url, - 'Image' => $this->getIco('read-document', 'library'), - 'Text' => $this->_('Voir'), - 'Class' => 'read_document', - 'Title' => $this->_('Voir le document %s de %s de type %s', - $this->getMainTitle(), - $this->getSecondaryTitle(), - $this->getDocTypeLabel())]); + return (new Intonation_Library_Link) + ->setUrl($url) + ->setImage($this->getIco('read-document', 'library')) + ->setText($this->_('Voir')) + ->setTitle($this->_('Voir le document %s de %s de type %s', + $this->getMainTitle(), + $this->getSecondaryTitle(), + $this->getDocTypeLabel())) + ->setClass('read_document'); } @@ -73,16 +74,15 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra public function getPictureAction() { if (Class_Users::isCurrentUserCanAccesBackend()) - return new Intonation_Library_Link(['Url' => $this->_view->url(['module' => 'admin', - 'controller' => 'records', - 'action' => 'thumbnail', - 'id' => $this->_model->getId()]), - 'Popup' => 'true', - 'Attribs' => ['class' => 'menu_admin_front_anchor'], - 'Image' => $this->getIco('edit', 'utils'), - 'Class' => 'record_change_thumbnail', - 'Title' => $this->_('Modifier la vignette de %s', - $this->_model->getTitrePrincipal(' '))]); + return (new Intonation_Library_Link) + ->setUrl($this->_view->url(['module' => 'admin', + 'controller' => 'records', + 'action' => 'thumbnail', + 'id' => $this->_model->getId()])) + ->setImage($this->getIco('edit', 'utils')) + ->setTitle($this->_('Modifier la vignette de %s', $this->_model->getTitrePrincipal(' '))) + ->setClass('menu_admin_front_anchor record_change_thumbnail') + ->setPopup('true'); } @@ -132,10 +132,11 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra $author_field = new Class_Notice_FieldAuthor($facet); - return new Intonation_Library_Link(['Url' => $author_field->getUrlForLink(), - 'Image' => $this->getSecondaryIco(), - 'Text' => $author_field->getLabel(), - 'Title' => $author_field->getTitle()]); + return (new Intonation_Library_Link) + ->setUrl($author_field->getUrlForLink()) + ->setImage($this->getSecondaryIco()) + ->setText($author_field->getLabel()) + ->setTitle($author_field->getTitle()); } @@ -450,17 +451,17 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra return []; if ((new Class_Notice_Sso($this->_model))->isValid()) { - $actions [] = new Intonation_Library_Link(['Url' => $this->_view->url(['module' => 'opac', - 'controller' => 'modules', - 'action' => 'sso', - 'id' => $this->_model->getId()], - null, - true), - 'Text' => $this->_('Consulter en ligne'), - 'Image' => $this->getIco('play', 'utils'), - 'Class' => 'view_online_resource', - 'Title' => $this->_('Consulter le document %s en ligne', - $this->getMainTitle())]); + $actions [] = (new Intonation_Library_Link) + ->setUrl($this->_view->url(['module' => 'opac', + 'controller' => 'modules', + 'action' => 'sso', + 'id' => $this->_model->getId()], + null, true)) + ->setImage($this->getIco('play', 'utils')) + ->setText($this->_('Consulter en ligne')) + ->setTitle($this->_('Consulter le document %s en ligne', $this->getMainTitle())) + ->setClass('view_online_resource'); + return $actions; } @@ -471,23 +472,24 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra return $actions; if ($url = $first_item->getUrl()) { - $actions [] = new Intonation_Library_Link(['Url' => $url, - 'Text' => $this->_('Description en ligne'), - 'Image' => $this->getIco('play', 'utils'), - 'Title' => $this->_('Description de %s en ligne', - $this->getMainTitle()), - 'Class' => 'view_online_resource_description']); + $actions [] = (new Intonation_Library_Link) + ->setUrl($url) + ->setImage($this->getIco('play', 'utils')) + ->setText($this->_('Description en ligne')) + ->setTitle($this->_('Description de %s en ligne', $this->getMainTitle())) + ->setClass('view_online_resource_description'); + return $actions; } if ($bundle = $first_item->getBundle()) { - $actions [] = new Intonation_Library_Link(['Url' => $this->_view->urlNotice($bundle), - 'Text' => $this->_('Fait partie du lot %s', - $bundle->getTitrePrincipal()), - 'Image' => ($this->getIco('list', 'utils')), - 'Title' => $this->_('Le document %s fait partie du lot %s', - $bundle->getTitrePrincipal()), - 'Class' => 'view_record_bundle']); + $actions [] = (new Intonation_Library_Link) + ->setUrl($this->_view->urlNotice($bundle)) + ->setImage(($this->getIco('list', 'utils'))) + ->setText($this->_('Fait partie du lot %s', $bundle->getTitrePrincipal())) + ->setTitle($this->_('Le document %s fait partie du lot %s', $bundle->getTitrePrincipal())) + ->setClass('view_record_bundle'); + return $actions; } @@ -498,17 +500,15 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra protected function _addHoldLink($actions) { - $actions [] = - new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'reserver', - 'record_id' => $this->_model->getId()]), - 'Class' => 'record_hold_link', - 'Text' => $this->_('Réserver'), - 'Image' => $this->getIco('hold', 'library'), - 'Title' => $this->_('Réserver le document %s', - $this->getMainTitle()), - 'Class' => 'hold_record', - 'Popup' => true]); + $actions [] = (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'reserver', + 'record_id' => $this->_model->getId()])) + ->setImage($this->getIco('hold', 'library')) + ->setText($this->_('Réserver')) + ->setTitle($this->_('Réserver le document %s', $this->getMainTitle())) + ->setClass('hold_record') + ->setPopup(true); return $actions; } @@ -521,35 +521,33 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra $this->_thumbnailActions(), [$this->_addNumericResourceAction()]); - $button = new Intonation_Library_Link(['Text' => $this->_('Plus'), - 'Attribs' => ['class' => 'more_action'], - 'Title' => $this->_('Voir plus d\'actions pour le document %s', - $this->_model->getTitrePrincipal(' ')), - 'Class' => 'view_more_record_actions', - 'Image' => $this->getIco('more', 'utils')]); - - $button->setCallback(function($button) use ($actions) - { - $button->setCallback(null); - return $this->_view->renderDropdown($this->_view->renderActions($actions), - $button, - 'dropleft dropup'); - }); - - return $button; + return (new Intonation_Library_Link) + ->setImage($this->getIco('more', 'utils')) + ->setText($this->_('Plus')) + ->setTitle($this->_('Voir plus d\'actions pour le document %s', + $this->_model->getTitrePrincipal(' '))) + ->setClass('view_more_record_actions') + ->setAttrib('class', 'more_action') + ->setCallback(function($button) use ($actions) + { + $button->setCallback(null); + return $this->_view->renderDropdown($this->_view->renderActions($actions), + $button, + 'dropleft dropup'); + }); } protected function _addToSelectionAction() { - return new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'panier', - 'action' => 'add-record-ajax', - 'id_notice' => $this->_model->getId()]), - 'Image' => $this->getIco('add', 'utils'), - 'Text' => $this->_('Ajouter …'), - 'Popup' => 'true', - 'Class' => 'add_record_to_selection', - 'Title' => $this->_('Ajouter %s dans une sélection', - $this->_model->getTitrePrincipal(' '))]); + return (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'panier', + 'action' => 'add-record-ajax', + 'id_notice' => $this->_model->getId()])) + ->setImage($this->getIco('add', 'utils')) + ->setText($this->_('Ajouter …')) + ->setTitle($this->_('Ajouter %s dans une sélection', $this->_model->getTitrePrincipal(' '))) + ->setClass('add_record_to_selection') + ->setPopup('true'); } @@ -560,16 +558,16 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra if ( ! Class_Users::isCurrentUserAdmin()) return; - return new Intonation_Library_Link(['Url' => $this->_view->url(['module' => 'admin', - 'controller' => 'album', - 'action' => 'link_album_to', - 'id_notice' => $this->_model->getId()]), - 'Image' => $this->getIco('media', 'library'), - 'Text' => $this->_('Créer …'), - 'Popup' => 'true', - 'Class' => 'menu_admin_front_anchor record_link_album', - 'Title' => $this->_('Créer un album numérique %s', - $this->_model->getTitrePrincipal(' '))]); + return (new Intonation_Library_Link) + ->setUrl($this->_view->url(['module' => 'admin', + 'controller' => 'album', + 'action' => 'link_album_to', + 'id_notice' => $this->_model->getId()])) + ->setImage($this->getIco('media', 'library')) + ->setText($this->_('Créer …')) + ->setTitle($this->_('Créer un album numérique %s', $this->_model->getTitrePrincipal(' '))) + ->setClass('menu_admin_front_anchor record_link_album') + ->setPopup('true'); } @@ -579,16 +577,16 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra protected function _printAction() { - return (Class_ModeleFusion::canPrintRecordInProfile(Class_Profil::getCurrentProfil()) - ? new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'recherche', - 'action' => 'print', - 'id' => $this->_model->getId()]), - 'Text' => $this->_('Imprimer'), - 'Image' => $this->getIco('print', 'utils'), - 'Title' => $this->_('Imprimer %s', $this->_model->getTitrePrincipal(' ')), - 'Attribs' => ['target' => '_blank'], - 'Class' => 'print_record']) - : ''); + if (Class_ModeleFusion::canPrintRecordInProfile(Class_Profil::getCurrentProfil())) + return (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'recherche', + 'action' => 'print', + 'id' => $this->_model->getId()])) + ->setImage($this->getIco('print', 'utils')) + ->setText($this->_('Imprimer')) + ->setTitle($this->_('Imprimer %s', $this->_model->getTitrePrincipal(' '))) + ->setAttrib('target', '_blank') + ->setClass('print_record'); } @@ -601,15 +599,15 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra ->setText($this->_('Modifier …')); if (Class_Users::isCurrentUserCanAccesBackend()) - $actions [] = new Intonation_Library_Link(['Url' => $this->_view->url(['module' => 'admin', - 'controller' => 'records', - 'action' => 'reset-thumbnail']), - 'Attribs' => ['class' => 'menu_admin_front_anchor'], - 'Image' => $this->getIco('refresh', 'utils'), - 'Class' => 'reset_record_thumbnail', - 'Text' => $this->_('Générer …'), - 'Title' => $this->_('Supprimer et re-générer la vignette de %s', - $this->_model->getTitrePrincipal(' '))]); + $actions [] = (new Intonation_Library_Link) + ->setUrl($this->_view->url(['module' => 'admin', + 'controller' => 'records', + 'action' => 'reset-thumbnail'])) + ->setImage($this->getIco('refresh', 'utils')) + ->setText($this->_('Générer …')) + ->setTitle($this->_('Supprimer et re-générer la vignette de %s', + $this->_model->getTitrePrincipal(' '))) + ->setClass('menu_admin_front_anchor reset_record_thumbnail'); return $actions; } diff --git a/library/templates/Intonation/Library/View/Wrapper/RecordInSelection.php b/library/templates/Intonation/Library/View/Wrapper/RecordInSelection.php index 6e8897c41eacef005fb43eb8c8c82ef952b2825d..866415b3719dfa14827d8fb07130b8d0927bb9f0 100644 --- a/library/templates/Intonation/Library/View/Wrapper/RecordInSelection.php +++ b/library/templates/Intonation/Library/View/Wrapper/RecordInSelection.php @@ -31,18 +31,17 @@ class Intonation_Library_View_Wrapper_RecordInSelection extends Intonation_Libra } public function getActions() { - return [new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'supprimer-de-la-selection', - 'selection_id' => $this->_selection->getId(), - 'record_id' => $this->_model->getId()]), - 'Class' => 'text-danger', - 'Text' => $this->_('Supprimer'), - 'Popup' => true, - 'Title' => $this->_('Supprimer le document %s de la sélection %s', - $this->_model->getTitrePrincipal(' '), - $this->_selection->getLibelle()), - 'Image' => Class_Template::current()->getIco($this->_view, - 'delete', - 'utils')])]; + return [(new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'supprimer-de-la-selection', + 'selection_id' => $this->_selection->getId(), + 'record_id' => $this->_model->getId()])) + ->setImage($this->getIco('delete', 'utils')) + ->setText($this->_('Supprimer')) + ->setTitle($this->_('Supprimer le document %s de la sélection %s', + $this->_model->getTitrePrincipal(' '), + $this->_selection->getLibelle())) + ->setClass('text-danger') + ->setPopup(true)]; } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/View/Wrapper/RecordToSelect.php b/library/templates/Intonation/Library/View/Wrapper/RecordToSelect.php index 15293fd1dfa8e28540b433896d725c627a3a7ee8..c332c790419af0bb8003a1aebcd5daedfeaec3d6 100644 --- a/library/templates/Intonation/Library/View/Wrapper/RecordToSelect.php +++ b/library/templates/Intonation/Library/View/Wrapper/RecordToSelect.php @@ -47,13 +47,15 @@ class Intonation_Library_View_Wrapper_RecordToSelect extends Intonation_Library_ 'record_id' => $this->_model->getId(), 'id' => $this->_selection->getId()]); - return new Intonation_Library_Link(['Text' => $this->_('Ajouter'), - 'Class' => 'add_to_selection_link position-relative', - 'Attribs' => ['onclick' => sprintf('$.ajax(\'%s\');$(this).closest(\'.card\').addClass(\'border border-success disabled added_to_selection\')', - $url), - 'style' => 'cursor: pointer;'], - 'Title' => $this->_('Ajouter le document %s à la sélection %s', - $this->getMainTitle(), - $this->_selection->getLibelle())]); + return (new Intonation_Library_Link) + ->setText($this->_('Ajouter')) + ->setTitle($this->_('Ajouter le document %s à la sélection %s', + $this->getMainTitle(), + $this->_selection->getLibelle())) + ->setClass('add_to_selection_link position-relative') + ->setAttrib('onclick', + sprintf('$.ajax(\'%s\');$(this).closest(\'.card\').addClass(\'border border-success disabled added_to_selection\')', + $url)) + ->setAttrib('style', 'cursor: pointer;'); } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/View/Wrapper/Review.php b/library/templates/Intonation/Library/View/Wrapper/Review.php index 5c16f84f5c7a4849546802a30bc92380331ba8d6..a7650d0c6ab2891367e14661711a59e789b5b264 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Review.php +++ b/library/templates/Intonation/Library/View/Wrapper/Review.php @@ -73,17 +73,15 @@ class Intonation_Library_View_Wrapper_Review extends Intonation_Library_View_Wra if (!$this->_model->getAvis() || !$this->_model->hasId()) return; - return new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'blog', - 'action' => 'read-more', - 'id' => $this->_model->getId()], - null, - true), - 'Image' => Class_Template::current()->getIco($this->_view, - 'read-review', - 'library'), - 'Text' => $this->_('Lire l\'avis'), - 'Title' => $this->_getMainLinkTitle(), - 'Popup' => true]); + return (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'blog', + 'action' => 'read-more', + 'id' => $this->_model->getId()], + null, true)) + ->setImage($this->getIco('read-review', 'library')) + ->setText($this->_('Lire l\'avis')) + ->setTitle($this->_getMainLinkTitle()) + ->setPopup(true); } @@ -153,38 +151,33 @@ class Intonation_Library_View_Wrapper_Review extends Intonation_Library_View_Wra if (!$record = $this->_model->getFirstNotice()) return []; - $actions = [new Intonation_Library_Link(['Url' => $record->getAbsoluteUrl(), - 'Image' => Class_Template::current()->getIco($this->_view, - 'read-document', - 'library'), - 'Text' => $this->_('Voir le document'), - 'Title' => $this->_('Voir le document %s', - $record->getTitrePrincipal(' '))])]; + $actions = [(new Intonation_Library_Link) + ->setUrl($record->getAbsoluteUrl()) + ->setImage($this->getIco('read-document', 'library')) + ->setText($this->_('Voir le document')) + ->setTitle($this->_('Voir le document %s', $record->getTitrePrincipal(' ')))]; + if (!$this->_model->isMine()) return $actions; - $actions [] = new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'edit-review', - 'id' => $this->_model->getId()]), - 'Image' => Class_Template::current()->getIco($this->_view, - 'edit', - 'utils'), - 'Text' => $this->_('Modifier'), - 'Title' => $this->_('Modifier l\'avis %s', - $this->_model->getEntete()), - 'Popup' => true]); - - $actions [] = new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'delete-review', - 'id' => $this->_model->getId()]), - 'Image' => Class_Template::current()->getIco($this->_view, - 'delete', - 'utils'), - 'Class' => 'text-danger', - 'Text' => $this->_('Supprimer'), - 'Title' => $this->_('Supprimer l\'avis %s', - $this->_model->getEntete()), - 'Popup' => true]); + $actions [] = (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'edit-review', + 'id' => $this->_model->getId()])) + ->setImage($this->getIco('edit', 'utils')) + ->setText($this->_('Modifier')) + ->setTitle($this->_('Modifier l\'avis %s', $this->_model->getEntete())) + ->setPopup(true); + + $actions [] = (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'delete-review', + 'id' => $this->_model->getId()])) + ->setImage($this->getIco('delete', 'utils')) + ->setText($this->_('Supprimer')) + ->setTitle($this->_('Supprimer l\'avis %s', $this->_model->getEntete())) + ->setClass('text-danger') + ->setPopup(true); return $actions; } diff --git a/library/templates/Intonation/Library/View/Wrapper/ReviewsByRecord.php b/library/templates/Intonation/Library/View/Wrapper/ReviewsByRecord.php index d577ac18541d1411369d5110872025049f1378c7..7699cae9aab1eab38b4e2b00f00c72affb37ab25 100644 --- a/library/templates/Intonation/Library/View/Wrapper/ReviewsByRecord.php +++ b/library/templates/Intonation/Library/View/Wrapper/ReviewsByRecord.php @@ -66,13 +66,12 @@ class Intonation_Library_View_Wrapper_ReviewsByRecord extends Intonation_Library public function getMainLink() { $nav_url = (new Intonation_Library_View_Wrapper_Record_RichContent_Reviews($this->_record))->getNavUrl(); $nav_url ['id'] = $this->_record->getModel()->getId(); - return new Intonation_Library_Link(['Url' => $nav_url, - 'Image' => Class_Template::current()->getIco($this->_view, - 'read-review', - 'library'), - 'Text' => $this->_('Lire les avis'), - 'Title' => $this->_('Lire les avis sur %s', - $this->getMainTitle())]); + + return (new Intonation_Library_Link) + ->setUrl($nav_url) + ->setImage($this->getIco('read-review', 'library')) + ->setText($this->_('Lire les avis')) + ->setTitle($this->_('Lire les avis sur %s', $this->getMainTitle())); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Rss.php b/library/templates/Intonation/Library/View/Wrapper/Rss.php index 1718599890d47e6f40479194f7334034965bc1cc..5d0f7952b6de2ef658beeb99df4c89b70dd85865 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Rss.php +++ b/library/templates/Intonation/Library/View/Wrapper/Rss.php @@ -28,12 +28,11 @@ class Intonation_Library_View_Wrapper_Rss extends Intonation_Library_View_Wrappe public function getMainLink() { - return new Intonation_Library_Link(['Url' => $this->_model->getUrl(), - 'Text' => $this->_view->_('Voir le flux'), - 'Title' => $this->_view->_('Voir le flux %s', $this->_model->getTitre()), - 'Image' => Class_Template::current()->getIco($this->_view, - 'read-document', - 'library')]); + return (new Intonation_Library_Link) + ->setUrl($this->_model->getUrl()) + ->setImage($this->getIco('read-document', 'library')) + ->setText($this->_('Voir le flux')) + ->setTitle($this->_('Voir le flux %s', $this->_model->getTitre())); } diff --git a/library/templates/Intonation/Library/View/Wrapper/RssItem.php b/library/templates/Intonation/Library/View/Wrapper/RssItem.php index cd3587c6f59721319c4c495c715e11b4d5b79817..ebcc3b55d2be57c1fbcc6f9c165f61ab66a7ff2f 100644 --- a/library/templates/Intonation/Library/View/Wrapper/RssItem.php +++ b/library/templates/Intonation/Library/View/Wrapper/RssItem.php @@ -63,12 +63,11 @@ class Intonation_Library_View_Wrapper_RssItem extends Intonation_Library_View_Wr public function getMainLink() { - return new Intonation_Library_Link(['Url' => $this->_getLink(), - 'Text' => $this->_view->_('Accéder au contenu'), - 'Title' => $this->_view->_('Accéder au contenu de %s', $this->getMainTitle()), - 'Image' => Class_Template::current()->getIco($this->_view, - 'read-document', - 'library')]); + return (new Intonation_Library_Link) + ->setUrl($this->_getLink()) + ->setImage($this->getIco('read-document', 'library')) + ->setText($this->_('Accéder au contenu')) + ->setTitle($this->_('Accéder au contenu de %s', $this->getMainTitle())); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Search.php b/library/templates/Intonation/Library/View/Wrapper/Search.php index e44a95e1d189fa846a30c5e93025afd35cf450ce..7512bb84396f2b140a2909ef9e09c8012277e42e 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Search.php +++ b/library/templates/Intonation/Library/View/Wrapper/Search.php @@ -43,12 +43,11 @@ class Intonation_Library_View_Wrapper_Search extends Intonation_Library_View_Wra public function getMainLink() { - return new Intonation_Library_Link(['Url' => $this->_view->url($this->_model->getCriteriasUrl()), - 'Text' => $this->_('Voir'), - 'Title' => $this->_('Voir le résultat de recherche'), - 'Image' => Class_Template::current()->getIco($this->_view, - 'search_more', - 'library')]); + return (new Intonation_Library_Link) + ->setUrl($this->_view->url($this->_model->getCriteriasUrl())) + ->setImage($this->getIco('search_more', 'library')) + ->setText($this->_('Voir')) + ->setTitle($this->_('Voir le résultat de recherche')); } @@ -119,70 +118,59 @@ class Intonation_Library_View_Wrapper_Search extends Intonation_Library_View_Wra public function getActions() { $id = $this->_model->getExistingIdFor(Class_Users::getIdentity()); $can_follow = !$id; - return [new Intonation_Library_Link(['Url' => $this->_view->url(array_merge($this->_model->getCriteriasUrl(), - ['controller' => 'bookmarked-searches', - 'action' => $can_follow ? 'add' : 'delete', - 'label' => $this->getMainTitle(), - 'id' => $id])), - 'Image' => Class_Template::current()->getIco($this->_view, - ($can_follow - ? 'no-selection' - : 'selection'), - 'library'), - 'Text' => ($can_follow - ? $this->_('Suivre') - : $this->_('Ne plus suivre')), - 'Title' => ($can_follow - ? $this->_('Suivre cette recherche') - : $this->_('Ne plus suivre cette recherche.')), - 'InlineText' => 1, - 'Popup' => true])]; + return [(new Intonation_Library_Link) + ->setUrl($this->_view->url(array_merge($this->_model->getCriteriasUrl(), + ['controller' => 'bookmarked-searches', + 'action' => $can_follow ? 'add' : 'delete', + 'label' => $this->getMainTitle(), + 'id' => $id]))) + ->setImage($this->getIco($can_follow ? 'no-selection' : 'selection', + 'library')) + ->setText($can_follow ? $this->_('Suivre') : $this->_('Ne plus suivre')) + ->setTitle($can_follow + ? $this->_('Suivre cette recherche') + : $this->_('Ne plus suivre cette recherche.')) + ->beNotResponsiveText() + ->setPopup(true)]; } public function getMoreActions() { - $actions = [new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'suggestion-achat-add']), - - 'Image' => Class_Template::current()->getIco($this->_view, - 'suggest', - 'library'), - 'Text' => $this->_('Suggérer un achat'), - 'Attribs' => ['target' => '_blank'], - 'InlineText' => 1, - 'Title' => $this->_('Envoyer une demande d\'achat de document')]), - - new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'recherche', - 'action' => 'print']), - - 'Image' => Class_Template::current()->getIco($this->_view, - 'print', - 'utils'), - 'Text' => $this->_('Imprimer'), - 'InlineText' => 1, - 'Attribs' => ['target' => '_blank'], - 'Title' => $this->_('Imprimer le résultat')]), - - new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'recherche', - 'action' => 'send-mail']), - - 'Image' => Class_Template::current()->getIco($this->_view, - 'email', - 'utils'), - 'Text' => $this->_('Partager par email'), - 'InlineText' => 1, - 'Popup' => 1, - 'Title' => $this->_('Partager le résultat par email')]), - + $actions = [(new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'suggestion-achat-add'])) + ->setImage($this->getIco('suggest', 'library')) + ->setText($this->_('Suggérer un achat')) + ->setTitle($this->_('Envoyer une demande d\'achat de document')) + ->setAttrib('target', '_blank') + ->beNotResponsiveText() + , + (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'recherche', + 'action' => 'print'])) + ->setImage($this->getIco('print', 'utils')) + ->setText($this->_('Imprimer')) + ->setTitle($this->_('Imprimer le résultat')) + ->setAttrib('target', '_blank') + ->beNotResponsiveText() + , + (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'recherche', + 'action' => 'send-mail'])) + ->setImage($this->getIco('email', 'utils')) + ->setText($this->_('Partager par email')) + ->setTitle($this->_('Partager le résultat par email')) + ->beNotResponsiveText() + ->setPopup(true) + , $this->_view->tagSearchExtension($this->_model->getUnserializedCriterias()), ]; - $button = new Intonation_Library_Link(['Text' => $this->_('Plus'), - 'Class' => 'btn btn-sm btn-light more_action', - 'Title' => $this->_('Voir plus d\'actions pour le résultat de recherche'), - 'Image' => Class_Template::current()->getIco($this->_view, - 'more', - 'utils')]); + $button = (new Intonation_Library_Link) + ->setImage($this->getIco('more', 'utils')) + ->setText($this->_('Plus')) + ->setTitle($this->_('Voir plus d\'actions pour le résultat de recherche')) + ->setClass('btn btn-sm btn-light more_action'); return $this->_view->renderDropdown($this->_view->renderActions($actions), $button); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Selection.php b/library/templates/Intonation/Library/View/Wrapper/Selection.php index ef6e69249a43f84af376321704fb8d73cc9c5ead..d427dc6c75fc828b11cf65df5d92d96e03c42e9d 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Selection.php +++ b/library/templates/Intonation/Library/View/Wrapper/Selection.php @@ -81,15 +81,14 @@ class Intonation_Library_View_Wrapper_Selection extends Intonation_Library_View_ public function getMainLink() { - $datas = ['Url' => $this->_view->url(['controller' => 'recherche', - 'action' => 'simple', - 'id_panier' => $this->getModelId()], - null, true), - 'Text' => $this->_('Voir'), - 'Title' => $this->_('Voir la sélection dans la recherche'), - 'Image' => $this->getIco('search_more', 'library')]; - - return new Intonation_Library_Link($datas); + return (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'recherche', + 'action' => 'simple', + 'id_panier' => $this->getModelId()], + null, true)) + ->setImage($this->getIco('search_more', 'library')) + ->setText($this->_('Voir')) + ->setTitle($this->_('Voir la sélection dans la recherche')); } @@ -152,93 +151,80 @@ class Intonation_Library_View_Wrapper_Selection extends Intonation_Library_View_ public function getActions() { $actions = $this->_getActions(); - $button = new Intonation_Library_Link(['Text' => $this->_('Plus'), - 'Title' => $this->_('Voir plus d\'actions pour la sélection %s', - $this->_model->getLibelle()), - 'Class' => 'view_more_record_actions more_action', - 'Image' => Class_Template::current()->getIco($this->_view, - 'more', - 'utils')]); + $button = (new Intonation_Library_Link) + ->setImage($this->getIco('more', 'utils')) + ->setText($this->_('Plus')) + ->setTitle($this->_('Voir plus d\'actions pour la sélection %s', $this->_model->getLibelle())) + ->setClass('view_more_record_actions more_action'); return [$this->_view->renderDropdown($this->_view->renderActions($actions), $button)]; } protected function _getActions() { - $actions = [new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'exporter-la-selection', - 'selection_id' => $this->_model->getId()]), - 'Text' => $this->_('Exporter'), - 'Popup' => true, - 'Title' => $this->_('Exporter la sélection %s', - $this->_model->getLibelle()), - 'Image' => Class_Template::current()->getIco($this->_view, - 'export', - 'utils')]), - - new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'ajouter-a-la-selection', - 'selection_id' => $this->_model->getId()]), - 'Text' => $this->_('Ajouter'), - 'Right' => $this->_model->canBeEditedByMe(), - 'Title' => $this->_('Ajouter un document à la sélection %s', - $this->_model->getLibelle()), - 'Image' => Class_Template::current()->getIco($this->_view, - 'add', - 'utils')]), - - new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'selection', - 'selection_id' => $this->_model->getId()]), - 'Text' => $this->_('Gérer'), - 'Right' => $this->_model->canBeEditedByMe(), - - 'Title' => $this->_('Gérer la sélection'), - 'Image' => Class_Template::current()->getIco($this->_view, - 'check-list', - 'utils')]) - ]; - - if ((new Intonation_Library_UserPatcher)->isSelectionDefault($this->_model)) + $actions = [(new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'exporter-la-selection', + 'selection_id' => $this->_model->getId()])) + ->setImage($this->getIco('export', 'utils')) + ->setText($this->_('Exporter')) + ->setTitle($this->_('Exporter la sélection %s', $this->_model->getLibelle())) + ->setPopup(true)]; + + if ($this->_model->canBeEditedByMe()) { + $actions[] = (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'ajouter-a-la-selection', + 'selection_id' => $this->_model->getId()])) + ->setImage($this->getIco('add', 'utils')) + ->setText($this->_('Ajouter')) + ->setTitle($this->_('Ajouter un document à la sélection %s', $this->_model->getLibelle())); + + $actions[] = (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'selection', + 'selection_id' => $this->_model->getId()])) + ->setImage($this->getIco('check-list', 'utils')) + ->setText($this->_('Gérer')) + ->setTitle($this->_('Gérer la sélection')); + } + + if ((new Intonation_Library_UserPatcher)->isSelectionDefault($this->_model) + || !$this->_model->canBeEditedByMe()) return $actions; - return array_merge($actions, - [new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'renommer-la-selection', - 'selection_id' => $this->_model->getId()]), - 'Text' => $this->_('Renommer'), - 'Right' => $this->_model->canBeEditedByMe(), - 'Title' => $this->_('Renommer la sélection %s', - $this->_model->getLibelle()), - 'Popup' => 'true', - 'Image' => Class_Template::current()->getIco($this->_view, - 'rename', - 'utils')]), - - new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'panier', - 'action' => 'edit', - 'id_panier' => $this->_model->getId()]), - 'Text' => $this->_('Domaines liés'), - 'Right' => $this->_model->canBeEditedByMe(), - 'Title' => $this->_('Lier la sélection %s à un domaine', - $this->_model->getLibelle()), - 'Popup' => 'true', - 'Image' => Class_Template::current()->getIco($this->_view, - 'external-link', - 'utils')]), - - new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'supprimer-la-selection', - 'selection_id' => $this->_model->getId()]), - 'Class' => 'text-danger', - 'Text' => $this->_('Supprimer'), - 'Right' => $this->_model->canBeEditedByMe(), - 'Title' => $this->_('Supprimer la sélection %s', - $this->_model->getLibelle()), - 'Popup' => 'true', - 'Image' => Class_Template::current()->getIco($this->_view, - 'delete', - 'utils')])]); + $actions[] = (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'renommer-la-selection', + 'selection_id' => $this->_model->getId()])) + ->setImage($this->getIco('rename', 'utils')) + ->setText($this->_('Renommer')) + ->setTitle($this->_('Renommer la sélection %s', $this->_model->getLibelle())) + ->setPopup('true') + ; + + $actions[] = (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'panier', + 'action' => 'edit', + 'id_panier' => $this->_model->getId()])) + ->setImage($this->getIco('external-link', 'utils')) + ->setText($this->_('Domaines liés')) + ->setTitle($this->_('Lier la sélection %s à un domaine', $this->_model->getLibelle())) + ->setPopup('true') + ; + + $actions[] = (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'supprimer-la-selection', + 'selection_id' => $this->_model->getId()])) + ->setImage($this->getIco('delete', 'utils')) + ->setText($this->_('Supprimer')) + ->setTitle($this->_('Supprimer la sélection %s', $this->_model->getLibelle())) + ->setClass('text-danger') + ->setPopup('true') + ; + + return $actions; } diff --git a/library/templates/Intonation/Library/View/Wrapper/Suggestion.php b/library/templates/Intonation/Library/View/Wrapper/Suggestion.php index f3d5ad3f56899a2d23dd51e127d8476f38048618..3da043e4dba69a19f7aa04e52692262b6aa7314a 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Suggestion.php +++ b/library/templates/Intonation/Library/View/Wrapper/Suggestion.php @@ -96,10 +96,11 @@ class Intonation_Library_View_Wrapper_Suggestion extends Intonation_Library_View $author_field = new Class_Notice_FieldAuthor($facet); - return new Intonation_Library_Link(['Url' => $author_field->getUrlForLink(), - 'Image' => $this->getSecondaryIco(), - 'Text' => $author, - 'Title' => $author_field->getTitle()]); + return (new Intonation_Library_Link) + ->setUrl($author_field->getUrlForLink()) + ->setImage($this->getSecondaryIco()) + ->setText($author) + ->setTitle($author_field->getTitle()); } diff --git a/library/templates/Intonation/Library/View/Wrapper/User.php b/library/templates/Intonation/Library/View/Wrapper/User.php index 8d9bdcca9a58d891d39007c4df0535e7dfe9b7e5..04c1f51fb532dbe60463edaec07bcbac021fa8e9 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User.php +++ b/library/templates/Intonation/Library/View/Wrapper/User.php @@ -43,11 +43,12 @@ class Intonation_Library_View_Wrapper_User extends Intonation_Library_View_Wrapp public function getMainLink() { - return new Intonation_Library_Link(['Url' => array_merge($this->_widget_context_params, - ['controller' => 'abonne', - 'action' => 'fiche']), - 'Text' => $this->_('Mon compte'), - 'Title' => $this->_('Accéder à mon compte lecteur')]); + return (new Intonation_Library_Link) + ->setUrl(array_merge($this->_widget_context_params, + ['controller' => 'abonne', + 'action' => 'fiche'])) + ->setText($this->_('Mon compte')) + ->setTitle($this->_('Accéder à mon compte lecteur')); } @@ -62,12 +63,13 @@ class Intonation_Library_View_Wrapper_User extends Intonation_Library_View_Wrapp public function getPictureAction() { - return new Intonation_Library_Link(['Url' => ['controller' => 'abonne', - 'action' => 'change-image'], - 'Image' => Class_Template::current()->getIco($this->_view, 'edit', 'utils'), - 'Attribs' => ['class' => 'ml-1'], - 'Popup' => true, - 'Title' => $this->_('Modifier mon image')]); + return (new Intonation_Library_Link) + ->setUrl(['controller' => 'abonne', + 'action' => 'change-image']) + ->setImage($this->getIco('edit', 'utils')) + ->setTitle($this->_('Modifier mon image')) + ->setClass('ml-1') + ->setPopup(true); } @@ -261,10 +263,11 @@ class Intonation_Library_View_Wrapper_User extends Intonation_Library_View_Wrapp public function getActions() { - return [new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'edit']), - 'Text' => $this->_('Modifier'), - 'Title' => $this->_('Modifier les informations de mon compte')])]; + return [(new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'edit'])) + ->setText($this->_('Modifier')) + ->setTitle($this->_('Modifier les informations de mon compte'))]; } diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/NewSuggestion.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/NewSuggestion.php index 214b54c687f9cc74aa003124ce38c502a41ad840..da49e649286ded40c0035981f9839a2440a1256e 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/NewSuggestion.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/NewSuggestion.php @@ -66,13 +66,16 @@ class Intonation_Library_View_Wrapper_User_RichContent_NewSuggestion extends Int $this->_form->titleValue(), $this->_form->authorValue())); - $html [] = $this->_view->button(new Class_Entity(['Text' => $this->_('Oui'), - 'Url' => $this->_view->url(['action' => 'suggestion-achat']), - 'Attribs' => ['class' => 'mr-5', - 'title' => $this->_('Annuler et revenir à la liste des suggestions.')]])); - $send_form_button = new Class_Entity(['Text' => $this->_('Non'), - 'Attribs' => ['title' => $this->_('Envoyer la suggestion'), - 'onclick' => "var form = $('#suggestion'); form.attr('action', form.attr('action') + '?validate_suggestion=1'); $('#submit').click();"]]); + $html [] = $this->_view->button((new Class_Button) + ->setText($this->_('Oui')) + ->setTitle($this->_('Annuler et revenir à la liste des suggestions.')) + ->setUrl($this->_view->url(['action' => 'suggestion-achat'])) + ->setAttrib('class', 'mr-5')); + + $send_form_button = (new Class_Button) + ->setText($this->_('Non')) + ->setTitle($this->_('Envoyer la suggestion')) + ->setAttrib('onclick', "var form = $('#suggestion'); form.attr('action', form.attr('action') + '?validate_suggestion=1'); $('#submit').click();"); $html [] = $this->_view->button($send_form_button); diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Reviews.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Reviews.php index 83f7f63186fb2b437445c1bb2b4993170dd81e1b..8448f0d9e8d531d1eeb0c8ddd7b524c1a9101929 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Reviews.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Reviews.php @@ -20,7 +20,8 @@ */ -class Intonation_Library_View_Wrapper_User_RichContent_Reviews extends Intonation_Library_View_Wrapper_User_RichContent_Section { +class Intonation_Library_View_Wrapper_User_RichContent_Reviews + extends Intonation_Library_View_Wrapper_User_RichContent_Section { public function getTitle() { return $this->_('Mes avis'); @@ -34,19 +35,18 @@ class Intonation_Library_View_Wrapper_User_RichContent_Reviews extends Intonatio 'action' => 'donner-des-avis'], $this->_('Commencer maintenant'))); $reviews = array_map(function($review) - { - return (new Intonation_Library_View_Wrapper_Review) - ->setModel($review) - ->setView($this->_view); - }, $reviews); + { + return (new Intonation_Library_View_Wrapper_Review) + ->setModel($review) + ->setView($this->_view); + }, $reviews); - $actions = [new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'donner-des-avis']), - 'Text' => $this->_('Écrire'), - 'Title' => $this->_('Écrire un avis'), - 'Image' => Class_Template::current()->getIco($this->_view, - 'add', - 'utils')])]; + $actions = [(new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'donner-des-avis'])) + ->setText($this->_('Écrire')) + ->setTitle($this->_('Écrire un avis')) + ->setImage(Class_Template::current()->getIco($this->_view, 'add', 'utils'))]; return $this->_view->renderCollection(new Storm_Collection($reviews), $actions, null, 20); } diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/SelectionsInDomains.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/SelectionsInDomains.php index d8f9e583c7df44cc4f11997fbf7c37a90d5e7c18..e8682d734b563e06f26a86235e17939a4faea2c8 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/SelectionsInDomains.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/SelectionsInDomains.php @@ -28,22 +28,21 @@ class Intonation_Library_View_Wrapper_User_RichContent_SelectionsInDomains exten public function getContent() { - $actions = [ - new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'selections']), - 'Class' => 'btn btn-sm btn-secondary', - 'Text' => $this->_('Mes sélections'), - 'Title' => $this->_('Voir mes sélections'), - 'Image' => $this->_view->abonne_MyImage($this->_model)]), - - - new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'selections-des-professionnels']), - 'Class' => 'btn btn-sm btn-warning', - 'Text' => $this->_('Sélections des professionnels'), - 'Title' => $this->_('Voir les sélections des professionnels'), - 'Image' => $this->_view->templateIco('team', - 'library')])]; + $actions = [(new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'selections'])) + ->setImage($this->_view->abonne_MyImage($this->_model)) + ->setText($this->_('Mes sélections')) + ->setTitle($this->_('Voir mes sélections')) + ->setClass('btn btn-sm btn-secondary') + , + (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'selections-des-professionnels'])) + ->setImage($this->_view->templateIco('team', 'library')) + ->setText($this->_('Sélections des professionnels')) + ->setTitle($this->_('Voir les sélections des professionnels')) + ->setClass('btn btn-sm btn-warning')]; $selections = []; foreach(Class_PanierNotice::findAllWithCatalogue() as $selection) diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/SelectionsOfPro.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/SelectionsOfPro.php index 17a0ff5712c73ab7fd53b46f01868ac736778261..d860638c83b9b27152dc11beb14e855ccb82f0ff 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/SelectionsOfPro.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/SelectionsOfPro.php @@ -28,22 +28,21 @@ class Intonation_Library_View_Wrapper_User_RichContent_SelectionsOfPro extends I public function getContent() { - $actions = [ - new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'selections']), - 'Class' => 'btn btn-sm btn-secondary', - 'Text' => $this->_('Mes sélections'), - 'Title' => $this->_('Voir mes sélections'), - 'Image' => $this->_view->abonne_MyImage($this->_model)]), - - - new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'selections-dans-les-domaines']), - 'Class' => 'btn btn-sm btn-info', - 'Text' => $this->_('Sélections dans les domaines'), - 'Title' => $this->_('Voir les sélections rangées dans les domaines'), - 'Image' => $this->_view->templateIco('search_more', - 'library')])]; + $actions = [(new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'selections'])) + ->setImage($this->_view->abonne_MyImage($this->_model)) + ->setText($this->_('Mes sélections')) + ->setTitle($this->_('Voir mes sélections')) + ->setClass('btn btn-sm btn-secondary') + , + (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'selections-dans-les-domaines'])) + ->setImage($this->_view->templateIco('search_more', 'library')) + ->setText($this->_('Sélections dans les domaines')) + ->setTitle($this->_('Voir les sélections rangées dans les domaines')) + ->setClass('btn btn-sm btn-info')]; $selections = []; foreach(Class_PanierNotice::findAllBelongsToAdmin() as $selection) diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/SessionActivityInscription.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/SessionActivityInscription.php index 3036155dea765daa8366e4b7425114cf9b7c2cbc..2ccaef162dc09cdd961a4ed5bcf675b51bfa9232 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/SessionActivityInscription.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/SessionActivityInscription.php @@ -46,29 +46,26 @@ class Intonation_Library_View_Wrapper_User_RichContent_SessionActivityInscriptio $message->validateInscription($inscription), ['class' => 'queued_title']); - $button_ok = $this->_view - ->tagAction(new Intonation_Library_Link(['Url' => $this->_view->url(['module' => 'opac', - 'controller' => 'abonne', - 'action' => 'agenda']), - 'Image' => Class_Template::current()->getIco($this->_view, - 'readed', - 'library'), - 'Text' => $this->_('OK'), - 'class' => 'queued_link_ok'])); + $button_ok = $this->_view->tagAction((new Intonation_Library_Link) + ->setUrl($this->_view->url(['module' => 'opac', + 'controller' => 'abonne', + 'action' => 'agenda'])) + ->setImage($this->_view->templateIco('readed', 'library')) + ->setText($this->_('OK')) + ->setClass('queued_link_ok')); if (!$inscription->isQueue()) return $html . $button_ok; $button_delete = $this->_view - ->tagAction(new Intonation_Library_Link(['Url' => $this->_view->url(['module' => 'opac', - 'controller' => 'abonne', - 'action' => 'desinscrire-session', - 'id' => $inscription->getSessionActivity()->getId()]), - 'Image' => Class_Template::current()->getIco($this->_view, - 'clean', - 'utils'), - 'Text' => $this->_('Supprimer de la liste d\'attente'), - 'class' => 'queued_link_delete'])); + ->tagAction((new Intonation_Library_Link) + ->setUrl($this->_view->url(['module' => 'opac', + 'controller' => 'abonne', + 'action' => 'desinscrire-session', + 'id' => $inscription->getSessionActivity()->getId()])) + ->setImage($this->_view->templateIco('clean', 'utils')) + ->setText($this->_('Supprimer de la liste d\'attente')) + ->setClass('queued_link_delete')); $html .= $this->_tag('p', $message->warningInscriptionQueue(), diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Settings.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Settings.php index e4834eac4d57e2cabce668d614917b38329336b4..0dbd4ea2fe746ae8075e429ffbc39d2f7360a06a 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Settings.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Settings.php @@ -67,13 +67,14 @@ class Intonation_Library_View_Wrapper_User_RichContent_Settings extends Intonati protected function _renderCards($cards) { - $link = new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne', - 'action' => 'add-card']), - 'Text' => $this->_('Ajouter une carte'), - 'Image' => Class_Template::current()->getIco($this->_view, 'add_user', 'utils'), - 'Class' => 'btn btn-sm btn-success', - 'InlineText' => 1, - 'Popup' => 1]); + $link = (new Intonation_Library_Link) + ->setUrl($this->_view->url(['controller' => 'abonne', + 'action' => 'add-card'])) + ->setText($this->_('Ajouter une carte')) + ->setImage($this->_view->templateIco('add_user', 'utils')) + ->setClass('btn btn-sm btn-success') + ->beNotResponsiveText() + ->setPopup(true); $html = [$this->_div(['class' => 'col-12'], $this->_view->tagAction($link))]; diff --git a/library/templates/Intonation/Library/View/Wrapper/Website.php b/library/templates/Intonation/Library/View/Wrapper/Website.php index 775f8d59b48394f3df37e7e30fef7bc5697afe81..9f3331b4d480bd18596d1ac9259b85c11ca09f91 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Website.php +++ b/library/templates/Intonation/Library/View/Wrapper/Website.php @@ -45,10 +45,11 @@ class Intonation_Library_View_Wrapper_Website extends Intonation_Library_View_Wr public function getMainLink() { - return new Intonation_Library_Link(['Url' => $this->_model->getUrl(), - 'Image' => $this->getIco('external-link', 'utils'), - 'Text' => $this->_('Accéder au site'), - 'Title' => $this->_('Accéder au site %s', $this->getMainTitle())]); + return (new Intonation_Library_Link) + ->setUrl($this->_model->getUrl()) + ->setImage($this->getIco('external-link', 'utils')) + ->setText($this->_('Accéder au site')) + ->setTitle($this->_('Accéder au site %s', $this->getMainTitle())); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Work.php b/library/templates/Intonation/Library/View/Wrapper/Work.php index 704e91cde62a267468a3fdf3bbd2561aa4c6b44e..a709c250169ce004def33ca5d3ce0a0e307b80d1 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Work.php +++ b/library/templates/Intonation/Library/View/Wrapper/Work.php @@ -53,12 +53,13 @@ class Intonation_Library_View_Wrapper_Work extends Intonation_Library_View_Wrapp 'action' => 'view', 'id' => $this->_model->getId()]); - return new Intonation_Library_Link(['Url' => $params, - 'Image' => $this->getIco('read-document', 'library'), - 'Text' => $this->_('Voir'), - 'Title' => $this->_('Voir l\'œuvre %s de %s', - $this->getMainTitle(), - $this->getSecondaryTitle())]); + return (new Intonation_Library_Link) + ->setUrl($params) + ->setImage($this->getIco('read-document', 'library')) + ->setText($this->_('Voir')) + ->setTitle($this->_('Voir l\'œuvre %s de %s', + $this->getMainTitle(), + $this->getSecondaryTitle())); } diff --git a/library/templates/Intonation/Library/Widget/Accessibility/View.php b/library/templates/Intonation/Library/Widget/Accessibility/View.php index 52341ecdce3ee9125064eb15ce026608ecccc74e..e450bbd77c5c44c75ea9cc8d9a1d1a2b41346f0a 100644 --- a/library/templates/Intonation/Library/Widget/Accessibility/View.php +++ b/library/templates/Intonation/Library/Widget/Accessibility/View.php @@ -149,7 +149,7 @@ class Intonation_Library_Widget_Accessibility_View extends Zendafi_View_Helper_A if ($option->getNoStyle()) $attribs['data-stylesheet-no'] = 1; - return $this->view->button((new Class_Entity()) + return $this->view->button((new Class_Button) ->setAttribs($attribs) ->setImage($icon)); } @@ -160,30 +160,30 @@ class Intonation_Library_Widget_Accessibility_View extends Zendafi_View_Helper_A return; return - $this->view->button((new Class_Entity) + $this->view->button((new Class_Button) ->setImage($this->view->tagImg(Class_Url::absolute('public/opac/images/buttons/default_font_size.png'), ['style' => 'height: 64px'])) - ->setAttribs(['title' => $this->_('Appliquer la taille par défaut aux textes'), - 'class' => 'accessibility default_font_size', + ->setTitle($this->_('Appliquer la taille par défaut aux textes')) + ->setAttribs(['class' => 'accessibility default_font_size', 'data-font-size' => 'default', 'onclick' => ''])) - . $this->view->button((new Class_Entity) + . $this->view->button((new Class_Button) ->setImage($this->view->tagImg(Class_Url::absolute('public/opac/images/buttons/decrease_font_size.png'), ['style' => 'height: 64px'])) - ->setAttribs(['title' => $this->_('Diminuer la taille des textes'), - 'class' => 'accessibility', + ->setTitle($this->_('Diminuer la taille des textes')) + ->setAttribs(['class' => 'accessibility', 'data-font-size' => 'decrease_font_size', 'onclick' => ''])) . $this->_tag('span', '', ['class' => 'accessibility btn btn-light', 'data-font-size' => 'current_font_size']) - . $this->view->button((new Class_Entity) + . $this->view->button((new Class_Button) ->setImage($this->view->tagImg(Class_Url::absolute('public/opac/images/buttons/increase_font_size.png'), ['style' => 'height: 64px'])) - ->setAttribs(['title' => $this->_('Augementer la taille des textes'), - 'class' => 'accessibility', + ->setTitle($this->_('Augmenter la taille des textes')) + ->setAttribs(['class' => 'accessibility', 'data-font-size' => 'increase_font_size', 'onclick' => ''])); } diff --git a/library/templates/Intonation/Library/Widget/Carousel/View.php b/library/templates/Intonation/Library/Widget/Carousel/View.php index da0f765d5a553c724ef1c803d69cedf6e1a8760c..2e3f4a72653eb1f2cec8c43193228e1f5fb0b174 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/View.php +++ b/library/templates/Intonation/Library/Widget/Carousel/View.php @@ -102,12 +102,11 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help protected function _getTagRss() { - return $this->view->button(new Class_Entity(['Text' => Class_Template::current() - ->getIco($this->view, - 'rss', - 'utils'), - 'Url' => $this->_getRSSUrl(), - 'Attribs' => ['title' => $this->_('Flux RSS de la boite "%s"', $this->titre)]])); + return $this->view->button((new Class_Button) + ->setText(Class_Template::current() + ->getIco($this->view, 'rss','utils')) + ->setUrl($this->_getRSSUrl()) + ->setTitle($this->_('Flux RSS de la boite "%s"', $this->titre))); } @@ -143,14 +142,13 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help protected function _getTagLinkToAll() { - return $this->view->tagAction(new Intonation_Library_Link(['Text' => $this->_getLinkToAllText(), - 'Url' => $this->_getLinkToAllUrl(), - 'OnlyClasses' => 'btn btn-secondary render_all_link', - 'Image' => Class_Template::current() - ->getIco($this->view, - 'search_more', - 'library'), - 'Title' => $this->_getLinkToAllTitleDb()])); + return $this->view + ->tagAction((new Intonation_Library_Link) + ->setUrl($this->_getLinkToAllUrl()) + ->setImage($this->view->templateIco('search_more', 'library')) + ->setText($this->_getLinkToAllText()) + ->setTitle($this->_getLinkToAllTitleDb()) + ->setOnlyClasses('btn btn-secondary render_all_link')); } diff --git a/library/templates/Intonation/Library/Widget/Login/View.php b/library/templates/Intonation/Library/Widget/Login/View.php index 2271401c176527344c60fc8831682e1a0bbd495e..50f4889d781722155441950f9b1cd3cf0a802947 100644 --- a/library/templates/Intonation/Library/Widget/Login/View.php +++ b/library/templates/Intonation/Library/Widget/Login/View.php @@ -242,23 +242,28 @@ class IntonationLoginRenderInline extends IntonationLoginRenderAbstract { $user_url = $this->_view->url(['controller' => 'abonne', 'action' => 'fiche', - 'id_profil' => $this->_settings->getProfilRedirect() > 0 ? $this->_settings->getProfilRedirect() : Class_Profil::getCurrentProfil()->getId()], + 'id_profil' => ($this->_settings->getProfilRedirect() > 0 + ? $this->_settings->getProfilRedirect() + : Class_Profil::getCurrentProfil()->getId())], null, true); - $links = [$this->_view->button((new Class_Entity()) - ->setUrl($user_url) - ->setText($this->_view->abonne_Name($user)) - ->setAttribs(['title' => $this->_('Accéder à l\'interface de gestion de %s.', $user->getNomComplet()), - 'class' => 'btn btn-sm btn-primary']))]; - - if ($disconection = $this->_settings->getLienDeconnection()) - $links [] = $this->_view->button((new Class_Entity()) - ->setText($disconection) - ->setAttribs(['class' => 'btn btn-sm btn-danger', - 'title' => $this->_('Se déconnecter de la session %s', $user->getNomComplet())]) - ->setUrl($this->_view->url(['controller'=>'auth', - 'action'=>'logout'], - null, true))); + $links = [$this->_view + ->button((new Class_Button) + ->setUrl($user_url) + ->setText($this->_view->abonne_Name($user)) + ->setTitle($this->_('Accéder à l\'interface de gestion de %s.', + $user->getNomComplet())) + ->setAttrib('class', 'btn btn-sm btn-primary'))]; + + if ($logout = $this->_settings->getLienDeconnection()) + $links [] = $this->_view + ->button((new Class_Button) + ->setText($logout) + ->setTitle($this->_('Se déconnecter de la session %s', $user->getNomComplet())) + ->setAttrib('class', 'btn btn-sm btn-danger') + ->setUrl($this->_view->url(['controller' => 'auth', + 'action' => 'logout'], + null, true))); $cards = new Class_User_Cards($user); if (!$cards->isEmpty()) { @@ -325,21 +330,23 @@ class IntonationLoginRenderToggle extends IntonationLoginRenderAbstract { 'id_profil' => $this->_settings->getProfilRedirect() > 0 ? $this->_settings->getProfilRedirect() : Class_Profil::getCurrentProfil()->getId()], null, true); - $links = [$this->_view->tagAction((new Intonation_Library_Link()) + $links = [$this->_view->tagAction((new Intonation_Library_Link) ->setUrl($user_url) ->setText($this->_settings->getTitreConnecte() ? $this->_settings->getTitreConnecte() : $this->_settings->getLienCompte()) - ->setAttribs(['title' => $this->_('Accéder à l\'interface de gestion de %s.', $this->_user->getNomComplet()), - 'class' => 'btn btn-sm btn-primary'])), + ->setTitle($this->_('Accéder à l\'interface de gestion de %s.', + $this->_user->getNomComplet())) + ->setClass('btn btn-sm btn-primary')), - $this->_view->tagAction((new Intonation_Library_Link()) - ->setText($this->_settings->getLienDeconnection()) - ->setAttribs(['class' => 'btn btn-sm btn-secondary', - 'title' => $this->_('Se déconnecter de la session %s', $this->_user->getNomComplet())]) + $this->_view->tagAction((new Intonation_Library_Link) ->setUrl($this->_view->url(['controller'=>'auth', 'action'=>'logout'], - null, true)))]; + null, true)) + ->setText($this->_settings->getLienDeconnection()) + ->setTitle($this->_('Se déconnecter de la session %s', + $this->_user->getNomComplet())) + ->setClass('btn btn-sm btn-secondary'))]; $cards = new Class_User_Cards($this->_user); if (!$cards->isEmpty()) { diff --git a/library/templates/Intonation/Library/Widget/Notify/View.php b/library/templates/Intonation/Library/Widget/Notify/View.php index 19b82205828a977ed48148ce69e7246ccc10046f..b30f0828e951d977b3c82240fb5cc23e36fda3ef 100644 --- a/library/templates/Intonation/Library/Widget/Notify/View.php +++ b/library/templates/Intonation/Library/Widget/Notify/View.php @@ -48,27 +48,30 @@ $("#%1$s .alert").on("closed.bs.alert", function() { $("#%1$s").remove(); });', $this->_getBoxId())); - $html = - $alerts->injectInto([], function($html, $alert) - { - $html [] = $this->_tag('div', - $alert->getMessage() - . $this->view->button((new Class_Entity) - ->setText(Class_Template::current()->getIco($this->view, 'delete', 'utils')) - ->setAttribs(['onclick' => '', - 'class' => 'close', - 'data-dismiss' => 'alert', - 'title' => $this->_('Masquer la notification'), - 'aria-label' => $this->_('Masquer la notification')])), - ['role' => 'alert', - 'class' => 'alert alert-dismissible ' . $alert->getStatus() . '_notify']); - return $html; - }); + $html = $alerts->injectInto([], [$this, 'alertRender']); return implode($html); } + public function alertRender($html, $alert) { + $dismiss_button = $this->view + ->button((new Class_Button) + ->setText($this->view->templateIco('delete', 'utils')) + ->setTitle($this->_('Masquer la notification')) + ->setAttribs(['onclick' => '', + 'class' => 'close', + 'data-dismiss' => 'alert', + 'aria-label' => $this->_('Masquer la notification')])); + + $html [] = $this->_tag('div', + $alert->getMessage() . $dismiss_button, + ['role' => 'alert', + 'class' => 'alert alert-dismissible ' . $alert->getStatus() . '_notify']); + return $html; + } + + protected function _getNotifications() { if ($this->_notifications) return $this->_notifications; diff --git a/library/templates/Intonation/Library/Widget/Scroll/View.php b/library/templates/Intonation/Library/Widget/Scroll/View.php index fc03f1b739a6c1a8995a45ea777c22562762ba90..d343311228a600daf562adc18baa102831c4b790 100644 --- a/library/templates/Intonation/Library/Widget/Scroll/View.php +++ b/library/templates/Intonation/Library/Widget/Scroll/View.php @@ -54,10 +54,12 @@ class Intonation_Library_Widget_Scroll_View extends Zendafi_View_Helper_Accueil_ $title = $this->_('Défiler jusqu\'au haut de la page'); } - return $this->view->button(new Class_Entity(['Text' => $this->_tag('i', '', ['class' => $ico]), - 'Attribs' => ['title' => $title, - 'onclick' => '', - 'id' => $id, - 'class' => 'scroll']])); + return $this->view + ->button((new Class_Button) + ->setText($this->_tag('i', '', ['class' => $ico])) + ->setTitle($title) + ->setAttribs(['id' => $id, + 'onclick' => '', + 'class' => 'scroll'])); } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Search/View.php b/library/templates/Intonation/Library/Widget/Search/View.php index 3038ed9864c0baa5e1054bc4013b8adb858bd185..3b2ef7e2ce54bd32ffac0ae32f44e87975413193 100644 --- a/library/templates/Intonation/Library/Widget/Search/View.php +++ b/library/templates/Intonation/Library/Widget/Search/View.php @@ -367,22 +367,23 @@ abstract class IntonationSearchRenderAbstract { protected function _renderAdvancedSearch() { - return $this->_view->tagAnchor($this->_view->url(['controller' => 'recherche', - 'action' => 'avancee', - 'statut' => 'reset'], - null, - true), - $this->_('Recherche avancée'), - ['class' => 'dropdown-item', - 'title' => $this->_('Accéder au formulaire de recherche avancée')]); + return $this->_view + ->tagAnchor($this->_view->url(['controller' => 'recherche', + 'action' => 'avancee', + 'statut' => 'reset'], + null, true), + $this->_('Recherche avancée'), + ['class' => 'dropdown-item', + 'title' => $this->_('Accéder au formulaire de recherche avancée')]); } protected function _renderToggle($html, $button_text = '') { - $button = new Intonation_Library_Link(['Tag' => 'button', - 'Text' => $button_text, - 'Attribs' => ['onclick' => '', - 'class' => 'dropdown-toggle ' . $this->_has_facet]]); + $button = (new Intonation_Library_Link) + ->setElement('button') + ->setText($button_text) + ->setClass('dropdown-toggle ' . $this->_has_facet) + ->setAttrib('onclick', ''); return $this->_view->renderDropdown($html, $button, '', 'search_dropdown_menu'); } diff --git a/library/templates/Intonation/View/Abonne/EditPassword.php b/library/templates/Intonation/View/Abonne/EditPassword.php index 7ad7a5dcad9ab600229c51118969a8895c51f60d..d40e2419ebab0115a2824427d1543d8f2677d0fa 100644 --- a/library/templates/Intonation/View/Abonne/EditPassword.php +++ b/library/templates/Intonation/View/Abonne/EditPassword.php @@ -31,7 +31,7 @@ class Intonation_View_Abonne_EditPassword extends Intonation_View_Abonne_Tab { $sections = $rich_content->getSections(); $content = $this->view->renderForm($this->view->form) - . $this->view->tagAction((new Intonation_Library_Link()) + . $this->view->tagAction((new Intonation_Library_Link) ->setText($this->_('J\'ai oublié mon mot de passe')) ->setUrl($this->view->url(['controller' => 'auth', 'action' => 'lostpass'])) diff --git a/library/templates/Intonation/View/Abonne/Holds.php b/library/templates/Intonation/View/Abonne/Holds.php index c54e4c9aac775bdfbc87a720b36b96c362d574be..e720cb25b9209d7f06333b95c8c6ebf7c08b9488 100644 --- a/library/templates/Intonation/View/Abonne/Holds.php +++ b/library/templates/Intonation/View/Abonne/Holds.php @@ -37,13 +37,12 @@ class Intonation_View_Abonne_Holds extends ZendAfi_View_Helper_BaseHelper { }; $actions = Class_AdminVar::isModuleEnabled('ENABLE_DRIVE_CHECKOUT') - ? [new Intonation_Library_Link(['Url' => $this->view->url(['controller' => 'drive-checkout', - 'action' => 'plan']), - 'Text' => $this->_('Planifier le retrait de mes documents'), - 'Title' => $this->_('Prendre ou lister mes rendez-vous pour le retrait de mes documents'), - 'Image' => Class_Template::current()->getIco($this->view, - 'agenda', - 'library')])] + ? [(new Intonation_Library_Link) + ->setUrl($this->view->url(['controller' => 'drive-checkout', + 'action' => 'plan'])) + ->setText($this->_('Planifier le retrait de mes documents')) + ->setTitle($this->_('Prendre ou lister mes rendez-vous pour le retrait de mes documents')) + ->setImage($this->view->templateIco('agenda', 'library'))] : []; return $this->view->renderCollection(new Storm_Collection($holds), $actions, null, 20); diff --git a/library/templates/Intonation/View/Abonne/LoansHistoryList.php b/library/templates/Intonation/View/Abonne/LoansHistoryList.php index 235460e8117255e7b7a4f2654490dbcce4ea8fda..308b6c1b0318de88e7be9dcc2ff443b7acdacb1b 100644 --- a/library/templates/Intonation/View/Abonne/LoansHistoryList.php +++ b/library/templates/Intonation/View/Abonne/LoansHistoryList.php @@ -29,14 +29,12 @@ class Intonation_View_Abonne_LoansHistoryList extends Intonation_View_Abonne_Loa protected function _getActions() { - return [ new Intonation_Library_Link(['Url' => ['controller' => 'abonne', - 'action' => 'prets', - 'history' => null - ], - 'Text' => $this->_('Mes prêts'), - 'Title' => $this->_('Voir mes prêts'), - 'Image' => Class_Template::current()->getIco($this->view, - 'loan', - 'library')]) ]; + return [(new Intonation_Library_Link) + ->setUrl(['controller' => 'abonne', + 'action' => 'prets', + 'history' => null]) + ->setImage($this->view->templateIco('loan', 'library')) + ->setText($this->_('Mes prêts')) + ->setTitle($this->_('Voir mes prêts'))]; } } diff --git a/library/templates/Intonation/View/Abonne/LoansList.php b/library/templates/Intonation/View/Abonne/LoansList.php index 0b80e05a50f412c7f5bfe12116d7f9bae67e6012..4c12e59e0839c3a23742dcdc457e81164c6c4a86 100644 --- a/library/templates/Intonation/View/Abonne/LoansList.php +++ b/library/templates/Intonation/View/Abonne/LoansList.php @@ -56,17 +56,14 @@ class Intonation_View_Abonne_LoansList extends ZendAfi_View_Helper_BaseHelper { protected function _getActions() { - $actions = []; - - if ($this->_config->getExtendAll()) - $actions [] = new Intonation_Library_Link(['Url' => ['controller' => 'abonne', - 'action' => 'prolongerPret', - 'id_pret' => $this->_config->getRenewableLoansIds()], - 'Text' => $this->_('Tout prolonger'), - 'Title' => $this->_('Prolonger tous les prêts en cours'), - 'Image' => Class_Template::current()->getIco($this->view, - 'extend-loan', - 'library')]); - return $actions; + return $this->_config->getExtendAll() + ? [(new Intonation_Library_Link) + ->setUrl(['controller' => 'abonne', + 'action' => 'prolongerPret', + 'id_pret' => $this->_config->getRenewableLoansIds()]) + ->setText($this->_('Tout prolonger')) + ->setTitle($this->_('Prolonger tous les prêts en cours')) + ->setImage($this->view->templateIco('extend-loan', 'library'))] + : []; } } diff --git a/library/templates/Intonation/View/Abonne/Selections.php b/library/templates/Intonation/View/Abonne/Selections.php index 06df0ca96813a6c9607494f628a394175155c476..25c0b42ddd5a7f17bee0260ac758e5f2cf789801 100644 --- a/library/templates/Intonation/View/Abonne/Selections.php +++ b/library/templates/Intonation/View/Abonne/Selections.php @@ -32,14 +32,13 @@ class Intonation_View_Abonne_Selections extends ZendAfi_View_Helper_BaseHelper { $collection = new Storm_Collection($selections); - $actions = [new Intonation_Library_Link(['Url' => $this->view->url(['controller' => 'abonne', - 'action' => 'creer-selection']), - 'Popup' => true, - 'Text' => $this->_('Créer'), - 'Title' => $this->_('Créer une nouvelle sélection'), - 'Image' => Class_Template::current()->getIco($this->view, - 'add', - 'utils')])]; + $actions = [(new Intonation_Library_Link) + ->setUrl($this->view->url(['controller' => 'abonne', + 'action' => 'creer-selection'])) + ->setImage($this->view->templateIco('add', 'utils')) + ->setText($this->_('Créer')) + ->setTitle($this->_('Créer une nouvelle sélection')) + ->setPopup(true)]; $actions = $this->_addAdminActions($actions); @@ -51,22 +50,21 @@ class Intonation_View_Abonne_Selections extends ZendAfi_View_Helper_BaseHelper { if ( ! Class_Users::isCurrentUserAdmin()) return $actions; - $actions [] = - new Intonation_Library_Link(['Url' => $this->view->url(['controller' => 'abonne', - 'action' => 'selections-dans-les-domaines']), - 'Class' => 'btn btn-sm btn-info', - 'Text' => $this->_('Sélections dans les domaines'), - 'Title' => $this->_('Voir les sélections rangés dans les domaines'), - 'Image' => $this->_templateIco('search_more', 'library')]); + $actions [] = (new Intonation_Library_Link) + ->setUrl($this->view->url(['controller' => 'abonne', + 'action' => 'selections-dans-les-domaines'])) + ->setImage($this->_templateIco('search_more', 'library')) + ->setText($this->_('Sélections dans les domaines')) + ->setTitle($this->_('Voir les sélections rangés dans les domaines')) + ->setClass('btn btn-sm btn-info'); - $actions [] = - new Intonation_Library_Link(['Url' => $this->view->url(['controller' => 'abonne', - 'action' => 'selections-des-professionnels']), - 'Class' => 'btn btn-sm btn-warning', - 'Text' => $this->_('Sélections des professionnels'), - 'Title' => $this->_('Voir les sélections des professionnels'), - 'Image' => $this->_templateIco('team', - 'library')]); + $actions [] = (new Intonation_Library_Link) + ->setUrl($this->view->url(['controller' => 'abonne', + 'action' => 'selections-des-professionnels'])) + ->setImage($this->_templateIco('team', 'library')) + ->setText($this->_('Sélections des professionnels')) + ->setTitle($this->_('Voir les sélections des professionnels')) + ->setClass('btn btn-sm btn-warning'); return $actions; } diff --git a/library/templates/Intonation/View/Abonne/Suggestions.php b/library/templates/Intonation/View/Abonne/Suggestions.php index 281f5a50282df9c47164aaf81048b1aa9cbb63f1..31eb8da7cf3caa9272bb85bceac35bda94a77f85 100644 --- a/library/templates/Intonation/View/Abonne/Suggestions.php +++ b/library/templates/Intonation/View/Abonne/Suggestions.php @@ -26,11 +26,11 @@ class Intonation_View_Abonne_Suggestions extends ZendAfi_View_Helper_BaseHelper return $this->_('Aucune suggestion'); $suggestions = array_map(function($suggestion) - { - return (new Intonation_Library_View_Wrapper_Suggestion) - ->setModel($suggestion) - ->setView($this->view); - }, $suggestions->getArrayCopy()); + { + return (new Intonation_Library_View_Wrapper_Suggestion) + ->setModel($suggestion) + ->setView($this->view); + }, $suggestions->getArrayCopy()); $callback = function($wrapped) { return $this->view->cardifyOnlyDescription($wrapped); @@ -38,15 +38,14 @@ class Intonation_View_Abonne_Suggestions extends ZendAfi_View_Helper_BaseHelper $collection = new Storm_Collection($suggestions); - $actions = [new Intonation_Library_Link(['Url' => $this->view->url(['controller' => 'abonne', - 'action' => 'suggestion-achat-add']), - 'Text' => $this->_('Suggérer un achat'), - 'InlineText' => 1, - 'Class' => 'btn btn-sm btn-success', - 'Title' => $this->_('Suggérer un achat à la bibliothèque'), - 'Image' => Class_Template::current()->getIco($this->view, - 'add', - 'utils')])]; + $actions = [(new Intonation_Library_Link) + ->setUrl($this->view->url(['controller' => 'abonne', + 'action' => 'suggestion-achat-add'])) + ->setImage($this->view->templateIco('add', 'utils')) + ->setText($this->_('Suggérer un achat')) + ->setTitle($this->_('Suggérer un achat à la bibliothèque')) + ->setClass('btn btn-sm btn-success') + ->beNotResponsiveText()]; return $this->view->renderCollection($collection, $actions, $callback); } diff --git a/library/templates/Intonation/View/BookmarkedSearches.php b/library/templates/Intonation/View/BookmarkedSearches.php index 8d56feb8dc3f323847f5b44715f14e039921cd1e..61ff37e6d5b5cf718359db6ae1578c6084687a2d 100644 --- a/library/templates/Intonation/View/BookmarkedSearches.php +++ b/library/templates/Intonation/View/BookmarkedSearches.php @@ -45,16 +45,14 @@ class Intonation_View_BookmarkedSearches extends ZendAfi_View_Helper_BaseHelper 'action' => 'suivre-une-recherche'], $this->_('Commencer maintenant'))); - return - $html + return $html . $this->view->renderCollection(new Storm_Collection($searches), - [new Intonation_Library_Link(['Url' => ['controller' => 'abonne', - 'action' => 'suivre-une-recherche'], - 'Text' => $this->_('Suivre'), - 'Title' => $this->_('Suivre une recherche'), - 'Image' => - (Class_Template::current()->getIco($this->view, - 'no-selection', - 'library'))])]); + [(new Intonation_Library_Link) + ->setUrl(['controller' => 'abonne', + 'action' => 'suivre-une-recherche']) + ->setText($this->_('Suivre')) + ->setTitle($this->_('Suivre une recherche')) + ->setImage($this->view->templateIco('no-selection', + 'library'))]); } } \ No newline at end of file diff --git a/library/templates/Intonation/View/Library/Bookmark.php b/library/templates/Intonation/View/Library/Bookmark.php index af65373a4de82944a577ee6e00a9f42b34325409..2e80652e7a869f5f949eed958466efa7e9825855 100644 --- a/library/templates/Intonation/View/Library/Bookmark.php +++ b/library/templates/Intonation/View/Library/Bookmark.php @@ -32,47 +32,45 @@ class Intonation_View_Library_Bookmark extends ZendAfi_View_Helper_RenderLibrary protected function _unbookmarkLink() { + if (!$this->_library) + return; + $url = $this->_url(['module' => 'opac', 'controller' => 'abonne', 'action' => 'remove-library-from-bookmarks', 'library_id' => $this->_library_id], - null, - true); - - $text = $this->_('Supprimer de mes préférences'); - $title = $this->_('Supprimer %s de mes bibliothèques préférées pour la recherche.', - $this->_library->getLibelle()); + null, true); - return - new Intonation_Library_Link(['Url' => $url, - 'Text' => $text, - 'Image' => $this->view->templateIco('like', - 'library'), - 'Popup' => true, - 'Class' => 'text-truncate remove_from_preferences', - 'Title' => $title]); + return (new Intonation_Library_Link) + ->setUrl($url) + ->setText($this->_('Supprimer de mes préférences')) + ->setTitle($this->_('Supprimer %s de mes bibliothèques préférées pour la recherche.', + $this->_library->getLibelle())) + ->setImage($this->view->templateIco('like', 'library')) + ->setClass('text-truncate remove_from_preferences') + ->setPopup(true); } protected function _bookmarkLink() { + if (!$this->_library) + return; + $url = $this->_url(['module' => 'opac', 'controller' => 'abonne', 'action' => 'add-library-to-bookmarks', 'library_id' => $this->_library_id], - null, - true); - - $text = $this->_('Ajouter à mes préférences'); - $title = $this->_('Ajouter %s à mes bibliothèques préférées pour la recherche.'); + null, true); - return - new Intonation_Library_Link(['Url' => $url, - 'Text' => $text, - 'Image' => $this->view->templateIco('dislike', - 'library'), - 'Popup' => true, - 'Class' => 'text-truncate add_to_preferences', - 'Title' => $title]); + return (new Intonation_Library_Link) + ->setUrl($url) + ->setImage($this->view->templateIco('dislike', 'library')) + ->setText($this->_('Ajouter à mes préférences')) + ->setTitle($this->_('Ajouter %s à mes bibliothèques préférées pour la recherche.', + $this->_library->getLibelle())) + ->setClass('text-truncate add_to_preferences') + ->setPopup(true) + ; } diff --git a/library/templates/Intonation/View/Permalink.php b/library/templates/Intonation/View/Permalink.php index dd046d2d77508ebc563b1f6068fe3ce6937929ef..09a20893195046970a69e16a8b38705612596ad3 100644 --- a/library/templates/Intonation/View/Permalink.php +++ b/library/templates/Intonation/View/Permalink.php @@ -21,16 +21,13 @@ class Intonation_View_Permalink extends ZendAfi_View_Helper_BaseHelper { public function permalink($url) { - $image = Class_Template::current()->getIco($this->view, - 'permalink', - 'utils'); - - return new Intonation_Library_Link(['Text' => $this->_('Lien …'), - 'Image' => $image, - 'Title' => $this->view->_('Voir le lien permanent suivant: %s', $url), - 'Class' => 'view_permalink permalink py-1 my-1', - 'Attribs' => ['data-url' => $url, - 'data-helptext' => $this->view->_('Copiez le lien suivant'), - 'onclick' => 'popupPermalink(this);']]); + return (new Intonation_Library_Link) + ->setText($this->_('Lien …')) + ->setImage($this->view->templateIco('permalink', 'utils')) + ->setTitle($this->_('Voir le lien permanent suivant: %s', $url)) + ->setClass('view_permalink permalink py-1 my-1') + ->setAttribs(['data-url' => $url, + 'data-helptext' => $this->_('Copiez le lien suivant'), + 'onclick' => 'popupPermalink(this);']); } } \ No newline at end of file diff --git a/library/templates/Intonation/View/RenderDeleteQuestion.php b/library/templates/Intonation/View/RenderDeleteQuestion.php index 8081baa5ef7b60c0f4d0468f5d7075b6f6668b0d..6cadce09a8062aa6a23b2d596c61be7fab396dc3 100644 --- a/library/templates/Intonation/View/RenderDeleteQuestion.php +++ b/library/templates/Intonation/View/RenderDeleteQuestion.php @@ -29,7 +29,8 @@ class Intonation_View_RenderDeleteQuestion extends ZendAfi_View_Helper_BaseHelpe $this->view->div(['class' => 'col-10'], $this->view->div(['class' => 'm-2 p-2 btn-group text-white'], - $this->view->Button_Back(new Class_Entity(['Attribs' => ['class' => 'btn btn-info']])) + $this->view->Button_Back((new Class_Button) + ->setAttrib('class', 'btn btn-info')) . $this->view->tagAnchor($confirm_deletion_url, $this->_('Oui'), ['class' => 'btn btn-danger'])))]; diff --git a/library/templates/Intonation/View/RenderDropdown.php b/library/templates/Intonation/View/RenderDropdown.php index 093bf4f1ed3adec76e9a37739628c7b58d3556a4..bc545565d3f482f1f2fa2f02c79483fc52ed5bfc 100644 --- a/library/templates/Intonation/View/RenderDropdown.php +++ b/library/templates/Intonation/View/RenderDropdown.php @@ -27,12 +27,10 @@ class Intonation_View_RenderDropdown extends ZendAfi_View_Helper_BaseHelper { $id = 'dropdown_button_' . $uniq_id; $dropdown_id = 'dropdown_'.$uniq_id; $button = ($button instanceof Intonation_Library_Link) - ? $this->view->tagAction($button->setAttribs(array_merge((($attribs = $button->getAttribs()) - ? $attribs - : []), - ['id' => $id, - 'data-toggle' => 'dropdown', - 'aria-haspopup' => 'true']))) + ? $this->view->tagAction($button + ->setAttrib('id', $id) + ->setAttrib('data-toggle', 'dropdown') + ->setAttrib('aria-haspopup', 'true')) : $this->_tag('button', $button, ['id' => $id, diff --git a/library/templates/Intonation/View/RenderExpandable.php b/library/templates/Intonation/View/RenderExpandable.php index 05109c7aea80c7c78521f3f44918241602169011..b38afd1bb29b6c56e666e9470a33acb2811331bd 100644 --- a/library/templates/Intonation/View/RenderExpandable.php +++ b/library/templates/Intonation/View/RenderExpandable.php @@ -37,12 +37,10 @@ class Intonation_View_RenderExpandable extends ZendAfi_View_Helper_BaseHelper { protected function _getButton($button, $id) { if ($button instanceof Intonation_Library_Link) - return $this->view->tagAction($button->setAttribs(array_merge((($attribs = $button->getAttribs()) - ? $attribs - : []), - ['type' => 'button', - 'data-toggle' => 'collapse', - 'data-target' => '#' . $id]))); + return $this->view->tagAction($button + ->setAttrib('type', 'button') + ->setAttrib('data-toggle', 'collapse') + ->setAttrib('data-target', '#' . $id)); $button = $button ? $button diff --git a/library/templates/Intonation/View/RenderNewsletters.php b/library/templates/Intonation/View/RenderNewsletters.php index fe8c15436496f636b9f83b6ea0e7316289d823b8..f67ca55818d4eeaf28bf8a491c132dfa74fa43ca 100644 --- a/library/templates/Intonation/View/RenderNewsletters.php +++ b/library/templates/Intonation/View/RenderNewsletters.php @@ -54,34 +54,28 @@ class Intonation_View_RenderNewsletters extends ZendAfi_View_Helper_BaseHelper { protected function _disableNewsletterAction() { - $ico = Class_Template::current()->getIco($this->view, 'ban', 'utils'); return $this->_renderAction('disable-newsletter', $this->_('Ne plus recevoir de lettre d\'information'), 'btn-warning', - $ico); + $this->view->templateIco('ban', 'utils')); } protected function _enableNewsletterAction() { - $ico = Class_Template::current()->getIco($this->view, 'add', 'utils'); return $this->_renderAction('enable-newsletter', $this->_('Pouvoir recevoir des lettres d\'information'), 'btn-success', - $ico); + $this->view->templateIco('add', 'utils')); } - protected function _renderAction($action, $text, $class, $ico) { - $url = $this->view->url(['controller' => 'abonne', - 'action' => $action]); - - $attribs = ['Tag' => 'url', - 'Text' => $text, - 'OnlyClasses' => "card-link btn btn-sm text-light ".$class, - 'Url' => $url, - 'Title' => $text, - 'Image' => $ico]; - - return $this->view->tagAction(new Intonation_Library_Link($attribs)); + protected function _renderAction($action, $text, $class, $image) { + return $this->view->tagAction((new Intonation_Library_Link) + ->setUrl($this->view->url(['controller' => 'abonne', + 'action' => $action])) + ->setImage($image) + ->setText($text) + ->setTitle($text) + ->setOnlyClasses('card-link btn btn-sm text-light ' . $class)); } } diff --git a/library/templates/Intonation/View/RenderRecord/RenderReviews.php b/library/templates/Intonation/View/RenderRecord/RenderReviews.php index c6cdb3a7dc4b2ace85983afea907dcf5e805b806..f5e5b74ef0f144d644c5df73f764007f83badc87 100644 --- a/library/templates/Intonation/View/RenderRecord/RenderReviews.php +++ b/library/templates/Intonation/View/RenderRecord/RenderReviews.php @@ -92,15 +92,13 @@ class Intonation_View_RenderRecord_RenderReviews extends ZendAfi_View_Helper_Bas protected function _mine() { if (!$me = Class_Users::getIdentity()) - return $this->view->tagAction(new Intonation_Library_Link(['Url' => $this->view->url(['controller' => 'auth', - 'action' => 'popup-login']), - 'Popup' => true, - 'Image' => Class_Template::current() - ->getIco($this->view, - 'login', - 'utils'), - 'Text' => $this->_('Se connecter'), - 'Title' => $this->_('Connectez vous pour donner un avis')])); + return $this->view->tagAction((new Intonation_Library_Link) + ->setUrl($this->view->url(['controller' => 'auth', + 'action' => 'popup-login'])) + ->setImage($this->view->templateIco('login', 'utils')) + ->setText($this->_('Se connecter')) + ->setTitle($this->_('Connectez vous pour donner un avis')) + ->setPopup(true)); if ($me->getFirstAvisByIdNotice($this->_record->getId()) || (!$me->isBibliothecaire() && Class_AdminVar::isLibrarianReviewsOnly())) diff --git a/library/templates/Intonation/View/RenderTrailers.php b/library/templates/Intonation/View/RenderTrailers.php index 1f33cd63052edf4812c83c60f0a55c526300e503..632c555a5a5d3fe63fd1df9f7b070b4b6723f9d3 100644 --- a/library/templates/Intonation/View/RenderTrailers.php +++ b/library/templates/Intonation/View/RenderTrailers.php @@ -63,7 +63,7 @@ class Intonation_View_RenderTrailers extends ZendAfi_View_Helper_BaseHelper { 'id' => $trailer->getModel()->getId()]); return $this->view - ->Admin_Button((new Class_Entity()) + ->Admin_Button((new Class_Button) ->setText($this->_('Modifier la bande-annonce')) ->setUrl($url) ->setAttribs(['data-popup' => 'true']) @@ -89,7 +89,7 @@ class Intonation_View_RenderTrailers extends ZendAfi_View_Helper_BaseHelper { 'id' => $trailer->getModel()->getId()]); return $this->view - ->Admin_Button((new Class_Entity()) + ->Admin_Button((new Class_Button) ->setText($this->_('Désactiver la bande-annonce')) ->setUrl($url) ->setAttribs(['data-popup' => 'true']) @@ -105,7 +105,7 @@ class Intonation_View_RenderTrailers extends ZendAfi_View_Helper_BaseHelper { 'id' => $trailer->getModel()->getId()]); return $this->view - ->Admin_Button((new Class_Entity()) + ->Admin_Button((new Class_Button) ->setText($this->_('Activer la bande-annonce')) ->setUrl($url) ->setAttribs(['data-popup' => 'true']) diff --git a/library/templates/Intonation/View/ReseauxSociaux.php b/library/templates/Intonation/View/ReseauxSociaux.php index 02602d360dc803791aefd29bc7c5ee633126a370..c9d584cf341ba4bb7a0fc284e68ada391710ff76 100644 --- a/library/templates/Intonation/View/ReseauxSociaux.php +++ b/library/templates/Intonation/View/ReseauxSociaux.php @@ -22,17 +22,15 @@ class Intonation_View_ReseauxSociaux extends ZendAfi_View_Helper_ReseauxSociaux { public function shareLinkImgHtml($clef, $url_table) { - $title = $this->_('Partager %s sur %s', $url_table['titre'], $clef); - $image = Class_Template::current()->getIco($this->view, - $clef, - 'utils'); $script = sprintf('$.getScript(\'%s\')', $this->_escapeJsAttrib($this->getScriptFromController($url_table))); - return $this->view->tagAction(new Intonation_Library_Link(['Text' => $clef, - 'Image' => $image, - 'Title' => $title, - 'Class' => 'reseau-social-img py-1 my-1 d-block', - 'attribs' => ['onclick' => $script]])); + return $this->view->tagAction((new Intonation_Library_Link) + ->setText($clef) + ->setImage($this->view->templateIco($clef, 'utils')) + ->setTitle($this->_('Partager %s sur %s', + $url_table['titre'], $clef)) + ->setClass('reseau-social-img py-1 my-1 d-block') + ->setAttrib('onclick', $script)); } } \ No newline at end of file diff --git a/library/templates/Intonation/View/Search/Facets.php b/library/templates/Intonation/View/Search/Facets.php index 7784553305fa23686008a2f2d73f492a3a449dcc..81ee6d384bc98553d7f9243f94c2f00b3db9d66b 100644 --- a/library/templates/Intonation/View/Search/Facets.php +++ b/library/templates/Intonation/View/Search/Facets.php @@ -97,15 +97,14 @@ class Intonation_View_Search_Facets extends ZendAfi_View_Helper_Facettes { protected function _moreFacetsAnchor($code) { - return $this->view->tagAction(new Intonation_Library_Link(['Url' => '#', - 'Text' => $this->_('Afficher plus de facettes'), - 'Image' => (Class_Template::current() - ->getIco($this->view, - 'add', - 'utils')), - 'Class' => 'text_small text_no_transform', - 'Title' => $this->_('Afficher plus de facettes "%s"', - Class_Codification::getInstance()->getNomChamp($code))])); + return $this->view->tagAction((new Intonation_Library_Link) + ->setUrl('#') + ->setImage($this->view->templateIco('add', 'utils')) + ->setText($this->_('Afficher plus de facettes')) + ->setTitle($this->_('Afficher plus de facettes "%s"', + Class_Codification::getInstance()->getNomChamp($code))) + ->setClass('text_small text_no_transform') + ); } diff --git a/library/templates/Intonation/View/Search/History.php b/library/templates/Intonation/View/Search/History.php index 62e02068287b838209b366ab576434c5306cba17..78bc3397751ec4ebe769191cd20f2c390901783b 100644 --- a/library/templates/Intonation/View/Search/History.php +++ b/library/templates/Intonation/View/Search/History.php @@ -53,16 +53,15 @@ class Intonation_View_Search_History extends ZendAfi_View_Helper_BaseHelper { return $this->view->cardify($wrapped); }; - $actions = [new Intonation_Library_Link(['Url' => $this->view->url(['controller' => 'abonne', - 'action' => 'clear-history']), - 'Popup' => true, - 'Text' => $this->_('Vider'), - 'Class' => 'clear_history_button', - 'InlineText' => 1, - 'Title' => $this->_('Vider l\'historique de recherches'), - 'Image' => Class_Template::current()->getIco($this->view, - 'delete', - 'utils')])]; + $actions = [(new Intonation_Library_Link) + ->setUrl($this->view->url(['controller' => 'abonne', + 'action' => 'clear-history'])) + ->setImage($this->view->templateIco('delete', 'utils')) + ->setText($this->_('Vider')) + ->setTitle($this->_('Vider l\'historique de recherches')) + ->setClass('clear_history_button') + ->beNotResponsiveText() + ->setPopup(true)]; $html = [$this->view->div(['class' => 'col-12'], $this->view->renderCollectionActions($actions)), $this->view->div(['class' => 'col-12 mt-3'], diff --git a/library/templates/Intonation/View/Search/HtmlCriteria.php b/library/templates/Intonation/View/Search/HtmlCriteria.php index 0a70931395531c1e7ef802f71bb24fae7d5a4be9..9035ae24de7440ff65bc7a8d6563fd62cf2abbf1 100644 --- a/library/templates/Intonation/View/Search/HtmlCriteria.php +++ b/library/templates/Intonation/View/Search/HtmlCriteria.php @@ -67,13 +67,13 @@ class Intonation_View_Search_HtmlCriteria extends ZendAfi_View_Helper_TagCritere null, true); - $link = - new Intonation_Library_Link(['Url' => $url, - 'Image' => $this->view->templateIco('clean', 'utils'), - 'Text' => $this->_('Réinitialiser'), - 'Title' => $this->_('Supprimer les facettes'), - 'InlineText' => 1, - 'Class' => 'reset_criteria']); + $link = (new Intonation_Library_Link) + ->setUrl($url) + ->setImage($this->view->templateIco('clean', 'utils')) + ->setText($this->_('Réinitialiser')) + ->setTitle($this->_('Supprimer les facettes')) + ->setClass('reset_criteria') + ->beNotResponsiveText(); $this->_html .= $this->view->tagAction($link); return $this; @@ -93,12 +93,13 @@ class Intonation_View_Search_HtmlCriteria extends ZendAfi_View_Helper_TagCritere unset($url['page']); return $this->view - ->tagAction(new Intonation_Library_Link(['Url' => $this->view->url($url, null, true), - 'Image' => Class_Template::current()->getIco($this->view, 'clean', 'utils'), - 'Text' => $label, - 'Title' => $this->_('Retirer le critère: %s', $label), - 'InlineText' => 1, - 'Class' => 'active_criteria'])); + ->tagAction((new Intonation_Library_Link) + ->setUrl($this->view->url($url, null, true)) + ->setImage($this->view->templateIco('clean', 'utils')) + ->setText($label) + ->setTitle($this->_('Retirer le critère: %s', $label)) + ->setClass('active_criteria') + ->beNotResponsiveText()); } diff --git a/library/templates/Intonation/View/Search/Result.php b/library/templates/Intonation/View/Search/Result.php index ae424470d41f9bf5b2e5f5d19fe66b44454cb2b9..641b8a9ac8df33089d22f5610755213033c036ab 100644 --- a/library/templates/Intonation/View/Search/Result.php +++ b/library/templates/Intonation/View/Search/Result.php @@ -193,24 +193,24 @@ class Intonation_View_Search_Result extends ZendAfi_View_Helper_BaseHelper { protected function _listModeLink(){ - return - new Intonation_Library_Link(['Url' => $this->view->url(['liste_format' => Class_Systeme_ModulesAppli::LISTE_FORMAT_LIST]), - 'Image' => Class_Template::current()->getIco($this->view, 'list', 'utils'), - 'Text' => $this->_tag('span', $this->_('Liste')), - 'Title' => $this->_('Afficher le résultat de recherche en mode liste'), - 'InlineText' => 1, - 'Attribs' => ['class' => 'btn-sm list_format' . ($this->_isWallMode() ? '' : ' active')]]); + return (new Intonation_Library_Link) + ->setUrl($this->view->url(['liste_format' => Class_Systeme_ModulesAppli::LISTE_FORMAT_LIST])) + ->setImage($this->view->templateIco('list', 'utils')) + ->setText($this->_tag('span', $this->_('Liste'))) + ->setTitle($this->_('Afficher le résultat de recherche en mode liste')) + ->setClass('btn-sm list_format' . ($this->_isWallMode() ? '' : ' active')) + ->beNotResponsiveText(); } protected function _wallModeLink(){ - return - new Intonation_Library_Link(['Url' => $this->view->url(['liste_format' => Class_Systeme_ModulesAppli::LISTE_FORMAT_MUR]), - 'Image' => Class_Template::current()->getIco($this->view, 'wall', 'utils'), - 'Text' => $this->_tag('span', $this->_('Mur')), - 'Title' => $this->_('Afficher le résultat de recherche en mode mur'), - 'InlineText' => 1, - 'Attribs' => ['class' => 'btn-sm list_format' . ($this->_isWallMode() ? ' active' : '')]]); + return (new Intonation_Library_Link) + ->setUrl($this->view->url(['liste_format' => Class_Systeme_ModulesAppli::LISTE_FORMAT_MUR])) + ->setImage($this->view->templateIco('wall', 'utils')) + ->setText($this->_tag('span', $this->_('Mur'))) + ->setTitle($this->_('Afficher le résultat de recherche en mode mur')) + ->setClass('btn-sm list_format' . ($this->_isWallMode() ? 'active' : '')) + ->beNotResponsiveText(); } diff --git a/library/templates/Intonation/View/SocialNetworksActions.php b/library/templates/Intonation/View/SocialNetworksActions.php index 8697efbe003f083c52ef23ad34e44762a0b7cc9d..520934b0c89a071dc1ed9a141d1cf56f78ccd305 100644 --- a/library/templates/Intonation/View/SocialNetworksActions.php +++ b/library/templates/Intonation/View/SocialNetworksActions.php @@ -32,17 +32,14 @@ class Intonation_View_SocialNetworksActions extends ZendAfi_View_Helper_ReseauxS public function shareLinkImgHtml($clef, $url_table) { - $label = $this->_('Partager %s sur %s', $url_table['titre'], $clef); - - $this->_actions [] = new Intonation_Library_Link(['Image' => (Class_Template::current() - ->getIco($this->view, - $clef, - 'utils')), - 'Text' => $clef, - 'Title' => $label, - 'Url' => '#', - 'Class' => 'share_record_on_' . $clef, - 'Attribs' => ['onclick' => sprintf('$.getScript(\'%s\')', $this->getScriptFromController($url_table))]]); + $this->_actions [] = (new Intonation_Library_Link) + ->setImage($this->view->templateIco($clef, 'utils')) + ->setText($clef) + ->setTitle($this->_('Partager %s sur %s', $url_table['titre'], $clef)) + ->setUrl('#') + ->setClass('share_record_on_' . $clef) + ->setAttrib('onclick', + sprintf('$.getScript(\'%s\')', $this->getScriptFromController($url_table))); return ''; } diff --git a/library/templates/Intonation/View/TagAction.php b/library/templates/Intonation/View/TagAction.php index 4ed648fb26277df3205f6b4ab4e359503abd8da7..ff96bbc7bd78b4db0cfc96499ae1d904aac21713 100644 --- a/library/templates/Intonation/View/TagAction.php +++ b/library/templates/Intonation/View/TagAction.php @@ -26,59 +26,51 @@ class Intonation_View_TagAction extends ZendAfi_View_Helper_BaseHelper { return ''; if (is_string($action)) - return $action; - - if (false === $action->getRight()) - return ''; + return $action; if ($callback = $action->getCallback()) - return call_user_func_array($callback, [$action]); + return call_user_func($callback, $action); + + if ('button' == $action->getElement()) + return $this->view->button($action); + + $img = ($img = $action->getImage()) + ? $img + : ''; + + $text = $this->_getText($action, $img); + + if (!$content = $img . $text) + return ''; $attribs = ($attribs = $action->getAttribs()) ? $attribs : []; - if ( $confirm = $action->getConfirm()) - $attribs ['onclick'] = $this->view->confirm($confirm); + if ($confirm = $action->getConfirm()) + $attribs['onclick'] = $this->view->confirm($confirm); - $classes = 'card-link'; + $classes = ['card-link']; if (isset($attribs['class'])) { - $classes .= ' ' . $attribs['class']; + $classes[] = $attribs['class']; unset($attribs['class']); } - $classes .= ($class = $action->getClass()) - ? ' ' . $class - : ''; + if ($class = $action->getClass()) + $classes[] = $class; if ($only_classes = $action->getOnlyClasses()) - $classes = $only_classes; - - $img = ($img = $action->getImage()) - ? $img - : ''; - - if ('button' == $action->getTag()) - return $this->view->button($action); - - $text = $this->_getText($action, $img); - - if ( ! $content = $img . $text) - return ''; + $classes = [$only_classes]; $attribs = array_merge(['title' => $action->getTitle(), 'data-popup' => $action->getPopup(), - 'class' => $classes], + 'class' => implode(' ', $classes)], $attribs); return ($url = $action->getUrl()) - ? $this->view->tagAnchor($url, - $content, - $attribs) - : $this->_tag('a', - (string) $content, - $attribs); + ? $this->view->tagAnchor($url, $content, $attribs) + : $this->_tag('a', (string) $content, $attribs); } @@ -89,9 +81,8 @@ class Intonation_View_TagAction extends ZendAfi_View_Helper_BaseHelper { if ($action->isNotResponsiveText()) return $this->_tag('div', $text, ['class' => 'd-inline text-left']); - if (!$img) - return $this->_tag('div', $text, ['class' => 'd-inline button_text text-left']); - - return $this->_tag('div', $text, ['class' => 'd-none d-md-inline text-left button_text']); + return $img + ? $this->_tag('div', $text, ['class' => 'd-none d-md-inline text-left button_text']) + : $this->_tag('div', $text, ['class' => 'd-inline button_text text-left']); } } \ No newline at end of file diff --git a/library/templates/Intonation/View/TagSelectRecord.php b/library/templates/Intonation/View/TagSelectRecord.php index b2c8d1e049bf003650548362c19fa6a608387ec7..93683fcbf4cbd2e99aef6d6cfcd4f0759433c69b 100644 --- a/library/templates/Intonation/View/TagSelectRecord.php +++ b/library/templates/Intonation/View/TagSelectRecord.php @@ -36,11 +36,13 @@ class Intonation_View_TagSelectRecord extends ZendAfi_View_Helper_TagSelectRecor protected function _renderCheckbox($record, $url, $checked) { return - $this->view->tagAction(new Intonation_Library_Link(['Text' => $this->_('Sélectionner'), - 'Image' => parent::_renderCheckbox($record, $url, $checked), - 'Title' => $this->_('Sélectionner "%s" pour impression, export ou sauvegarde', - $record->getTitrePrincipal()), - 'Attribs' => ['onclick' => "event.stopImmediatePropagation();var checkbox = $(this).find('input[type=checkbox]'); checkbox.click();"]])); + $this->view->tagAction((new Intonation_Library_Link) + ->setImage(parent::_renderCheckbox($record, $url, $checked)) + ->setText($this->_('Sélectionner')) + ->setTitle($this->_('Sélectionner "%s" pour impression, export ou sauvegarde', + $record->getTitrePrincipal())) + ->setAttrib('onclick', + "event.stopImmediatePropagation();var checkbox = $(this).find('input[type=checkbox]'); checkbox.click();")); } @@ -53,20 +55,19 @@ class Intonation_View_TagSelectRecord extends ZendAfi_View_Helper_TagSelectRecor $this->_selectViewLink($criteria), $this->_clearSelectionLink()]))); - $count_button = new Intonation_Library_Link(['Text' => ($this->_('Sélection : ') - . $this->_tag('span', $record_count)), - 'Url' => '#', - 'Image' => Class_Template::current()->getIco($this->view, - 'check-list', - 'utils'), - 'Class' => 'btn btn-sm btn-dark', - 'Title' => implode(' ' , - [$this->_('Ouvrir le menu des actions de sélection.'), - $this->_plural($record_count, - 'Aucun document sélectionné', - 'Un document sélectionné', - '%d documents sélectionnés', - $record_count)])]); + $count_button = (new Intonation_Library_Link) + ->setUrl('#') + ->setImage($this->view->templateIco('check-list', 'utils')) + ->setText($this->_('Sélection : ') . $this->_tag('span', $record_count)) + ->setTitle(implode(' ' , + [$this->_('Ouvrir le menu des actions de sélection.'), + $this->_plural($record_count, + 'Aucun document sélectionné', + 'Un document sélectionné', + '%d documents sélectionnés', + $record_count)])) + ->setClass('btn btn-sm btn-dark') + ; return $this->view->div(['class' => 'record-selection'], $this->view->renderDropdown($menu, $count_button)); diff --git a/library/templates/Intonation/View/User/Informations.php b/library/templates/Intonation/View/User/Informations.php index 2ca8268dcc6f63ee88dbc613315ef5a5d8cb0506..d27e3aece92827c721c8000556f53a38e8440a32 100644 --- a/library/templates/Intonation/View/User/Informations.php +++ b/library/templates/Intonation/View/User/Informations.php @@ -30,15 +30,14 @@ class Intonation_View_User_Informations extends ZendAfi_View_Helper_BaseHelper { protected function _renderUserInfo($user) { $links = $this->_addEditionLinks($user, []); - $links [] = - new Intonation_Library_Link(['Url' => $this->view->url(['controller' => 'abonne', - 'action' => 'all-datas.csv'], null, true), - 'Image' => Class_Template::current()->getIco($this->view, 'export', 'utils'), - 'Text' => $this->_('Télécharger mes données'), - 'Title' => $this->_('Télécharger mes données'), - 'Class' => 'btn btn-sm btn-info mr-3', - 'InlineText' => 1, - ]); + $links [] = (new Intonation_Library_Link) + ->setUrl($this->view->url(['controller' => 'abonne', + 'action' => 'all-datas.csv'], null, true)) + ->setImage($this->view->templateIco('export', 'utils')) + ->setText($this->_('Télécharger mes données')) + ->setTitle($this->_('Télécharger mes données')) + ->setClass('btn btn-sm btn-info mr-3') + ->beNotResponsiveText(); $links_html = array_map(function($link) { @@ -58,22 +57,24 @@ class Intonation_View_User_Informations extends ZendAfi_View_Helper_BaseHelper { if (Class_AdminVar::get('INTERDIRE_MODIF_FICHE_ABONNE')) return $links; - $links [] = - new Intonation_Library_Link(['Url' => $this->view->url(['controller' => 'abonne', - 'action' => 'modifier']), - 'Image' => Class_Template::current()->getIco($this->view, 'edit', 'utils'), - 'Text' => $this->_('Modifier mes informations'), - 'Title' => $this->_('Modifier les informations me concernant'), - 'Class' => 'btn btn-sm btn-success mr-3', - 'InlineText' => 1]); - $links [] = - new Intonation_Library_Link(['Url' => $this->view->url(['controller' => 'abonne', - 'action' => 'changer-mon-mot-de-passe']), - 'Image' => Class_Template::current()->getIco($this->view, 'lock', 'utils'), - 'Text' => $this->_('Changer mon mot de passe'), - 'Title' => $this->_('Changer le mot de passe de mon compte.'), - 'Class' => 'btn btn-sm btn-secondary mr-3', - 'InlineText' => 1]); + $links [] = (new Intonation_Library_Link) + ->setUrl($this->view->url(['controller' => 'abonne', + 'action' => 'modifier'])) + ->setImage($this->view->templateIco('edit', 'utils')) + ->setText($this->_('Modifier mes informations')) + ->setTitle($this->_('Modifier les informations me concernant')) + ->setClass('btn btn-sm btn-success mr-3') + ->beNotResponsiveText(); + + $links [] = (new Intonation_Library_Link) + ->setUrl($this->view->url(['controller' => 'abonne', + 'action' => 'changer-mon-mot-de-passe'])) + ->setImage($this->view->templateIco('lock', 'utils')) + ->setText($this->_('Changer mon mot de passe')) + ->setTitle($this->_('Changer le mot de passe de mon compte.')) + ->setClass('btn btn-sm btn-secondary mr-3') + ->beNotResponsiveText(); + return $links; } diff --git a/tests/scenarios/Templates/ChiliSearchTest.php b/tests/scenarios/Templates/ChiliSearchTest.php index e38234cfdf168b5a2bd04d1484be55d275cf7695..c0272e345f58098b2ced6314ab99edd6ed4c13f7 100644 --- a/tests/scenarios/Templates/ChiliSearchTest.php +++ b/tests/scenarios/Templates/ChiliSearchTest.php @@ -80,19 +80,22 @@ class ChiliSearchHoldLinkTest extends AbstractControllerTestCase { /** @test */ public function linkToReserverRecord2ShouldBePickupLocationItem1() { - $this->assertXPathContentContains('//div[@class="card_action record_hold_link col col-sm-12 p-1 m-1"]//a[@href = "/recherche/reservation-pickup-ajax/id_notice/2/id_int_bib/1/id_bib/1/copy_id/1"][contains(@class, "record_hold_link")]', 'Réserver'); + $this->assertXPathContentContains('//div[@class="card_action record_hold_link col col-sm-12 p-1 m-1"]//a[@href = "/recherche/reservation-pickup-ajax/id_notice/2/id_int_bib/1/id_bib/1/copy_id/1"][contains(@class, "record_hold_link")]', + 'Réserver'); } /** @test */ public function viewMoreRecordActionsShouldBeInDivViewMoreRecordActions() { - $this->assertXPathContentContains('//div[@class="card_action view_more_record_actions col col-sm-12 p-1 m-1"]//a[@data-toggle="dropdown"]', 'Plus'); + $this->assertXPathContentContains('//div[@class="card_action view_more_record_actions col col-sm-12 p-1 m-1"]//a[@data-toggle="dropdown"]', + 'Plus'); } /** @test */ public function readRecordShouldBeInADivReadDocument() { - $this->assertXPathContentContains('//div[@class="card_action read_document col col-sm-12 p-1 m-1"]//a[contains(@href,"recherche/viewnotice")]', 'Voir'); + $this->assertXPathContentContains('//div[@class="card_action read_document col col-sm-12 p-1 m-1"]//a[contains(@href,"recherche/viewnotice")]', + 'Voir'); } @@ -149,7 +152,8 @@ class ChiliSearchHoldLinkNoSIGBTest extends AbstractControllerTestCase { /** @test */ public function linkToReserverRecord2ShouldHaveClassNoHoldableItom() { - $this->assertXPathContentContains('//a[@class = "card-link record_hold_link no_holdable_item"]', 'Non réservable'); + $this->assertXPathContentContains('//a[@class = "card-link record_hold_link no_holdable_item"]', + 'Non réservable'); } diff --git a/tests/scenarios/Templates/TemplatesAbonneSelectionsTest.php b/tests/scenarios/Templates/TemplatesAbonneSelectionsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..1c7d91c1e8253ec49d9464a32e5c0c92b4213ef3 --- /dev/null +++ b/tests/scenarios/Templates/TemplatesAbonneSelectionsTest.php @@ -0,0 +1,559 @@ +<?php +/** + * Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH 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). + * + * BOKEH 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 BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +require_once 'TemplatesTest.php'; + +abstract class TemplatesAbonneSelectionsTestCase extends TemplatesIntonationTestCase { + protected $_emprunteur; + + public function setUp() { + parent::setUp(); + + $this->_emprunteur = new Class_WebService_SIGB_Emprunteur('1234', 'Florence'); + $this->_emprunteur->setLibraryCode('IST'); + + $current_user = Class_Users::getIdentity(); + $current_user + ->setPassword('test') + ->setIdabon(123456) + ->setDateFin('2020/01/01') + ->setFicheSigb(['type_comm' => 2, + 'fiche' => $this->_emprunteur, + 'erreur' => '']) + ->setPseudo('Paul') + ->beAbonneSIGB(); + + $libre_domain = $this->fixture('Class_Catalogue', + ['id' => 1, + 'libelle' => 'Libre']); + + $mes_bd = $this->fixture('Class_PanierNotice', + ['id' => 2, + 'id_panier' => 1, + 'libelle' => 'Mes BD', + 'date_maj' => '10/02/2011', + 'notices' => 'COMBAT ORDINAIRE;BLACKSAD', + 'user' => $current_user]); + + $mes_bd->setCatalogues([$libre_domain]); + + $criteres_potter = (new Class_CriteresRecherche) + ->setParams(['expressionRecherche' => 'Harry Potter', + 'page' => 2]); + + $this->fixture('Class_User_BookmarkedSearch', + ['id' => 5, + 'id_user' => $current_user->getId(), + 'label' => 'Potter', + 'criterias' => serialize($criteres_potter), + 'creation_date' => '2020-01-17 15:05:57']); + } +} + + + + +class TemplatesAbonneSelectionsAsAbonneTest extends TemplatesAbonneSelectionsTestCase { + public function setUp() { + parent::setUp(); + $this->dispatch('/opac/abonne/selections/id_profil/72'); + } + + + /** @test */ + public function dispatchSelectionsShouldContainsCreerSelectionAnchor() { + $this->assertXPathContentContains('//a[contains(@href, "/abonne/creer-selection")]','Créer'); + } + + + + /** @test */ + public function shouldNotContainsVoirLesPaniersRangesDansLesDomaines() { + $this->assertNotXPathContentContains('//a[contains(@href, "/abonne/selections-dans-les-domaines")]','Voir les sélections dans les domaines'); + } + + + /** @test */ + public function shouldNotContainsVoirLesPaniersDesProfessionnels() { + $this->assertNotXPathContentContains('//a[contains(@href, "/abonne/selections-des-professionnels")]','Voir les sélections des professionnels'); + } + + + /** @test */ + public function mesBdShouldBeDisplay() { + $this->assertXPathContentContains('//div', 'Mes BD'); + } + + + /** @test */ + public function mesBdShouldHaveBadge1DomainLinked() { + $this->assertXPathContentContains('//div//span[contains(@class, "badge")]', '1 domaine lié'); + } + + + /** @test */ + public function shouldContainsLinkToAddToMesBd() { + $this->assertXPath('//a[contains(@href, "/abonne/ajouter-a-la-selection")]' + . '[contains(@href, "/selection_id/2")]'); + } + + + /** @test */ + public function shouldContainsLinkToManageMesBd() { + $this->assertXPath('//a[contains(@href, "/abonne/selection")]' + . '[contains(@href, "/selection_id/2")]'); + } + + + /** @test */ + public function shouldContainsLinkToRenameMesBd() { + $this->assertXPath('//a[contains(@href, "/abonne/renommer-la-selection")]' + . '[contains(@href, "/selection_id/2")]'); + } + + + /** + * @test + * @see #115804 + */ + public function mesBdLinkShouldNotContainsIdParam() { + $this->assertXPath('//a[contains(@href, "/recherche/simple")]' + . '[contains(@href, "/id_panier/2")]' + . '[not(contains(@href, "/id/"))]'); + } + + + /** @test */ + public function mesRechercheSuiviesShouldBeDisplay() { + $this->assertXPathContentContains('//div//h3', 'Mes recherches suivies'); + } + + + /** @test */ + public function linkToFollowASearchShouldBePresent() { + $this->assertXPathContentContains('//div[@class = "collection_action alone_in_the_list btn btn-sm btn-success col mr-3 col-3"]//a', 'Suivre'); + } +} + + + +class TemplatesAbonneSelectionsViewSelectionTest extends TemplatesAbonneSelectionsTestCase { + /** @test */ + public function exporterSelection2LinkShouldBePresent() { + $this->dispatch('/opac/abonne/selection/selection_id/2/id_profil/72'); + $this->assertXPathContentContains('//a[contains(@href, "/abonne/exporter-la-selection/selection_id/2")]', 'Exporter'); + } +} + + + + +class TemplatesAbonneSelectionsAjouterASelectionTest extends TemplatesAbonneSelectionsTestCase { + public function setUp() { + parent::setUp(); + $records = [$this->fixture('Class_Notice', + ['id' => 89]), + $this->fixture('Class_Notice', + ['id' => 99])]; + + $engine = $this->mock(); + Class_MoteurRecherche::setInstance($engine + ->whenCalled('visitLimit') + ->answers($engine) + + ->whenCalled('lancerRecherche') + ->answers($this->mock() + ->whenCalled('fetchRecords') + ->answers($records) + ->whenCalled('getRecordsCount') + ->answers(2))); + $this->dispatch('/opac/abonne/ajouter-a-la-selection/selection_id/2/id_profil/72'); + } + + + /** @test */ + public function titleShouldBeAjouterDesDocumentsALaSelection() { + $this->assertXPathContentContains('//h2', 'Ajouter des documents à la sélection'); + } + + + /** @test */ + public function pageShouldContainsLinkToAddRecord89() { + $this->assertXPath('//a[contains(@onclick, "abonne/ajouter-le-document-a-la-selection/selection_id/2/id_profil/72/record_id/89")]'); + } +} + + + + +class TemplatesAbonneSelectionsAjouterLeDocumentALaSelectionTest + extends TemplatesAbonneSelectionsTestCase { + public function setUp() { + parent::setUp(); + + Intonation_Library_Selection::clearSelectionsCache(); + $this->fixture('Class_Notice', + ['id' => 89, + 'titre_principal' => 'Neige', + 'type_doc' => 2, + 'clef_alpha' => 'NEIGE']); + } + + + /** @test */ + public function withSelectioIdTwoRecordId89ShouldHaveBeenHadedToSelection2() { + $this->dispatch('/opac/abonne/ajouter-le-document-a-la-selection/selection_id/2/id_profil/72/record_id/89'); + $this->assertEquals('COMBAT ORDINAIRE;BLACKSAD;NEIGE', Class_PanierNotice::find(2)->getNotices()); + } + + + /** @test */ + public function withSelectioIdTwoRecordId89ResponseShouldBeAnchorWithHrefSupprimerDeLaSelection() { + $this->dispatch('/opac/abonne/ajouter-le-document-a-la-selection/selection_label/Déjà lu/id_profil/72/record_id/89'); + $this->assertContains('/abonne/supprimer-de-la-selection', + json_decode($this->_response->getBody(), true)['anchor']); + } + + + /** @test */ + public function withSelectionLabelDejaVuNeigeShouldHaveBeenHadedToReaded() { + $this->dispatch('/opac/abonne/ajouter-le-document-a-la-selection/selection_label/Déjà lu/id_profil/72/record_id/89'); + $this->assertEquals('NEIGE', Class_PanierNotice::findFirstBy(['libelle' => 'Déjà lu'])->getNotices()); + } + + + /** @test */ + public function onPopupRequestShouldRedirectToReferer() { + $this->dispatch('/opac/abonne/ajouter-le-document-a-la-selection/selection_label/Déjà lu/id_profil/72/record_id/89/render/popup'); + $this->assertXPathContentContains('//script', 'location.reload();'); + } +} + + + + +class TemplatesAbonneSelectionsCreerSelectionTest extends TemplatesAbonneSelectionsTestCase { + /** @test */ + public function dispatchCreerSelectionShouldRenderForm() { + $this->dispatch('/opac/abonne/creer-selection/id_profil/72'); + $this->assertXPath('//main//div//form'); + } + + + /** @test */ + public function postDispatchCreerSelectionShouldCreateMaLectureDuDimanche() { + $this->postDispatch('/opac/abonne/creer-selection/id_profil/72', + ['libelle' => 'Lecture du dimanche']); + $this->assertNotNull(Class_PanierNotice::findFirstBy(['libelle' => 'Lecture du dimanche'])); + } +} + + + + +class TemplatesAbonneSelectionsSupprimerDeLaSelectionTest extends TemplatesAbonneSelectionsTestCase { + /** @test */ + public function recordId89ShouldHaveBeenRemovedFromSelection2() { + $record = $this->fixture('Class_Notice', + ['id' => 89, + 'titre_principal' => 'Neige', + 'type_doc' => 2, + 'clef_alpha' => 'NEIGE']); + + Class_PanierNotice::find(2)->addNotice($record)->save(); + + $this->dispatch('/opac/abonne/supprimer-de-la-selection/selection_id/2/id_profil/72/record_id/89/delete/1'); + $this->assertEquals('COMBAT ORDINAIRE;BLACKSAD', Class_PanierNotice::find(2)->getNotices()); + } +} + + + + +class TemplatesAbonneSelectionsSupprimerLaSelectionTest extends TemplatesAbonneSelectionsTestCase { + /** @test */ + public function questionToDeleteShouldBePresent() { + $this->dispatch('/opac/abonne/supprimer-la-selection/selection_id/2/id_profil/72'); + $this->assertXPathContentContains('//div//a', 'Oui'); + } + + + /** @test */ + public function selection2ShouldHaveBeenDeleted() { + $this->dispatch('/opac/abonne/supprimer-la-selection/selection_id/2/id_profil/72/delete/1'); + $this->assertNull(Class_PanierNotice::find(2)); + } +} + + + + +class TemplatesAbonneSelectionsRenommerLaSelectionTest extends TemplatesAbonneSelectionsTestCase { + /** @test */ + public function formToRenameSelectionShouldBePresent() { + $this->dispatch('/opac/abonne/renommer-la-selection/selection_id/2/id_profil/72'); + $this->assertXPath('//form'); + } + + + /** @test */ + public function renameSelectionToTopShouldRenameIt() { + $this->postDispatch('/opac/abonne/renommer-la-selection/selection_id/2/id_profil/72', + ['libelle' => 'Top']); + $this->assertEquals('Top', Class_PanierNotice::find(2)->getLibelle()); + } +} + + + + +class TemplatesAbonneSelectionsExporterLaSelectionTest extends TemplatesAbonneSelectionsTestCase { + /** @test */ + public function buttonUnimarcShoulbBePresent() { + $this->dispatch('/opac/abonne/exporter-la-selection/selection_id/2/id_profil/72'); + $this->assertXPathContentContains('//div', 'UNIMARC'); + } +} + + + + +class TemplatesAbonneSelectionsAsAdminTest extends Admin_AbstractControllerTestCase { + + protected $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + $this->_buildTemplateProfil(['id' => 72]); + $this->dispatch('/opac/abonne/selections'); + } + + + /** @test */ + public function shouldContainsCreerSelectionAnchor() { + $this->assertXPathContentContains('//a[contains(@href, "/abonne/creer-selection")]','Créer'); + } + + + /** @test */ + public function shouldContainsVoirLesSelectionsDansLesDomaines() { + $this->assertXPathContentContains('//a[contains(@href, "/abonne/selections-dans-les-domaines")]','Sélections dans les domaines'); + } + + + /** @test */ + public function shouldContainsVoirLesSelectionsDesProfessionnels() { + $this->assertXPathContentContains('//a[contains(@href, "/abonne/selections-des-professionnels")]','Sélections des professionnels'); + } +} + + + + +class TemplatesAbonneSelectionsDansLesDomainesAsAdminTest extends Admin_AbstractControllerTestCase { + + protected $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + $this->_buildTemplateProfil(['id' => 72]); + $this->dispatch('/opac/abonne/selections-dans-les-domaines'); + } + + + /** @test */ + public function shouldContainsVoirMesSelections() { + $this->assertXPathContentContains('//a[contains(@href, "/abonne/selections")]','Mes sélections'); + } + + + /** @test */ + public function shouldContainsVoirLesSelectionsDesProfessionnels() { + $this->assertXPathContentContains('//a[contains(@href, "/abonne/selections-des-professionnels")]','Sélections des professionnels'); + } +} + + + +class TemplatesAbonneSelectionsDansLesDomainesAsBorrowerLoggedTest extends AbstractControllerTestCase { + + protected $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + $this->_buildTemplateProfil(['id' => 72]); + $francois = $this->fixture('Class_Users', + ['id' => 1213, + 'login' => 'François', + 'password' => 'auienauiet' + ]); + ZendAfi_Auth::getInstance()->logUser($francois); + $this->dispatch('/opac/abonne/selections-dans-les-domaines'); + } + + + /** @test */ + public function shouldContainsNotifyMessageNotAllowedToAccessThisPage() { + $this->assertFlashMessengerContentContains('Vous n\'avez pas le droit d\'accéder à cette page.'); + } + + + /** @test */ + public function pageShouldRediret() { + $this->assertRedirect(); + } +} + + + + +abstract class TemplatesAbonneSelectionsOthersAsAdminTestCase + extends Admin_AbstractControllerTestCase { + + protected + $_storm_default_to_volatile = true, + $_mes_bd; + + + public function setUp() { + parent::setUp(); + $this->_buildTemplateProfil(['id' => 72]); + + $this->_mes_bd = $this->fixture(Class_PanierNotice::class, + ['id' => 2, + 'libelle' => 'Mes BD', + 'date_maj' => '10/02/2011', + 'notices' => 'COMBAT ORDINAIRE;BLACKSAD']); + + $this->onLoaderOfModel(Class_PanierNotice::class); + } + + + /** @test */ + public function shouldContainsLinkToMesSelections() { + $this->assertXPathContentContains('//a[contains(@href, "/abonne/selections")]', 'Mes sélections'); + } + + + /** @test */ + public function shouldContainsSelectionMesBd() { + $this->assertXPathContentContains('//a[contains(@href, "/recherche/simple/id_panier/2")]', + 'Mes BD'); + } + + + /** @test */ + public function shouldContainsLinkToExportMesBd() { + $this->assertXPath('//a[contains(@href, "/abonne/exporter-la-selection")]' + . '[contains(@href, "/selection_id/2")]'); + } +} + + + + +class TemplatesAbonneSelectionsProfessionnelsAsAdminTest + extends TemplatesAbonneSelectionsOthersAsAdminTestCase { + + public function setUp() { + parent::setUp(); + + Class_PanierNotice::whenCalled('findAllBelongsToAdmin')->answers([$this->_mes_bd]); + $this->dispatch('/opac/abonne/selections-des-professionnels'); + } + + + /** @test */ + public function shouldContainsVoirLesSelectionsDansLesDomaines() { + $this->assertXPathContentContains('//a[contains(@href, "/abonne/selections-dans-les-domaines")]', + 'Sélections dans les domaines'); + } + + + /** @test */ + public function shouldNotContainsLinkToAddToMesBd() { + $this->assertNotXPath('//a[contains(@href, "/abonne/ajouter-a-la-selection")]' + . '[contains(@href, "/selection_id/2")]'); + } + + + /** @test */ + public function shouldNotContainsLinkToManageMesBd() { + $this->assertNotXPath('//a[contains(@href, "/abonne/selection")]' + . '[contains(@href, "/selection_id/2")]'); + } + + + /** @test */ + public function shouldNotContainsLinkToRenameMesBd() { + $this->assertNotXPath('//a[contains(@href, "/abonne/renommer-la-selection")]' + . '[contains(@href, "/selection_id/2")]'); + } +} + + + + +class TemplatesAbonneSelectionsInDomainsAsAdminTest + extends TemplatesAbonneSelectionsOthersAsAdminTestCase { + public function setUp() { + parent::setUp(); + + Class_PanierNotice::whenCalled('findAllWithCatalogue') + ->answers([$this->_mes_bd]) + + ->whenCalled('findAllIdsWithCatalogue') + ->answers([2]); + + $this->dispatch('/opac/abonne/selections-dans-les-domaines'); + } + + + /** @test */ + public function shouldContainsVoirLesSelectionsDansLesDomaines() { + $this->assertXPathContentContains('//a[contains(@href, "/abonne/selections-des-professionnels")]', + 'Sélections des professionnels'); + } + + + /** @test */ + public function shouldContainsLinkToAddToMesBd() { + $this->assertXPath('//a[contains(@href, "/abonne/ajouter-a-la-selection")]' + . '[contains(@href, "/selection_id/2")]'); + } + + + /** @test */ + public function shouldContainsLinkToManageMesBd() { + $this->assertXPath('//a[contains(@href, "/abonne/selection")]' + . '[contains(@href, "/selection_id/2")]'); + } + + + /** @test */ + public function shouldContainsLinkToRenameMesBd() { + $this->assertXPath('//a[contains(@href, "/abonne/renommer-la-selection")]' + . '[contains(@href, "/selection_id/2")]'); + } +} diff --git a/tests/scenarios/Templates/TemplatesAbonneTest.php b/tests/scenarios/Templates/TemplatesAbonneTest.php index dd858f8c3c85653edd9452d94965ea0e9d703fc4..1b78cb48844c14bb17db6ee5e3a67faa8559198d 100644 --- a/tests/scenarios/Templates/TemplatesAbonneTest.php +++ b/tests/scenarios/Templates/TemplatesAbonneTest.php @@ -705,54 +705,9 @@ class TemplatesDispatchAbonneLargeNumberOfHoldsTest extends TemplatesIntonationA -class TemplatesDispatchAbonneSelectionsTest extends TemplatesIntonationAccountTestCase { - public function setUp() { - parent::setUp(); - $this->dispatch('/opac/abonne/selections/id_profil/72/id/' . Class_Users::getIdentity()->getId()); - } - - - /** @test */ - public function mesBdShouldBeDisplay() { - $this->assertXPathContentContains('//div', 'Mes BD'); - } - - - /** @test */ - public function mesBdShouldHaveBadge1DomainLinked() { - $this->assertXPathContentContains('//div//span[contains(@class, "badge")]', '1 domaine lié'); - } - - - /** - * @test - * @see #115804 - */ - public function mesBdLinkShouldNotContainsIdParam() { - $this->assertXPath('//a[contains(@href, "/recherche/simple")]' - . '[contains(@href, "/id_panier/2")]' - . '[not(contains(@href, "/id/"))]'); - } - - - /** @test */ - public function mesRechercheSuiviesShouldBeDisplay() { - $this->assertXPathContentContains('//div//h3', 'Mes recherches suivies'); - } - - - /** @test */ - public function linkToFollowASearchShouldBePresent() { - $this->assertXPathContentContains('//div[@class = "collection_action alone_in_the_list btn btn-sm btn-success col mr-3 col-3"]//a', 'Suivre'); - } -} - - - - class TemplatesDispatchAbonneReviewsTest extends TemplatesIntonationAccountTestCase { /** @test */ - public function selectionMesBDShouldBeDisplay() { + public function leRoiDesConsShouldBeDisplay() { $this->dispatch('/opac/abonne/mes-avis/id_profil/72'); $this->assertXPathContentContains('//div', 'Le Roi des cons sur son throne'); } @@ -793,7 +748,7 @@ class TemplatesDispatchAbonneConfigurationsTest extends TemplatesIntonationAccou class TemplatesDispatchAbonneDonnerDesAvisTest extends TemplatesIntonationAccountTestCase { /** @test */ - public function selectionMesBDShouldBeDisplay() { + public function donnerDesAvisShouldBeDisplay() { $this->dispatch('/opac/abonne/donner-des-avis/id_profil/72'); $this->assertXPathContentContains('//div', 'Donner des avis'); } @@ -803,7 +758,7 @@ class TemplatesDispatchAbonneDonnerDesAvisTest extends TemplatesIntonationAccoun class TemplatesDispatchAbonneSuivreUneRechercheTest extends TemplatesIntonationAccountTestCase { /** @test */ - public function selectionMesBDShouldBeDisplay() { + public function suivreUneRechercheShouldBeDisplay() { $this->onLoaderOfModel('Class_TypeDoc') ->whenCalled('findUsedTypeDocIds') ->answers([]); @@ -1025,52 +980,6 @@ class TemplatesAbonneAccountEditTest extends TemplatesIntonationAccountTestCase -class TemplatesIntonationDispatchAbonneSelectionTest extends TemplatesIntonationAccountTestCase { - /** @test */ - public function exporterSelection2LinkShouldBePresent() { - $this->dispatch('/opac/abonne/selection/selection_id/2/id_profil/72'); - $this->assertXPathContentContains('//a[contains(@href, "/abonne/exporter-la-selection/selection_id/2")]', 'Exporter'); - } -} - - - -class TemplatesIntonationDispatchAbonneAjouterASelectionTest extends TemplatesIntonationAccountTestCase { - - /** @test */ - public function titleShouldBeAjouterDesDocumentsALaSelection() { - $this->dispatch('/opac/abonne/ajouter-a-la-selection/selection_id/2/id_profil/72'); - $this->assertXPathContentContains('//h2', 'Ajouter des documents à la sélection'); - } - - - /** @test */ - public function onclickShouldContainsAddItemToSelection() { - $records = [$this->fixture('Class_Notice', - ['id' => 89]), - $this->fixture('Class_Notice', - ['id' => 99])]; - - $engine = $this->mock(); - Class_MoteurRecherche::setInstance($engine - ->whenCalled('visitLimit') - ->answers($engine) - - ->whenCalled('lancerRecherche') - ->answers($this->mock() - ->whenCalled('fetchRecords') - ->answers($records) - ->whenCalled('getRecordsCount') - ->answers(2))); - - $this->dispatch('/opac/abonne/ajouter-a-la-selection/selection_id/2/id_profil/72'); - $this->assertXPath('//a[contains(@onclick, "abonne/ajouter-le-document-a-la-selection/selection_id/2/id_profil/72/record_id/89")]'); - } -} - - - - class TemplatesIntonationDispatchAccountTest extends TemplatesIntonationAccountTestCase { public function setUp() { parent::setUp(); @@ -1188,135 +1097,6 @@ class TemplatesAbonneInformationsTest extends TemplatesIntonationAccountTestCase -class TemplatesIntonationDispatchAbonneAjouterLeDocumentALaSelectionTest extends TemplatesIntonationAccountTestCase { - public function setUp() { - parent::setUp(); - Intonation_Library_Selection::clearSelectionsCache(); - $this->fixture('Class_Notice', - ['id' => 89, - 'titre_principal' => 'Neige', - 'type_doc' => 2, - 'clef_alpha' => 'NEIGE']); - } - - - /** @test */ - public function withSelectioIdTwoRecordId89ShouldHaveBeenHadedToSelection2() { - $this->dispatch('/opac/abonne/ajouter-le-document-a-la-selection/selection_id/2/id_profil/72/record_id/89'); - $this->assertEquals('COMBAT ORDINAIRE;BLACKSAD;NEIGE', Class_PanierNotice::find(2)->getNotices()); - } - - - /** @test */ - public function withSelectioIdTwoRecordId89ResponseShouldBeAnchorWithHrefSupprimerDeLaSelection() { - $this->dispatch('/opac/abonne/ajouter-le-document-a-la-selection/selection_label/Déjà lu/id_profil/72/record_id/89'); - $this->assertContains('/abonne/supprimer-de-la-selection', - json_decode($this->_response->getBody(), true)['anchor']); - } - - - /** @test */ - public function withSelectionLabelDejaVuNeigeShouldHaveBeenHadedToReaded() { - $this->dispatch('/opac/abonne/ajouter-le-document-a-la-selection/selection_label/Déjà lu/id_profil/72/record_id/89'); - $this->assertEquals('NEIGE', Class_PanierNotice::findFirstBy(['libelle' => 'Déjà lu'])->getNotices()); - } - - - /** @test */ - public function onPopupRequestShouldRedirectToReferer() { - $this->dispatch('/opac/abonne/ajouter-le-document-a-la-selection/selection_label/Déjà lu/id_profil/72/record_id/89/render/popup'); - $this->assertXPathContentContains('//script', 'location.reload();'); - } -} - - - - -class TemplatesIntonationDispatchCreerSelectionTest extends TemplatesIntonationAccountTestCase { - /** @test */ - public function dispatchCreerSelectionShouldRenderForm() { - $this->dispatch('/opac/abonne/creer-selection/id_profil/72'); - $this->assertXPath('//main//div//form'); - } - - - /** @test */ - public function postDispatchCreerSelectionShouldCreateMaLectureDuDimanche() { - $this->postDispatch('/opac/abonne/creer-selection/id_profil/72', - ['libelle' => 'Lecture du dimanche']); - $this->assertNotNull(Class_PanierNotice::findFirstBy(['libelle' => 'Lecture du dimanche'])); - } -} - - - -class TemplatesIntonationDispatchAbonneSupprimerDeLaSelectionTest extends TemplatesIntonationAccountTestCase { - /** @test */ - public function recordId89ShouldHaveBeenHadedToSelection2() { - $record = $this->fixture('Class_Notice', - ['id' => 89, - 'titre_principal' => 'Neige', - 'type_doc' => 2, - 'clef_alpha' => 'NEIGE']); - - Class_PanierNotice::find(2)->addNotice($record)->save(); - - $this->dispatch('/opac/abonne/supprimer-de-la-selection/selection_id/2/id_profil/72/record_id/89/delete/1'); - $this->assertEquals('COMBAT ORDINAIRE;BLACKSAD', Class_PanierNotice::find(2)->getNotices()); - } -} - - - -class TemplatesIntonationDispatchAbonneSupprimerLaSelectionTest extends TemplatesIntonationAccountTestCase { - - /** @test */ - public function questionToDeleteShouldBePresent() { - $this->dispatch('/opac/abonne/supprimer-la-selection/selection_id/2/id_profil/72'); - $this->assertXPathContentContains('//div//a', 'Oui'); - } - - - /** @test */ - public function selection2ShouldHaveBeenDeleted() { - $this->dispatch('/opac/abonne/supprimer-la-selection/selection_id/2/id_profil/72/delete/1'); - $this->assertNull(Class_PanierNotice::find(2)); - } -} - - - -class TemplatesIntonationDispatchAbonneRenommerLaSelectionTest extends TemplatesIntonationAccountTestCase { - - /** @test */ - public function formToRenameSelectionShouldBePresent() { - $this->dispatch('/opac/abonne/renommer-la-selection/selection_id/2/id_profil/72'); - $this->assertXPath('//form'); - } - - - /** @test */ - public function renameSelectionToTopShouldRenameIt() { - $this->postDispatch('/opac/abonne/renommer-la-selection/selection_id/2/id_profil/72', - ['libelle' => 'Top']); - $this->assertEquals('Top', Class_PanierNotice::find(2)->getLibelle()); - } -} - - - - -class TemplatesIntonationDispatchAbonneExporterLaSelectionTest extends TemplatesIntonationAccountTestCase { - /** @test */ - public function buttonUnimarcShoulbBePresent() { - $this->dispatch('/opac/abonne/exporter-la-selection/selection_id/2/id_profil/72'); - $this->assertXPathContentContains('//div', 'UNIMARC'); - } -} - - - - class TemplatesIntonationDispatchAbonneReserverTest extends TemplatesIntonationAccountTestCase { /** @test */ public function itemsShoulbBePresent() { @@ -1482,161 +1262,6 @@ class TemplatesAbonneWithPNBHoldsTest extends AbstractControllerTestCase { -class TemplatesAbonneSelectionsTest extends TemplatesIntonationAccountTestCase { - - - public function setUp() { - parent::setUp(); - $this->dispatch('/opac/abonne/selections/id_profil/72'); - } - - - /** @test */ - public function dispatchSelectionsShouldContainsCreerSelectionAnchor() { - $this->assertXPathContentContains('//a[contains(@href, "/abonne/creer-selection")]','Créer'); - } - - - - /** @test */ - public function shouldNotContainsVoirLesPaniersRangesDansLesDomaines() { - $this->assertNotXPathContentContains('//a[contains(@href, "/abonne/selections-dans-les-domaines")]','Voir les sélections dans les domaines'); - } - - - /** @test */ - public function shouldNotContainsVoirLesPaniersDesProfessionnels() { - $this->assertNotXPathContentContains('//a[contains(@href, "/abonne/selections-des-professionnels")]','Voir les sélections des professionnels'); - } -} - - - - -class TemplatesAbonneSelectionsAsAdminTest extends Admin_AbstractControllerTestCase { - - protected $_storm_default_to_volatile = true; - - - public function setUp() { - parent::setUp(); - $this->_buildTemplateProfil(['id' => 72]); - $this->dispatch('/opac/abonne/selections'); - } - - - /** @test */ - public function shouldContainsCreerSelectionAnchor() { - $this->assertXPathContentContains('//a[contains(@href, "/abonne/creer-selection")]','Créer'); - } - - - /** @test */ - public function shouldContainsVoirLesSelectionsDansLesDomaines() { - $this->assertXPathContentContains('//a[contains(@href, "/abonne/selections-dans-les-domaines")]','Sélections dans les domaines'); - } - - - /** @test */ - public function shouldContainsVoirLesSelectionsDesProfessionnels() { - $this->assertXPathContentContains('//a[contains(@href, "/abonne/selections-des-professionnels")]','Sélections des professionnels'); - } -} - - - - -class TemplatesAbonneSelectionsDansLesDomainesAsAdminTest extends Admin_AbstractControllerTestCase { - - protected $_storm_default_to_volatile = true; - - - public function setUp() { - parent::setUp(); - $this->_buildTemplateProfil(['id' => 72]); - $this->dispatch('/opac/abonne/selections-dans-les-domaines'); - } - - - /** @test */ - public function shouldContainsVoirMesSelections() { - $this->assertXPathContentContains('//a[contains(@href, "/abonne/selections")]','Mes sélections'); - } - - - /** @test */ - public function shouldContainsVoirLesSelectionsDesProfessionnels() { - $this->assertXPathContentContains('//a[contains(@href, "/abonne/selections-des-professionnels")]','Sélections des professionnels'); - } -} - - - -class TemplatesAbonneSelectionsDansLesDomainesAsBorrowerLoggedTest extends AbstractControllerTestCase { - - protected $_storm_default_to_volatile = true; - - - public function setUp() { - parent::setUp(); - $this->_buildTemplateProfil(['id' => 72]); - $francois = $this->fixture('Class_Users', - ['id' => 1213, - 'login' => 'François', - 'password' => 'auienauiet' - ]); - ZendAfi_Auth::getInstance()->logUser($francois); - $this->dispatch('/opac/abonne/selections-dans-les-domaines'); - } - - - /** @test */ - public function shouldContainsNotifyMessageNotAllowedToAccessThisPage() { - $this->assertFlashMessengerContentContains('Vous n\'avez pas le droit d\'accéder à cette page.'); - } - - - /** @test */ - public function pageShouldRediret() { - $this->assertRedirect(); - } -} - - - - -class TemplatesAbonneSelectionsProfessionnelsAsAdminTest extends Admin_AbstractControllerTestCase { - - protected $_storm_default_to_volatile = true; - - - public function setUp() { - parent::setUp(); - $this->_buildTemplateProfil(['id' => 72]); - - $this->onLoaderOfModel('Class_PanierNotice') - ->whenCalled('findAllBelongsToAdmin') - ->answers([]); - - $this->dispatch('/opac/abonne/selections-des-professionnels'); - } - - - /** @test */ - public function shouldContainsVoirMesSelections() { - $this->assertXPathContentContains('//a[contains(@href, "/abonne/selections")]','Mes sélections'); - } - - - /** @test */ - public function shouldContainsVoirLesSelectionsDansLesDomaines() { - $this->assertXPathContentContains('//a[contains(@href, "/abonne/selections-dans-les-domaines")]','Sélections dans les domaines'); - } -} - - - - class TemplatesAbonneSearchHistoryTest extends AbstractControllerTestCase { protected $_storm_default_to_volatile = true; diff --git a/tests/scenarios/Templates/TemplatesWidgetTest.php b/tests/scenarios/Templates/TemplatesWidgetTest.php index e3b4ff4e3fc6e8e74f8df5398edeaff37b2197da..563ce0f320ca1063a6fc6d4758ad006dc40cd807 100644 --- a/tests/scenarios/Templates/TemplatesWidgetTest.php +++ b/tests/scenarios/Templates/TemplatesWidgetTest.php @@ -53,7 +53,8 @@ class TemplatesWidgetsNewsletterTest extends TemplatesIntonationTestCase { 'contenu' => 'les nouveautés jeunesse']); $this->dispatch('/opac/abonne/fiche', true); - $this->assertXPathContentContains('//a[@href="/abonne/disable-newsletter"]', 'Ne plus recevoir de lettre d\'information'); + $this->assertXPathContentContains('//a[@href="/abonne/disable-newsletter"]', + 'Ne plus recevoir de lettre d\'information'); } }