1: <?php
2:
3: namespace Zippy\Html;
4:
5: /**
6: * Компонент медиаплеера HTML5
7: */
8: class Player extends HtmlComponent
9: {
10: public $sources;
11: public $src;
12:
13: public function __construct($id) {
14: parent::__construct($id);
15: $this->sources = array();
16: }
17:
18: /**
19: * рендеринг
20: * @see Zippy\Html\HtmlComponent
21: */
22: protected function RenderImpl() {
23: $i = 0;
24: $children = \Zippy\WebApplication::$dom->find('[zippy=' . $this->id . '] source');
25: foreach ($children as $child) {
26: if (strlen($this->sources[$i]) > 0) {
27: $child->attr("src", $this->sources[$i]);
28: $i++;
29: }
30: }
31:
32: if (strlen($this->src) > 0) {
33: $this->setAttribute("src", $this->src);
34: }
35: }
36:
37: }
38: