Merge commit 'origin/master' into fusionax
[platal.git] / plugins / function.display_phones.php
similarity index 50%
rename from plugins/function.geoloc_region.php
rename to plugins/function.display_phones.php
index 1a66dae..b676d50 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-function smarty_function_geoloc_region($params, &$smarty) {
-    require_once 'geoloc.inc.php';
-    if(!isset($params['country']) || !isset($params['region'])) {
-        return;
+function smarty_function_display_phones($param, &$smarty)
+{
+    $txthtml = "";
+    if (count($param['tels'])) {
+        foreach ($param['tels'] as $tel) {
+            $tel_type = ($param['dcd'] ? 'Dernier ' : '');
+            switch ($tel['tel_type']) {
+              case 'fixed':
+                $tel_type .= 'Tél';
+                break;
+              case 'fax':
+                $tel_type .= 'Fax';
+                break;
+              case 'mobile':
+                $tel_type .= 'Mob';
+                break;
+              default:
+                $tel_type .= $tel['tel_type'];
+            }
+            $txthtml .= "<div>\n<em>" . $tel_type . "&nbsp;: </em>\n<strong>" . $tel['tel'] . "</strong>\n";
+            $comment = "";
+            if ($tel['comment'] != "") {
+                $commentHtml = str_replace(array('&', '"'), array('&amp;', '&quot;'), $tel['comment']);
+                $commentJs = str_replace(array('\\', '\''), array('\\\\', '\\\''), $commentHtml);
+                $txthtml .= "<img style=\"margin-left: 5px;\" src=\"images/icons/comments.gif\""
+                            . " onmouseover=\"return overlib('"
+                            . $commentJs
+                            . "',WIDTH,250);\""
+                            . " onmouseout=\"nd();\""
+                            . " alt=\"Commentaire\" title=\""
+                            . $commentHtml
+                            . "\"/>\n";
+            }
+            $txthtml .= "</div>\n";
+        }
     }
-    return geoloc_region($params['country'], $params['region'], @$params['available']);
+    return $txthtml;
 }
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: