Line 2... |
Line 2... |
2 |
|
2 |
|
3 |
class Fragmenteur {
|
3 |
class Fragmenteur {
|
4 |
const PAGER_MODE = 'Sliding';
|
4 |
const PAGER_MODE = 'Sliding';
|
5 |
const PAGE_DELTA = 2;
|
5 |
const PAGE_DELTA = 2;
|
6 |
const PAGE_SEPARATEUR = '<span class="frag_separateur">-</span>';
|
- |
|
7 |
const URL_VAR = 'page';
|
6 |
const PAGE_SEPARATEUR = '<span class="frag_separateur">-</span>';
|
8 |
const SQUELETTE = 'defaut';
|
7 |
const SQUELETTE = 'defaut';
|
9 |
const DONNEES_PAR_PAGE_CHOIX = '10,20,50,100';
|
8 |
const DONNEES_PAR_PAGE_CHOIX = '10,20,50,100';
|
10 |
const DONNEES_PAR_PAGE_DEFAUT = 10;
|
9 |
const DONNEES_PAR_PAGE_DEFAUT = 10;
|
11 |
const ALPHABET_AFFICHAGE_DEFAUT = false;
|
10 |
const ALPHABET_AFFICHAGE_DEFAUT = false;
|
Line 24... |
Line 23... |
24 |
private $donnees_par_page;
|
23 |
private $donnees_par_page;
|
25 |
private $donnees_par_page_choix;
|
24 |
private $donnees_par_page_choix;
|
26 |
private $url_var;
|
25 |
private $url_var;
|
27 |
private $squelette;
|
26 |
private $squelette;
|
28 |
private $chemin_squelette;
|
27 |
private $chemin_squelette;
|
29 |
private $recherche_alphabetique;
|
- |
|
30 |
private $squelette_donnees = array();
|
28 |
private $squelette_donnees = array();
|
Line 31... |
Line 29... |
31 |
|
29 |
|
32 |
public function __construct($options) {
|
30 |
public function __construct($options) {
|
33 |
// Gestion de l'url
|
31 |
// Gestion de l'url
|
Line 58... |
Line 56... |
58 |
$this->squelette = (isset($options['squelette']) ? $options['squelette'] : self::SQUELETTE).'.tpl.html';
|
56 |
$this->squelette = (isset($options['squelette']) ? $options['squelette'] : self::SQUELETTE).'.tpl.html';
|
59 |
$this->chemin_squelette = dirname(__FILE__).DS.'squelettes'.DS.$this->squelette;
|
57 |
$this->chemin_squelette = dirname(__FILE__).DS.'squelettes'.DS.$this->squelette;
|
60 |
$this->pager_mode = (isset($options['pager_mode']) ? $options['pager_mode'] : self::PAGER_MODE);
|
58 |
$this->pager_mode = (isset($options['pager_mode']) ? $options['pager_mode'] : self::PAGER_MODE);
|
61 |
$this->page_delta = (isset($options['page_delta']) ? $options['page_delta'] : self::PAGE_DELTA);
|
59 |
$this->page_delta = (isset($options['page_delta']) ? $options['page_delta'] : self::PAGE_DELTA);
|
62 |
$this->page_separateur = (isset($options['page_separateur']) ? $options['page_separateur'] : self::PAGE_SEPARATEUR);
|
60 |
$this->page_separateur = (isset($options['page_separateur']) ? $options['page_separateur'] : self::PAGE_SEPARATEUR);
|
63 |
$this->url_var = (isset($options['url_var']) ? $options['url_var'] : self::URL_VAR);
|
61 |
$this->url_var = (isset($options['url_var']) ? $options['url_var'] : Config::get('parametre_url_page'));
|
64 |
$this->donnees_par_page = (isset($options['donnees_par_page']) ? $options['donnees_par_page'] : self::DONNEES_PAR_PAGE_DEFAUT);
|
62 |
$this->donnees_par_page = (isset($options['donnees_par_page']) ? $options['donnees_par_page'] : self::DONNEES_PAR_PAGE_DEFAUT);
|
65 |
$this->donnees_par_page_choix = (isset($options['donnees_par_page_choix']) ? $options['donnees_par_page_choix'] : self::DONNEES_PAR_PAGE_CHOIX);
|
63 |
$this->donnees_par_page_choix = (isset($options['donnees_par_page_choix']) ? $options['donnees_par_page_choix'] : self::DONNEES_PAR_PAGE_CHOIX);
|
66 |
$this->donnees_total = (isset($options['donnees_total']) ? $options['donnees_total'] : 0);
|
64 |
$this->donnees_total = (isset($options['donnees_total']) ? $options['donnees_total'] : 0);
|
Line 67... |
Line 65... |
67 |
|
65 |
|
68 |
// Gestion du nombre de données à afficher par page.
|
66 |
// Gestion du nombre de données à afficher par page.
|
69 |
if (isset($_GET['frag_nbre'])) {
|
67 |
if (isset($_GET['frag_nbre'])) {
|
70 |
if ($_GET['frag_nbre'] == '*') {
|
68 |
if ($_GET['frag_nbre'] == '*') {
|
71 |
$_GET['page'] = 1;
|
69 |
$_GET[$this->url_var] = 1;
|
72 |
}
|
70 |
}
|
73 |
$_SESSION['fragmenteur']['donnees_par_page'] = $_GET['frag_nbre'];
|
71 |
$_SESSION['fragmenteur']['donnees_par_page'] = $_GET['frag_nbre'];
|
74 |
} else {
|
72 |
} else {
|
75 |
$_SESSION['fragmenteur']['donnees_par_page'] = $this->donnees_par_page;
|
73 |
$_SESSION['fragmenteur']['donnees_par_page'] = $this->donnees_par_page;
|
Line 82... |
Line 80... |
82 |
// Gestion du Fragmenteur (basé sur le Pager de Pear)
|
80 |
// Gestion du Fragmenteur (basé sur le Pager de Pear)
|
83 |
$pager_options = array( 'mode' => $this->pager_mode,
|
81 |
$pager_options = array( 'mode' => $this->pager_mode,
|
84 |
'perPage' => $this->donnees_par_page,
|
82 |
'perPage' => $this->donnees_par_page,
|
85 |
'delta' => $this->page_delta,
|
83 |
'delta' => $this->page_delta,
|
86 |
'totalItems' => $this->donnees_total,
|
84 |
'totalItems' => $this->donnees_total,
|
- |
|
85 |
'path' => Config::get('url_base'),
|
87 |
'urlVar' => $this->url_var,
|
86 |
'urlVar' => $this->url_var,
|
88 |
'separator' => $this->page_separateur,
|
87 |
'separator' => $this->page_separateur,
|
89 |
'curPageLinkClassName' => self::CSS_CLASS_PAGE_COURRANTE,
|
88 |
'curPageLinkClassName' => self::CSS_CLASS_PAGE_COURRANTE,
|
90 |
'spacesBeforeSeparator' => self::PAGE_SEPARATEUR_ESPACE,
|
89 |
'spacesBeforeSeparator' => self::PAGE_SEPARATEUR_ESPACE,
|
91 |
'spacesAfterSeparator' => self::PAGE_SEPARATEUR_ESPACE,
|
90 |
'spacesAfterSeparator' => self::PAGE_SEPARATEUR_ESPACE,
|
Line 148... |
Line 147... |
148 |
// Gestion de l'url
|
147 |
// Gestion de l'url
|
149 |
$this->url->setVariableRequete('lettre', $this->getLettre());
|
148 |
$this->url->setVariableRequete('lettre', $this->getLettre());
|
150 |
}
|
149 |
}
|
Line 151... |
Line 150... |
151 |
|
150 |
|
152 |
// Gestion des urls
|
151 |
// Gestion des urls
|
153 |
$this->url->setVariableRequete('page', $this->pager->getCurrentPageID());
|
152 |
$this->url->setVariableRequete($this->url_var, $this->pager->getCurrentPageID());
|
Line 154... |
Line 153... |
154 |
$this->setSqueletteDonnees('url', $this->url->getURL());
|
153 |
$this->setSqueletteDonnees('url', $this->url->getURL());
|
155 |
|
154 |
|
156 |
// Gestion du fragmenteur
|
155 |
// Gestion du fragmenteur
|