rsvp_show_attendees($rsvp, $controls = TRUE)
rsvp/rsvp.module, line 489
$rid The rid of the rsvp instance.
<?php
function rsvp_show_attendees($rsvp, $controls = TRUE) {
$content = '<h2>'. t('Responses') .'</h2>';
$content .= l(t('Download RSVP List'), 'node/'. $rsvp->nid .'/rsvp/'. $rsvp->rid .'/attendees/csv');
$content .= '<br /><br />';
if ($rsvp->blind && !_rsvp_is_owner($rsvp->rid)) {
// for blind rsvps display only totals
$totals = _rsvp_attendance_totals($rsvp->rid);
foreach ($totals as $key => $value) {
if ($value) {
$list[] = $key .': '. $value;
}
}
$content .= theme('item_list', $list);
}
else {
// display full attendee info
$attendees = _rsvp_get_attendees($rsvp->rid);
while ($attendee = db_fetch_object($attendees)) {
if ($attendee->uid) {
$u = db_fetch_object(db_query("SELECT uid, name FROM {users} WHERE uid = %d", $attendee->uid));
$name = l($u->name, 'user/'. $u->uid, array('title' => t('view user')));
}
else {
// hide e-mails for system users
$user = user_load(array('uid' => $attendee->uid));
$user_name = ($user->uid == 0 ? $attendee->email : $user->name);
$name = ($controls ? $user_name : substr($attendee->email, 0, strpos($attendee->email, '@')));
}
$links = array();
if ($controls) {
$links['status'] = array(
'title' => t('status'),
'href' => 'rsvp/email/'. $attendee->hash .'/status',
'attributes' => array('title' => t('view user invite status'))
);
$links['remove'] = array(
'title' => t('remove'),
'href' => 'rsvp/email/'. $attendee->hash .'/remove',
'attributes' => array('title' => t('remove user from rsvp'))
);
$link = $name .' - '. theme('links', $links);
}
else {
$link = $name;
}
if (!$attendee->invited) {
$notsent[] = $link;
}
switch ($attendee->response) {
case 'none' :
$noreply[] = $link;
break;
case 'yes' :
$yes[] = $link;
break;
case 'no' :
$no[] = $link;
break;
case 'maybe' :
$maybe[] = $link;
break;
}
}
if ($controls && $notsent) {
$title = t('No invitation sent').' ['.l(t('Send invites'), 'node/'. $rsvp->nid .'/rsvp/'. $rsvp->rid .'/attendees/send', array('title' => t('Send invititations to uninvited users'))).']';
$content .= theme('item_list', $notsent, $title);
}
$content .= theme('item_list', $noreply, t('No response'));
$content .= theme('item_list', $yes, t('Attending'));
$content .= theme('item_list', $no, t('Not attending'));
$content .= theme('item_list', $maybe, t('Might attend'));
}
return $content;
}
?>