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

reformat classes

parent 2023b30d
No related branches found
No related tags found
1 merge request!18Update renderer class
This commit is part of merge request !18. Comments created here will be created in the context of that merge request.
......@@ -16,7 +16,8 @@
*
* @author Axel
*/
class htmlelements {
class htmlelements
{
/**
* set of auto generated icon prefixes
......@@ -34,7 +35,8 @@ class htmlelements {
// CONSTRUCTOR
// ----------------------------------------------------------------------
public function __construct() {
public function __construct()
{
return true;
}
......@@ -49,7 +51,8 @@ class htmlelements {
* generate html attibutes with all internal attributes key -> values
* @return string
*/
protected function _addAttributes() {
protected function _addAttributes()
{
$sReturn = '';
foreach ($this->_aAttributes as $sAttr => $sValue) {
if (is_array($sValue)) {
......@@ -71,7 +74,8 @@ class htmlelements {
* @param array $aAttributes
* @return boolean
*/
protected function _setAttributes($aAttributes){
protected function _setAttributes($aAttributes)
{
$this->_sLabel = '';
if (isset($aAttributes['icon']) && $aAttributes['icon']) {
$this->_sLabel .= $this->getIcon($aAttributes['icon']);
......@@ -100,7 +104,8 @@ class htmlelements {
* @param boolean $bCloseTag optional: set false if tag has no closing tag (= ending with "/>")
* @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";
$this->_setAttributes($aAttributes);
return sprintf($sTpl, $this->_addAttributes(), $this->_sLabel);
......@@ -120,7 +125,8 @@ class htmlelements {
* @param string $sIconclass
* @return boolean
*/
public function getIcon($sIconclass=false){
public function getIcon($sIconclass = false)
{
if (!$sIconclass) {
return '';
}
......@@ -150,7 +156,8 @@ class htmlelements {
* @param array $aAttributes attributes of the select tag
* @return string
*/
public function getFormInput($aAttributes){
public function getFormInput($aAttributes)
{
$sTpl = '<input %s/>';
$this->_setAttributes($aAttributes);
return sprintf($sTpl, $this->_addAttributes());
......@@ -161,7 +168,8 @@ class htmlelements {
* @param array $aAttributes attributes of the option tag
* @return string
*/
public function getFormOption($aAttributes){
public function getFormOption($aAttributes)
{
$sTpl = '<option %s>%s</option>';
$this->_setAttributes($aAttributes);
return sprintf($sTpl, $this->_addAttributes(), $this->_sLabel);
......@@ -173,7 +181,8 @@ class htmlelements {
* @param array $aOptions array for all option fields
* @return string
*/
public function getFormSelect($aAttributes, $aOptions=array()){
public function getFormSelect($aAttributes, $aOptions = array())
{
// $sTpl = '<select %s>%s</select>';
if (!count($aOptions)) {
......@@ -193,7 +202,8 @@ class htmlelements {
*/
}
public function getTable($aHead, $aBody, $aTableAttributes=array()){
public function getTable($aHead, $aBody, $aTableAttributes = array())
{
$sReturn = '';
$sTdata = '';
$sThead = '';
......@@ -213,7 +223,8 @@ class htmlelements {
$sTdata .= '</tr>';
}
$this->_setAttributes($aTableAttributes);
return sprintf($sTpl,
return sprintf(
$sTpl,
$this->_addAttributes(),
$sThead,
$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