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\Maniacode;
14:
15: abstract class Component
16: {
17:
18: protected $xmlTagName;
19: protected $xml;
20: protected $name;
21:
22: /**
23: * This method sets the Name of the file once download
24: *
25: * @param string $name The name of the file once download
26: * @return void
27: *
28: */
29: function setName($name)
30: {
31: $this->name = $name;
32: }
33:
34: /**
35: * This method gets the Name of the element
36: *
37: * @return string This return the name of the file once download
38: *
39: */
40: function getName()
41: {
42: return $this->name;
43: }
44:
45: protected function preFilter()
46: {
47:
48: }
49:
50: protected function postFilter()
51: {
52:
53: }
54:
55: final function save()
56: {
57: $this->preFilter();
58:
59: $this->xml = \ManiaLib\Gui\Maniacode\Maniacode::$domDocument->createElement($this->xmlTagName);
60: end(\ManiaLib\Gui\Maniacode\Maniacode::$parentNodes)->appendChild($this->xml);
61:
62: if(isset($this->name))
63: {
64: $elem = \ManiaLib\Gui\Maniacode\Maniacode::$domDocument->createElement('name');
65: $value = \ManiaLib\Gui\Maniacode\Maniacode::$domDocument->createTextNode($this->name);
66: $elem->appendChild($value);
67: $this->xml->appendChild($elem);
68: }
69:
70: $this->postFilter();
71: }
72:
73: }
74:
75: ?>