From: <ara...@us...> - 2007-05-01 20:19:03
|
Revision: 142 http://svn.sourceforge.net/easybox-mod/?rev=142&view=rev Author: aragornis Date: 2007-05-01 13:19:00 -0700 (Tue, 01 May 2007) Log Message: ----------- Mise ?\195?\160 jour de la navigation multipage avec gestion de la pagination + r?\195?\169paration d'un bug sur MacOS Mise ?\195?\160 jour des quatre modules ultilisant la gestion multipage et des explorateurs Mise en place du htaccess pour garantir la compatibilit?\195?\169 sur MacOS Mise ?\195?\160 jour de la skin simplegreen pour qu'elle remarche Modified Paths: -------------- trunk/module/_explorateur/explorateur.tpl trunk/module/_explorateur/index1.php trunk/module/cinefil/index1.php trunk/module/cinefil/sorties_cine.tpl trunk/module/clips/clips.tpl trunk/module/clips/index1.php trunk/module/dailymotion/dailymotion.tpl trunk/module/dailymotion/index1.php trunk/module/youtube/index1.php trunk/module/youtube/youtube.tpl trunk/skin/simple/framework_skin.php trunk/skin/simplegreen/framework_skin.php Added Paths: ----------- trunk/.htaccess Added: trunk/.htaccess =================================================================== --- trunk/.htaccess (rev 0) +++ trunk/.htaccess 2007-05-01 20:19:00 UTC (rev 142) @@ -0,0 +1 @@ +php_flag short_open_tag on Modified: trunk/module/_explorateur/explorateur.tpl =================================================================== --- trunk/module/_explorateur/explorateur.tpl 2007-05-01 15:37:58 UTC (rev 141) +++ trunk/module/_explorateur/explorateur.tpl 2007-05-01 20:19:00 UTC (rev 142) @@ -98,8 +98,8 @@ {*######## Fin Affichage des raccourcis rapides ########*} -{if $MIN!=0} - <tr><td colspan="2">{precedent} <a href="{$PAGE_EXPLO}?start=0&directory={$REP|urlencode}&mode={$MODE}"><font size=2>D\xE9but du r\xE9pertoire</font></a></td></tr> +{if !$_multipage.is_first_page} + <tr><td colspan="2">{precedent}<font size="1"> <a href="{$PAGE_EXPLO}?start=0&directory={$REP|urlencode}&mode={$MODE}">D\xE9but du r\xE9pertoire</a></font></td></tr> {/if} {if $Nb_rep_path >='2' AND $MIN==0} @@ -143,13 +143,8 @@ {/if} {/section} -{if $MIN+$smarty.section.files.total<count($T_affich)} - <tr><td colspan="2"><table><tr><td>{suivant} - <font size=2><a href="{$PAGE_EXPLO}?start={$N_affich-$smarty.section.files.total}&directory={$REP|urlencode}&mode={$MODE}">Fin du r\xE9pertoire</a> - Page {$MIN/$NUM_ROW_AFFICH+1|ceil} / {$N_affich/$NUM_ROW_AFFICH|ceil}</font></td> -{else} - <tr><td colspan="2"><table><tr><td><font size=2>Page {$MIN/$NUM_ROW_AFFICH+1|ceil} / {$N_affich/$NUM_ROW_AFFICH|ceil}</font></td> -{/if} + <tr><td colspan="2"><table><tr><td>{if !$_multipage.is_last_page}{suivant}<font size=1> - <a href="{$PAGE_EXPLO}?start={$_multipage.min_max}&directory={$REP|urlencode}&mode={$MODE}">Fin du r\xE9pertoire</a> - </font>{/if}{pagination}</td> - <td width="30" align="center"> {if $PLAYREP} <a href="{$PAGE_LECT_REP}?toplay={$REP|urlencode}&type=playrep" onfocus='aide="Lire le dossier en entier";'><table width="20" height="20" border="0" cellpadding="0" cellspacing="0" bgcolor="{#COULEUR_FOND1#}" abgcolor="{#COULEUR_ALINK#}"><tr height="20"><td align=center width="20" height="20" align="center" valign="middle"><img src="{$SKIN_REP}dossier/rep_all.gif" border="0" width="20" height="20"></td></tr></table></a> @@ -166,3 +161,4 @@ {/if} </table> {$FOOTER} + Modified: trunk/module/_explorateur/index1.php =================================================================== --- trunk/module/_explorateur/index1.php 2007-05-01 15:37:58 UTC (rev 141) +++ trunk/module/_explorateur/index1.php 2007-05-01 20:19:00 UTC (rev 142) @@ -147,8 +147,16 @@ RETURN ($chemin); } +// R\xE9cup\xE9ration de la liste des fichiers +$fichiers = FICHIERS(); +$smarty->assign('DISQUES',unserialize(get_variable('disques'))); +$T_affich = array_merge($fichiers[0],$fichiers[1]); +$smarty->assign('T_rep',$fichiers[0]); +$smarty->assign('T_file',$fichiers[1]); +$smarty->assign('T_affich',$T_affich); + // Lancement de la gestion multipage -start_multi($page_explo.'?directory='.urlencode($rep).'&mode='.$_GET['mode'],14); +start_multi($page_explo.'?directory='.urlencode($rep).'&mode='.$_GET['mode'],14,count($T_affich)); //Ajout dans la base de donn\xE9e pour les retours if($extension==$ini['explorateur']['ext']){ @@ -185,13 +193,6 @@ $smarty->assign('MIN',$min); $smarty->assign('Nb_rep_path',count($path)); -$fichiers = FICHIERS(); - -$smarty->assign('DISQUES',unserialize(get_variable('disques')));//unserialize(get_variable('disques'))); - -$smarty->assign('T_rep',$fichiers[0]); -$smarty->assign('T_file',$fichiers[1]); -$smarty->assign('T_affich',array_merge($fichiers[0],$fichiers[1])); $smarty->assign('CONTENT',$smarty->fetch('explorateur.tpl')); if(!isset($nointerface)){ $smarty->display('interface.tpl'); Modified: trunk/module/cinefil/index1.php =================================================================== --- trunk/module/cinefil/index1.php 2007-05-01 15:37:58 UTC (rev 141) +++ trunk/module/cinefil/index1.php 2007-05-01 20:19:00 UTC (rev 142) @@ -37,10 +37,9 @@ $LINK['red']= page_retour_menu(); -start_multi('index1.php?week='.$week,8); +start_multi('index1.php?week='.$week,8,count($SORTIES)); $smarty->assign('TITRE',$titre); -$smarty->assign('MIN',$min); $smarty->assign('SORTIES',$SORTIES); $smarty->assign('week',$week); Modified: trunk/module/cinefil/sorties_cine.tpl =================================================================== --- trunk/module/cinefil/sorties_cine.tpl 2007-05-01 15:37:58 UTC (rev 141) +++ trunk/module/cinefil/sorties_cine.tpl 2007-05-01 20:19:00 UTC (rev 142) @@ -1,7 +1,7 @@ {section name=sorties loop=$SORTIES max=8 start=$MIN} {cycle name=place assign=place print=false values="3,2,1,0"} {if $smarty.section.sorties.first} - {if $MIN!=0}{precedent}{/if} + {if !$_multipage.is_first_page}{precedent}{/if} <table border="0" cellpadding="0" cellspacing="0" width="500" height="360" align="center"><tr> {/if} @@ -17,8 +17,7 @@ {if $place >= 1}<td> </td>{/if} </tr> </table> - {if $MIN+$smarty.section.sorties.total<count($SORTIES)}{suivant}{/if} - + {if !$_multipage.is_last_page}{suivant} - {/if}{pagination} {/if} {/section} Modified: trunk/module/clips/clips.tpl =================================================================== --- trunk/module/clips/clips.tpl 2007-05-01 15:37:58 UTC (rev 141) +++ trunk/module/clips/clips.tpl 2007-05-01 20:19:00 UTC (rev 142) @@ -4,7 +4,7 @@ {cycle name=place assign=place print=false values="4,3,2,1,0"} {if $smarty.section.clip.first} <table border="0" cellpadding="0" cellspacing="0" width="500" align="center"><tr> - {if $MIN!=0} + {if !$_multipage.is_first_page} <td colspan="5" align=center>{precedent}</td></tr><tr> {/if} {/if} @@ -29,7 +29,7 @@ <td> </td> {/if} </tr> - <tr><td colspan="5" align="center" height="25" valign="bottom">{if $MIN+$NUM_ROW_AFFICH < $TOTAL}{suivant} - {/if}{$DEB+$START} \xE0 {$FIN-10+$START} sur {$TOTAL}</td></tr> + <tr><td colspan="5" align="center" height="25" valign="bottom">{if !$_multipage.is_last_page}{suivant} - {/if}{pagination}</td></tr> </table> {if $SHOW=='tous'} Modified: trunk/module/clips/index1.php =================================================================== --- trunk/module/clips/index1.php 2007-05-01 15:37:58 UTC (rev 141) +++ trunk/module/clips/index1.php 2007-05-01 20:19:00 UTC (rev 142) @@ -27,7 +27,7 @@ } function get_recherche($rec){ - $contenu = str_replace("\r\n",'',@file_get_contents('http://search.fr.music.yahoo.com/search/?p='.$rec.'&m=video')); + $contenu = str_replace("\r\n",'',@file_get_contents('http://search.fr.music.yahoo.com/search/?p='.urlencode($rec).'&m=video')); $ereg = '<td bgcolor=......><a href=javascript:playVideos\((.{1,10})\); title="(.{1,50})"><b>(.{1,50})<\/b><\/a><\/td><td bgcolor=......><a href=http:\/\/fr.music.yahoo.com\/ar-(.{1,50})><font title="(.{1,50})">(.{1,50})<\/font><\/a><\/td><td bgcolor=...... align=center class="yss_right'; preg_match_all("/$ereg/s", $contenu, $valeur); foreach($valeur[2] as $key=>$val){ @@ -49,7 +49,7 @@ } // Lancement de la gestion multipage -start_multi('index1.php?show='.$show.$sup,10); +start_multi('index1.php?show='.$show.$sup,10,0); // D\xE9termination de la page $page = floor($min/20)+1; @@ -66,6 +66,10 @@ $res = get_videos_id($url.'p='.$page); } +// RELancement de la gestion multipage pour informer aussi du nombre d'\xE9l\xE9ments +start_multi('index1.php?show='.$show.$sup,10,$res[3]); + + for ($i=0; $i<26; $i++){ $lettres[] = array(chr(97+$i),chr(65+$i)); } @@ -77,7 +81,6 @@ $smarty->assign('DEB',$res[1]); $smarty->assign('FIN',$res[2]); $smarty->assign('CLIP',$res[0]); -$smarty->assign('MIN',$min); $smarty->assign('START',$start); $smarty->assign('CONTENT',$smarty->fetch('clips.tpl')); Modified: trunk/module/dailymotion/dailymotion.tpl =================================================================== --- trunk/module/dailymotion/dailymotion.tpl 2007-05-01 15:37:58 UTC (rev 141) +++ trunk/module/dailymotion/dailymotion.tpl 2007-05-01 20:19:00 UTC (rev 142) @@ -3,7 +3,7 @@ {cycle name=place assign=place print=false values="4,3,2,1,0"} {if $smarty.section.clip.first} <table border="0" cellpadding="0" cellspacing="0" width="500" align="center"><tr> - {if $MIN!=0} + {if !$_multipage.is_first_page} <td colspan="5" align=center>{precedent}</td></tr><tr> {/if} {/if} @@ -20,7 +20,7 @@ {if $place >= 2}<td> </td>{/if} {if $place >= 1}<td> </td>{/if} </tr> - <tr><td colspan="5" align="center" height="25" valign="bottom">{if $MIN+$NUM_ROW_AFFICH < $TOTAL}{suivant} - {/if}{$DEB} \xE0 {$FIN}</td></tr> + <tr><td colspan="5" align="center" height="25" valign="bottom">{if !$_multipage.is_last_page}{suivant} - {/if}{pagination}</td></tr> </table> {/if} {sectionelse} Modified: trunk/module/dailymotion/index1.php =================================================================== --- trunk/module/dailymotion/index1.php 2007-05-01 15:37:58 UTC (rev 141) +++ trunk/module/dailymotion/index1.php 2007-05-01 20:19:00 UTC (rev 142) @@ -11,7 +11,7 @@ array('lien'=>'index1.php?show=note', 'nom'=>'Mieux not\xE9s', 'selected'=>$show=='note'), array('lien'=>'index1.php?show=rec', 'nom'=>'Recherche', 'selected'=>$show=='rec')); -$title = array('hit'=>'Les plus r\xE9cents', 'new'=>'Les plus vus', 'tous'=>'Les mieux not\xE9s', 'rec'=>'Recherche'); +$title = array('recent'=>'Les plus r\xE9cents', 'vus'=>'Les plus vus', 'note'=>'Les mieux not\xE9s', 'rec'=>'Recherche'); $smarty->assign('TITRE','Vid\xE9os Dailymotion - '.$title[$show]); function get_videos_id($page){ @@ -45,7 +45,7 @@ $nb_p = 5; }elseif($show=='rec'){ (isset($_GET['string'])?$string=$_GET['string']:$string=''); - $url = 'http://www.dailymotion.com/rss/relevance/search/'.$string.'/'; + $url = 'http://www.dailymotion.com/rss/relevance/search/'.urlencode($string).'/'; $sup = '&string='.$string; } @@ -60,7 +60,7 @@ if(!($show=='rec' and $string=='')){ $res = get_videos_id($url); if(count($res)==10){ - $total = ($page+5)*10; + $total = ($page+10)*10; }else{ $total = ($page-1)*10+count($res); } @@ -68,6 +68,9 @@ $fin = $page*10; } +// RELancement de la gestion multipage pour informer aussi du nombre d'\xE9l\xE9ments +start_multi('index1.php?show='.$show.$sup,10,$total); + $smarty->assign('string',$string); $smarty->assign('lettres',$lettres); $smarty->assign('SHOW',$show); @@ -75,7 +78,6 @@ $smarty->assign('DEB',$deb); $smarty->assign('FIN',$fin); $smarty->assign('CLIP',$res); -$smarty->assign('MIN',$min); $smarty->assign('START',$start); $smarty->assign('CONTENT',$smarty->fetch('dailymotion.tpl')); Modified: trunk/module/youtube/index1.php =================================================================== --- trunk/module/youtube/index1.php 2007-05-01 15:37:58 UTC (rev 141) +++ trunk/module/youtube/index1.php 2007-05-01 20:19:00 UTC (rev 142) @@ -11,12 +11,12 @@ array('lien'=>'index1.php?show=note', 'nom'=>'Mieux not\xE9s', 'selected'=>$show=='note'), array('lien'=>'index1.php?show=rec', 'nom'=>'Recherche', 'selected'=>$show=='rec')); -$title = array('hit'=>'Les plus r\xE9cents', 'new'=>'Les plus vus', 'tous'=>'Les mieux not\xE9s', 'rec'=>'Recherche'); +$title = array('recent'=>'Les plus r\xE9cents', 'vus'=>'Les plus vus', 'note'=>'Les mieux not\xE9s', 'rec'=>'Recherche'); $smarty->assign('TITRE','Vid\xE9os Youtube - '.$title[$show]); function get_videos_id($page){ $contenu = str_replace("\n",'',@file_get_contents($page)); - $ereg = '<a href="\/watch\?v=(.{1,12})"><img src="(.{1,200})" class=" vimg " alt="video" \/><\/a><\/div> <\/div> <div class="vtitle"> <a href="\/watch\?v=(.{1,12})" onclick="_hbLink\(\'(.{1,100})\',\'(.{1,50})\'\);">(.{1,100})<\/a><br\/> <span class="runtime">(.{1,10})<\/span>'; + $ereg = '<a href="\/watch\?v=(.{1,12})"><img src="(.{1,200})" class=" vimg " alt="video" \/><\/a><\/div> <\/div> <div class="vtitle"> <a href="\/watch\?v=(.{1,12})" onclick="_hbLink\(\'(.{0,100})\',\'(.{1,50})\'\);">(.{1,100})<\/a><br\/> <span class="runtime">(.{1,10})<\/span>'; preg_match_all("/$ereg/s", $contenu, $valeur); foreach($valeur[1] as $key=>$val){ $retour[] = array('temps'=>$valeur[7][$key], 'titre'=>utf8_decode($valeur[6][$key]), 'id'=>$valeur[1][$key], 'img'=>$valeur[2][$key]); @@ -25,7 +25,7 @@ } function get_recherche($rec,$page){ - $contenu = str_replace("\n",'',@file_get_contents('http://www.youtube.com/results?search_query='.$rec.'&search=Search&page='.$page)); + $contenu = str_replace("\n",'',@file_get_contents('http://www.youtube.com/results?search_query='.urlencode($rec).'&search=Search&page='.$page)); $ereg = '<img src="(.{1,200})" border="0" class="vimg120" \/><\/a><\/div> <\/div> <\/td> <td class="vinfo"> <div class="vSnippetTitle"> <a href="\/watch\?v=(.{1,12})" rel="nofollow" onclick="_hbLink\(\'(.{1,100})\',\'(.{1,50})\'\);">(.{1,100})<\/a><br\/> <span class="runtime">(.{1,10})<\/span>'; preg_match_all("/$ereg/s", $contenu, $valeur); foreach($valeur[1] as $key=>$val){ @@ -59,7 +59,7 @@ } // Lancement de la gestion multipage -start_multi('index1.php?show='.$show.$sup,10); +start_multi('index1.php?show='.$show.$sup,10,0); // D\xE9termination de la page $page = floor($min/20)+1; @@ -83,6 +83,8 @@ $fin = $page*20; } +// RELancement de la gestion multipage pour informer aussi du nombre d'\xE9l\xE9ments +start_multi('index1.php?show='.$show.$sup,10,$total); $smarty->assign('LETTRE',$lettre); $smarty->assign('string',$string); Modified: trunk/module/youtube/youtube.tpl =================================================================== --- trunk/module/youtube/youtube.tpl 2007-05-01 15:37:58 UTC (rev 141) +++ trunk/module/youtube/youtube.tpl 2007-05-01 20:19:00 UTC (rev 142) @@ -3,7 +3,7 @@ {cycle name=place assign=place print=false values="4,3,2,1,0"} {if $smarty.section.clip.first} <table border="0" cellpadding="0" cellspacing="0" width="500" align="center"><tr> - {if $MIN!=0} + {if !$_multipage.is_first_page} <td colspan="5" align=center>{precedent}</td></tr><tr> {/if} {/if} @@ -20,7 +20,7 @@ {if $place >= 2}<td> </td>{/if} {if $place >= 1}<td> </td>{/if} </tr> - <tr><td colspan="5" align="center" height="25" valign="bottom">{if $MIN+$NUM_ROW_AFFICH < $TOTAL}{suivant} - {/if}{$DEB+$START} \xE0 {$FIN-10+$START} sur {$TOTAL}</td></tr> + <tr><td colspan="5" align="center" height="25" valign="bottom">{if !$_multipage.is_last_page}{suivant} - {/if}{pagination}</td></tr> </table> {/if} {sectionelse} Modified: trunk/skin/simple/framework_skin.php =================================================================== --- trunk/skin/simple/framework_skin.php 2007-05-01 15:37:58 UTC (rev 141) +++ trunk/skin/simple/framework_skin.php 2007-05-01 20:19:00 UTC (rev 142) @@ -50,25 +50,45 @@ // Gestion des multipages $smarty->register_function('precedent', '_multipage_prec'); $smarty->register_function('suivant', '_multipage_suiv'); +$smarty->register_function('pagination', '_multipage_pagination'); -function start_multi($lien,$step){ -global $_multipage_lien, $_multipage_step, $_GET, $min, $smarty; - $_multipage_lien = $lien; - $_multipage_step = $step; +function start_multi($lien,$step,$total=0){ +global $_multipage, $_GET, $min, $smarty; (isset($_GET['start'])?$min=$_GET['start']:$min=0); - $smarty->assign('MIN',&$min); + $_multipage['lien'] = $lien; + $_multipage['step'] = $step; + $_multipage['total'] = $total; + $_multipage['nb_page'] = ceil($total/$step); + $_multipage['current_page'] = ceil(($min/$step)+1); + $_multipage['is_last_page'] = ($_multipage['current_page']==$_multipage['nb_page']); + $_multipage['is_first_page'] = ($_multipage['current_page']==1); + $_multipage['min_max'] = $step*($_multipage['nb_page']-1); + $smarty->assign('_multipage',$_multipage); + $smarty->assign_by_ref('MIN',$min); } function _multipage_prec(){ -global $_multipage_lien, $_multipage_step, $MENU_ALT, $INTERFACE_REP, $min, $LINK; - echo '<a href="'.$_multipage_lien.'&start='.max(0,$min-$_multipage_step).'" onfocus=\'aide="Page pr\xE9c\xE9dente";\'><img src="'.$INTERFACE_REP.'btn_vert.gif" border="0"> <font size="2">Pr\xE9c\xE9dent</font></a>'; - $LINK['green']=$_multipage_lien.'&start='.max(0,$min-$_multipage_step); +global $_multipage, $INTERFACE_REP, $min, $LINK; + if(!$_multipage['is_first_page']){ + $LINK['green'] = $_multipage['lien'].'&start='.max(0,$min-$_multipage['step']); + return '<a href="'.$_multipage['lien'].'&start='.max(0,$min-$_multipage['step']).'" onfocus=\'aide="Page pr\xE9c\xE9dente";\'><img src="'.$INTERFACE_REP.'btn_vert.gif" border="0"><font size="1"> Pr\xE9c\xE9dent</font></a>'; + }else{ + return false; + } } function _multipage_suiv(){ -global $_multipage_lien, $_multipage_step, $MENU_ALT, $INTERFACE_REP, $min, $LINK; - echo '<a href="'.$_multipage_lien.'&start='.($min+$_multipage_step).'" onfocus=\'aide="Page suivante";\'><img src="'.$INTERFACE_REP.'btn_bleu.gif" border="0"> <font size="2">Suivant</font></a>'; - $LINK['blue']=$_multipage_lien.'&start='.($min+$_multipage_step); +global $_multipage, $INTERFACE_REP, $min, $LINK; + if(!$_multipage['is_last_page']){ + $LINK['blue'] = $_multipage['lien'].'&start='.($min+$_multipage['step']); + return '<a href="'.$_multipage['lien'].'&start='.($min+$_multipage['step']).'" onfocus=\'aide="Page suivante";\'><img src="'.$INTERFACE_REP.'btn_bleu.gif" border="0"><font size="1"> Suivant</font></a>'; + }else{ + return false; + } } - + +function _multipage_pagination(){ +global $_multipage; + return '<font size="1">Page '.$_multipage['current_page'].' / '.$_multipage['nb_page'].'</font>'; +} ?> Modified: trunk/skin/simplegreen/framework_skin.php =================================================================== --- trunk/skin/simplegreen/framework_skin.php 2007-05-01 15:37:58 UTC (rev 141) +++ trunk/skin/simplegreen/framework_skin.php 2007-05-01 20:19:00 UTC (rev 142) @@ -25,21 +25,21 @@ } $smarty->assign('BACKGROUND_REP',$BACKGROUND_REP); - // Fond d'\xE9cran par d\xE9faut - path d\xE9finit \xE0 partir du r\xE9pertoire /http/skin/simple/ $BACKGROUND = $_COULEUR['BACKGROUND']; // Fonction responsable de l'affichage du fond d'\xE9cran \xE0 la toute fin du processus de conception de la page (post-filtre de smarty) function background($output, &$smarty){ - global $contenu_html, $BACKGROUND, $BACKGROUND_REP, $SKIN_REP, $BACKGROUND_TYPE, $FORCED, $_SERVER, $BACK_DONE; + global $contenu_html, $BACKGROUND, $BACKGROUND_REP, $SKIN_REP, $BACKGROUND_TYPE, $FORCED, $_SERVER, $BACK_DONE, $smarty; if(((eregi("stop",$contenu_html) AND $BACKGROUND!="none" AND realpath($BACKGROUND_REP.$BACKGROUND)!='') OR $FORCED) AND !$BACK_DONE){ - if($BACKGROUND_TYPE == 'add'){ + if($BACKGROUND_TYPE == 'add'){ play_fichier('type=21&temps=8000',realpath($BACKGROUND_REP.$BACKGROUND),1,'photo'); }else{ play_fichier('type=20&temps=8000',realpath($BACKGROUND_REP.$BACKGROUND),1,'photo'); } //Pour ne pas lancer deux fois le background $BACK_DONE = 1; + } return($output); } @@ -50,25 +50,45 @@ // Gestion des multipages $smarty->register_function('precedent', '_multipage_prec'); $smarty->register_function('suivant', '_multipage_suiv'); +$smarty->register_function('pagination', '_multipage_pagination'); -function start_multi($lien,$step){ -global $_multipage_lien, $_multipage_step, $_GET, $min, $smarty; - $_multipage_lien = $lien; - $_multipage_step = $step; +function start_multi($lien,$step,$total=0){ +global $_multipage, $_GET, $min, $smarty; (isset($_GET['start'])?$min=$_GET['start']:$min=0); - $smarty->assign('MIN',&$min); + $_multipage['lien'] = $lien; + $_multipage['step'] = $step; + $_multipage['total'] = $total; + $_multipage['nb_page'] = ceil($total/$step); + $_multipage['current_page'] = ceil(($min/$step)+1); + $_multipage['is_last_page'] = ($_multipage['current_page']==$_multipage['nb_page']); + $_multipage['is_first_page'] = ($_multipage['current_page']==1); + $_multipage['min_max'] = $step*($_multipage['nb_page']-1); + $smarty->assign('_multipage',$_multipage); + $smarty->assign_by_ref('MIN',$min); } function _multipage_prec(){ -global $_multipage_lien, $_multipage_step, $MENU_ALT, $INTERFACE_REP, $min, $LINK; - $MENU_ALT[]=array('lien'=>$_multipage_lien.'&start='.max(0,$min-$_multipage_step), 'nom'=>'<img src="'.$INTERFACE_REP.'btn_vert.gif" border="0"> Pr\xE9c\xE9dent', 0,'front_pannel'=>'Pr\xE9c\xE9dent'); - $LINK['green']=$_multipage_lien.'&start='.max(0,$min-$_multipage_step); +global $_multipage, $INTERFACE_REP, $min, $LINK; + if(!$_multipage['is_first_page']){ + $LINK['green'] = $_multipage['lien'].'&start='.max(0,$min-$_multipage['step']); + return '<a href="'.$_multipage['lien'].'&start='.max(0,$min-$_multipage['step']).'" onfocus=\'aide="Page pr\xE9c\xE9dente";\'><img src="'.$INTERFACE_REP.'btn_vert.gif" border="0"><font size="1"> Pr\xE9c\xE9dent</font></a>'; + }else{ + return false; + } } function _multipage_suiv(){ -global $_multipage_lien, $_multipage_step, $MENU_ALT, $INTERFACE_REP, $min, $LINK; - $MENU_ALT[]=array('lien'=>$_multipage_lien.'&start='.($min+$_multipage_step), 'nom'=>'<img src="'.$INTERFACE_REP.'btn_bleu.gif" border="0"> Suivant', 0,'front_pannel'=>'Suivant'); - $LINK['blue']=$_multipage_lien.'&start='.($min+$_multipage_step); +global $_multipage, $INTERFACE_REP, $min, $LINK; + if(!$_multipage['is_last_page']){ + $LINK['blue'] = $_multipage['lien'].'&start='.($min+$_multipage['step']); + return '<a href="'.$_multipage['lien'].'&start='.($min+$_multipage['step']).'" onfocus=\'aide="Page suivante";\'><img src="'.$INTERFACE_REP.'btn_bleu.gif" border="0"><font size="1"> Suivant</font></a>'; + }else{ + return false; + } } - + +function _multipage_pagination(){ +global $_multipage; + return '<font size="1">Page '.$_multipage['current_page'].' / '.$_multipage['nb_page'].'</font>'; +} ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |