]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Show Event attendees in mini-list
authorEvan Prodromou <evan@status.net>
Thu, 29 Sep 2011 19:12:30 +0000 (15:12 -0400)
committerEvan Prodromou <evan@status.net>
Thu, 29 Sep 2011 19:12:30 +0000 (15:12 -0400)
classes/Profile.php
plugins/Event/event.css
plugins/Event/eventlistitem.php

index f983225fd5df7a341c29915eee2bf81d0820b4c0..7ccfa72166e0c4cead17f7dd2bc15248f4c91034 100644 (file)
@@ -1454,4 +1454,8 @@ class Profile extends Managed_DataObject
     {
         return $this;
     }
+
+    static function pivotGet($key, $values, $otherCols=array()) {
+        return Memcached_DataObject::pivotGet('Profile', $key, $values, $otherCols);
+    }
 }
index 7fbb67d732f61ea8998f3c3d2c491b2d5668b396..3cad53c590309f2b42ab889f4b5466cd7c5165a7 100644 (file)
     overflow-x: hidden;
     /* add padding to account for vertical scrollbar */
     padding-right: 20px;
-}
\ No newline at end of file
+}
+
+li.rsvp-list ul.entities {
+    float:left;
+    width:100%;
+    display:inline;
+}
+li.rsvp-list .entities li {
+    list-style-type: none;
+    float: left;
+    margin-right: 3px;
+    margin-bottom: 8px;
+    display: inline;
+}
+li.rsvp-list .entities li .photo {
+    margin: 0;
+}
+li.rsvp-list .entities li .fn {
+    display: none;
+}
index fb27704461378cc788c47a2754a7c572c7829574..2f0710f01f520a91c118c2c6d85c48b3dfb7a30f 100644 (file)
@@ -152,14 +152,39 @@ class EventListItem extends NoticeListItemAdapter
 
         $out->elementStart('div', 'event-rsvps');
         // TRANS: Field label for event description.
-        $out->element('strong', null, _m('Attending:'));
-        $out->element('span', 'event-rsvps',
-                      // TRANS: RSVP counts.
-                      // TRANS: %1$d, %2$d and %3$d are numbers of RSVPs.
-                      sprintf(_m('Yes: %1$d No: %2$d Maybe: %3$d'),
-                              count($rsvps[RSVP::POSITIVE]),
-                              count($rsvps[RSVP::NEGATIVE]),
-                              count($rsvps[RSVP::POSSIBLE])));
+
+        $out->text(_('Attending:'));
+        $out->elementStart('ul', 'attending-list');
+
+        foreach ($rsvps as $verb => $responses) {
+            $out->elementStart('li', 'rsvp-list');
+            switch ($verb)
+            {
+            case RSVP::POSITIVE:
+                $out->text(_('Yes:'));
+                break;
+            case RSVP::NEGATIVE:
+                $out->text(_('No:'));
+                break;
+            case RSVP::POSSIBLE:
+                $out->text(_('Maybe:'));
+                break;
+            }
+            $ids = array();
+            foreach ($responses as $response) {
+                $ids[] = $response->profile_id;
+            }
+            common_debug("IDS = " . implode(',', $ids));
+            $profiles = Profile::pivotGet('id', $ids);
+            common_debug("Profiles = " . print_r($profiles, true));
+            $profile  = new ArrayWrapper(array_values($profiles));
+            $minilist = new ProfileMiniList($profile, $out);
+            $minilist->show();
+
+            $out->elementEnd('li');
+        }
+
+        $out->elementEnd('ul');
         $out->elementEnd('div');
 
         $user = common_current_user();