Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
bibliossimo
opacce
Commits
4a6ddb54
Commit
4a6ddb54
authored
Dec 12, 2017
by
Laurent
Browse files
dev #13615 fix search result back links + refactoring
parent
29dfc640
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
66 additions
and
55 deletions
+66
-55
library/Class/CriteresRecherche.php
library/Class/CriteresRecherche.php
+34
-35
library/ZendAfi/View/Helper/Abonne/LoansHistory.php
library/ZendAfi/View/Helper/Abonne/LoansHistory.php
+15
-9
library/ZendAfi/View/Helper/AuthorAnchor.php
library/ZendAfi/View/Helper/AuthorAnchor.php
+1
-1
library/ZendAfi/View/Helper/UrlNotice.php
library/ZendAfi/View/Helper/UrlNotice.php
+2
-0
tests/application/modules/opac/controllers/AbonneControllerLoansHistoryNanookTest.php
...ac/controllers/AbonneControllerLoansHistoryNanookTest.php
+2
-2
tests/library/Class/CriteresRechercheTest.php
tests/library/Class/CriteresRechercheTest.php
+8
-4
tests/library/ZendAfi/View/Helper/AuthorAnchorTest.php
tests/library/ZendAfi/View/Helper/AuthorAnchorTest.php
+4
-4
No files found.
library/Class/CriteresRecherche.php
View file @
4a6ddb54
...
...
@@ -669,36 +669,52 @@ class Class_CriteresRecherche {
public
function
getUrlRetourRechercheInitiale
(){
if
(
$url
=
$this
->
_getNotSearchPagesBackUrl
())
return
array_filter
(
$url
);
if
(
array_key_exists
(
'rubrique'
,
$this
->
_params
))
return
[
'controller'
=>
'recherche'
,
'action'
=>
'guidee'
];
$action
=
'avancee'
;
if
(
array_key_exists
(
'expressionRecherche'
,
$this
->
_params
)
||
array_key_exists
(
'id_panier'
,
$this
->
_params
)
||
array_key_exists
(
'id_catalogue'
,
$this
->
_params
))
$action
=
'saisie'
;
if
(
array_key_exists
(
'retour_panier'
,
$this
->
_params
))
$url
=
array_merge
(
array_intersect_key
(
$this
->
_params
,
self
::
$criteres
),
[
'controller'
=>
'recherche'
,
'action'
=>
$action
]);
return
array_filter
(
$url
);
}
protected
function
_getNotSearchPagesBackUrl
()
{
if
(
array_key_exists
(
'retour_panier'
,
$this
->
_params
))
return
[
'controller'
=>
'panier'
,
'action'
=>
'index'
,
'id_panier'
=>
$this
->
_params
[
'retour_panier'
]];
'id_panier'
=>
$this
->
_params
[
'retour_panier'
]]
;
if
(
array_key_exists
(
'retour_abonne'
,
$this
->
_params
))
{
$url
=
[
'controller'
=>
'abonne'
,
'action'
=>
$this
->
_params
[
'retour_abonne'
],
'page'
=>
isset
(
$this
->
_params
[
'page'
])
?
$this
->
_params
[
'page'
]
:
null
]
;
return
array_filter
(
$url
);
};
if
(
array_key_exists
(
'retour_abonne'
,
$this
->
_params
))
return
[
'controller'
=>
'abonne'
,
'action'
=>
$this
->
_params
[
'retour_abonne'
],
'page'
=>
$this
->
getParam
(
'page'
)
,
'page_size'
=>
$this
->
getParam
(
'page_size'
)];
if
(
array_key_exists
(
'rubrique'
,
$this
->
_params
))
return
[
'controller'
=>
'recherche'
,
'action'
=>
'guidee'
];
$url
=
array_merge
(
array_intersect_key
(
$this
->
_params
,
self
::
$criteres
),
[
'controller'
=>
'recherche'
,
'action'
=>
$action
]);
if
(
array_key_exists
(
'retour_avis'
,
$this
->
_params
))
return
[
'controller'
=>
'blog'
,
'action'
=>
'viewcritiques'
,
'id_module'
=>
$this
->
_params
[
'retour_avis'
],
'retour_avis'
=>
$this
->
_params
[
'retour_avis'
]]
;
return
array_filter
(
$url
)
;
return
null
;
}
public
function
getUrlCriteresWithFacettes
()
{
$intersect
=
$this
->
_params
;
if
(
$this
->
getFacettesUrlEncoded
()
!=
''
)
...
...
@@ -792,26 +808,9 @@ class Class_CriteresRecherche {
public
function
getUrlRetourListe
()
{
if
(
!
array_key_exists
(
'code_rebond'
,
$this
->
_params
))
{
if
(
array_key_exists
(
'retour_panier'
,
$this
->
_params
))
return
[
'controller'
=>
'panier'
,
'action'
=>
'index'
,
'id_panier'
=>
$this
->
_params
[
'retour_panier'
]]
;
if
(
array_key_exists
(
'retour_abonne'
,
$this
->
_params
))
{
$url
=
[
'controller'
=>
'abonne'
,
'action'
=>
$this
->
_params
[
'retour_abonne'
],
'page'
=>
isset
(
$this
->
_params
[
'page'
])
?
$this
->
_params
[
'page'
]
:
null
]
;
return
array_filter
(
$url
);
};
if
(
array_key_exists
(
'retour_avis'
,
$this
->
_params
))
return
[
'controller'
=>
'blog'
,
'action'
=>
'viewcritiques'
,
'id_module'
=>
$this
->
_params
[
'retour_avis'
],
'retour_avis'
=>
$this
->
_params
[
'retour_avis'
]]
;
}
if
(
!
array_key_exists
(
'code_rebond'
,
$this
->
_params
)
&&
(
$url
=
$this
->
_getNotSearchPagesBackUrl
()))
return
array_filter
(
$url
);
return
$this
->
getUrlCriteresWithFacettes
();
}
...
...
library/ZendAfi/View/Helper/Abonne/LoansHistory.php
View file @
4a6ddb54
...
...
@@ -21,17 +21,20 @@
class
ZendAfi_View_Helper_Abonne_LoansHistory
extends
ZendAfi_View_Helper_Abonne_Loans
{
protected
$_paginator
;
public
function
abonne_LoansHistory
(
$loans
,
$page_number
,
$page_size
)
{
$paginator
=
(
new
Zend_Paginator
(
new
Zend_Paginator_Adapter_Array
(
array_reverse
(
$loans
->
getArrayCopy
()))))
$loans
=
array_reverse
(
$loans
->
getArrayCopy
());
$this
->
_paginator
=
(
new
Zend_Paginator
(
new
Zend_Paginator_Adapter_Array
(
$loans
)))
->
setItemCountPerPage
(
$page_size
)
->
setCurrentPageNumber
(
$page_number
);
$this
->
_operations
=
$paginator
->
getCurrentItems
();
$this
->
_operations
=
$
this
->
_
paginator
->
getCurrentItems
();
Class_ScriptLoader
::
getInstance
()
->
loadTableSorter
();
return
$this
->
renderPaginator
(
$paginator
)
.
$this
->
renderPaginator
()
.
$this
->
_tag
(
'table'
,
$this
->
renderHeader
()
.
$this
->
renderLoans
(),
...
...
@@ -39,12 +42,12 @@ class ZendAfi_View_Helper_Abonne_LoansHistory extends ZendAfi_View_Helper_Abonne
}
protected
function
renderPaginator
(
$paginator
)
{
protected
function
renderPaginator
()
{
$reload_link
=
[
'module'
=>
'opac'
,
'controller'
=>
'abonne'
,
'action'
=>
'loans-history'
,
'page_size'
=>
$paginator
->
getItemCountPerPage
()];
return
$this
->
view
->
paginationControl
(
$paginator
,
'page_size'
=>
$
this
->
_
paginator
->
getItemCountPerPage
()];
return
$this
->
view
->
paginationControl
(
$
this
->
_
paginator
,
null
,
null
,
[
'url_link'
=>
$reload_link
,
...
...
@@ -68,6 +71,9 @@ class ZendAfi_View_Helper_Abonne_LoansHistory extends ZendAfi_View_Helper_Abonne
protected
function
renderLoan
(
$loan
)
{
$url
=
[
'retour_abonne'
=>
'loans-history'
,
'page'
=>
$this
->
_paginator
->
getCurrentPageNumber
(),
'page_size'
=>
$this
->
_paginator
->
getItemCountPerPage
()];
return
$this
->
_tag
(
'tr'
,
$this
->
_tag
(
'td'
,
...
...
@@ -75,11 +81,11 @@ class ZendAfi_View_Helper_Abonne_LoansHistory extends ZendAfi_View_Helper_Abonne
.
$this
->
_tag
(
'td'
,
$this
->
_renderDocTypeLabel
(
$loan
))
.
$this
->
_tag
(
'td'
,
$this
->
_renderThumbnail
(
$loan
,
[
'retour_abonne'
=>
'loans-history'
]
))
$this
->
_renderThumbnail
(
$loan
,
$url
))
.
$this
->
_tag
(
'td'
,
$this
->
_renderTitle
(
$loan
,
[
'retour_abonne'
=>
'loans-history'
]
))
$this
->
_renderTitle
(
$loan
,
$url
))
.
$this
->
_tag
(
'td'
,
$this
->
_renderAuthor
(
$loan
,
[
'retour_abonne'
=>
'loans-history'
]
))
$this
->
_renderAuthor
(
$loan
,
$url
))
.
$this
->
_tag
(
'td'
,
$loan
->
getIssueDate
())
.
$this
->
_tag
(
'td'
,
...
...
library/ZendAfi/View/Helper/AuthorAnchor.php
View file @
4a6ddb54
...
...
@@ -31,7 +31,7 @@ class ZendAfi_View_Helper_AuthorAnchor extends ZendAfi_View_Helper_BaseHelper {
$params
=
array_merge
([
'controller'
=>
'recherche'
,
'action'
=>
'simple'
,
'
facette
'
=>
Class_CodifAuteur
::
CODE_FACETTE
.
$facet
->
getId
()],
'
code_rebond
'
=>
Class_CodifAuteur
::
CODE_FACETTE
.
$facet
->
getId
()],
$params
);
return
$this
->
view
->
tagAnchor
(
$this
->
view
->
url
(
$params
,
null
,
true
),
...
...
library/ZendAfi/View/Helper/UrlNotice.php
View file @
4a6ddb54
...
...
@@ -41,6 +41,8 @@ class ZendAfi_View_Helper_UrlNotice extends Zend_View_Helper_HtmlElement {
'id_catalogue'
=>
0
,
'module'
=>
'opac'
,
'tri'
=>
''
,
'page'
=>
null
,
'page_size'
=>
null
,
'id_profil'
=>
null
,
'id_module'
=>
null
]));
...
...
tests/application/modules/opac/controllers/AbonneControllerLoansHistoryNanookTest.php
View file @
4a6ddb54
...
...
@@ -104,14 +104,14 @@ class AbonneControllerLoansHistoryNanookIndexTest extends AbonneControllerLoansH
/** @test */
public
function
pageShouldContainLoanLaFemmeADroiteLink
()
{
$this
->
assertXPathContentContains
(
'//table//a[contains(@href, "/recherche/viewnotice/page_size/2/id/464732/retour_abonne/loans-history")]'
,
$this
->
assertXPathContentContains
(
'//table//a[contains(@href, "/recherche/viewnotice/page_size/2/id/464732/retour_abonne/loans-history
/page/1
")]'
,
'La femme à droite sur la photo'
);
}
/** @test */
public
function
valentinMussoShouldLinkToFacetA11
()
{
$this
->
assertXPathContentContains
(
'//table//a[contains(@href, "/recherche/simple/
facette
/A11/retour_abonne/loans-history")]'
,
$this
->
assertXPathContentContains
(
'//table//a[contains(@href, "/recherche/simple/
code_rebond
/A11/retour_abonne/loans-history
/page/1/page_size/2
")]'
,
'Valentin Musso'
);
}
...
...
tests/library/Class/CriteresRechercheTest.php
View file @
4a6ddb54
...
...
@@ -112,11 +112,13 @@ class CriteresRechercheRetourTest extends ModelTestCase {
[[
'retour_abonne'
=>
'loans-history'
,
'page'
=>
2
],
'page'
=>
2
,
'page_size'
=>
10
],
[
'controller'
=>
'abonne'
,
'action'
=>
'loans-history'
,
'page'
=>
'2'
]],
'page'
=>
'2'
,
'page_size'
=>
10
]],
[[
'id_panier'
=>
'23'
,
'code_rebond'
=>
'G123'
],
...
...
@@ -195,11 +197,13 @@ class CriteresRechercheRetourRechercheInitialeTest extends ModelTestCase {
]],
[[
'retour_abonne'
=>
'loans-history'
,
'page'
=>
2
],
'page'
=>
2
,
'page_size'
=>
20
],
[
'controller'
=>
'abonne'
,
'action'
=>
'loans-history'
,
'page'
=>
'2'
]],
'page'
=>
2
,
'page_size'
=>
'20'
]],
];
}
...
...
tests/library/ZendAfi/View/Helper/AuthorAnchorTest.php
View file @
4a6ddb54
...
...
@@ -56,14 +56,14 @@ class ZendAfi_View_Helper_AnchorAuthorSimpleTest extends ViewHelperTestCase {
/** @test */
public
function
shouldReturnAnchorWith
Facet
A10
()
{
$this
->
assertContains
(
'/recherche/simple/
facette
/A10">Stéphanie BRISSON</a>'
,
$this
->
_helper
->
authorAnchor
(
'Stéphanie BRISSON'
));
public
function
shouldReturnAnchorWith
CodeRebond
A10
()
{
$this
->
assertContains
(
'/recherche/simple/
code_rebond
/A10">Stéphanie BRISSON</a>'
,
$this
->
_helper
->
authorAnchor
(
'Stéphanie BRISSON'
));
}
/** @test */
public
function
shouldReturnAnchorWith
Facet
A11
()
{
$this
->
assertContains
(
'/recherche/simple/
facette
/A11">Marie Kondō</a>'
,
$this
->
_helper
->
authorAnchor
(
'Marie Kondō'
));
public
function
shouldReturnAnchorWith
CodeRebond
A11
()
{
$this
->
assertContains
(
'/recherche/simple/
code_rebond
/A11">Marie Kondō</a>'
,
$this
->
_helper
->
authorAnchor
(
'Marie Kondō'
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment