/** * @param $Occurrence Occurrence identifier. * @return array Attendees, defined by fields: * - 'name' string Name of attendee. * - 'link' string URL about user. * - 'entity_id' int Entity id if known. * - 'attend' bool,NULL TRUE for attending, FALSE for not attending, NULL for maybe. */ function GetOccurrenceAttendanceList($Occurrence) { if ('e' === substr($Occurrence, 0, 1)) { $event = substr($Occurrence, 1); if (is_numeric($event)) { // get the list of members. $CI =& get_instance(); try { // Get the ids + statuses of event members $fb_attendings = $CI->facebook->Client->fql_query('SELECT uid, rsvp_status ' . 'FROM event_member ' . 'WHERE eid = ' . (int) $event); // there are only attendees if people are members if (true || !empty($fb_attendings)) { $fb_attendees = $CI->facebook->Client->fql_query('SELECT uid, name ' . 'FROM user ' . 'WHERE uid IN (SELECT uid, rsvp_status ' . 'FROM event_member ' . 'WHERE eid = ' . (int) $event . ')'); $fb_friend_attendees = $CI->facebook->Client->fql_query('SELECT uid ' . 'FROM user ' . 'WHERE uid IN (SELECT uid, rsvp_status ' . 'FROM event_member ' . 'WHERE eid = ' . (int) $event . ') AND ' . 'uid IN (SELECT uid2 ' . 'FROM friend ' . 'WHERE uid1 = ' . $CI->facebook->Uid . 'OR uid2 = ' . $CI->facebook->Uid . ')'); //$members = $CI->facebook->Client->events_getMembers((int)$event); $attendees = array(); foreach ($fb_attendees as $attendee) { $attendees[(int) $attendee['uid']] = array('name' => $attendee['name'], 'link' => $this->ProfileUrl($attendee['uid']), 'friend' => false); } foreach ($fb_friend_attendees as $friend_attendee) { $attendees[(int) $friend_attendee['uid']]['friend'] = true; } foreach ($fb_attendings as $attending) { $attendees[(int) $attending['uid']]['attend'] = $attending['rsvp_status']; } return array_values($attendees); } else { return array(); } } catch (FacebookRestClientException $ex) { $CI->facebook->HandleException($ex); } } } return parent::GetOccurrenceAttendanceList($Occurrence); }
/** * @param $SourceId int Event source id. * @param $Occurrence Occurrence identifier. * @return array Attendees, defined by fields: * - 'name' string Name of attendee. * - 'link' string URL about user. * - 'entity_id' int Entity id if known. * - 'attend' bool,NULL TRUE for attending, FALSE for not attending, NULL for maybe. */ function GetOccurrenceAttendanceList($SourceId, $Occurrence) { if (array_key_exists($SourceId, $this->mSources)) { return $this->mSources[$SourceId]->GetOccurrenceAttendanceList($Occurrence); } else { return parent::GetOccurrenceAttendanceList($Occurrence); } }