Skip to content
Snippets Groups Projects
Commit a9d7b2ae authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

reformat classes

parent 2023b30d
Branches
No related tags found
1 merge request!18Update renderer class
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
* *
* @author Axel * @author Axel
*/ */
class htmlelements { class htmlelements
{
/** /**
* set of auto generated icon prefixes * set of auto generated icon prefixes
...@@ -34,7 +35,8 @@ class htmlelements { ...@@ -34,7 +35,8 @@ class htmlelements {
// CONSTRUCTOR // CONSTRUCTOR
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
public function __construct() { public function __construct()
{
return true; return true;
} }
...@@ -49,7 +51,8 @@ class htmlelements { ...@@ -49,7 +51,8 @@ class htmlelements {
* generate html attibutes with all internal attributes key -> values * generate html attibutes with all internal attributes key -> values
* @return string * @return string
*/ */
protected function _addAttributes() { protected function _addAttributes()
{
$sReturn = ''; $sReturn = '';
foreach ($this->_aAttributes as $sAttr => $sValue) { foreach ($this->_aAttributes as $sAttr => $sValue) {
if (is_array($sValue)) { if (is_array($sValue)) {
...@@ -71,7 +74,8 @@ class htmlelements { ...@@ -71,7 +74,8 @@ class htmlelements {
* @param array $aAttributes * @param array $aAttributes
* @return boolean * @return boolean
*/ */
protected function _setAttributes($aAttributes){ protected function _setAttributes($aAttributes)
{
$this->_sLabel = ''; $this->_sLabel = '';
if (isset($aAttributes['icon']) && $aAttributes['icon']) { if (isset($aAttributes['icon']) && $aAttributes['icon']) {
$this->_sLabel .= $this->getIcon($aAttributes['icon']); $this->_sLabel .= $this->getIcon($aAttributes['icon']);
...@@ -100,7 +104,8 @@ class htmlelements { ...@@ -100,7 +104,8 @@ class htmlelements {
* @param boolean $bCloseTag optional: set false if tag has no closing tag (= ending with "/>") * @param boolean $bCloseTag optional: set false if tag has no closing tag (= ending with "/>")
* @return type * @return type
*/ */
public function getTag($sTag, $aAttributes, $bCloseTag=true){ public function getTag($sTag, $aAttributes, $bCloseTag = true)
{
$sTpl = $bCloseTag ? "<$sTag%s>%s</$sTag>" : "<$sTag %s/>%s"; $sTpl = $bCloseTag ? "<$sTag%s>%s</$sTag>" : "<$sTag %s/>%s";
$this->_setAttributes($aAttributes); $this->_setAttributes($aAttributes);
return sprintf($sTpl, $this->_addAttributes(), $this->_sLabel); return sprintf($sTpl, $this->_addAttributes(), $this->_sLabel);
...@@ -120,7 +125,8 @@ class htmlelements { ...@@ -120,7 +125,8 @@ class htmlelements {
* @param string $sIconclass * @param string $sIconclass
* @return boolean * @return boolean
*/ */
public function getIcon($sIconclass=false){ public function getIcon($sIconclass = false)
{
if (!$sIconclass) { if (!$sIconclass) {
return ''; return '';
} }
...@@ -150,7 +156,8 @@ class htmlelements { ...@@ -150,7 +156,8 @@ class htmlelements {
* @param array $aAttributes attributes of the select tag * @param array $aAttributes attributes of the select tag
* @return string * @return string
*/ */
public function getFormInput($aAttributes){ public function getFormInput($aAttributes)
{
$sTpl = '<input %s/>'; $sTpl = '<input %s/>';
$this->_setAttributes($aAttributes); $this->_setAttributes($aAttributes);
return sprintf($sTpl, $this->_addAttributes()); return sprintf($sTpl, $this->_addAttributes());
...@@ -161,7 +168,8 @@ class htmlelements { ...@@ -161,7 +168,8 @@ class htmlelements {
* @param array $aAttributes attributes of the option tag * @param array $aAttributes attributes of the option tag
* @return string * @return string
*/ */
public function getFormOption($aAttributes){ public function getFormOption($aAttributes)
{
$sTpl = '<option %s>%s</option>'; $sTpl = '<option %s>%s</option>';
$this->_setAttributes($aAttributes); $this->_setAttributes($aAttributes);
return sprintf($sTpl, $this->_addAttributes(), $this->_sLabel); return sprintf($sTpl, $this->_addAttributes(), $this->_sLabel);
...@@ -173,7 +181,8 @@ class htmlelements { ...@@ -173,7 +181,8 @@ class htmlelements {
* @param array $aOptions array for all option fields * @param array $aOptions array for all option fields
* @return string * @return string
*/ */
public function getFormSelect($aAttributes, $aOptions=array()){ public function getFormSelect($aAttributes, $aOptions = array())
{
// $sTpl = '<select %s>%s</select>'; // $sTpl = '<select %s>%s</select>';
if (!count($aOptions)) { if (!count($aOptions)) {
...@@ -193,7 +202,8 @@ class htmlelements { ...@@ -193,7 +202,8 @@ class htmlelements {
*/ */
} }
public function getTable($aHead, $aBody, $aTableAttributes=array()){ public function getTable($aHead, $aBody, $aTableAttributes = array())
{
$sReturn = ''; $sReturn = '';
$sTdata = ''; $sTdata = '';
$sThead = ''; $sThead = '';
...@@ -213,7 +223,8 @@ class htmlelements { ...@@ -213,7 +223,8 @@ class htmlelements {
$sTdata .= '</tr>'; $sTdata .= '</tr>';
} }
$this->_setAttributes($aTableAttributes); $this->_setAttributes($aTableAttributes);
return sprintf($sTpl, return sprintf(
$sTpl,
$this->_addAttributes(), $this->_addAttributes(),
$sThead, $sThead,
$sTdata $sTdata
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment