本文整理汇总了PHP中Summit::Presentations方法的典型用法代码示例。如果您正苦于以下问题:PHP Summit::Presentations方法的具体用法?PHP Summit::Presentations怎么用?PHP Summit::Presentations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Summit
的用法示例。
在下文中一共展示了Summit::Presentations方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createSummitJSON
/**
* @param Summit $s
* @return array
*/
protected function createSummitJSON(Summit $s)
{
$page = SummitPage::get()->filter('SummitID', $s->ID)->first();
$image = null;
if ($page) {
$image = $page->SummitImage()->Image();
}
return ['id' => $s->ID, 'title' => $s->Title, 'dates' => $s->getSummitDateRange(), 'videoCount' => PresentationVideo::get()->filter(['DisplayOnSite' => true, 'Processed' => true, 'PresentationID' => $s->Presentations()->column('ID')])->count(), 'imageURL' => $image && $image->exists() && Director::fileExists($image->Filename) ? $image->CroppedImage(263, 148)->URL : 'summit-video-app/production/images/placeholder-image.jpg'];
}
示例2: createSummitJSON
/**
* @param Summit $s
* @return array
*/
protected function createSummitJSON(Summit $s)
{
$page = SummitPage::get()->filter('SummitID', $s->ID)->first();
$image = null;
if ($page) {
$image = $page->SummitImage()->Image();
}
$tracks = array_map(function ($t) {
return ['id' => $t->ID, 'slug' => $t->Slug, 'title' => $t->Title, 'has_videos' => 0];
}, $s->Categories()->toArray());
$videos = PresentationVideo::get()->filter(['DisplayOnSite' => true, 'Processed' => true])->sort('DateUploaded', 'DESC')->innerJoin('Presentation', 'Presentation.ID = PresentationMaterial.PresentationID')->innerJoin('SummitEvent', 'SummitEvent.ID = PresentationMaterial.PresentationID')->filter('SummitEvent.SummitID', $s->ID);
$videos_groupedby_track = GroupedList::create($videos)->groupBy('Track');
foreach ($tracks as &$track) {
if (array_key_exists($track['title'], $videos_groupedby_track)) {
$track['has_videos'] = 1;
}
}
return ['id' => $s->ID, 'title' => $s->Title, 'dates' => $s->getSummitDateRange(), 'videoCount' => PresentationVideo::get()->filter(['DisplayOnSite' => true, 'Processed' => true, 'PresentationID' => $s->Presentations()->column('ID')])->count(), 'imageURL' => $image && $image->exists() && Director::fileExists($image->Filename) ? $image->CroppedImage(263, 148)->URL : 'summit-video-app/production/images/placeholder-image.jpg', 'slug' => $s->Slug, 'tracks' => $tracks];
}