Gestion generique de la navigation Fiche suivante-Precedente

This commit is contained in:
Laurent Destailleur 2007-07-29 10:18:31 +00:00
parent dc54567298
commit d701921380
2 changed files with 23 additions and 8 deletions

View File

@ -3323,6 +3323,27 @@ class Form
return $select_month; 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;
}
} }
?> ?>

View File

@ -628,9 +628,6 @@ if ($_GET["id"] || $_GET["ref"])
print($mesg); 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 <> '') if ($_GET["action"] <> 'edit' && $product->canvas <> '')
{ {
@ -657,12 +654,9 @@ if ($_GET["id"] || $_GET["ref"])
// Reference // Reference
print '<td width="15%">'.$langs->trans("Ref").'</td><td width="85%">'; 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 $html->showrefnav($product);
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 '</td>'; print '</td>';
$nblignes=6; $nblignes=6;
if ($product->isproduct() && $conf->stock->enabled) $nblignes++; if ($product->isproduct() && $conf->stock->enabled) $nblignes++;
if ($product->isservice()) $nblignes++; if ($product->isservice()) $nblignes++;