本文整理汇总了PHP中Summit::get_most_recent方法的典型用法代码示例。如果您正苦于以下问题:PHP Summit::get_most_recent方法的具体用法?PHP Summit::get_most_recent怎么用?PHP Summit::get_most_recent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Summit
的用法示例。
在下文中一共展示了Summit::get_most_recent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: presentations
/**
* @param SS_HTTPRequest $r
*/
public function presentations(SS_HTTPRequest $r)
{
$data = [];
$speaker = null;
$key = $r->getVar('key');
if ($key) {
$username = PresentationSpeaker::hash_to_username($key);
$speaker = PresentationSpeaker::get()->filter('Member.Email', $username)->first();
} elseif ($speakerID = Session::get('UploadMedia.SpeakerID')) {
$speaker = PresentationSpeaker::get()->byID($speakerID);
}
// Speaker not found
if (!$speaker) {
return $this->httpError(404, 'Sorry, that does not appear to be a valid token.');
}
Session::set('UploadMedia.SpeakerID', $speaker->ID);
$mostRecentSummit = Summit::get_most_recent();
$presentations = $speaker->PublishedPresentations($mostRecentSummit->ID);
// No presentations
if (!$presentations->exists()) {
return $this->httpError(404, 'Sorry, it does not appear that you have any presentations.');
}
// IF there's only one presentation with no media, go ahead and forward to it's page
if ($presentations->count() == 1) {
$slide = $presentations->first()->MaterialType('PresentationSlide');
if (!$slide) {
$presentationID = $presentations->first()->ID;
return $this->redirect(Controller::join_links($this->Link(), '/presentation/', $presentationID, 'upload'));
}
}
$data['Speaker'] = $speaker;
$data['Presentations'] = $presentations;
return $this->customise($data);
}
示例2: emailattendees
/**
* @param SS_HTTPRequest $r
*/
public function emailattendees(SS_HTTPRequest $r)
{
$startTime = microtime(true);
$summit = Summit::get_most_recent();
$confirm = $r->getVar('confirm');
$limit = $r->getVar('limit');
$attendees = $summit->Attendees();
$totalBeforeLimit = $attendees->count();
$chunkSize = 100;
$offset = 0;
$appliedLimit = $confirm ? $chunkSize : ($limit ?: 50);
$attendees = $attendees->limit($appliedLimit);
while ($offset < $totalBeforeLimit) {
echo "----- new chunk ({$offset}) ----" . $this->br();
foreach ($attendees->limit($chunkSize, $offset) as $attendee) {
if (!EmailValidator::validEmail($attendee->Member()->Email)) {
echo $attendee->Member()->Email . " is not a valid email. Skipping" . $this->br();
continue;
}
$to = $attendee->Member()->Email;
$subject = "Rate OpenStack Summit sessions from {$summit->Title}";
$email = EmailFactory::getInstance()->buildEmail('do-not-reply@openstack.org', $to, $subject);
$email->setUserTemplate("rate-summit-sessions-austin");
$email->populateTemplate(['Name' => $attendee->Member()->FirstName]);
if ($confirm) {
$email->send();
} else {
//echo $email->debug();
}
echo 'Email sent to ' . $to . ' (' . $attendee->Member()->getName() . ')' . $this->br();
}
echo "---- end chunk ({$offset}) ----" . $this->br();
$offset += $chunkSize;
}
echo $this->br(3) . "Sent a sample of {$appliedLimit} emails out of {$totalBeforeLimit} total" . $this->br();
$endTime = microtime(true);
echo "Elapsed time: " . $endTime - $startTime . $this->br();
}