Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
opacce
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
afi
opacce
Commits
ef83712a
Commit
ef83712a
authored
Nov 17, 2015
by
lbrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev#23223_sito_widget_pagination : add reload picto for random paged config
parent
5daf38c2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
24 deletions
+81
-24
VERSIONS_DEV.md
VERSIONS_DEV.md
+18
-0
Sito.php
library/ZendAfi/View/Helper/Accueil/Sito.php
+33
-24
reload.png
public/admin/images/picto/reload.png
+0
-0
global.css
public/opac/css/global.css
+6
-0
SitoTest.php
tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php
+24
-0
No files found.
VERSIONS_DEV.md
View file @
ef83712a
...
...
@@ -102,3 +102,21 @@ See _Class\_Users>>registerNotificationsOn_ for notifications usage.
## ILS Web services
Add
_Class\_WebService\_SIGB\_Reservation
>>
isWaitingToBePulled_
that
returns
_true_
when
holded
document
is
available
in
library
.
Works
for
:
Nanook
,
Koha
,
Microbib
,
Aloes
,
Carthame
,
Orphée
,
Pergame
.
# Reload module content with AJAX
On
module
ajax
link
,
add
tag
attributes
:
'data-reload-module = true'
.
For
example
:
```
php
$this->view->tagAnchor($reload_link,
'',
[
'data-ajax-reload' => 'true',
'class' => 'reload-module',
'title' => $this->view->_('Recharger')]);
```
See public/opac/js/reload_module.js
\ No newline at end of file
library/ZendAfi/View/Helper/Accueil/Sito.php
View file @
ef83712a
...
...
@@ -23,7 +23,7 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base
const
ORDER_RANDOM
=
'Random'
;
const
ORDER_SELECTION
=
'Selection'
;
const
DISPLAY_
SELECTION
=
1
;
const
DISPLAY_
PAGED
=
1
;
const
DISPLAY_GROUPED
=
2
;
const
DISPLAY_HIERARCHY
=
3
;
...
...
@@ -38,10 +38,10 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base
if
(
$this
->
strategy
)
return
$this
->
strategy
;
$strategy
=
new
Select
edStrategy
();
$strategy
=
new
Pag
edStrategy
();
if
(
$this
->
isHierarchicalDisplay
())
$strategy
=
new
Hier
r
achicalStrategy
();
$strategy
=
new
HierachicalStrategy
();
if
(
$this
->
isTypeAffichageGrouped
())
$strategy
=
new
GroupedStrategy
();
...
...
@@ -68,8 +68,8 @@ class ZendAfi_View_Helper_Accueil_Sito extends ZendAfi_View_Helper_Accueil_Base
}
public
function
isTypeAffichage
Selection
()
{
return
$this
->
_isDisplayType
(
static
::
DISPLAY_
SELECTION
);
public
function
isTypeAffichage
Paged
()
{
return
$this
->
_isDisplayType
(
static
::
DISPLAY_
PAGED
);
}
...
...
@@ -218,17 +218,18 @@ class SitoDisplayStrategy {
class
Select
edStrategy
extends
SitoDisplayStrategy
{
class
Pag
edStrategy
extends
SitoDisplayStrategy
{
public
function
getContent
()
{
$nb_aff
=
$this
->
getPreference
(
'nb_aff'
)
?
$this
->
getPreference
(
'nb_aff'
)
:
$this
->
_getDefaultNbAff
();
$sites
=
$this
->
_loadSites
();
if
(
static
::
ORDER_RANDOM
==
$this
->
getPreference
(
'display_order'
))
{
if
(
static
::
ORDER_RANDOM
==
$this
->
getPreference
(
'display_order'
))
shuffle
(
$sites
);
return
$this
->
renderSitesSlice
(
$sites
,
$nb_aff
);
}
return
$this
->
renderSitesWithPagination
(
$sites
,
$nb_aff
);
return
$this
->
renderSitesSlice
(
$sites
,
$nb_aff
)
.
$this
->
getPaginator
(
$sites
,
$nb_aff
,
$this
->
page
);
}
protected
function
_getDefaultNbAff
()
{
...
...
@@ -237,25 +238,33 @@ class SelectedStrategy extends SitoDisplayStrategy {
}
protected
function
renderSitesWithPagination
(
$sites
,
$nb_sites_by_pages
)
{
if
(
count
(
$sites
)
<=
$nb_sites_by_pages
)
return
$this
->
renderSitesSlice
(
$sites
,
$nb_sites_by_pages
)
;
protected
function
getPaginator
(
$items
,
$items_by_page
,
$page
=
1
)
{
if
(
count
(
$items
)
<=
$items_by_page
)
return
''
;
return
$this
->
renderSitesSlice
(
$sites
,
$nb_sites_by_pages
)
.
$this
->
getPaginator
(
$sites
,
$nb_sites_by_pages
,
$this
->
page
);
}
$reload_link
=
[
'module'
=>
'opac'
,
'controller'
=>
'sito'
,
'action'
=>
'widget-page'
,
'id_module'
=>
$this
->
id_module
,
'id_division'
=>
$this
->
division
];
if
(
static
::
ORDER_RANDOM
==
$this
->
getPreference
(
'display_order'
))
return
$this
->
view
->
tagAnchor
(
$reload_link
,
''
,
[
'data-ajax-reload'
=>
'true'
,
'class'
=>
'reload-module'
,
'title'
=>
$this
->
view
->
_
(
'Recharger'
)]);
protected
function
getPaginator
(
$items
,
$items_by_page
,
$page
=
1
)
{
$paginator
=
(
new
Zend_Paginator
(
new
Zend_Paginator_Adapter_Null
(
count
(
$items
))))
->
setItemCountPerPage
(
max
(
$items_by_page
,
1
))
->
setCurrentPageNumber
(
$page
);
return
$this
->
view
->
paginationControl
(
$paginator
,
null
,
null
,
[
'url_link'
=>
[
'module'
=>
'opac'
,
'controller'
=>
'sito'
,
'action'
=>
'widget-page'
,
'id_module'
=>
$this
->
id_module
,
'id_division'
=>
$this
->
division
]
,
'link_attribs'
=>
[
'data-ajax-reload'
=>
'true'
]
]);
return
$this
->
view
->
paginationControl
(
$paginator
,
null
,
null
,
[
'url_link'
=>
$reload_link
,
'link_attribs'
=>
[
'data-ajax-reload'
=>
'true'
]
]);
}
}
...
...
@@ -314,7 +323,7 @@ class GroupedStrategy extends SitoDisplayStrategy {
class
Hier
r
achicalStrategy
extends
SitoDisplayStrategy
{
class
HierachicalStrategy
extends
SitoDisplayStrategy
{
public
function
getContent
()
{
return
$this
->
view
->
sitoTree
(
$this
->
getPreference
(
'id_categorie'
));
}
...
...
public/admin/images/picto/reload.png
0 → 100644
View file @
ef83712a
1.04 KB
public/opac/css/global.css
View file @
ef83712a
...
...
@@ -727,6 +727,12 @@ select{color:#666666;font-family:Arial;font-size:1em;}
padding-top
:
10px
;
}
.boite.sito
a
.reload-module
{
background
:
url('../../admin/images/picto/reload.png')
no-repeat
;
display
:
block
;
width
:
16px
;
height
:
16px
;
}
ul
.sitotheque
,
ul
.sitotheque
ul
{
...
...
tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php
View file @
ef83712a
...
...
@@ -205,6 +205,30 @@ class SitoViewHelperSelectItemsByRandomOrderTest extends SitoViewHelperTestCase
$this
->
assertEquals
(
2
,
count
(
array_unique
(
$htmls
)));
}
/** @test */
public
function
pageShouldNotContainsLinkToReloadModule
()
{
$this
->
assertNotXPath
(
$this
->
html
,
'//a[contains(@href, "sito/widget-page/id_module/2/id_division/1")]'
);
}
}
class
SitoViewHelperSelectItemsByRandomOrderWithOneSiteTest
extends
SitoViewHelperTestCase
{
protected
$_preferences
=
[
'titre'
=>
'Ma sito'
,
'type_aff'
=>
1
,
'id_items'
=>
'12-15'
,
'id_categorie'
=>
''
,
'nb_aff'
=>
1
,
'display_order'
=>
'Random'
];
/** @test */
public
function
pageShouldContainsLinkToReloadModule
()
{
$this
->
assertXPath
(
$this
->
html
,
'//a[@class="reload-module"][contains(@href, "sito/widget-page/id_module/2/id_division/1")]'
);
}
}
...
...
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