Small cleanup.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 6 Mar 2010 12:59:06 +0000 (13:59 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 6 Mar 2010 12:59:06 +0000 (13:59 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/profile.php
templates/include/minifiche.tpl

index f8d2781..f83f5f1 100644 (file)
@@ -195,6 +195,21 @@ class Profile
         return array_unique($vals);
     }
 
+    public function nationalities()
+    {
+        $nats = array();
+        if ($this->nationality1) {
+            $nats[] = $this->nationality1;
+        }
+        if ($this->nationality2) {
+            $nats[] = $this->nationality2;
+        }
+        if ($this->nationality3) {
+            $nats[] = $this->nationality3;
+        }
+        return $nats;
+    }
+
     public function __get($name)
     {
         if (property_exists($this, $name)) {
index f6cdc65..cebe1d3 100644 (file)
     </div>
 
     <div class="edu">
-      {if $profile->nationality1}
-      <img src='images/flags/{$profile->nationality1}.gif' alt='{$profile->nationality1}' height='11' title='{$profile->nationality1}' />&nbsp;
-      {/if}
-      {if $profile->nationality2}
-      <img src='images/flags/{$profile->nationality2}.gif' alt='{$profile->nationality2}' height='11' title='{$profile->nationality2}' />&nbsp;
-      {/if}
-      {if $profile->nationality3}
-      <img src='images/flags/{$profile->nationality3}.gif' alt='{$profile->nationality3}' height='11' title='{$profile->nationality3}' />&nbsp;
-      {/if}
+      {foreach from=$profile->nationalities() item=nat}
+      <img src='images/flags/{$nat}.gif' alt='{$nat}' height='11' title='{$nat}' />&nbsp;
+      {/foreach}
       {$profile->promo()}{*
       *}{iterate from=$profile->getExtraEducations(4) item=edu}, {education_fmt edu=$edu profile=$profile}{/iterate}{*
       *}{if $dead}, {"décédé"|sex:"décédée":$profile} le {$profile->deathdate|date_format}{/if}