Adds education related functions to Profile class.
authorStéphane Jacob <sj@m4x.org>
Thu, 25 Mar 2010 14:13:54 +0000 (15:13 +0100)
committerStéphane Jacob <sj@m4x.org>
Thu, 25 Mar 2010 16:49:43 +0000 (17:49 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
classes/profile.php

index 96cc71e..a397da7 100644 (file)
@@ -195,6 +195,25 @@ class Profile
         return intval(substr($this->promo, 1, 4));
     }
 
+    public function mainEducation()
+    {
+        return $this->promo{0};
+    }
+
+    public function mainEducationDuration()
+    {
+        switch ($this->mainEducation()) {
+          case 'X':
+            return 3;
+          case 'M':
+            return 2;
+          case 'D':
+            return 3;
+          default:
+            return 0;
+        }
+    }
+
     /** Print a name with the given formatting:
      * %s = • for women
      * %f = firstname