From fda3b17b032b67e0ccfbaa3aa6ec6e4ee5a17f70 Mon Sep 17 00:00:00 2001 From: Michael Francis Date: Sat, 16 Jul 2011 00:50:36 -0400 Subject: Implemented mySQL based friending --- models/Friends.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 models/Friends.php (limited to 'models/Friends.php') diff --git a/models/Friends.php b/models/Friends.php new file mode 100644 index 0000000..67d747a --- /dev/null +++ b/models/Friends.php @@ -0,0 +1,32 @@ + array('keys' => array('FromUserId' => 'id'))); + + /** + * Returns the opposite value of whatever is passed in (like an enum) + * @param Mixed $input + * @return String or Int; + */ + public static function status($input) { + if (is_int($input)) { + switch($input) { + case "rejected": return 0; + case "accepted": return 1; + case "open": return 2; + } + } + else { + switch($input) { + case 0: return "rejected"; + case 1: return "accepted"; + case 2: return "open"; + } + } + } +} +?> \ No newline at end of file -- cgit v1.2.3