Adds function to retrieve the year of the promotion..
authorStéphane Jacob <sj@m4x.org>
Sat, 27 Feb 2010 12:45:33 +0000 (13:45 +0100)
committerStéphane Jacob <sj@m4x.org>
Sun, 28 Feb 2010 16:12:01 +0000 (17:12 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
classes/profile.php
classes/user.php

index 8ebf639..1853fa4 100644 (file)
@@ -113,6 +113,11 @@ class Profile
         return $this->promo;
     }
 
+    public function yearpromo()
+    {
+        return intval(substr($this->promo, 1, 4));
+    }
+
     /** Print a name with the given formatting:
      * %s = • for women
      * %f = firstname
index 17ee862..77bacbf 100644 (file)
@@ -277,6 +277,14 @@ class User extends PlUser
         return $this->profile()->promo();
     }
 
+    public function yearpromo()
+    {
+        if (!$this->hasProfile()) {
+            return 0;
+        }
+        return $this->profile()->yearpromo();
+    }
+
     public function firstName()
     {
         if (!$this->hasProfile()) {