Moving to GitHub.
[platal.git] / plugins / function.display_education.php
index 160f99c..752c5e7 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2014 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
  ***************************************************************************/
 
 
-function display_education($name, $url, $degree, $grad_year, $field, $program, $sexe, $long)
+function display_education($name, $url, $degree, $gradYear, $field, $program, $full)
 {
     $field = strtolower($field);
-    $txt = "";
+    $txt = '';
 
-    if ($grad_year || $field || $program) {
-        $txt .= "<span title=\"(";
+    if (($degree != 'Ing.') && ($degree != 'Dipl.')) {
+        $txt .= $degree;
+        if ($name) {
+            $txt .= ' ';
+        }
+    }
+    if ($url != '') {
+        $txt .= '<a href="' . $url . '" target="_blank">' . $name . '</a>';
+    } else {
+        $txt .= $name;
+    }
+
+    if ($gradYear || $field || $program) {
+        $details = '';
         if ($program) {
-            $txt .= $program;
-            if ($grad_year || $field) {
-                $txt .= ", ";
+            $details .= $program;
+            if ($gradYear || $field) {
+                $details .= ', ';
             }
         }
-        if ($grad_year) {
-            if ($sexe) {
-                $txt .= "diplômée en $grad_year";
-            } else {
-                $txt .= "diplômé en $grad_year";
-            }
+        if ($gradYear) {
+            $details .= $gradYear;
             if ($field) {
-                $txt .= ", ";
+                $details .= ', ';
             }
         }
         if ($field) {
-            $txt .= "domaine : $field";
+            $details .= $field;
         }
-        $txt .= ")\">";
-    }
 
-    if (($degree != "Lic.") || ($long)) {
-        if (($degree != "Ing.") && ($degree != "Dipl.")) {
-            $txt .= $degree;
-        }
-        if ($name) {
-            $txt .= ' ';
-        }
-        if ($url != '') {
-            $txt .= "<a href=\"$url\" onclick=\"return popup(this)\">$name</a>";
+        if ($full) {
+            $txt .= ' <small>(' . $details . ')</small>';
         } else {
-            $txt .= $name;
+            $txt = '<span title="' . $details . '">' . $txt . '</span>';
         }
     }
-    if ($grad_year || $field || $program) {
-        $txt .= "</span>";
-    }
 
     return $txt;
 }
 
-function smarty_function_display_education($params, &$smarty)
+function smarty_function_display_education($params, $smarty)
 {
-    $params  = new PlDict($params);
-    $edu     = $params->v('edu');
-    if (!$params->has('sex')) {
-        $profile = $params->v('profile');
-        $sex = $profile->isFemale();
-    } else {
-        $sex = $params->b('sex');
-    }
+    $params = new PlDict($params);
+    $edu = $params->v('edu');
     return display_education(($edu->school_short == '') ?  $edu->school : $edu->school_short,
                              $edu->school_url, $edu->degree_short, $edu->grad_year,
-                             $edu->field, $edu->program, $sex, $params->b('long'));
+                             $edu->field, $edu->program, $params->b('full'));
 }
 
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
 ?>