From d7019213803781a16a083cb3403243dfbb4095f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Sun, 29 Jul 2007 10:18:31 +0000 Subject: [PATCH] Gestion generique de la navigation Fiche suivante-Precedente --- htdocs/html.form.class.php | 23 ++++++++++++++++++++++- htdocs/product/fiche.php | 8 +------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index c8c9fcc1683..e00e8821014 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -3322,7 +3322,28 @@ class Form $select_month .= '</select>'; return $select_month; } - + + /** + * \brief Affiche tableau avec ref et bouton navigation pour un objet metier + * \param object Objet a afficher + * \return string Portion HTML avec ref + boutons nav + */ + function showrefnav($object) + { + $ret=''; + + $object->load_previous_next_ref($object->next_prev_filter); + $previous_ref = $object->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.urlencode($object->ref_previous).'">'.img_previous().'</a>':''; + $next_ref = $object->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.urlencode($object->ref_next).'">'.img_next().'</a>':''; + + if ($previous_ref || $next_ref) $ret.='<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">'; + $ret.=$object->getNomUrl(1); + if ($previous_ref || $next_ref) { + $ret.='</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td>'; + $ret.='<td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>'; + } + return $ret; + } } ?> diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 7e836708b1d..aa644658e95 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -628,9 +628,6 @@ if ($_GET["id"] || $_GET["ref"]) print($mesg); - $product->load_previous_next_ref($product->next_prev_filter); - $previous_ref = $product->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.urlencode($product->ref_previous).'">'.img_previous().'</a>':''; - $next_ref = $product->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?ref='.urlencode($product->ref_next).'">'.img_next().'</a>':''; } if ($_GET["action"] <> 'edit' && $product->canvas <> '') { @@ -657,12 +654,9 @@ if ($_GET["id"] || $_GET["ref"]) // Reference print '<td width="15%">'.$langs->trans("Ref").'</td><td width="85%">'; - if ($previous_ref || $next_ref) print '<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">'; - print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">'.$product->ref.'</a>'; - if ($previous_ref || $next_ref) print '</td><td class="nobordernopadding" align="center" width="20">'.$previous_ref.'</td><td class="nobordernopadding" align="center" width="20">'.$next_ref.'</td></tr></table>'; + print $html->showrefnav($product); print '</td>'; - $nblignes=6; if ($product->isproduct() && $conf->stock->enabled) $nblignes++; if ($product->isservice()) $nblignes++; -- GitLab