diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php
index 12a40054b04..e20526f9e70 100644
--- a/htdocs/adherents/fiche.php
+++ b/htdocs/adherents/fiche.php
@@ -613,7 +613,7 @@ if ($action == 'edit')
dol_fiche_head($head, 'general', $langs->trans("Member"));
- $rowspan=14;
+ $rowspan=15;
$rowspan+=sizeof($adho->attribute_label);
if ($conf->societe->enabled) $rowspan++;
@@ -643,17 +643,10 @@ if ($action == 'edit')
// Photo
print '
';
- if (file_exists($conf->adherent->dir_output."/".$adh->id.".jpg"))
- {
- print ' ';
- }
- else
- {
- print ' ';
- }
+ print $html->showphoto('member',$adh);
if ($caneditfieldmember)
{
- print '
| '.$langs->trans("PhotoFile").' | ';
+ print '
';
@@ -1042,14 +1035,7 @@ if ($rowid && $action != 'edit')
// Login
print '| '.$langs->trans("Login").' | '.$adh->login.' | ';
print '';
- if (file_exists($conf->adherent->dir_output."/".$adh->id.".jpg"))
- {
- print ' ';
- }
- else
- {
- print ' ';
- }
+ print $html->showphoto('member',$adh);
print ' | ';
print ' ';
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index ba3f08661d3..c7db4f67183 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -2775,6 +2775,49 @@ class Form
return $ret;
}
+
+ /**
+ * \brief Return HTML code to output a photo
+ * \param modulepart Id to define module concerned
+ * \param object Object containing data to retreive file name
+ * \param width Width of photo
+ * \return string HTML code to output photo
+ */
+ function showphoto($modulepart,$object,$width=100)
+ {
+ global $conf;
+
+ $ret='';$dir='';$file='';
+
+ if ($modulepart=='userphoto')
+ {
+ $dir=$conf->user->dir_output;
+ $file=$object->id.".jpg";
+ }
+ if ($modulepart=='member')
+ {
+ $dir=$conf->adherent->dir_output;
+ $file=$object->id.".jpg";
+ }
+
+ if ($dir && $file)
+ {
+ if (file_exists($dir."/".$file))
+ {
+ $ret.=' ';
+ }
+ else
+ {
+ $ret.=' ';
+ }
+ }
+ else
+ {
+ dol_print_error('','Call to showrefnav with wrong parameters');
+ }
+
+ return $ret;
+ }
}
?>
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index 10bb9bca0ab..423f614adf9 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -1105,7 +1105,7 @@ function img_delete($alt = "default")
/**
* \brief Affiche logo help avec curseur "?"
* \param usehelpcursor
- * \param usealttitle
+ * \param usealttitle Texte to use as alt title
* \return string Retourne tag img
*/
function img_help($usehelpcursor=1,$usealttitle=1)
@@ -1119,6 +1119,7 @@ function img_help($usehelpcursor=1,$usealttitle=1)
if (is_string($usealttitle)) $s.=' alt="'.$usealttitle.'" title="'.$usealttitle.'"';
else $s.=' alt="'.$langs->trans("Info").'" title="'.$langs->trans("Info").'"';
}
+ else $s.=' alt=""';
$s.='>';
return $s;
}
diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php
index 3041e2a59de..58f3ab44ab5 100644
--- a/htdocs/user/fiche.php
+++ b/htdocs/user/fiche.php
@@ -846,15 +846,9 @@ else
{
print ''.$fuser->login.' | ';
}
+ // Photo
print '';
- if (file_exists($conf->user->dir_output."/".$fuser->id.".jpg"))
- {
- print ' ';
- }
- else
- {
- print ' ';
- }
+ print $html->showphoto('userphoto',$fuser);
print ' | ';
print '';
@@ -892,7 +886,7 @@ else
}
print "\n";
- // Administrateur
+ // Administrator
print '| '.$langs->trans("Administrator").' | ';
print ''.yn($fuser->admin);
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY) && $fuser->admin && ! $fuser->entity)
@@ -1324,18 +1318,13 @@ else
print $fuser->login;
}
print ' | ';
+
+ // Photo
print '';
- if (file_exists($conf->user->dir_output."/".$fuser->id.".jpg"))
- {
- print ' ';
- }
- else
- {
- print ' ';
- }
+ print $html->showphoto('userphoto',$fuser);
if ($caneditfield)
{
- print '
| '.$langs->trans("PhotoFile").' | ';
+ print '
';
@@ -1365,7 +1354,7 @@ else
print $text;
print "\n";
- // Administrateur
+ // Administrator
print "".'| '.$langs->trans("Administrator").' | ';
if ($fuser->societe_id > 0)
{
diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php
index 7d818d74200..2059fda407e 100644
--- a/htdocs/viewimage.php
+++ b/htdocs/viewimage.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2005-2008 Laurent Destailleur
+ * Copyright (C) 2005-2009 Laurent Destailleur
* Copyright (C) 2005-2009 Regis Houssin
*
* This program is free software; you can redistribute it and/or modify
@@ -20,11 +20,11 @@
*/
/**
- \file htdocs/viewimage.php
- \brief Wrapper permettant l'affichage de fichiers images Dolibarr
- \remarks L'appel est viewimage.php?file=pathrelatifdufichier&modulepart=repfichierconcerne
- \version $Id$
-*/
+ * \file htdocs/viewimage.php
+ * \brief Wrapper permettant l'affichage de fichiers images Dolibarr
+ * \remarks L'appel est viewimage.php?file=pathrelatifdufichier&modulepart=repfichierconcerne
+ * \version $Id$
+ */
// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$action = isset($_GET["action"])?$_GET["action"]:'';
@@ -55,6 +55,7 @@ else
require("./main.inc.php");
// master.inc.php is included in main.inc.php
}
+require_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
// C'est un wrapper, donc header vierge
|
|