Display more info about education on profile pages (Closes #1186).
authorStéphane Jacob <sj@m4x.org>
Sat, 4 Sep 2010 07:50:31 +0000 (09:50 +0200)
committerStéphane Jacob <sj@m4x.org>
Sat, 4 Sep 2010 07:50:44 +0000 (09:50 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
plugins/function.display_education.php
templates/include/minifiche.tpl
templates/profile/profile.tpl

index 160f99c..4e7db2a 100644 (file)
  ***************************************************************************/
 
 
-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 . '" onclick="return popup(this)">' . $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)
 {
-    $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:
index e018b4b..0daa537 100644 (file)
@@ -64,7 +64,7 @@
       <img src='images/flags/{$code}.gif' alt='{$code}' height='11' title='{$country}' />&nbsp;
       {/foreach}
       {$profile->promo()}{*
-      *}{foreach from=$profile->getExtraEducations(4) item=edu}, {display_education edu=$edu profile=$profile}{/foreach}{*
+      *}{foreach from=$profile->getExtraEducations(4) item=edu}, {display_education edu=$edu profile=$profile full=false}{/foreach}{*
       *}{if $dead}, {"décédé"|sex:"décédée":$profile} le {$profile->deathdate|date_format}{/if}
     </div>
   </div>
index ed73b0b..926f807 100644 (file)
@@ -172,7 +172,7 @@ function chgMainWinLoc(strPage)
         &nbsp;-&nbsp;Formation&nbsp;:
         <ul>
         {foreach from=$educations item=edu}
-          <li>{display_education edu=$edu profile=$profile}</li>
+          <li>{display_education edu=$edu profile=$profile full=true}</li>
         {/foreach}
         </ul>
       {/if}