Gestion generique de la navigation Fiche suivante-Precedente
This commit is contained in:
parent
d57e2e3997
commit
d8754400d8
@ -51,6 +51,7 @@ class Adherent
|
||||
var $error;
|
||||
var $errors=array();
|
||||
|
||||
var $ref;
|
||||
var $prenom;
|
||||
var $nom;
|
||||
var $fullname;
|
||||
@ -686,7 +687,7 @@ class Adherent
|
||||
|
||||
|
||||
/**
|
||||
* \brief Fonction qui récupére l'adhérent en donnant son login
|
||||
* \brief Fonction qui récupére l'adhérent depuis son login
|
||||
* \param login login de l'adhérent
|
||||
*/
|
||||
function fetch_login($login)
|
||||
@ -744,6 +745,7 @@ class Adherent
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->ref = $obj->rowid;
|
||||
$this->id = $obj->rowid;
|
||||
$this->prenom = $obj->prenom;
|
||||
$this->nom = $obj->nom;
|
||||
@ -1915,7 +1917,7 @@ class Adherent
|
||||
* \param filter filtre
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function load_previous_next_id($filter='')
|
||||
function load_previous_next_ref($filter='')
|
||||
{
|
||||
$sql = "SELECT MAX(rowid)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent";
|
||||
@ -1928,7 +1930,7 @@ class Adherent
|
||||
return -1;
|
||||
}
|
||||
$row = $this->db->fetch_row($result);
|
||||
$this->id_previous = $row[0];
|
||||
$this->ref_previous = $row[0];
|
||||
|
||||
$sql = "SELECT MIN(rowid)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent";
|
||||
@ -1941,7 +1943,7 @@ class Adherent
|
||||
return -2;
|
||||
}
|
||||
$row = $this->db->fetch_row($result);
|
||||
$this->id_next = $row[0];
|
||||
$this->ref_next = $row[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -882,7 +882,7 @@ if ($rowid && $action != 'edit')
|
||||
// Ref
|
||||
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td class="valeur" colspan="2">';
|
||||
print $html->showrefnav($adh);
|
||||
print $html->showrefnav($adh,'rowid');
|
||||
print '</td></tr>';
|
||||
|
||||
// Nom
|
||||
|
||||
@ -3326,15 +3326,16 @@ class Form
|
||||
/**
|
||||
* \brief Affiche tableau avec ref et bouton navigation pour un objet metier
|
||||
* \param object Objet a afficher
|
||||
* \param paramid Nom du parametre a utiliser pour nommer id dans liens URL
|
||||
* \return string Portion HTML avec ref + boutons nav
|
||||
*/
|
||||
function showrefnav($object)
|
||||
function showrefnav($object,$paramid='ref')
|
||||
{
|
||||
$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>':'';
|
||||
$previous_ref = $object->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).'">'.img_previous().'</a>':'';
|
||||
$next_ref = $object->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.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(0);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user