/
Component.php
74 lines (62 loc) · 2.37 KB
/
Component.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
72
73
74
<?php
abstract class Kwc_Abstract_Flash_Component extends Kwc_Abstract
{
public static function getSettings($param = null)
{
$ret = parent::getSettings($param);
$ret['componentName'] = trlKwfStatic('Flash');
$ret['componentIcon'] = 'film';
$ret['generators']['placeholder'] = array(
'class' => 'Kwf_Component_Generator_Static',
'component' => 'Kwc_Abstract_Flash_Placeholder_Component'
);
$ret['assets']['dep'][] = 'ExtUtilJson';
$ret['assets']['dep'][] = 'SwfObject';
$ret['rootElementClass'] = 'kwfUp-webStandard';
$ret['removeHiddenFlash'] = true;
return $ret;
}
public function getTemplateVars(Kwf_Component_Renderer_Abstract $renderer)
{
$ret = parent::getTemplateVars($renderer);
$ret['flash'] = array();
// flash data
$ret['flash']['data'] = $this->_getFlashData();
if (!array_key_exists('url', $ret['flash']['data'])
|| !array_key_exists('width', $ret['flash']['data'])
|| !array_key_exists('height', $ret['flash']['data'])
) {
throw new Kwf_Exception("_getFlashData() must return an array with keys 'url', 'width' and 'height'");
}
if (!isset($ret['flash']['data']['params'])) {
$ret['flash']['data']['params'] = array();
}
$ret['flash']['data']['params'] = (object)$ret['flash']['data']['params'];
// flash vars
$ret['flash']['vars'] = $this->_getFlashVars();
foreach ($ret['flash']['vars'] as $k => $v) {
$ret['flash']['vars'][$k] = urlencode($v);
}
$ret['flash']['vars'] = (object)$ret['flash']['vars'];
$ret['flash']['removeHiddenFlash'] = $this->_getSetting('removeHiddenFlash');
$ret['placeholder'] = $this->_getPlaceholderComponent();
return $ret;
}
protected function _getPlaceholderComponent()
{
return $this->getData()->getChildComponent('-placeholder');
}
protected function _getFlashVars()
{
return array();
}
/**
* Muss ein array mit 'url', 'width' und 'height' zurückgeben
* Optional 'params': ein array mit weiteren parametern die gesetzt
* werden sollen, zB: array('allowfullscreen' => 'true')
*/
protected function _getFlashData()
{
return array();
}
}