@@ -17,9 +17,9 @@ discard block |
||
| 17 | 17 | use BaseHtmlEventsTrait; |
| 18 | 18 | protected $_template; |
| 19 | 19 | protected $tagName; |
| 20 | - protected $properties=array (); |
|
| 21 | - protected $_wrapBefore=array (); |
|
| 22 | - protected $_wrapAfter=array (); |
|
| 20 | + protected $properties=array(); |
|
| 21 | + protected $_wrapBefore=array(); |
|
| 22 | + protected $_wrapAfter=array(); |
|
| 23 | 23 | protected $_bsComponent; |
| 24 | 24 | |
| 25 | 25 | public function getBsComponent() { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | protected function getTemplate(JsUtils $js=NULL) { |
| 35 | - return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
| 35 | + return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function getProperties() { |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | public function addToProperty($name, $value, $separator=" ") { |
| 58 | 58 | if (\is_array($value)) { |
| 59 | - foreach ( $value as $v ) { |
|
| 59 | + foreach ($value as $v) { |
|
| 60 | 60 | $this->addToProperty($name, $v, $separator); |
| 61 | 61 | } |
| 62 | - } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
|
| 62 | + } else if ($value!=="" && $this->propertyContains($name, $value)===false) { |
|
| 63 | 63 | $v=@$this->properties[$name]; |
| 64 | - if (isset($v) && $v !== "") |
|
| 65 | - $v=$v . $separator . $value; |
|
| 64 | + if (isset($v) && $v!=="") |
|
| 65 | + $v=$v.$separator.$value; |
|
| 66 | 66 | else |
| 67 | 67 | $v=$value; |
| 68 | 68 | |
@@ -78,19 +78,19 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 80 | 80 | $result=$this->getTemplate($js); |
| 81 | - foreach ( $this as $key => $value ) { |
|
| 82 | - if (JString::startswith($key, "_") === false && $key !== "events") { |
|
| 81 | + foreach ($this as $key => $value) { |
|
| 82 | + if (JString::startswith($key, "_")===false && $key!=="events") { |
|
| 83 | 83 | if (is_array($value)) { |
| 84 | 84 | $v=PropertyWrapper::wrap($value, $js); |
| 85 | 85 | } else { |
| 86 | 86 | $v=$value; |
| 87 | 87 | } |
| 88 | - $result=str_ireplace("%" . $key . "%", $v, $result); |
|
| 88 | + $result=str_ireplace("%".$key."%", $v, $result); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | if (isset($js)===true) { |
| 92 | 92 | $this->run($js); |
| 93 | - if (isset($view) === true) { |
|
| 93 | + if (isset($view)===true) { |
|
| 94 | 94 | $js->addViewElement($this->identifier, $result, $view); |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | protected function ctrl($name, $value, $typeCtrl) { |
| 101 | 101 | if (is_array($typeCtrl)) { |
| 102 | - if (array_search($value, $typeCtrl) === false) { |
|
| 103 | - throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
| 102 | + if (array_search($value, $typeCtrl)===false) { |
|
| 103 | + throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
| 104 | 104 | } |
| 105 | 105 | } else { |
| 106 | 106 | if (!$typeCtrl($value)) { |
| 107 | - throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
| 107 | + throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | return true; |
@@ -119,13 +119,13 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 122 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
| 122 | + if ($this->ctrl($name, $value, $typeCtrl)===true) |
|
| 123 | 123 | return $this->setProperty($name, $value); |
| 124 | 124 | return $this; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
| 128 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 128 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 129 | 129 | return $name=$value; |
| 130 | 130 | } |
| 131 | 131 | return $this; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") { |
| 135 | 135 | if (is_array($typeCtrl)) { |
| 136 | 136 | $this->removeOldValues($name, $typeCtrl); |
| 137 | - $name.=$separator . $value; |
|
| 137 | + $name.=$separator.$value; |
|
| 138 | 138 | } |
| 139 | 139 | return $this; |
| 140 | 140 | } |
@@ -156,17 +156,17 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
| 159 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 159 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 160 | 160 | if (is_array($typeCtrl)) { |
| 161 | 161 | $this->removeOldValues($name, $typeCtrl); |
| 162 | 162 | } |
| 163 | - $name.=$separator . $value; |
|
| 163 | + $name.=$separator.$value; |
|
| 164 | 164 | } |
| 165 | 165 | return $this; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | protected function addToMember(&$name, $value, $separator=" ") { |
| 169 | - $name=str_ireplace($value, "", $name) . $separator . $value; |
|
| 169 | + $name=str_ireplace($value, "", $name).$separator.$value; |
|
| 170 | 170 | return $this; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | public function addToPropertyCtrlCheck($name, $value, $typeCtrl) { |
| 187 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 187 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 188 | 188 | return $this->addToProperty($name, $value); |
| 189 | 189 | } |
| 190 | 190 | return $this; |
@@ -212,30 +212,30 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | public function fromArray($array) { |
| 215 | - foreach ( $this as $key => $value ) { |
|
| 216 | - $this->_callSetter("set" . ucfirst($key), $key, $value, $array); |
|
| 215 | + foreach ($this as $key => $value) { |
|
| 216 | + $this->_callSetter("set".ucfirst($key), $key, $value, $array); |
|
| 217 | 217 | if (array_key_exists($key, $array) && !JString::startswith($key, "_")) { |
| 218 | - $setter="set" . ucfirst($key); |
|
| 218 | + $setter="set".ucfirst($key); |
|
| 219 | 219 | $this->$setter($array[$key]); |
| 220 | 220 | unset($array[$key]); |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | - foreach ( $array as $key => $value ) { |
|
| 224 | - if($this->_callSetter($key, $key, $value, $array)===false){ |
|
| 225 | - $this->_callSetter("set" . ucfirst($key), $key, $value, $array); |
|
| 223 | + foreach ($array as $key => $value) { |
|
| 224 | + if ($this->_callSetter($key, $key, $value, $array)===false) { |
|
| 225 | + $this->_callSetter("set".ucfirst($key), $key, $value, $array); |
|
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | return $array; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - private function _callSetter($setter,$key,$value,&$array){ |
|
| 231 | + private function _callSetter($setter, $key, $value, &$array) { |
|
| 232 | 232 | $result=false; |
| 233 | 233 | if (method_exists($this, $setter) && !JString::startswith($key, "_")) { |
| 234 | 234 | try { |
| 235 | 235 | $this->$setter($value); |
| 236 | 236 | unset($array[$key]); |
| 237 | 237 | $result=true; |
| 238 | - } catch ( \Exception $e ) { |
|
| 238 | + }catch (\Exception $e) { |
|
| 239 | 239 | $result=false; |
| 240 | 240 | } |
| 241 | 241 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | public function fromDatabaseObjects($objects, $function) { |
| 246 | 246 | if (isset($objects)) { |
| 247 | - foreach ( $objects as $object ) { |
|
| 247 | + foreach ($objects as $object) { |
|
| 248 | 248 | $this->fromDatabaseObject($object, $function); |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -268,33 +268,33 @@ discard block |
||
| 268 | 268 | if (is_array($elements)) { |
| 269 | 269 | $flag=false; |
| 270 | 270 | $index=0; |
| 271 | - while ( !$flag && $index < sizeof($elements) ) { |
|
| 271 | + while (!$flag && $index<sizeof($elements)) { |
|
| 272 | 272 | if ($elements[$index] instanceof BaseHtml) |
| 273 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 273 | + $flag=($elements[$index]->getIdentifier()===$identifier); |
|
| 274 | 274 | $index++; |
| 275 | 275 | } |
| 276 | - if ($flag === true) |
|
| 277 | - return $elements[$index - 1]; |
|
| 276 | + if ($flag===true) |
|
| 277 | + return $elements[$index-1]; |
|
| 278 | 278 | } elseif ($elements instanceof BaseHtml) { |
| 279 | - if ($elements->getIdentifier() === $identifier) |
|
| 279 | + if ($elements->getIdentifier()===$identifier) |
|
| 280 | 280 | return $elements; |
| 281 | 281 | } |
| 282 | 282 | return null; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - protected function getElementByPropertyValue($propertyName,$value, $elements) { |
|
| 285 | + protected function getElementByPropertyValue($propertyName, $value, $elements) { |
|
| 286 | 286 | if (is_array($elements)) { |
| 287 | 287 | $flag=false; |
| 288 | 288 | $index=0; |
| 289 | - while ( !$flag && $index < sizeof($elements) ) { |
|
| 289 | + while (!$flag && $index<sizeof($elements)) { |
|
| 290 | 290 | if ($elements[$index] instanceof BaseHtml) |
| 291 | - $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 291 | + $flag=($elements[$index]->propertyContains($propertyName, $value)===true); |
|
| 292 | 292 | $index++; |
| 293 | 293 | } |
| 294 | - if ($flag === true) |
|
| 295 | - return $elements[$index - 1]; |
|
| 294 | + if ($flag===true) |
|
| 295 | + return $elements[$index-1]; |
|
| 296 | 296 | } elseif ($elements instanceof BaseHtml) { |
| 297 | - if ($elements->propertyContains($propertyName, $value) === true) |
|
| 297 | + if ($elements->propertyContains($propertyName, $value)===true) |
|
| 298 | 298 | return $elements; |
| 299 | 299 | } |
| 300 | 300 | return null; |
@@ -10,16 +10,16 @@ discard block |
||
| 10 | 10 | * @property SimpleExtComponent $_bsComponent |
| 11 | 11 | * @property string identifier |
| 12 | 12 | */ |
| 13 | -trait BaseHtmlEventsTrait{ |
|
| 13 | +trait BaseHtmlEventsTrait { |
|
| 14 | 14 | |
| 15 | - protected $_events=array (); |
|
| 15 | + protected $_events=array(); |
|
| 16 | 16 | |
| 17 | 17 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 18 | - if ($stopPropagation === true) { |
|
| 19 | - $jsCode="event.stopPropagation();" . $jsCode; |
|
| 18 | + if ($stopPropagation===true) { |
|
| 19 | + $jsCode="event.stopPropagation();".$jsCode; |
|
| 20 | 20 | } |
| 21 | - if ($preventDefault === true) { |
|
| 22 | - $jsCode="event.preventDefault();" . $jsCode; |
|
| 21 | + if ($preventDefault===true) { |
|
| 22 | + $jsCode="event.preventDefault();".$jsCode; |
|
| 23 | 23 | } |
| 24 | 24 | return $this->_addEvent($event, $jsCode); |
| 25 | 25 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | if (is_array($this->_events[$event])) { |
| 30 | 30 | $this->_events[$event][]=$jsCode; |
| 31 | 31 | } else { |
| 32 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
| 32 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
| 33 | 33 | } |
| 34 | 34 | } else { |
| 35 | 35 | $this->_events[$event]=$jsCode; |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | return $this->onClick($jsCode); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function onCreate($jsCode){ |
|
| 53 | - if(isset($this->_events["_create"])){ |
|
| 52 | + public function onCreate($jsCode) { |
|
| 53 | + if (isset($this->_events["_create"])) { |
|
| 54 | 54 | $this->_events["_create"][]=$jsCode; |
| 55 | - }else{ |
|
| 55 | + } else { |
|
| 56 | 56 | $this->_events["_create"]=[$jsCode]; |
| 57 | 57 | } |
| 58 | 58 | return $this; |
@@ -61,15 +61,15 @@ discard block |
||
| 61 | 61 | public function addEventsOnRun(JsUtils $js) { |
| 62 | 62 | $this->_eventsOnCreate($js); |
| 63 | 63 | if (isset($this->_bsComponent)) { |
| 64 | - foreach ( $this->_events as $event => $jsCode ) { |
|
| 64 | + foreach ($this->_events as $event => $jsCode) { |
|
| 65 | 65 | $code=$jsCode; |
| 66 | 66 | if (is_array($jsCode)) { |
| 67 | 67 | $code=""; |
| 68 | - foreach ( $jsCode as $jsC ) { |
|
| 68 | + foreach ($jsCode as $jsC) { |
|
| 69 | 69 | if ($jsC instanceof AjaxCall) { |
| 70 | - $code.="\n" . $jsC->compile($js); |
|
| 70 | + $code.="\n".$jsC->compile($js); |
|
| 71 | 71 | } else { |
| 72 | - $code.="\n" . $jsC; |
|
| 72 | + $code.="\n".$jsC; |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -77,24 +77,24 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | $this->_bsComponent->addEvent($event, $code); |
| 79 | 79 | } |
| 80 | - $this->_events=array (); |
|
| 80 | + $this->_events=array(); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - protected function _eventsOnCreate(JsUtils $js){ |
|
| 85 | - if(isset($this->_events["_create"])){ |
|
| 84 | + protected function _eventsOnCreate(JsUtils $js) { |
|
| 85 | + if (isset($this->_events["_create"])) { |
|
| 86 | 86 | $create=$this->_events["_create"]; |
| 87 | - if(\is_array($create)){ |
|
| 87 | + if (\is_array($create)) { |
|
| 88 | 88 | $create=\implode("", $create); |
| 89 | 89 | } |
| 90 | - if($create!=="") |
|
| 91 | - $js->exec($create,true); |
|
| 90 | + if ($create!=="") |
|
| 91 | + $js->exec($create, true); |
|
| 92 | 92 | unset($this->_events["_create"]); |
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 97 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
| 97 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
| 98 | 98 | $params=array_merge($params, $parameters); |
| 99 | 99 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
| 100 | 100 | return $this; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | public function jsDoJquery($jqueryCall, $param="") { |
| 130 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . Javascript::prep_value($param) . ");"; |
|
| 130 | + return "$('#".$this->identifier."').".$jqueryCall."(".Javascript::prep_value($param).");"; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | public function executeOnRun($jsCode) { |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | class HtmlForm extends HtmlSemCollection { |
| 22 | 22 | |
| 23 | - use FieldsTrait,FormTrait; |
|
| 23 | + use FieldsTrait, FormTrait; |
|
| 24 | 24 | /** |
| 25 | 25 | * @var array |
| 26 | 26 | */ |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function __construct($identifier, $elements=array()) { |
| 35 | 35 | parent::__construct($identifier, "form", "ui form"); |
| 36 | - $this->_states=[ State::ERROR,State::SUCCESS,State::WARNING,State::DISABLED ]; |
|
| 36 | + $this->_states=[State::ERROR, State::SUCCESS, State::WARNING, State::DISABLED]; |
|
| 37 | 37 | $this->setProperty("name", $this->identifier); |
| 38 | - $this->_fields=array (); |
|
| 38 | + $this->_fields=array(); |
|
| 39 | 39 | $this->_validationParams=[]; |
| 40 | 40 | $this->addItems($elements); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - protected function getForm(){ |
|
| 43 | + protected function getForm() { |
|
| 44 | 44 | return $this; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -61,14 +61,14 @@ discard block |
||
| 61 | 61 | * @param string $caption |
| 62 | 62 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
| 63 | 63 | */ |
| 64 | - public function addDivider($caption=NULL){ |
|
| 65 | - return $this->addContent(new HtmlDivider("",$caption)); |
|
| 64 | + public function addDivider($caption=NULL) { |
|
| 65 | + return $this->addContent(new HtmlDivider("", $caption)); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | public function addFields($fields=NULL, $label=NULL) { |
| 69 | 69 | if (isset($fields)) { |
| 70 | 70 | if (!$fields instanceof HtmlFormFields) { |
| 71 | - if (\is_array($fields) === false) { |
|
| 71 | + if (\is_array($fields)===false) { |
|
| 72 | 72 | $fields=\func_get_args(); |
| 73 | 73 | $end=\end($fields); |
| 74 | 74 | if (\is_string($end)) { |
@@ -78,12 +78,12 @@ discard block |
||
| 78 | 78 | $label=NULL; |
| 79 | 79 | } |
| 80 | 80 | $this->_fields=\array_merge($this->_fields, $fields); |
| 81 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields); |
|
| 81 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields); |
|
| 82 | 82 | } |
| 83 | 83 | if (isset($label)) |
| 84 | 84 | $fields=new HtmlFormField("", $fields, $label); |
| 85 | 85 | } else { |
| 86 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count()); |
|
| 86 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count()); |
|
| 87 | 87 | } |
| 88 | 88 | $this->addItem($fields); |
| 89 | 89 | return $fields; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | public function addItem($item) { |
| 93 | 93 | $item=parent::addItem($item); |
| 94 | - if (\is_subclass_of($item, HtmlFormField::class) === true) { |
|
| 94 | + if (\is_subclass_of($item, HtmlFormField::class)===true) { |
|
| 95 | 95 | $this->_fields[]=$item; |
| 96 | 96 | } |
| 97 | 97 | return $item; |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | return $this->addItem($message); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - private function addCompoValidation($js,$compo,$field){ |
|
| 146 | + private function addCompoValidation($js, $compo, $field) { |
|
| 147 | 147 | $validation=$field->getValidation(); |
| 148 | - if(isset($validation)){ |
|
| 149 | - if(isset($compo)===false){ |
|
| 148 | + if (isset($validation)) { |
|
| 149 | + if (isset($compo)===false) { |
|
| 150 | 150 | $compo=$js->semantic()->form("#".$this->identifier); |
| 151 | 151 | } |
| 152 | 152 | $validation->setIdentifier($field->getDataField()->getIdentifier()); |
@@ -155,38 +155,38 @@ discard block |
||
| 155 | 155 | return $compo; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 159 | - if(\sizeof($this->_validationParams)>0) |
|
| 158 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 159 | + if (\sizeof($this->_validationParams)>0) |
|
| 160 | 160 | $this->setProperty("novalidate", ""); |
| 161 | - return parent::compile($js,$view); |
|
| 161 | + return parent::compile($js, $view); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | public function run(JsUtils $js) { |
| 165 | 165 | $compo=NULL; |
| 166 | - foreach ($this->_fields as $field){ |
|
| 167 | - if($field instanceof HtmlFormField) |
|
| 166 | + foreach ($this->_fields as $field) { |
|
| 167 | + if ($field instanceof HtmlFormField) |
|
| 168 | 168 | $compo=$this->addCompoValidation($js, $compo, $field); |
| 169 | 169 | } |
| 170 | - foreach ($this->content as $field){ |
|
| 171 | - if($field instanceof HtmlFormFields){ |
|
| 170 | + foreach ($this->content as $field) { |
|
| 171 | + if ($field instanceof HtmlFormFields) { |
|
| 172 | 172 | $items=$field->getItems(); |
| 173 | - foreach ($items as $_field){ |
|
| 174 | - if($_field instanceof HtmlFormField) |
|
| 173 | + foreach ($items as $_field) { |
|
| 174 | + if ($_field instanceof HtmlFormField) |
|
| 175 | 175 | $compo=$this->addCompoValidation($js, $compo, $_field); |
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | - if(isset($compo)===false){ |
|
| 179 | + if (isset($compo)===false) { |
|
| 180 | 180 | return parent::run($js); |
| 181 | 181 | } |
| 182 | - $this->_runValidationParams($compo,$js); |
|
| 182 | + $this->_runValidationParams($compo, $js); |
|
| 183 | 183 | return $this->_bsComponent; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - private function _runValidationParams(&$compo,JsUtils $js=NULL){ |
|
| 187 | - if(isset($this->_validationParams["_ajaxSubmit"]) && $this->_validationParams["_ajaxSubmit"] instanceof AjaxCall){ |
|
| 186 | + private function _runValidationParams(&$compo, JsUtils $js=NULL) { |
|
| 187 | + if (isset($this->_validationParams["_ajaxSubmit"]) && $this->_validationParams["_ajaxSubmit"] instanceof AjaxCall) { |
|
| 188 | 188 | $compilation=$this->_validationParams["_ajaxSubmit"]->compile($js); |
| 189 | - $compilation=str_ireplace("\"","%quote%", $compilation); |
|
| 189 | + $compilation=str_ireplace("\"", "%quote%", $compilation); |
|
| 190 | 190 | $this->onSuccess($compilation); |
| 191 | 191 | unset($this->_validationParams["_ajaxSubmit"]); |
| 192 | 192 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $this->addEventsOnRun($js); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - public function addValidationParam($paramName,$paramValue){ |
|
| 198 | + public function addValidationParam($paramName, $paramValue) { |
|
| 199 | 199 | $this->_validationParams[$paramName]=$paramValue; |
| 200 | 200 | return $this; |
| 201 | 201 | } |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | protected $_hasCheckboxes; |
| 31 | 31 | protected $_compileParts; |
| 32 | 32 | |
| 33 | - public function run(JsUtils $js){ |
|
| 34 | - if($this->_hasCheckboxes && isset($js)){ |
|
| 33 | + public function run(JsUtils $js) { |
|
| 34 | + if ($this->_hasCheckboxes && isset($js)) { |
|
| 35 | 35 | $js->execOn("change", "#".$this->identifier." [name='selection[]']", " |
| 36 | 36 | var \$parentCheckbox=\$('#ck-main-ck-{$this->identifier}'),\$checkbox=\$('#{$this->identifier} [name=\"selection[]\"]'),allChecked=true,allUnchecked=true; |
| 37 | 37 | \$checkbox.each(function() {if($(this).prop('checked')){allUnchecked = false;}else{allChecked = false;}}); |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | parent::run($js); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function __construct($identifier,$model,$modelInstance=NULL) { |
|
| 44 | - parent::__construct($identifier, $model,$modelInstance); |
|
| 43 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
| 44 | + parent::__construct($identifier, $model, $modelInstance); |
|
| 45 | 45 | $this->_instanceViewer=new InstanceViewer($identifier); |
| 46 | - $this->content=["table"=>new HtmlTable($identifier, 0,0)]; |
|
| 46 | + $this->content=["table"=>new HtmlTable($identifier, 0, 0)]; |
|
| 47 | 47 | $this->_toolbarPosition=PositionInTable::BEFORETABLE; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -56,61 +56,61 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
| 59 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 59 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 60 | 60 | $this->_instanceViewer->setInstance($this->_model); |
| 61 | 61 | $captions=$this->_instanceViewer->getCaptions(); |
| 62 | 62 | |
| 63 | 63 | $table=$this->content["table"]; |
| 64 | 64 | |
| 65 | - if($this->_hasCheckboxes){ |
|
| 65 | + if ($this->_hasCheckboxes) { |
|
| 66 | 66 | $this->_generateMainCheckbox($captions); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $table->setRowCount(0, \sizeof($captions)); |
| 70 | 70 | $table->setHeaderValues($captions); |
| 71 | - if(isset($this->_compileParts)) |
|
| 71 | + if (isset($this->_compileParts)) |
|
| 72 | 72 | $table->setCompileParts($this->_compileParts); |
| 73 | - if(isset($this->_searchField) && isset($js)){ |
|
| 74 | - $this->_searchField->postOn("change", $this->_urls,"{'s':$(this).val()}","-#".$this->identifier." tbody",["preventDefault"=>false]); |
|
| 73 | + if (isset($this->_searchField) && isset($js)) { |
|
| 74 | + $this->_searchField->postOn("change", $this->_urls, "{'s':$(this).val()}", "-#".$this->identifier." tbody", ["preventDefault"=>false]); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $this->_generateContent($table); |
| 78 | 78 | |
| 79 | - if($this->_hasCheckboxes && $table->hasPart("thead")){ |
|
| 80 | - $table->getHeader()->getCell(0, 0)->addToProperty("class","no-sort"); |
|
| 79 | + if ($this->_hasCheckboxes && $table->hasPart("thead")) { |
|
| 80 | + $table->getHeader()->getCell(0, 0)->addToProperty("class", "no-sort"); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if(isset($this->_pagination) && $this->_pagination->getVisible()){ |
|
| 83 | + if (isset($this->_pagination) && $this->_pagination->getVisible()) { |
|
| 84 | 84 | $this->_generatePagination($table); |
| 85 | 85 | } |
| 86 | - if(isset($this->_toolbar)){ |
|
| 86 | + if (isset($this->_toolbar)) { |
|
| 87 | 87 | $this->_setToolbarPosition($table, $captions); |
| 88 | 88 | } |
| 89 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]); |
|
| 90 | - return parent::compile($js,$view); |
|
| 89 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]); |
|
| 90 | + return parent::compile($js, $view); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - private function _generateMainCheckbox(&$captions){ |
|
| 94 | - $ck=new HtmlCheckbox("main-ck-".$this->identifier,""); |
|
| 93 | + private function _generateMainCheckbox(&$captions) { |
|
| 94 | + $ck=new HtmlCheckbox("main-ck-".$this->identifier, ""); |
|
| 95 | 95 | $ck->setOnChecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',true);"); |
| 96 | 96 | $ck->setOnUnchecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',false);"); |
| 97 | 97 | \array_unshift($captions, $ck); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - protected function _generateContent($table){ |
|
| 100 | + protected function _generateContent($table) { |
|
| 101 | 101 | $objects=$this->_modelInstance; |
| 102 | - if(isset($this->_pagination)){ |
|
| 102 | + if (isset($this->_pagination)) { |
|
| 103 | 103 | $objects=$this->_pagination->getObjects($this->_modelInstance); |
| 104 | 104 | } |
| 105 | 105 | InstanceViewer::setIndex(0); |
| 106 | - $table->fromDatabaseObjects($objects, function($instance){ |
|
| 106 | + $table->fromDatabaseObjects($objects, function($instance) { |
|
| 107 | 107 | $this->_instanceViewer->setInstance($instance); |
| 108 | 108 | InstanceViewer::$index++; |
| 109 | - $result= $this->_instanceViewer->getValues(); |
|
| 110 | - if($this->_hasCheckboxes){ |
|
| 111 | - $ck=new HtmlCheckbox("ck-".$this->identifier,""); |
|
| 109 | + $result=$this->_instanceViewer->getValues(); |
|
| 110 | + if ($this->_hasCheckboxes) { |
|
| 111 | + $ck=new HtmlCheckbox("ck-".$this->identifier, ""); |
|
| 112 | 112 | $field=$ck->getField(); |
| 113 | - $field->setProperty("value",$this->_instanceViewer->getIdentifier()); |
|
| 113 | + $field->setProperty("value", $this->_instanceViewer->getIdentifier()); |
|
| 114 | 114 | $field->setProperty("name", "selection[]"); |
| 115 | 115 | \array_unshift($result, $ck); |
| 116 | 116 | } |
@@ -118,25 +118,25 @@ discard block |
||
| 118 | 118 | }); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - private function _generatePagination($table){ |
|
| 121 | + private function _generatePagination($table) { |
|
| 122 | 122 | $footer=$table->getFooter(); |
| 123 | 123 | $footer->mergeCol(); |
| 124 | - $menu=new HtmlPaginationMenu("pagination-".$this->identifier,$this->_pagination->getPagesNumbers()); |
|
| 124 | + $menu=new HtmlPaginationMenu("pagination-".$this->identifier, $this->_pagination->getPagesNumbers()); |
|
| 125 | 125 | $menu->floatRight(); |
| 126 | 126 | $menu->setActiveItem($this->_pagination->getPage()-1); |
| 127 | 127 | $footer->setValues($menu); |
| 128 | - $menu->postOnClick($this->_urls,"{'p':$(this).attr('data-page')}","-#".$this->identifier." tbody",["preventDefault"=>false]); |
|
| 128 | + $menu->postOnClick($this->_urls, "{'p':$(this).attr('data-page')}", "-#".$this->identifier." tbody", ["preventDefault"=>false]); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - protected function _setToolbarPosition($table,$captions=NULL){ |
|
| 132 | - switch ($this->_toolbarPosition){ |
|
| 131 | + protected function _setToolbarPosition($table, $captions=NULL) { |
|
| 132 | + switch ($this->_toolbarPosition) { |
|
| 133 | 133 | case PositionInTable::BEFORETABLE:case PositionInTable::AFTERTABLE: |
| 134 | - if(isset($this->_compileParts)===false){ |
|
| 134 | + if (isset($this->_compileParts)===false) { |
|
| 135 | 135 | $this->content[$this->_toolbarPosition]=$this->_toolbar; |
| 136 | 136 | } |
| 137 | 137 | break; |
| 138 | 138 | case PositionInTable::HEADER:case PositionInTable::FOOTER: case PositionInTable::BODY: |
| 139 | - $this->addToolbarRow($this->_toolbarPosition,$table, $captions); |
|
| 139 | + $this->addToolbarRow($this->_toolbarPosition, $table, $captions); |
|
| 140 | 140 | break; |
| 141 | 141 | } |
| 142 | 142 | } |
@@ -148,18 +148,18 @@ discard block |
||
| 148 | 148 | * @param callable $callback function called after the field compilation |
| 149 | 149 | * @return \Ajax\semantic\widgets\datatable\DataTable |
| 150 | 150 | */ |
| 151 | - public function afterCompile($index,$callback){ |
|
| 152 | - $this->_instanceViewer->afterCompile($index,$callback); |
|
| 151 | + public function afterCompile($index, $callback) { |
|
| 152 | + $this->_instanceViewer->afterCompile($index, $callback); |
|
| 153 | 153 | return $this; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - private function addToolbarRow($part,$table,$captions){ |
|
| 156 | + private function addToolbarRow($part, $table, $captions) { |
|
| 157 | 157 | $row=$table->getPart($part)->addRow(\sizeof($captions)); |
| 158 | 158 | $row->mergeCol(); |
| 159 | 159 | $row->setValues([$this->_toolbar]); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - public function getHtmlComponent(){ |
|
| 162 | + public function getHtmlComponent() { |
|
| 163 | 163 | return $this->content["table"]; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | return $this; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - public function paginate($items_per_page=10,$page=1){ |
|
| 176 | - $this->_pagination=new Pagination($items_per_page,4,$page); |
|
| 175 | + public function paginate($items_per_page=10, $page=1) { |
|
| 176 | + $this->_pagination=new Pagination($items_per_page, 4, $page); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | public function getHasCheckboxes() { |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | return $this; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - public function refresh($compileParts=["tbody"]){ |
|
| 188 | + public function refresh($compileParts=["tbody"]) { |
|
| 189 | 189 | $this->_compileParts=$compileParts; |
| 190 | 190 | return $this; |
| 191 | 191 | } |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | * @param callable $callback |
| 195 | 195 | * @return callable |
| 196 | 196 | */ |
| 197 | - private function getFieldButtonCallable($caption,$callback=null){ |
|
| 198 | - return $this->getCallable("getFieldButton",[$caption],$callback); |
|
| 197 | + private function getFieldButtonCallable($caption, $callback=null) { |
|
| 198 | + return $this->getCallable("getFieldButton", [$caption], $callback); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -203,16 +203,16 @@ discard block |
||
| 203 | 203 | * @param callable $callback |
| 204 | 204 | * @return callable |
| 205 | 205 | */ |
| 206 | - private function getCallable($thisCallback,$parameters,$callback=null){ |
|
| 207 | - $result=function($instance) use($thisCallback,$parameters,$callback){ |
|
| 208 | - $object=call_user_func_array(array($this,$thisCallback), $parameters); |
|
| 209 | - if(isset($callback)){ |
|
| 210 | - if(\is_callable($callback)){ |
|
| 211 | - $callback($object,$instance); |
|
| 206 | + private function getCallable($thisCallback, $parameters, $callback=null) { |
|
| 207 | + $result=function($instance) use($thisCallback, $parameters, $callback){ |
|
| 208 | + $object=call_user_func_array(array($this, $thisCallback), $parameters); |
|
| 209 | + if (isset($callback)) { |
|
| 210 | + if (\is_callable($callback)) { |
|
| 211 | + $callback($object, $instance); |
|
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | - if($object instanceof HtmlSemDoubleElement){ |
|
| 215 | - $object->setProperty("data-ajax",$this->_instanceViewer->getIdentifier()); |
|
| 214 | + if ($object instanceof HtmlSemDoubleElement) { |
|
| 215 | + $object->setProperty("data-ajax", $this->_instanceViewer->getIdentifier()); |
|
| 216 | 216 | } |
| 217 | 217 | return $object; |
| 218 | 218 | }; |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | * @param string $caption |
| 224 | 224 | * @return HtmlButton |
| 225 | 225 | */ |
| 226 | - private function getFieldButton($caption){ |
|
| 227 | - return new HtmlButton("",$caption); |
|
| 226 | + private function getFieldButton($caption) { |
|
| 227 | + return new HtmlButton("", $caption); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | /** |
@@ -233,8 +233,8 @@ discard block |
||
| 233 | 233 | * @param callable $callback |
| 234 | 234 | * @return \Ajax\semantic\widgets\datatable\DataTable |
| 235 | 235 | */ |
| 236 | - public function addFieldButton($caption,$callback=null){ |
|
| 237 | - $this->addField($this->getCallable("getFieldButton",[$caption],$callback)); |
|
| 236 | + public function addFieldButton($caption, $callback=null) { |
|
| 237 | + $this->addField($this->getCallable("getFieldButton", [$caption], $callback)); |
|
| 238 | 238 | return $this; |
| 239 | 239 | } |
| 240 | 240 | |
@@ -245,8 +245,8 @@ discard block |
||
| 245 | 245 | * @param callable $callback |
| 246 | 246 | * @return \Ajax\semantic\widgets\datatable\DataTable |
| 247 | 247 | */ |
| 248 | - public function insertFieldButton($index,$caption,$callback=null){ |
|
| 249 | - $this->insertField($index, $this->getFieldButtonCallable($caption,$callback)); |
|
| 248 | + public function insertFieldButton($index, $caption, $callback=null) { |
|
| 249 | + $this->insertField($index, $this->getFieldButtonCallable($caption, $callback)); |
|
| 250 | 250 | return $this; |
| 251 | 251 | } |
| 252 | 252 | |
@@ -257,60 +257,60 @@ discard block |
||
| 257 | 257 | * @param callable $callback |
| 258 | 258 | * @return \Ajax\semantic\widgets\datatable\DataTable |
| 259 | 259 | */ |
| 260 | - public function insertInFieldButton($index,$caption,$callback=null){ |
|
| 261 | - $this->insertInField($index, $this->getFieldButtonCallable($caption,$callback)); |
|
| 260 | + public function insertInFieldButton($index, $caption, $callback=null) { |
|
| 261 | + $this->insertInField($index, $this->getFieldButtonCallable($caption, $callback)); |
|
| 262 | 262 | return $this; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - private function addDefaultButton($icon,$class=null,$callback=null){ |
|
| 266 | - $this->addField($this->getCallable("getDefaultButton",[$icon,$class],$callback)); |
|
| 265 | + private function addDefaultButton($icon, $class=null, $callback=null) { |
|
| 266 | + $this->addField($this->getCallable("getDefaultButton", [$icon, $class], $callback)); |
|
| 267 | 267 | return $this; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - private function insertDefaultButtonIn($index,$icon,$class=null,$callback=null){ |
|
| 271 | - $this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class],$callback)); |
|
| 270 | + private function insertDefaultButtonIn($index, $icon, $class=null, $callback=null) { |
|
| 271 | + $this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class], $callback)); |
|
| 272 | 272 | return $this; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - private function getDefaultButton($icon,$class=null){ |
|
| 275 | + private function getDefaultButton($icon, $class=null) { |
|
| 276 | 276 | $bt=$this->getFieldButton(""); |
| 277 | 277 | $bt->asIcon($icon); |
| 278 | - if(isset($class)) |
|
| 278 | + if (isset($class)) |
|
| 279 | 279 | $bt->addToProperty("class", $class); |
| 280 | 280 | return $bt; |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - public function addDeleteButton($callback=null){ |
|
| 284 | - return $this->addDefaultButton("remove","delete red basic",$callback); |
|
| 283 | + public function addDeleteButton($callback=null) { |
|
| 284 | + return $this->addDefaultButton("remove", "delete red basic", $callback); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - public function addEditButton($callback=null){ |
|
| 288 | - return $this->addDefaultButton("edit","edit basic",$callback); |
|
| 287 | + public function addEditButton($callback=null) { |
|
| 288 | + return $this->addDefaultButton("edit", "edit basic", $callback); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - public function addEditDeleteButtons($callbackEdit=null,$callbackDelete=null){ |
|
| 291 | + public function addEditDeleteButtons($callbackEdit=null, $callbackDelete=null) { |
|
| 292 | 292 | $this->addEditButton($callbackEdit); |
| 293 | 293 | $index=$this->_instanceViewer->visiblePropertiesCount()-1; |
| 294 | - $this->insertDeleteButtonIn($index,$callbackDelete); |
|
| 294 | + $this->insertDeleteButtonIn($index, $callbackDelete); |
|
| 295 | 295 | return $this; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - public function insertDeleteButtonIn($index,$callback=null){ |
|
| 299 | - return $this->insertDefaultButtonIn($index,"remove","delete red basic",$callback); |
|
| 298 | + public function insertDeleteButtonIn($index, $callback=null) { |
|
| 299 | + return $this->insertDefaultButtonIn($index, "remove", "delete red basic", $callback); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | - public function insertEditButtonIn($index,$callback=null){ |
|
| 303 | - return $this->insertDefaultButtonIn($index,"edit","edit basic",$callback); |
|
| 302 | + public function insertEditButtonIn($index, $callback=null) { |
|
| 303 | + return $this->insertDefaultButtonIn($index, "edit", "edit basic", $callback); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - public function addSearchInToolbar($position=Direction::RIGHT){ |
|
| 306 | + public function addSearchInToolbar($position=Direction::RIGHT) { |
|
| 307 | 307 | return $this->addInToolbar($this->getSearchField())->setPosition($position); |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - public function getSearchField(){ |
|
| 311 | - if(isset($this->_searchField)===false){ |
|
| 312 | - $this->_searchField=new HtmlInput("search-".$this->identifier,"search","","Search..."); |
|
| 313 | - $this->_searchField->addIcon("search",Direction::RIGHT); |
|
| 310 | + public function getSearchField() { |
|
| 311 | + if (isset($this->_searchField)===false) { |
|
| 312 | + $this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search..."); |
|
| 313 | + $this->_searchField->addIcon("search", Direction::RIGHT); |
|
| 314 | 314 | } |
| 315 | 315 | return $this->_searchField; |
| 316 | 316 | } |
@@ -68,8 +68,9 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $table->setRowCount(0, \sizeof($captions)); |
| 70 | 70 | $table->setHeaderValues($captions); |
| 71 | - if(isset($this->_compileParts)) |
|
| 72 | - $table->setCompileParts($this->_compileParts); |
|
| 71 | + if(isset($this->_compileParts)) { |
|
| 72 | + $table->setCompileParts($this->_compileParts); |
|
| 73 | + } |
|
| 73 | 74 | if(isset($this->_searchField) && isset($js)){ |
| 74 | 75 | $this->_searchField->postOn("change", $this->_urls,"{'s':$(this).val()}","-#".$this->identifier." tbody",["preventDefault"=>false]); |
| 75 | 76 | } |
@@ -275,8 +276,9 @@ discard block |
||
| 275 | 276 | private function getDefaultButton($icon,$class=null){ |
| 276 | 277 | $bt=$this->getFieldButton(""); |
| 277 | 278 | $bt->asIcon($icon); |
| 278 | - if(isset($class)) |
|
| 279 | - $bt->addToProperty("class", $class); |
|
| 279 | + if(isset($class)) { |
|
| 280 | + $bt->addToProperty("class", $class); |
|
| 281 | + } |
|
| 280 | 282 | return $bt; |
| 281 | 283 | } |
| 282 | 284 | |