]> git.sur5r.net Git - bacula/bacula/blob - gui/baculum/framework/Web/UI/WebControls/THtmlElement.php
baculum: New Baculum API and Baculum Web
[bacula/bacula] / gui / baculum / framework / Web / UI / WebControls / THtmlElement.php
1 <?php
2 /**
3  * THtmlElement class file.
4  *
5  * @author Qiang Xue <qiang.xue@gmail.com>
6  * @link https://github.com/pradosoft/prado
7  * @copyright Copyright &copy; 2005-2016 The PRADO Group
8  * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
9  * @package System.Web.UI.WebControls
10  */
11
12 Prado::using('System.Web.UI.WebControls.TWebControl');
13
14 /**
15  * THtmlElement class.
16  *
17  * THtmlElement represents a generic HTML element whose tag name is specified
18  * via {@link setTagName TagName} property. Because THtmlElement extends from
19  * {@link TWebControl}, it enjoys all its functionalities.
20  *
21  * To change the default tag your subclass should override {@link getDefaultTagName}
22  *
23  * @author Qiang Xue <qiang.xue@gmail.com>
24  * @author Brad Anderson <javalizard@gmail.com>
25  * @package System.Web.UI.WebControls
26  * @since 3.1.2
27  */
28 class THtmlElement extends TWebControl
29 {
30         /**
31          * @var the tag of this element
32          */
33         private $_tagName=null;
34
35         /**
36          * @return string the tag name of this control. Defaults to 'span'.
37          */
38         public function getTagName()
39         {
40                 return ($this->_tagName !== null) ? $this->_tagName : ($this->_tagName = $this->getDefaultTagName());
41         }
42
43         /**
44          * @param string the tag name of this control.
45          */
46         public function setTagName($value)
47         {
48                 $this->_tagName=TPropertyValue::ensureString($value);
49         }
50
51         /**
52          *      This is the default tag when no other is specified
53          * @return string the default tag
54          */
55         public function getDefaultTagName() {
56                 return 'span';
57         }
58
59         /**
60          * This tells you if this TagName has deviated from the original
61          * @return boolean true if TagName has deviated from the default.
62          */
63         public function getIsMutated() {
64                 return $this->_tagName !== null && $this->_tagName != $this->getDefaultTagName();
65         }
66 }