]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
work in progress: prepping for storage of extended profile details
authorBrion Vibber <brion@pobox.com>
Thu, 3 Feb 2011 01:29:34 +0000 (17:29 -0800)
committerBrion Vibber <brion@pobox.com>
Thu, 3 Feb 2011 01:29:34 +0000 (17:29 -0800)
plugins/ExtendedProfile/Profile_detail.php [new file with mode: 0644]
plugins/ExtendedProfile/extendedprofile.php

diff --git a/plugins/ExtendedProfile/Profile_detail.php b/plugins/ExtendedProfile/Profile_detail.php
new file mode 100644 (file)
index 0000000..ae8cdce
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+/* 
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+class Profile_detail extends Memcached_DataObject
+{
+    public $id;
+    public $profile_id;
+    public $field;
+    public $index; // relative ordering of multiple values in the same field
+    public $value; // primary text value
+    public $rel; // detail for some field types; eg "home", "mobile", "work" for phones or "aim", "irc", "xmpp" for IM
+    public $ref_profile; // for people types, allows pointing to a known profile in the system
+
+}
\ No newline at end of file
index 18fef20331f8ff3900d77a46bd6b88bfac0def70..7f69f90899237e479cb8e09d276352a41d4d5343 100644 (file)
@@ -23,6 +23,25 @@ if (!defined('STATUSNET')) {
 
 class ExtendedProfile
 {
+    function __construct(Profile $profile)
+    {
+        $this->profile = $profile;
+        $this->sections = $this->getSections();
+        $this->fields = $this->loadFields();
+    }
+
+    function loadFields()
+    {
+        $detail = new Profile_detail();
+        $detail->profile_id = $this->profile->id;
+        $detail->find();
+        
+        while ($detail->get()) {
+            $fields[$detail->field][] = clone($detail);
+        }
+        return $fields;
+    }
+
     function getSections()
     {
         return array(