本文整理汇总了PHP中Schedule::setBody方法的典型用法代码示例。如果您正苦于以下问题:PHP Schedule::setBody方法的具体用法?PHP Schedule::setBody怎么用?PHP Schedule::setBody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schedule
的用法示例。
在下文中一共展示了Schedule::setBody方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateApiFromEvent
public function updateApiFromEvent(Google_Service_Calendar_Event $event, Member $member, $publicFlag)
{
$conn = $this->getConnection();
$conn->beginTransaction();
try {
$schedule = $this->findOneByApiIdUnique($event->id);
if ('cancelled' === $event->status) {
if ($schedule) {
$schedule->delete();
}
$conn->commit();
return true;
}
if (!$schedule) {
$schedule = new Schedule();
$schedule->setApiIdUnique($event->id);
} elseif ($event->etag === $schedule->api_etag) {
$conn->rollback();
return $schedule->id;
}
$schedule->setTitle($event->summary);
$schedule->setBody($event->description);
$schedule->setMember($member);
$schedule->setPublicFlag($this->getEventPublicFlag($event, $publicFlag));
if ($event->start->dateTime) {
$startDateTime = new DateTime($event->start->dateTime);
$schedule->setStartDate($startDateTime->format('Y-m-d'));
$schedule->setStartTime($startDateTime->format('H:i:s'));
} elseif ($event->start->date) {
$schedule->setStartDate($event->start->date);
}
if ($event->end->dateTime) {
$endDateTime = new DateTime($event->end->dateTime);
$schedule->setEndDate($endDateTime->format('Y-m-d'));
$schedule->setEndTime($endDateTime->format('H:i:s'));
} elseif ($event->end->date) {
$schedule->setStartDate($event->end->date);
}
$schedule->setApiEtag($event->etag);
$schedule->save();
ScheduleMemberTable::getInstance()->updateScheduleMember(array('schedule_id' => $schedule->id, 'member_id' => $schedule->member_id));
foreach ($event->attendees as $attendee) {
$memberId = opCalendarPluginToolkit::seekEmailAndGetMemberId($attendee->email);
if (!$memberId) {
continue;
}
ScheduleMemberTable::getInstance()->updateScheduleMember(array('schedule_id' => $schedule->id, 'member_id' => $memberId));
}
$conn->commit();
} catch (Exception $e) {
$conn->rollback();
throw $e;
}
return $schedule->id;
}
示例2: save
public function save($con = null)
{
$schedule = new Schedule();
$schedule->setStartDate($this->getValue('start_date'));
$schedule->setEndDate($this->getValue('start_date'));
$schedule->setTitle($this->getValue('title'));
$schedule->setBody('');
$schedule->setMember(sfContext::getInstance()->getUser()->getMember());
$scheduleMember = new ScheduleMember();
$scheduleMember->setSchedule($schedule);
$scheduleMember->setMember($schedule->Member);
$scheduleMember->save($con);
return $schedule->save($con);
}