当前位置: 首页>>代码示例>>PHP>>正文


PHP ElggObject::getEventDays方法代码示例

本文整理汇总了PHP中ElggObject::getEventDays方法的典型用法代码示例。如果您正苦于以下问题:PHP ElggObject::getEventDays方法的具体用法?PHP ElggObject::getEventDays怎么用?PHP ElggObject::getEventDays使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ElggObject的用法示例。


在下文中一共展示了ElggObject::getEventDays方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateEvent

 /**
  * After the event is updated in the database make sure the owned entities have the same access_id
  *
  * @param string      $event  the name of the event
  * @param string      $type   the type of the event
  * @param \ElggObject $entity the affected object
  *
  * @return void
  */
 public static function updateEvent($event, $type, $entity)
 {
     if (!$entity instanceof \Event) {
         return;
     }
     $org_attributes = $entity->getOriginalAttributes();
     if (elgg_extract('access_id', $org_attributes) === null) {
         // access wasn't updated
         return;
     }
     // ignore access for this part
     $ia = elgg_set_ignore_access(true);
     $days = $entity->getEventDays();
     if (!empty($days)) {
         foreach ($days as $day) {
             $day->access_id = $entity->access_id;
             $day->save();
             $slots = $day->getEventSlots();
             if (empty($slots)) {
                 continue;
             }
             foreach ($slots as $slot) {
                 $slot->access_id = $entity->access_id;
                 $slot->save();
             }
         }
     }
     $questions = $entity->getRegistrationFormQuestions();
     if (!empty($questions)) {
         foreach ($questions as $question) {
             $question->access_id = $entity->access_id;
             $question->save();
         }
     }
     // restore access
     elgg_set_ignore_access($ia);
 }
开发者ID:coldtrick,项目名称:event_manager,代码行数:46,代码来源:Access.php

示例2: 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;
}
开发者ID:pleio,项目名称:event_manager,代码行数:76,代码来源:functions.php


注:本文中的ElggObject::getEventDays方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。