MovieFilter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 5
Bugs 2 Features 2
Metric Value
eloc 26
c 5
b 2
f 2
dl 0
loc 53
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A renderControls() 0 42 2
A getFormClassName() 0 3 1
1
<?php
2
3
/**
4
 * Renders the filter on the movie index page
5
 *
6
 * @author Sam Stenvall <[email protected]>
7
 * @copyright Copyright &copy; 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(
0 ignored issues
show
Bug introduced by
The method movieNameFieldControlGroup() does not exist on FilterActiveForm. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
		echo $this->form->/** @scrutinizer ignore-call */ movieNameFieldControlGroup($this->model, 'name', array(
Loading history...
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