/** * Videos function. * * @access public * @return void */ public function getVideoList() { $filter = '"ParentID" = ' . $this->ID; $limit = 3; // Build a list of all IDs for VideoGroups that are children $holderIDs = $this->VideoGroupIDs(); if ($holderIDs) { if ($filter) { $filter .= ' OR '; } $filter .= '"ParentID" IN (' . implode(',', $holderIDs) . ")"; } $order = '"SiteTree"."Title" ASC'; $entries = Video::get()->where($filter)->sort($order); $list = new PaginatedList($entries, Controller::curr()->request); $list->setPageLength($limit); return $list; }
/** * Method that returns a DataList of all * Video pages in the current VideoGroup * and all child VideoGroup pages. * Note: this isn't recursive through child * VideoGroup pages of the current VideoGroup * page. * * @access public * @param bool $all * * @return DataList */ public function getVideoList($all = false) { $groupIDS = $this->getVideoGroupIDS($all); $groupIDS[] = $this->ID; return Video::get()->filter('ParentID', $groupIDS); }
/** * @return mixed */ public function all() { return $this->video->get(); }
public function video() { $banners = $this->banners; $videos = Video::get(); return View::make('pages.video')->with(compact('banners', 'videos')); }
public function oembed(SS_HTTPRequest $request) { /*{ * "thumbnail_height": 360, * "author_name": "ZackScott", * "title": "Amazing Nintendo Facts", * "height": 270, * "provider_name": "YouTube", * "width": 480, * "html": "\u003ciframe width=\"480\" height=\"270\" src=\"http:\/\/www.youtube.com\/embed\/M3r2XDceM6A?feature=oembed\" frameborder=\"0\" allowfullscreen\u003e\u003c\/iframe\u003e", * "provider_url": "http:\/\/www.youtube.com\/", * "thumbnail_url": "http:\/\/i.ytimg.com\/vi\/M3r2XDceM6A\/hqdefault.jpg", * "type": "video", * "thumbnail_width": 480, * "author_url": "http:\/\/www.youtube.com\/user\/ZackScott", * "version": "1.0" * } */ /* { "version": "1.0", "type": "video", "provider_name": "YouTube", "provider_url": "http://youtube.com/", "width": 425, "height": 344, "title": "Amazing Nintendo Facts", "author_name": "ZackScott", "author_url": "http://www.youtube.com/user/ZackScott", "html": "<object width=\"425\" height=\"344\"> <param name=\"movie\" value=\"http://www.youtube.com/v/M3r2XDceM6A&fs=1\"></param> <param name=\"allowFullScreen\" value=\"true\"></param> <param name=\"allowscriptaccess\" value=\"always\"></param> <embed src=\"http://www.youtube.com/v/M3r2XDceM6A&fs=1\" type=\"application/x-shockwave-flash\" width=\"425\" height=\"344\" allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed> </object>", }*/ // get video object by ID if ($this->request->param('ID') && ($vid = Video::get()->byID((int) $this->request->param('ID')))) { // get some references $thumbnail = $vid->Poster(); $html = $vid->renderWith('VideoTag'); // build embed $embed = new stdClass(); $embed->version = "1.0"; $embed->type = "video"; $embed->title = $vid->Name; $embed->width = $thumbnail->getWidth(); $embed->height = $thumbnail->getHeight(); $embed->html = "{$html}"; $embed->thumbnail_height = $thumbnail->getWidth(); $embed->thumbnail_width = $thumbnail->getHeight(); $embed->thumbnail_url = $thumbnail->getAbsoluteURL(); // Format response with json $response = new SS_HTTPResponse(Convert::raw2json($embed)); $response->addHeader('Content-Type', 'application/json'); return $response; } else { return $this->httpError(404); } }