EpisodeList::getColumns()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 39
Code Lines 29

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 29
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 39
rs 9.456
1
<?php
2
3
use \yiilazyimage\components\LazyImage as LazyImage;
0 ignored issues
show
Bug introduced by
The type \yiilazyimage\components\LazyImage was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
4
5
/**
6
 * Renders an EpisodeGrid with the column definitions defined by getColumns().
7
 *
8
 * @author Sam Stenvall <[email protected]>
9
 * @copyright Copyright &copy; Sam Stenvall 2013-
10
 * @license https://www.gnu.org/licenses/gpl.html The GNU General Public License v3.0
11
 */
12
class EpisodeList extends CWidget
13
{
14
15
	/**
16
	 * @var CDataProvider the data provider for the grid view
17
	 */
18
	public $dataProvider;
19
20
	/**
21
	 * Renders the grid view
22
	 */
23
	public function run()
24
	{
25
		$this->widget('EpisodeGrid', array(
26
			'type'=>TbHtml::GRID_TYPE_STRIPED,
27
			'dataProvider'=>$this->dataProvider,
28
			'template'=>'{items}',
29
			'columns'=>$this->getColumns()
30
		));
31
	}
32
33
	/**
34
	 * Returns the column definitions for the grid view. Child classes can 
35
	 * override this to provide additional columns.
36
	 * @return array the column definitions
37
	 */
38
	protected function getColumns()
39
	{
40
		return array(
41
			array(
42
				'type'=>'raw',
43
				'header'=>Yii::t('EpisodeList', 'Episode'),
44
				'value'=>function($data) {
45
					Yii::app()->controller->renderPartial('_getEpisode', array('episode'=>$data));
46
				}
47
			),
48
			array(
49
				'type'=>'raw',
50
				'header'=>'',
51
				'value'=>function($data) {
52
					$thumbnail = ThumbnailFactory::create($data->thumbnail, Thumbnail::SIZE_SMALL);
53
					return LazyImage::image($thumbnail->getUrl(), '', array('class'=>'item-thumbnail episode-thumbnail'));
54
				}
55
			),
56
			array(
57
				'header'=>Yii::t('GenericList', 'Title'),
58
				'name'=>'title',
59
			),
60
			array(
61
				'type'=>'raw',
62
				'name'=>'plot',
63
				'header'=>Yii::t('EpisodeList', 'Plot'),
64
				'cssClassExpression'=>function() {
65
					return 'episode-list-plot';
66
				},
67
				'value'=>function($data) {
68
					Yii::app()->controller->renderPartial('_plotStreamDetails', array('episode'=>$data));
69
				}
70
			),
71
			array(
72
				'name'=>'runtime',
73
				'header'=>Yii::t('GenericList', 'Runtime'),
74
				'type'=>'html',
75
				'value'=>function($data) {
76
					echo $data->getRuntimeString();
77
				}
78
			),
79
		);
80
	}
81
82
}
83