function __construct($ICalendarData = '', $SourceId)
 {
     parent::__construct();
     $this->SetSourceId($SourceId);
     $this->mName = 'iCalendar file';
     //$this->mCapabilities[] = 'attend';
     $this->SetIcalData($ICalendarData);
 }
 /**
  * @param $Event Event identifier.
  * @return RecurrenceSet,NULL.
  */
 function GetEventRecur(&$Event)
 {
     if (is_numeric($Event)) {
         $CI =& get_instance();
         $RecurrenceInfo = $CI->recurrence_model->SelectRecurByEvent($Event);
         $RecurrenceSet = new RecurrenceSet();
         $RecurrenceSet->SetRecurData($RecurrenceInfo);
         return $RecurrenceSet;
     } else {
         return parent::GetEventRecur($Event);
     }
 }
 /**
  * @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);
 }
 function AmmendEvent($Event, $Changes)
 {
     if (array_key_exists($Event->Source->GetSourceId(), $this->mSources)) {
         return $this->mSources[$Event->Source->GetSourceId()]->AmmendEvent($Event, $Changes);
     } else {
         return parent::AmmendEvent($Event, $Changes);
     }
 }