Skip to content
Snippets Groups Projects
Commit 22b654b1 authored by efalcy's avatar efalcy Committed by Patrick Barroca
Browse files

hotline #24590 : fix navigation on kiosque : don't display navigation if not...

hotline #24590 : fix navigation on kiosque : don't display navigation if not needed and max number of notices displayed
parent 852a08cc
Branches
Tags 6.29
4 merge requests!915Master,!914Hotline master,!913Stable,!905Hotline #24590 fleches mode liste kiosque
......@@ -258,25 +258,47 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba
}
protected function hasPages() {
if ($this->_nombre_notices_par_page >= $this->preferences['nb_analyse'] && $this->preferences['nb_analyse']>0)
return false;
return true;
}
protected function totalNotices($req) {
$nb_notices=0;
if (isset($this->preferences['nb_analyse']))
$nb_notices=$this->preferences['nb_analyse'];
if ($nb_notices==0)
return Class_Notice::countBySQLSelect($req);
$total_count=Class_Notice::countBySQLSelect($req);
if ($nb_notices >=$total_count)
return $total_count;
return $nb_notices;
}
public function getKiosqueHtml($page = 1) {
$this->_nombre_notices_par_page = $this->preferences['nb_notices'];
// $this->preferences['nb_notices'] = 0;
$nombre_total_notices=0;
$this->preferences['nb_notices'] = 0;
// $this->preferences['nb_analyse'] = 0;
$requetes = Class_Catalogue::getLoader()->getRequetes($this->preferences, ['id_notice']);
xdebug_break();
$nombre_total_notices = 0;
$notices = [];
if (isset($requetes['req_comptage'])) {
$nombre_total_notices = Class_Notice::countBySQLSelect($requetes['req_comptage']);
$nombre_total_notices=$this->totalNotices($requetes['req_comptage']);
xdebug_break();
$notices = Class_Notice::findAllByRequeteRecherche($requetes['req_ids'],
$this->_nombre_notices_par_page,
$page);
}
$html = $this->renderNoticesKiosqueHtml($notices);
if (!$this->isModeChrono())
xdebug_break();
if (!$this->isModeChrono() && $this->hasPages())
$html = $this->getPagerHtml($page,
$this->_nombre_notices_par_page,
$nombre_total_notices)
......@@ -298,8 +320,12 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba
public function getPagerHtml($page, $nombre_notices_par_page, $nombre_total_notices) {
$next_page = ($page * $nombre_notices_par_page < $nombre_total_notices) ? $page + 1 : 1;
$previous_page = ($page > 1) ? $page - 1 : (int)(($nombre_total_notices + $nombre_notices_par_page)/ max($nombre_notices_par_page, 1));
$last_page=($nombre_total_notices % max($nombre_notices_par_page, 1))>0
? (int)(($nombre_total_notices) / max($nombre_notices_par_page, 1))+1
:(int)(($nombre_total_notices) / max($nombre_notices_par_page, 1)) ;
$previous_page = ($page > 1) ? $page - 1 : $last_page;
$onclick = 'var contenu = $(this).parents(\'.contenu\');'
.'contenu.animate({opacity:0});'
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment