IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

MkFramework Discussion :

Chargement trop long avec pagination


Sujet :

MkFramework

  1. #1
    Membre régulier
    Homme Profil pro
    Développeur COBOL
    Inscrit en
    Octobre 2013
    Messages
    102
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur COBOL
    Secteur : Santé

    Informations forums :
    Inscription : Octobre 2013
    Messages : 102
    Points : 87
    Points
    87
    Par défaut Chargement trop long avec pagination
    Bonjour,
    Si la table est assez importante, la pagination est trop longue, Cmt faire pour renvoyer dans le model de la requete SQL les 2 parametres LIMIT de pagination ?

  2. #2
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 098
    Points
    19 098
    Billets dans le blog
    17
    Par défaut
    Il faut pour cela créer une méthode

    dans votre classe modèle

    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    public function findAllLimit($offset,$limit){
      return $this->findMany('SELECT * FROM maTache LIMIT '.(int)$offset.','.(int)$limit);
    }

  3. #3
    Membre régulier
    Homme Profil pro
    Développeur COBOL
    Inscrit en
    Octobre 2013
    Messages
    102
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur COBOL
    Secteur : Santé

    Informations forums :
    Inscription : Octobre 2013
    Messages : 102
    Points : 87
    Points
    87
    Par défaut
    return $this->findMany('SELECT * FROM maTache LIMIT '.(int)$offset.','.(int)$limit);

    cmt faire pour envoyer les 2 paramètres dans le model SQL ?.
    Ces parametres se trouvent dans le main du module pagination, ils ont comme noms iMin et ipart

    public function findAllLimit($iMin,$iPart){

  4. #4
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 098
    Points
    19 098
    Billets dans le blog
    17
    Par défaut
    Dans votre action (methode _list) du module article

    vous faites actuellemetn quelque chose comme

    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    $tArticle=model_article::getInstance()->findAll();

    remplacez le par
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    $tArticle=model_article::getInstance()->findAllLimit($iMin,$iPart);
    où $iMin et $iPart auront préalablement été récupéré

  5. #5
    Membre régulier
    Homme Profil pro
    Développeur COBOL
    Inscrit en
    Octobre 2013
    Messages
    102
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur COBOL
    Secteur : Santé

    Informations forums :
    Inscription : Octobre 2013
    Messages : 102
    Points : 87
    Points
    87
    Par défaut
    je l'avais fait, les param n'etaient reconduits.

    En fait si c'est aussi long (15s pour afficher page) dans mon sql il se trouve un where et ma table est assez conséquente.

    si j'enleve se where cad de charger mon tableau complet, puis ensuite de trier seulement les enregs sélectionnés.
    cmt faire pour trier sur mes champs à la 2e étape ?

  6. #6
    Membre régulier
    Homme Profil pro
    Développeur COBOL
    Inscrit en
    Octobre 2013
    Messages
    102
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur COBOL
    Secteur : Santé

    Informations forums :
    Inscription : Octobre 2013
    Messages : 102
    Points : 87
    Points
    87
    Par défaut
    ce n'est pas le WHERE mais ORDER BY

  7. #7
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 098
    Points
    19 098
    Billets dans le blog
    17
    Par défaut
    postez le code de votre fichier main (methode _list) + la classe model_article et je vous indiquerai

    utilsez de préférence les balises codes

  8. #8
    Membre régulier
    Homme Profil pro
    Développeur COBOL
    Inscrit en
    Octobre 2013
    Messages
    102
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur COBOL
    Secteur : Santé

    Informations forums :
    Inscription : Octobre 2013
    Messages : 102
    Points : 87
    Points
    87
    Par défaut
    Model
    -----

    // Si tous les enregs
    public function findAll(){
    return $this->findMany('
    SELECT * FROM '.$this->sTable.'
    LEFT OUTER JOIN c_not
    ON par_che_id=not_che_id
    LEFT OUTER JOIN c_che
    ON par_che_id=che_id
    LEFT OUTER JOIN c_fav
    ON par_dtm = fav_dtm
    AND par_reu = fav_reu
    AND par_crs = fav_crs
    WHERE par_jec in(1,2,3,4)
    ORDER BY par_dtm DESC,fav_heu ASC
    ');
    }

    // selection d'une journée avec le calendrier
    public function findByDate($datSel){
    return $this->findMany('
    SELECT * FROM '.$this->sTable.'
    LEFT OUTER JOIN c_not
    ON par_che_id=not_che_id
    LEFT OUTER JOIN c_che
    ON par_che_id=che_id
    LEFT OUTER JOIN c_fav
    ON par_dtm = fav_dtm
    AND par_reu = fav_reu
    AND par_crs = fav_crs
    AND fav_dtm=?
    WHERE par_jec in(1,2,3,4)
    AND par_dtm=?
    ORDER BY par_dtm DESC,fav_heu ASC '
    ,$datSel,$datSel);
    }

    Main
    ----

    public function _list(){

    $iAnnee=_root::getParam('annee');
    $iMois=_root::getParam('mois');
    $iJour=_root::getParam('jour');

    if(!$iAnnee){ // si pas de date
    $tC_par=model_c_par::getInstance()->findAll();
    }else{ // si une date est selectionne
    $datSel=$iAnnee.$iMois.$iJour;
    $tC_par=model_c_par::getInstance()->findByDate($datSel);
    }

    $oView=new _view('c_par::list');
    $oView->tC_par=$tC_par;

    $oModulePagination=new module_pagination;
    $oModulePagination->setModuleAction('c_par::list');
    $oModulePagination->setParamPage('page');
    $oModulePagination->setLimit(5);
    $oModulePagination->setPage( _root::getParam('page') );
    $oModulePagination->setTab( $tC_par );

    $oView=new _tpl('c_par::list');
    $oView->tC_par=$oModulePagination->getPageElement();
    $oView->oModulePagination=$oModulePagination->build();

    //Calendrier
    $oModuleCalendrier=new module_calendrier;
    $oModuleCalendrier->sModuleAction='c_par::list'; //indiquer le couple module::action de la page parente
    $oView->oModuleCalendrier=$oModuleCalendrier->build(); //la methode build() doit retourner un objet _view

    $this->oLayout->add('main',$oView);
    }

  9. #9
    Membre régulier
    Homme Profil pro
    Développeur COBOL
    Inscrit en
    Octobre 2013
    Messages
    102
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur COBOL
    Secteur : Santé

    Informations forums :
    Inscription : Octobre 2013
    Messages : 102
    Points : 87
    Points
    87
    Par défaut
    Cmt je passe la date(datSel) sur les liens quand une date est sélectionnée ?

    le list du pagination
    ------------------

    <div class="pagination">

    <ul>
    <?php
    if($this->iPage==0) $this->iPage=1;
    $pagEnCours=_root::getParam('page');
    if($pagEnCours==0) $pagEnCours=1;
    //_root::getParam('annee');

    echo "pagEnCours:$pagEnCours - iMin:$this->iMin - iPart:$this->iPart - iPagMaxPag:$this->iPagMaxPag - iPagMaxTot:$this->iPagMaxTot - iPage:$this->iPage - iLigLimitPag:$this->iLigLimitPag";
    echo "<br>";

    // --Affichage page Début
    if($this->iMin >0) { $i=1?>
    <?php $tParam=$this->tParam ?>
    <?php $tParam[$this->sParamPage]=$i?>
    <li <?php if($i==1)>class="selectionne"<?php endif;?>><a href="<?php echo _root::getLink($this->sModuleAction,$tParam) ?>">Début </a></li>
    <?php if($this->iPage>=$this->iPagMaxPag) $this->iPage=$this->iPage-($this->iPagMaxPag/2);
    }

    // --Affichage page Précédent
    if($this->iMin >0) { $i=$pagEnCours-1?>
    <?php $tParam=$this->tParam ?>
    <?php $tParam[$this->sParamPage]=$i?>
    <li <?php if($i==$pagEnCours-1)>class="selectionne"<?php endif;?>><a href="<?php echo _root::getLink($this->sModuleAction,$tParam) ?>"> Précédent</a></li>
    <?php }?>

    <?php
    // ----Pages de x à y
    for($i=$this->iPage;$i<=($this->iPagMaxPag+$this->iPage)and($i<=$this->iPagMaxTot);$i++)>
    <?php $tParam=$this->tParam ?>
    <?php $tParam[$this->sParamPage]=$i?>
    <li <?php if($i==$pagEnCours)>class="selectionne"<?php endif;?>><a href="<?php echo _root::getLink($this->sModuleAction,$tParam) ?> "> <?php echo $i?></a></li>
    <?php endfor?>


    <?php
    // ---Affichage page Suite
    if($pagEnCours < $this->iPagMaxTot) { $i=$pagEnCours+1?>
    <?php $tParam=$this->tParam;?>
    <?php $tParam[$this->sParamPage]=$i?>
    <li <?php if($i==$pagEnCours+1)>class="selectionne"<?php endif;?>><a href="<?php echo _root::getLink($this->sModuleAction,$tParam) ?>"> Suite</a></li>
    <?php }?>


    <?php
    // ---Affichage page Fin
    if($pagEnCours < $this->iPagMaxTot) { $i=$this->iPagMaxTot?>
    <?php $tParam=$this->tParam;?>
    <?php $tParam[$this->sParamPage]=$i?>
    <li <?php if($i==$this->iPagMaxTot)>class="selectionne"<?php endif;?>><a href="<?php echo _root::getLink($this->sModuleAction,$tParam) ?>"> Fin</a></li>
    <?php }?>

    </ul>
    </div>


    <!-- Affichage des éléments pages -->
    Page <?php if($pagEnCours==1) {
    echo '1//'. $this->iPagMaxTot;
    }else{
    echo $pagEnCours .'/'. $this->iPagMaxTot;
    }

  10. #10
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 098
    Points
    19 098
    Billets dans le blog
    17
    Par défaut
    Essayez ceci:

    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
     
    <?php
     
    // Si tous les enregs
    public function findAllLimit($offset,$limit){
    return $this->findMany('
    SELECT * FROM '.$this->sTable.'
    	LEFT OUTER JOIN c_not
    	ON par_che_id=not_che_id
    	LEFT OUTER JOIN c_che
    	ON par_che_id=che_id
    	LEFT OUTER JOIN c_fav
    	ON par_dtm = fav_dtm
    	AND par_reu = fav_reu
    	AND par_crs = fav_crs
    	WHERE par_jec in(1,2,3,4)
    	ORDER BY par_dtm DESC,fav_heu ASC
    	
    	LIMIT '.(int)$offset.','.(int)$limit.'
    ');
    }
    public function findAllCount(){
    	$oRow=$this->findOneSimple('SELECT count(*) as total FROM '.$this->sTable.' 
    	LEFT OUTER JOIN c_not
    	ON par_che_id=not_che_id
    	LEFT OUTER JOIN c_che
    	ON par_che_id=che_id
    	LEFT OUTER JOIN c_fav
    	ON par_dtm = fav_dtm
    	AND par_reu = fav_reu
    	AND par_crs = fav_crs
    	WHERE par_jec in(1,2,3,4)
    	
    	');
    	return (int)$oRow->total;
    }
     
    // selection d'une journée avec le calendrier 
    public function findByDateLimit($datSel,$offset,$limit){
    return $this->findMany('
    	SELECT * FROM '.$this->sTable.'
    	LEFT OUTER JOIN c_not
    	ON par_che_id=not_che_id
    	LEFT OUTER JOIN c_che
    	ON par_che_id=che_id
    	LEFT OUTER JOIN c_fav
    	ON par_dtm = fav_dtm
    	AND par_reu = fav_reu
    	AND par_crs = fav_crs
    	AND fav_dtm=?
    	WHERE par_jec in(1,2,3,4)
    	AND par_dtm=?
    	ORDER BY par_dtm DESC,fav_heu ASC 
    
    	LIMIT '.(int)$offset.','.(int)$limit.'
    
    	'
    	,$datSel,$datSel);
    }
     
     
    public function findByDateCount($datSel){
    	$oRow=$this->findOneSimple('SELECT count(*) as total FROM '.$this->sTable.' 
    	LEFT OUTER JOIN c_not
    	ON par_che_id=not_che_id
    	LEFT OUTER JOIN c_che
    	ON par_che_id=che_id
    	LEFT OUTER JOIN c_fav
    	ON par_dtm = fav_dtm
    	AND par_reu = fav_reu
    	AND par_crs = fav_crs
    	AND fav_dtm=?
    	WHERE par_jec in(1,2,3,4)
    	AND par_dtm=?
    	
    	',$datSel,$datSel);
    	return (int)$oRow->total;
    }
     
     
    //-----------------------
    //MAIN
     
    public function _list(){
     
    	$iAnnee=_root::getParam('annee');
    	$iMois=_root::getParam('mois');
    	$iJour=_root::getParam('jour'); 
     
    	//pagination
    	$limit=5;
    	$offset=_root::getParam('page',0)*$limit;
     
    	if(!$iAnnee){ // si pas de date
    		$tC_par=model_c_par::getInstance()->findAllLimit($offset,$limit);
    		$iMax=model_c_par::getInstance()->findAllCount();
    	}else{ // si une date est selectionne
    		$datSel=$iAnnee.$iMois.$iJour;
    		$tC_par=model_c_par::getInstance()->findByDateLimit($datSel,$offset,$limit);
    		$iMax=model_c_par::getInstance()->findByDateCount($datSel);
    	}
     
    	$oView=new _view('c_par::list');
    	$oView->tC_par=$tC_par;
     
    	$oModulePagination=new module_pagination;
    	$oModulePagination->setModuleAction('c_par::list');
    	$oModulePagination->setParamPage('page');
    	$oModulePagination->setLimit(5);
    	$oModulePagination->setPage( _root::getParam('page') ); 
    	$oModulePagination->setMax( $iMax );
     
    	$oView->oModulePagination=$oModulePagination->build();
     
    	//Calendrier
    	$oModuleCalendrier=new module_calendrier;
    	$oModuleCalendrier->sModuleAction='c_par::list'; //indiquer le couple module::action de la page parente
    	$oView->oModuleCalendrier=$oModuleCalendrier->build(); //la methode build() doit retourner un objet _view
     
    	$this->oLayout->add('main',$oView);
    }

  11. #11
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 098
    Points
    19 098
    Billets dans le blog
    17
    Par défaut
    J'oublais, dans le module pagination, dans le fichier main.php
    ajoutez cette méthode:
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    public function setMax($iMax){
    		$this->iMax=$iMax;
    	}

  12. #12
    Membre régulier
    Homme Profil pro
    Développeur COBOL
    Inscrit en
    Octobre 2013
    Messages
    102
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur COBOL
    Secteur : Santé

    Informations forums :
    Inscription : Octobre 2013
    Messages : 102
    Points : 87
    Points
    87
    Par défaut
    le temps d'affichage est le même et je n'ai plus les autres pages en pagination !!!

    cmt faire pour ajouter la date dans ce lien dans le list de pagination ?

    <li <?php if($i==$pagEnCours)>class="selectionne"<?php endif;?>><a href="<?php echo _root::getLink($this->sModuleAction,$tParam) ?> "> <?php echo $i?></a></li>

  13. #13
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 098
    Points
    19 098
    Billets dans le blog
    17
    Par défaut
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    <?php $tParam['dateSel']=_root::getParam('dateSel');?>
    <li <?php if($i==$pagEnCours):?>class="selectionne"<?php endif;?>><a href="<?php echo _root::getLink($this->sModuleAction,$tParam) ?> "> <?php echo $i?></a></li>

  14. #14
    Membre régulier
    Homme Profil pro
    Développeur COBOL
    Inscrit en
    Octobre 2013
    Messages
    102
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur COBOL
    Secteur : Santé

    Informations forums :
    Inscription : Octobre 2013
    Messages : 102
    Points : 87
    Points
    87
    Par défaut
    merci, je vais réviser le code pour mieux comprendre.
    exemple a quoi sert les count :
    findByDateCount($datSel). et findAllCount(){

    le count est déja fait dans le main du pagination:
    public function getPageElement(){
    $tPartElement=array();

    $this->iPagMaxTot=count($this->tElement);

    Bonne soiree

  15. #15
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 098
    Points
    19 098
    Billets dans le blog
    17
    Par défaut
    Par defaut oui, mais dans le code que je vous ai fourni, il n'y a plus d'appel a getPageElement()
    Il y a a la place setMax()

    Pour éviter de recuperer tous les enregistrements


    Après, il vous faut peut etre ajouter des index sur votre table (sur le champ date, les fk et les champs a trier)

  16. #16
    Membre régulier
    Homme Profil pro
    Développeur COBOL
    Inscrit en
    Octobre 2013
    Messages
    102
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur COBOL
    Secteur : Santé

    Informations forums :
    Inscription : Octobre 2013
    Messages : 102
    Points : 87
    Points
    87
    Par défaut
    Pour le temps réponse maintenant il est immédiat, mes index étaient bien créés mais je ne sais pas pk, le nombre correspondait pas à la réalité, en supprimant un index et le recréant dans chaque table tout c'est réorganisé correctement.

    Dans votre génération de pagination, tous les liens des pages sont affichés en même temps, le pb si la table est importante trop de liens sont affichés.
    J'ai modifié la pagination de sorte à afficher comme ceci:

    Début Précédent 1 2 3 4 5 6 7 Suite Fin

    Cela marche très bien quand je ne choisis pas une date du calendrier.

    quand je choisis une date avec le calendrier la 1ère page est correct mais quand je veux choisir la 2ème page par exemple il affiche toutes les dates, je n'arrive pas à passer cette fameuse date choisie en paramètre pour passer dans le bon SQL !!!

  17. #17
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 098
    Points
    19 098
    Billets dans le blog
    17
    Par défaut
    Vous avez bien modifié la vue de pagination comme ceci:

    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    <?php $tParam['dateSel']=_root::getParam('dateSel');?>
    <li <?php if($i==$pagEnCours):?>class="selectionne"<?php endif;?>><a href="<?php echo _root::getLink($this->sModuleAction,$tParam) ?> "> <?php echo $i?></a></li>

  18. #18
    Membre régulier
    Homme Profil pro
    Développeur COBOL
    Inscrit en
    Octobre 2013
    Messages
    102
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur COBOL
    Secteur : Santé

    Informations forums :
    Inscription : Octobre 2013
    Messages : 102
    Points : 87
    Points
    87
    Par défaut
    1) quand je clique la date du 20131103 (voici le résultat)

    datSel:20131103- - pagEnCours:1 - iMin:0 - iPart:4 - iPagMaxPag:6 - iPagMaxTot:6 - iPage:1 - iLigLimitPag:4


    1 2 3 4 5 6 Suite Fin
    Page 1/6
    ----------------------------
    2) quand je clique sur la 2e page (datSel n'a pas de date)

    datSel:- - pagEnCours:2 - iMin:4 - iPart:8 - iPagMaxPag:6 - iPagMaxTot:177 - iPage:1 - iLigLimitPag:4

    Début Précédent 1 2 3 4 5 6 7 Suite Fin
    Page 2/177

    --------------
    voici le list de pagination

    <div class="pagination">
    <ul>
    <?php
    if($this->iPage==0) $this->iPage=1;
    $pagEnCours=_root::getParam('page');
    if($pagEnCours==0) $pagEnCours=1;
    $datSel=_root::getParam('annee')._root::getParam('mois')._root::getParam('jour');

    // echo pour controle
    echo " datSel:$datSel- - pagEnCours:$pagEnCours - iMin:$this->iMin - iPart:$this->iPart - iPagMaxPag:$this->iPagMaxPag - iPagMaxTot:$this->iPagMaxTot - iPage:$this->iPage - iLigLimitPag:$this->iLigLimitPag";
    echo "<br>";
    //---------

    // --Affichage page Début
    if($this->iMin >0) { $i=1?>
    <?php $tParam=$this->tParam ?>
    <?php $tParam[$this->sParamPage]=$i?>
    <?php $tParam['datSel']=_root::getParam('datSel');?>
    <li <?php if($i==1)>class="selectionne"<?php endif;?>><a href="<?php echo _root::getLink($this->sModuleAction,$tParam) ?>">Début </a></li>
    <?php if($this->iPage>=$this->iPagMaxPag) $this->iPage=$this->iPage-($this->iPagMaxPag/2);
    }

    // --Affichage page Précédent
    if($this->iMin >0) { $i=$pagEnCours-1?>
    <?php $tParam=$this->tParam ?>
    <?php $tParam[$this->sParamPage]=$i?>
    <?php $tParam['datSel']=_root::getParam('datSel');?>
    <li <?php if($i==$pagEnCours-1)>class="selectionne"<?php endif;?>><a href="<?php echo _root::getLink($this->sModuleAction,$tParam) ?>"> Précédent</a></li>
    <?php }?>

    <?php
    // ----Pages de x à y
    for($i=$this->iPage;$i<=($this->iPagMaxPag+$this->iPage)and($i<=$this->iPagMaxTot);$i++)>
    <?php $tParam=$this->tParam ?>
    <?php $tParam[$this->sParamPage]=$i?>
    <?php $tParam['datSel']=_root::getParam('datSel');?>
    <li <?php if($i==$pagEnCours)>class="selectionne"<?php endif;?>><a href="<?php echo _root::getLink($this->sModuleAction,$tParam) ?> "> <?php echo $i?></a></li>
    <?php endfor?>


    <?php
    // ---Affichage page Suite
    if($pagEnCours < $this->iPagMaxTot) { $i=$pagEnCours+1?>
    <?php $tParam=$this->tParam;?>
    <?php $tParam[$this->sParamPage]=$i?>
    <?php $tParam['datSel']=_root::getParam('datSel');?>
    <li <?php if($i==$pagEnCours+1)>class="selectionne"<?php endif;?>><a href="<?php echo _root::getLink($this->sModuleAction,$tParam) ?>"> Suite</a></li>
    <?php }?>


    <?php
    // ---Affichage page Fin
    if($pagEnCours < $this->iPagMaxTot) { $i=$this->iPagMaxTot?>
    <?php $tParam=$this->tParam;?>
    <?php $tParam[$this->sParamPage]=$i?>
    <?php $tParam['datSel']=_root::getParam('datSel');?>
    <li <?php if($i==$this->iPagMaxTot)>class="selectionne"<?php endif;?>><a href="<?php echo _root::getLink($this->sModuleAction,$tParam) ?>"> Fin</a></li>
    <?php }?>

    </ul>
    </div>


    <!-- Affichage des éléments pages -->
    Page <?php if($pagEnCours==1) {
    echo '1/'. $this->iPagMaxTot;
    }else{
    echo $pagEnCours .'/'. $this->iPagMaxTot;
    }

  19. #19
    Rédacteur
    Avatar de imikado
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Décembre 2006
    Messages
    5 239
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Décembre 2006
    Messages : 5 239
    Points : 19 098
    Points
    19 098
    Billets dans le blog
    17
    Par défaut
    J'ai peut etre une piste:
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    $datSel=_root::getParam('annee')._root::getParam('mois')._root::getParam('jour');

    Lors de la seconde page, les variables annees/mois/jour sont vide
    il faut d'abord verifier que datSel n'est pas deja renseigné

    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    if(_root::getParam('dateSel')){
      //si deja dans l'url on l'utilise
      $datSel=_root::getParam('dateSel');
    }else{
      //sinon on concatene annee/mois/jour
      $datSel=_root::getParam('annee')._root::getParam('mois')._root::getParam('jour');
    }

  20. #20
    Membre régulier
    Homme Profil pro
    Développeur COBOL
    Inscrit en
    Octobre 2013
    Messages
    102
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur COBOL
    Secteur : Santé

    Informations forums :
    Inscription : Octobre 2013
    Messages : 102
    Points : 87
    Points
    87
    Par défaut
    j'ai changé dans le list et le main du calendier de façon a fusionné les 3 champs(annee.mois.jour) dans datSel , elle devient une variable d'URL.

    j'ai changé ces 2 lignes dans le list de c_par:
    $datSel=_root::getParam('annee')._root::getParam('mois')._root::getParam('jour');
    <?php $tParam['datSel']=_root::getParam('datSel');?>

    par:

    $datSel=_root::getParam('datSel');
    $tParam['datSel']=$datSel;

    et ca marche.

    Je pense que cette ligne en rouge , tParam était vide.
    Qu'est-ce que vous en pensé ?

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 2 12 DernièreDernière

Discussions similaires

  1. Select avec bcp d'option = chargement trop long
    Par gato18 dans le forum Langage
    Réponses: 2
    Dernier message: 09/05/2012, 10h27
  2. Tronquer un texte trop long avec …
    Par mestressat dans le forum Langage
    Réponses: 7
    Dernier message: 22/01/2012, 13h15
  3. Chargement trop long tree
    Par lil_k123 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 09/07/2007, 16h17
  4. Temps de chargement trop long pour animation légère
    Par CharlyMops dans le forum Flash
    Réponses: 1
    Dernier message: 27/09/2006, 07h13
  5. Réponses: 5
    Dernier message: 15/09/2006, 16h58

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo