#385: Add some custom fields in vcard with binets, groupes-X and section
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Thu, 16 Nov 2006 10:42:55 +0000 (10:42 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Thu, 16 Nov 2006 10:42:55 +0000 (10:42 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1091 839d8a87-29fc-0310-9880-83ba4fa771e5

ChangeLog
include/user.func.inc.php
include/vcard.inc.php
templates/vcard.tpl

index 41f6f22..bb29706 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -46,6 +46,7 @@ Bug/Wish:
         - #532: Fix case sensitivity issues in emails processing           -FRU
 
     * Profile:
+        - #385: Add section, binets and groupes-X in vCard                 -FRU
         - #451: vCard are RFC compliant                                    -FRU
         - #502: Use 'alias' instead of 'aka' to specify the nickname       -FRU
         - #536: Can use login.promo as a valid user identifier             -FRU
@@ -59,6 +60,7 @@ Bug/Wish:
         - #490: Events can be opened to non-members                        -FRU
         - #514: Improve visibility of open events                          -FRU
         - #523: Organizer does not change when editing an event            -FRU
+        - #546: More understandable new payment form                       -FRU
 
 From 0.9.11 branch:
 
index 4f7a40a..fb7ac34 100644 (file)
@@ -386,21 +386,23 @@ function &get_user_details($login, $from_uid = '', $view = 'private')
         $user['binets_join'] = join(', ', $user['binets']);
     
         $res  = XDB::iterRow("SELECT  text, url
-                                          FROM  groupesx_ins
-                                     LEFT JOIN  groupesx_def ON groupesx_ins.gid = groupesx_def.id
-                                         WHERE  guid = {?}", $uid);
+                                FROM  groupesx_ins
+                           LEFT JOIN  groupesx_def ON groupesx_ins.gid = groupesx_def.id
+                               WHERE  guid = {?}", $uid);
         $user['gpxs'] = Array();
+        $user['gpxs_name'] = Array();
         while (list($gxt, $gxu) = $res->next()) {
             $user['gpxs'][] = $gxu ? "<a href=\"$gxu\">$gxt</a>" : $gxt;
+            $user['gpxs_name'][] = $gxt;
         } 
         $user['gpxs_join'] = join(', ', $user['gpxs']);
     }
 
     $res = XDB::iterRow("SELECT  applis_def.text, applis_def.url, applis_ins.type
-                                     FROM  applis_ins
-                               INNER JOIN  applis_def ON applis_def.id = applis_ins.aid
-                                    WHERE  uid={?}
-                                 ORDER BY  ordre", $uid);
+                           FROM  applis_ins
+                     INNER JOIN  applis_def ON applis_def.id = applis_ins.aid
+                          WHERE  uid={?}
+                       ORDER BY  ordre", $uid);
     
     $user['applis_fmt'] = Array();
     $user['formation'] = Array();
@@ -413,10 +415,10 @@ function &get_user_details($login, $from_uid = '', $view = 'private')
 
     if (has_user_right($user['medals_pub'], $view)) {
         $res = XDB::iterator("SELECT  m.id, m.text AS medal, m.type, m.img, s.gid, g.text AS grade
-                                          FROM  profile_medals_sub    AS s
-                                    INNER JOIN  profile_medals        AS m ON ( s.mid = m.id )
-                                    LEFT  JOIN  profile_medals_grades AS g ON ( s.mid = g.mid AND s.gid = g.gid )
-                                         WHERE  s.uid = {?}", $uid);
+                                FROM  profile_medals_sub    AS s
+                          INNER JOIN  profile_medals        AS m ON ( s.mid = m.id )
+                           LEFT JOIN  profile_medals_grades AS g ON ( s.mid = g.mid AND s.gid = g.gid )
+                               WHERE  s.uid = {?}", $uid);
         $user['medals'] = Array();
         while ($tmp = $res->next()) {
             $user['medals'][] = $tmp;
index f876f4d..08c46c8 100644 (file)
@@ -61,6 +61,9 @@ class VCard
 
     function text_encode($text, $escape = true)
     {
+        if (is_array($text)) {
+            return implode(',', array_map(array($this, 'text_encode'), $text));
+        }
         if ($escape) {
             $text = $this->escape($text);
         }
@@ -98,7 +101,8 @@ class VCard
                 $user['forlife'].'@'.$globals->mail->domain2);
 
         $user['virtualalias'] = $res->fetchOneCell();
-
+        $user['gpxs_vcardjoin'] = join(',', array_map(array($this, 'text_encode'), $user['gpxs_name']));
+        $user['binets_vcardjoin'] = join(',', array_map(array($this, 'text_encode'), $user['binets']));
         // get photo
         if ($this->photos) {
             $res = XDB::query(
index dd9ad0e..302dc0c 100644 (file)
@@ -75,6 +75,15 @@ NOTE:(X{$vcard.promo})
 {else}
 NOTE:(X{$vcard.promo})\n{$vcard.freetext|vcard_enc}
 {/if}
+{if $vcard.section}
+X-SECTION:{$vcard.section}
+{/if}
+{if $vcard.binets_vcardjoin}
+X-BINETS:{$vcard.binets_vcardjoin}
+{/if}
+{if $vcard.gpxs_vcardjoin}
+X-GROUPS:{$vcard.gpxs_vcardjoin}
+{/if}
 {if $vcard.photo}
 PHOTO;ENCODING=b;TYPE={$vcard.photo.attachmime}:{$vcard.photo.attach|base64_encode}
 {/if}