本文整理汇总了PHP中ElggObject::exportAttendees方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggObject::exportAttendees方法的具体用法?PHP ElggObject::exportAttendees怎么用?PHP ElggObject::exportAttendees使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ElggObject
的用法示例。
在下文中一共展示了ElggObject::exportAttendees方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: event_manager_export_attendees
/**
* Export the event attendees. Returns csv body
*
* @param ElggObject $event the event
* @param string $rel relationship type
*
* @return string
*/
function event_manager_export_attendees($event, $rel = EVENT_MANAGER_RELATION_ATTENDING)
{
$old_ia = elgg_set_ignore_access(true);
$headerString = "";
$dataString = "";
$headerString .= '"' . elgg_echo('guid') . '";"' . elgg_echo('name') . '";"' . elgg_echo('email') . '";"' . elgg_echo('username') . '";"' . elgg_echo('registration date') . '"';
if ($event->registration_needed) {
if ($registration_form = $event->getRegistrationFormQuestions()) {
foreach ($registration_form as $question) {
$headerString .= ';"' . $question->title . '"';
}
}
}
if ($event->with_program) {
if ($eventDays = $event->getEventDays()) {
foreach ($eventDays as $eventDay) {
$date = date(EVENT_MANAGER_FORMAT_DATE_EVENTDAY, $eventDay->date);
if ($eventSlots = $eventDay->getEventSlots()) {
foreach ($eventSlots as $eventSlot) {
$start_time = $eventSlot->start_time;
$end_time = $eventSlot->end_time;
$start_time_hour = date('H', $start_time);
$start_time_minutes = date('i', $start_time);
$end_time_hour = date('H', $end_time);
$end_time_minutes = date('i', $end_time);
$headerString .= ';"Event activity: \'' . addslashes($eventSlot->title) . '\' ' . $date . ' (' . $start_time_hour . ':' . $start_time_minutes . ' - ' . $end_time_hour . ':' . $end_time_minutes . ')"';
}
}
}
}
}
$attendees = $event->exportAttendees($rel);
if ($attendees) {
foreach ($attendees as $attendee) {
$answerString = '';
$dataString .= '"' . $attendee->guid . '";"' . $attendee->name . '";"' . $attendee->email . '";"' . $attendee->username . '"';
$relation = check_entity_relationship($event->guid, $rel, $attendee->guid);
$dataString .= ';"' . date("d-m-Y H:i:s", $relation->time_created) . '"';
if ($event->registration_needed) {
if ($registration_form = $event->getRegistrationFormQuestions()) {
foreach ($registration_form as $question) {
$answer = $question->getAnswerFromUser($attendee->getGUID());
$answerString .= '"' . addslashes($answer->value) . '";';
}
}
$dataString .= ';' . substr($answerString, 0, strlen($answerString) - 1);
}
if ($event->with_program) {
if ($eventDays = $event->getEventDays()) {
foreach ($eventDays as $eventDay) {
if ($eventSlots = $eventDay->getEventSlots()) {
foreach ($eventSlots as $eventSlot) {
if (check_entity_relationship($attendee->getGUID(), EVENT_MANAGER_RELATION_SLOT_REGISTRATION, $eventSlot->getGUID())) {
$dataString .= ';"V"';
} else {
$dataString .= ';""';
}
}
}
}
}
}
$dataString .= PHP_EOL;
}
}
elgg_set_ignore_access($old_ia);
return $headerString . PHP_EOL . $dataString;
}