1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Renders the filter on the movie index page |
5
|
|
|
* |
6
|
|
|
* @author Sam Stenvall <[email protected]> |
7
|
|
|
* @copyright Copyright © Sam Stenvall 2013- |
8
|
|
|
* @license https://www.gnu.org/licenses/gpl.html The GNU General Public License v3.0 |
9
|
|
|
* |
10
|
|
|
* @property MovieFilterForm $model |
11
|
|
|
*/ |
12
|
|
|
class MovieFilter extends VideoFilter |
13
|
|
|
{ |
14
|
|
|
|
15
|
|
|
protected function renderControls() |
16
|
|
|
{ |
17
|
|
|
$ctrl = Yii::app()->controller; |
18
|
|
|
|
19
|
|
|
// Wrap the movie name typeahead field in a container so we can style it |
20
|
|
|
echo CHtml::openTag('div', array('class'=>'movie-name-typeahead')); |
21
|
|
|
|
22
|
|
|
echo $this->form->movieNameFieldControlGroup($this->model, 'name', array( |
|
|
|
|
23
|
|
|
'prefetch'=>$ctrl->createUrl('typeahead/getMovieNames'))); |
24
|
|
|
|
25
|
|
|
echo CHtml::closeTag('div'); |
26
|
|
|
|
27
|
|
|
echo $this->form->dropDownListControlGroup($this->model, 'genre', |
28
|
|
|
$this->model->getGenres(), array('empty'=>' ')); |
29
|
|
|
|
30
|
|
|
echo $this->form->textFieldControlGroup($this->model, 'year', |
31
|
|
|
array('style'=>'max-width: 40px;')); |
32
|
|
|
|
33
|
|
|
echo $this->form->textFieldControlGroup($this->model, 'rating', |
34
|
|
|
array('style'=>'max-width: 40px;')); |
35
|
|
|
|
36
|
|
|
echo $this->form->dropDownListControlGroup($this->model, 'quality', |
37
|
|
|
$this->model->getQualities(), |
38
|
|
|
array('empty'=>' ', 'style'=>'width: 70px;')); |
39
|
|
|
|
40
|
|
|
echo $this->form->dropDownListControlGroup($this->model, 'watchedStatus', |
41
|
|
|
VideoFilterForm::getWatchedStatuses(), |
42
|
|
|
array('empty'=>' ', 'style'=>'width: 120px;')); |
43
|
|
|
|
44
|
|
|
if ($this->enableActorTypeahead()) |
45
|
|
|
{ |
46
|
|
|
echo $this->form->typeaheadFieldControlGroup($this->model, 'actor', [ |
47
|
|
|
'prefetch' => $ctrl->createUrl('typeahead/getActorNames', ['mediaType' => Actor::MEDIA_TYPE_MOVIE]), |
48
|
|
|
]); |
49
|
|
|
} |
50
|
|
|
else |
51
|
|
|
{ |
52
|
|
|
echo $this->form->textFieldControlGroup($this->model, 'actor'); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
echo $this->form->typeaheadFieldControlGroup($this->model, 'director', array( |
56
|
|
|
'prefetch'=>$ctrl->createUrl('typeahead/getDirectorNames'))); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @inheritDoc |
61
|
|
|
*/ |
62
|
|
|
protected function getFormClassName() |
63
|
|
|
{ |
64
|
|
|
return 'MovieFilterActiveForm'; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
} |
68
|
|
|
|