-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathVideoGroupController.php
71 lines (61 loc) · 1.51 KB
/
VideoGroupController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
namespace Dynamic\HTML5Video\Pages;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Core\Config\Config;
use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\FieldType\DBHTMLText;
use SilverStripe\ORM\PaginatedList;
/**
* Class VideoGroup_Controller
* @package Dynamic\HTML5Video\Pages
*
* @mixin \Dynamic\HTML5Video\Pages\VideoGroup
*/
class VideoGroupController extends \PageController
{
/**
* @var array
*/
private static $allowed_actions = [
'index',
];
/**
*
*/
public function init()
{
parent::init();
}
/**
* @param HTTPRequest $request
* @return array|DBHTMLText
*/
public function index(HTTPRequest $request)
{
$videos = PaginatedList::create(
$this->getVideoList(),
$request
)->setPageLength(Config::inst()->get(VideoGroup::class, 'page_length'))
->setPaginationGetVar(Config::inst()->get(VideoGroup::class, 'pagination_get_var'));
$data = [
'VideoList' => $videos,
];
if ($request->isAjax()) {
return $this->customise($data)->renderWith('VideoList');
}
return $data;
}
/**
* Method called from the layout that can be passed
* a boolean variable to override the default behavior
* of getChildGroups().
*
* @param bool $all
*
* @return ArrayList
*/
public function SubGroups($all = false)
{
return $this->getChildGroups($all);
}
}