1: <?php
2: /**
3: * ManiaLib - Lightweight PHP framework for Manialinks
4: *
5: * @see http://code.google.com/p/manialib/
6: * @copyright Copyright (c) 2009-2011 NADEO (http://www.nadeo.com)
7: * @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
8: * @version $Revision: 590 $:
9: * @author $Author: maximeraoust $:
10: * @date $Date: 2011-12-27 19:40:38 +0100 (mar., 27 déc. 2011) $:
11: */
12:
13: namespace ManiaLib\Gui\Elements;
14:
15: class Music extends \ManiaLib\Gui\Element
16: {
17:
18: protected $xmlTagName = 'music';
19: protected $halign = null;
20: protected $valign = null;
21: protected $posX = null;
22: protected $posY = null;
23: protected $posZ = null;
24: protected $data;
25: protected $dataId;
26:
27: function __construct()
28: {
29:
30: }
31:
32: /**
33: * Sets the data to play
34: * @param string The data filename (or URL)
35: * @param bool Whether to prefix the filename with the default media dir URL
36: */
37: function setData($filename, $absoluteUrl = false)
38: {
39: if(!$absoluteUrl)
40: {
41: $this->data = \ManiaLib\Gui\Manialink::$mediaURL.$filename;
42: }
43: else
44: {
45: $this->data = $filename;
46: }
47: }
48:
49: /**
50: * Sets the data id to play
51: * @param string The data id
52: */
53: function setDataId($dataId)
54: {
55: $this->dataId = $dataId;
56: }
57:
58: /**
59: * Returns the data URL
60: * @return string
61: */
62: function getData()
63: {
64: return $this->data;
65: }
66:
67: /**
68: * Returns the data id
69: * @return string
70: */
71: function getDataId()
72: {
73: return $this->dataId;
74: }
75:
76: protected function postFilter()
77: {
78: if($this->data !== null)
79: $this->xml->setAttribute('data', $this->data);
80: if($this->dataId !== null)
81: $this->xml->setAttribute('dataId', $this->dataId);
82: }
83:
84: }
85:
86: ?>