From 8829b862b5537fcfd85954f5e52d21ea749c0b72 Mon Sep 17 00:00:00 2001 From: Vincent Zanotti Date: Sat, 23 Aug 2008 17:41:27 +0200 Subject: [PATCH] Adds fields 'gender' and 'email_format' to the PlUser class. Signed-off-by: Vincent Zanotti --- classes/pluser.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/classes/pluser.php b/classes/pluser.php index 1dd2873..86cdf26 100644 --- a/classes/pluser.php +++ b/classes/pluser.php @@ -42,6 +42,14 @@ class UserNotFoundException extends Exception abstract class PlUser { /** + * User data enumerations. + */ + const GENDER_FEMALE = true; + const GENDER_MALE = false; + const FORMAT_HTML = "html"; + const FORMAT_TEXT = "text"; + + /** * User data storage. * By convention, null means the information hasn't been fetched yet, and * false means the information is not available. @@ -60,6 +68,10 @@ abstract class PlUser protected $full_name = null; protected $promo = null; + // Other important parameters used when sending emails. + protected $gender = null; // Acceptable values are GENDER_MALE and GENDER_FEMALE + protected $email_format = null; // Acceptable values are FORMAT_HTML and FORMAT_TEXT + // Permissions protected $perms = null; protected $perm_flags = null; @@ -137,6 +149,23 @@ abstract class PlUser return $this->full_name; } + public function promo() + { + return $this->promo; + } + + // Fallback value is GENDER_MALE. + public function isFemale() + { + return $this->gender == self::GENDER_FEMALE; + } + + // Fallback value is FORMAT_TEXT. + public function isEmailFormatHtml() + { + return $this->email_format == self::FORMAT_HTML; + } + /** * Other properties are available directly through the $data array, or as * standard object variables, using a getter. -- 2.1.4