MediaFlags::run()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 44
Code Lines 33

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 33
c 2
b 0
f 0
nc 2
nop 0
dl 0
loc 44
rs 9.392
1
<?php
2
3
Yii::import('application.widgets.flags.*');
4
5
/**
6
 * Renders the media flags for a media
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 MediaFlags extends CWidget
13
{
14
	
15
	/**
16
	 * @var File the media file
17
	 */
18
	public $file;
19
	
20
	/**
21
	 * Runs the widget
22
	 */
23
	public function run()
24
	{
25
		echo CHtml::openTag('div', array('class'=>'media-flags'));
26
		
27
		// Some media don't have any stream details, we have to skip the flags
28
		// that depend on them.
29
		$helper = new MediaInfoHelper($this->file);
30
		
31
		if ($helper->hasMediaInfo())
32
		{
33
			$streamDetails = $this->file->streamdetails;
34
			
35
			?>
36
			<div class="flag-section">
37
				<?php $this->widget('MediaFlagResolution', array(
38
				'streamDetails'=>$streamDetails));
39
					$this->widget('MediaFlagVideoCodec', array(
40
				'streamDetails'=>$streamDetails)); ?>
41
			</div>
42
			
43
			<div class="flag-section">
44
				<?php $this->widget('MediaFlagAudioCodec', array(
45
						'streamDetails'=>$streamDetails));
46
					$this->widget('MediaFlagAudioChannels', array(
47
						'streamDetails'=>$streamDetails)); ?>
48
			</div>
49
			
50
			<div class="flag-section">
51
				<?php $this->widget('MediaFlagAspect', array(
52
						'streamDetails'=>$streamDetails)); ?>
53
			</div>
54
			<?php
55
		}
56
		
57
		?>
58
		<div class="flag-section">
59
			<?php $this->widget('MediaFlagVideoSource', array(
60
				'file'=>$this->file->file));
61
			$this->widget('MediaFlagAudioSource', array(
62
				'file'=>$this->file->file)); ?>
63
		</div>
64
		<?php
65
		
66
		echo CHtml::closeTag('div');
67
	}
68
69
}
70