Show Event attendees in mini-list

This commit is contained in:
Evan Prodromou 2011-09-29 15:12:30 -04:00
parent 32845a1051
commit 699a90f11c
3 changed files with 57 additions and 9 deletions

View File

@ -1454,4 +1454,8 @@ class Profile extends Managed_DataObject
{ {
return $this; return $this;
} }
static function pivotGet($key, $values, $otherCols=array()) {
return Memcached_DataObject::pivotGet('Profile', $key, $values, $otherCols);
}
} }

View File

@ -14,3 +14,22 @@
/* add padding to account for vertical scrollbar */ /* add padding to account for vertical scrollbar */
padding-right: 20px; padding-right: 20px;
} }
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;
}

View File

@ -152,14 +152,39 @@ class EventListItem extends NoticeListItemAdapter
$out->elementStart('div', 'event-rsvps'); $out->elementStart('div', 'event-rsvps');
// TRANS: Field label for event description. // TRANS: Field label for event description.
$out->element('strong', null, _m('Attending:'));
$out->element('span', 'event-rsvps', $out->text(_('Attending:'));
// TRANS: RSVP counts. $out->elementStart('ul', 'attending-list');
// TRANS: %1$d, %2$d and %3$d are numbers of RSVPs.
sprintf(_m('Yes: %1$d No: %2$d Maybe: %3$d'), foreach ($rsvps as $verb => $responses) {
count($rsvps[RSVP::POSITIVE]), $out->elementStart('li', 'rsvp-list');
count($rsvps[RSVP::NEGATIVE]), switch ($verb)
count($rsvps[RSVP::POSSIBLE]))); {
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'); $out->elementEnd('div');
$user = common_current_user(); $user = common_current_user();