@@ -19,28 +19,28 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public function __construct(JsUtils $js=NULL) { |
| 21 | 21 | parent::__construct($js); |
| 22 | - $this->events=array (); |
|
| 22 | + $this->events=array(); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | protected function compileEvents() { |
| 26 | - foreach ( $this->events as $event => $jsCode ) { |
|
| 26 | + foreach ($this->events as $event => $jsCode) { |
|
| 27 | 27 | $itemSelector=JString::getValueBetween($event); |
| 28 | 28 | //echo $itemSelector.":::".$jsCode."<br>"; |
| 29 | - if($event=="execute"){ |
|
| 29 | + if ($event=="execute") { |
|
| 30 | 30 | $this->jquery_code_for_compile []=$jsCode; |
| 31 | - }else if($event=="beforeExecute"){ |
|
| 31 | + } else if ($event=="beforeExecute") { |
|
| 32 | 32 | \array_unshift($this->jquery_code_for_compile, $jsCode); |
| 33 | - }else{ |
|
| 33 | + } else { |
|
| 34 | 34 | $selector=$this->_createSelector($itemSelector, $this->attachTo); |
| 35 | 35 | $this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - protected function _createSelector($itemSelector,$selector){ |
|
| 41 | - if(!isset($itemSelector)) |
|
| 40 | + protected function _createSelector($itemSelector, $selector) { |
|
| 41 | + if (!isset($itemSelector)) |
|
| 42 | 42 | $itemSelector=$this->itemSelector; |
| 43 | - if(isset($itemSelector) && $itemSelector!=="") |
|
| 43 | + if (isset($itemSelector) && $itemSelector!=="") |
|
| 44 | 44 | $selector.=" ".$itemSelector; |
| 45 | 45 | return $selector; |
| 46 | 46 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $result=implode("\n", $this->jquery_code_for_compile); |
| 50 | 50 | $result=str_ireplace("\"%", "", $result); |
| 51 | 51 | $result=str_ireplace("%\"", "", $result); |
| 52 | - $result=str_replace(array ( |
|
| 52 | + $result=str_replace(array( |
|
| 53 | 53 | "\\n", |
| 54 | 54 | "\\r", |
| 55 | 55 | "\\t" |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | public function getScript() { |
| 61 | 61 | $allParams=$this->params; |
| 62 | - $this->jquery_code_for_compile=array (); |
|
| 62 | + $this->jquery_code_for_compile=array(); |
|
| 63 | 63 | $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).");"; |
| 64 | 64 | $this->compileEvents(); |
| 65 | 65 | return $this->compileJQueryCode(); |
@@ -2,63 +2,63 @@ |
||
| 2 | 2 | namespace Ajax\service; |
| 3 | 3 | class JString { |
| 4 | 4 | |
| 5 | - public static function contains($hay,$needle){ |
|
| 6 | - return strpos($hay, $needle) !== false; |
|
| 5 | + public static function contains($hay, $needle) { |
|
| 6 | + return strpos($hay, $needle)!==false; |
|
| 7 | 7 | } |
| 8 | 8 | public static function startswith($hay, $needle) { |
| 9 | - return substr($hay, 0, strlen($needle)) === $needle; |
|
| 9 | + return substr($hay, 0, strlen($needle))===$needle; |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | public static function endswith($hay, $needle) { |
| 13 | - return substr($hay, -strlen($needle)) === $needle; |
|
| 13 | + return substr($hay, -strlen($needle))===$needle; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - public static function isNull($s){ |
|
| 16 | + public static function isNull($s) { |
|
| 17 | 17 | return (!isset($s) || NULL===$s || ""===$s); |
| 18 | 18 | } |
| 19 | - public static function isNotNull($s){ |
|
| 19 | + public static function isNotNull($s) { |
|
| 20 | 20 | return (isset($s) && NULL!==$s && ""!==$s); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public static function isBoolean($value){ |
|
| 23 | + public static function isBoolean($value) { |
|
| 24 | 24 | return \is_bool($value) || $value==1 || $value==0; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public static function isBooleanTrue($value){ |
|
| 27 | + public static function isBooleanTrue($value) { |
|
| 28 | 28 | return $value==1 || $value; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public static function isBooleanFalse($value){ |
|
| 31 | + public static function isBooleanFalse($value) { |
|
| 32 | 32 | return $value==0 || !$value; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public static function camelCaseToSeparated($input,$separator=" "){ |
|
| 35 | + public static function camelCaseToSeparated($input, $separator=" ") { |
|
| 36 | 36 | return strtolower(preg_replace('/(?<!^)[A-Z]/', $separator.'$0', $input)); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public static function replaceAtFirst($subject,$from, $to){ |
|
| 40 | - $from = '/\A'.preg_quote($from, '/').'/'; |
|
| 39 | + public static function replaceAtFirst($subject, $from, $to) { |
|
| 40 | + $from='/\A'.preg_quote($from, '/').'/'; |
|
| 41 | 41 | return \preg_replace($from, $to, $subject, 1); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public static function replaceAtLast($subject,$from, $to){ |
|
| 45 | - $from = '/'.preg_quote($from, '/').'\z/'; |
|
| 44 | + public static function replaceAtLast($subject, $from, $to) { |
|
| 45 | + $from='/'.preg_quote($from, '/').'\z/'; |
|
| 46 | 46 | return \preg_replace($from, $to, $subject, 1); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public static function replaceAtFirstAndLast($subject,$fromFirst,$toFirst,$fromLast,$toLast){ |
|
| 49 | + public static function replaceAtFirstAndLast($subject, $fromFirst, $toFirst, $fromLast, $toLast) { |
|
| 50 | 50 | $s=self::replaceAtFirst($subject, $fromFirst, $toFirst); |
| 51 | 51 | return self::replaceAtLast($s, $fromLast, $toLast); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public static function getValueBetween(&$str,$before="{{",$after="}}"){ |
|
| 54 | + public static function getValueBetween(&$str, $before="{{", $after="}}") { |
|
| 55 | 55 | $matches=[]; |
| 56 | 56 | $result=null; |
| 57 | 57 | $_before=\preg_quote($before); |
| 58 | 58 | $_after=\preg_quote($after); |
| 59 | - if(\preg_match('/'.$_before.'(.*?)'.$_after.'/s', $str, $matches)===1){ |
|
| 59 | + if (\preg_match('/'.$_before.'(.*?)'.$_after.'/s', $str, $matches)===1) { |
|
| 60 | 60 | $result=$matches[1]; |
| 61 | - $str=\str_replace($before.$result.$after,"", $str); |
|
| 61 | + $str=\str_replace($before.$result.$after, "", $str); |
|
| 62 | 62 | } |
| 63 | 63 | return $result; |
| 64 | 64 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Ajax\semantic\html\collections\table\traits; |
| 3 | 3 | |
| 4 | -trait TableTrait{ |
|
| 4 | +trait TableTrait { |
|
| 5 | 5 | /** |
| 6 | 6 | * @return HtmlTable |
| 7 | 7 | */ |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | abstract public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false); |
| 10 | 10 | abstract public function getOn($event, $url, $responseElement="", $parameters=array()); |
| 11 | 11 | |
| 12 | - protected function addToPropertyTable($property,$value){ |
|
| 12 | + protected function addToPropertyTable($property, $value) { |
|
| 13 | 13 | return $this->getTable()->addToProperty($property, $value); |
| 14 | 14 | } |
| 15 | 15 | |
@@ -20,15 +20,15 @@ discard block |
||
| 20 | 20 | public function setBasic($very=false) { |
| 21 | 21 | $table=$this->getTable(); |
| 22 | 22 | if ($very) |
| 23 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 24 | - return $table->addToPropertyCtrl("class", "basic", array ("basic" )); |
|
| 23 | + $table->addToPropertyCtrl("class", "very", array("very")); |
|
| 24 | + return $table->addToPropertyCtrl("class", "basic", array("basic")); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function setCompact($very=false) { |
| 28 | 28 | $table=$this->getTable(); |
| 29 | 29 | if ($very) |
| 30 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 31 | - return $table->addToPropertyCtrl("class", "compact", array ("compact" )); |
|
| 30 | + $table->addToPropertyCtrl("class", "very", array("very")); |
|
| 31 | + return $table->addToPropertyCtrl("class", "compact", array("compact")); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public function setCollapsing() { |
@@ -67,16 +67,16 @@ discard block |
||
| 67 | 67 | return $this->addToPropertyTable("class", "striped"); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false){ |
|
| 71 | - $this->onRowClick($jsCode,$stopPropagation,$preventDefault); |
|
| 70 | + public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false) { |
|
| 71 | + $this->onRowClick($jsCode, $stopPropagation, $preventDefault); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function onRow($event,$jsCode, $stopPropagation=false, $preventDefault=false){ |
|
| 75 | - $this->getTable()->addEvent($event."{{tr}}",$jsCode,$stopPropagation,$preventDefault); |
|
| 74 | + public function onRow($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
| 75 | + $this->getTable()->addEvent($event."{{tr}}", $jsCode, $stopPropagation, $preventDefault); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - public function getOnRow($event, $url, $responseElement="", $parameters=array()){ |
|
| 79 | - $parameters=\array_merge($parameters,["stopPropagation"=>false,"preventDefault"=>false]); |
|
| 80 | - return $this->getTable()->getOn($event."{{tbody tr}}", $url,$responseElement,$parameters); |
|
| 78 | + public function getOnRow($event, $url, $responseElement="", $parameters=array()) { |
|
| 79 | + $parameters=\array_merge($parameters, ["stopPropagation"=>false, "preventDefault"=>false]); |
|
| 80 | + return $this->getTable()->getOn($event."{{tbody tr}}", $url, $responseElement, $parameters); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | \ No newline at end of file |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @param string $event |
| 22 | 22 | * @param boolean $multiple |
| 23 | 23 | */ |
| 24 | - public function __construct($table,$class="active",$event="click",$multiple=false){ |
|
| 24 | + public function __construct($table, $class="active", $event="click", $multiple=false) { |
|
| 25 | 25 | $this->table=$table; |
| 26 | 26 | $this->class=$class; |
| 27 | 27 | $this->event=$event; |
@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | return $this; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function compile(){ |
|
| 58 | + public function compile() { |
|
| 59 | 59 | $multiple=""; |
| 60 | - if(!$this->multiple){ |
|
| 60 | + if (!$this->multiple) { |
|
| 61 | 61 | $multiple="$(this).closest('tbody').children('tr').removeClass('".$this->class."');"; |
| 62 | 62 | } |
| 63 | - $this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');",false,false); |
|
| 63 | + $this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');", false, false); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | } |
| 67 | 67 | \ No newline at end of file |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | return $this->setParam("context", $value); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function setOffset($offset=0){ |
|
| 24 | + public function setOffset($offset=0) { |
|
| 25 | 25 | return $this->setParam("offset", $offset); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -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->addItems($elements); |
| 40 | 40 | $this->_validationParams=[]; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - protected function getForm(){ |
|
| 43 | + protected function getForm() { |
|
| 44 | 44 | return $this; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | * @param string $caption |
| 63 | 63 | * @return HtmlForm |
| 64 | 64 | */ |
| 65 | - public function addDivider($caption=NULL){ |
|
| 66 | - return $this->addContent(new HtmlDivider("",$caption)); |
|
| 65 | + public function addDivider($caption=NULL) { |
|
| 66 | + return $this->addContent(new HtmlDivider("", $caption)); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | $label=NULL; |
| 86 | 86 | } |
| 87 | 87 | $this->_fields=\array_merge($this->_fields, $fields); |
| 88 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields); |
|
| 88 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields); |
|
| 89 | 89 | } |
| 90 | 90 | if (isset($label)) |
| 91 | 91 | $fields=new HtmlFormField("", $fields, $label); |
| 92 | 92 | } else { |
| 93 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count()); |
|
| 93 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count()); |
|
| 94 | 94 | } |
| 95 | 95 | $this->addItem($fields); |
| 96 | 96 | return $fields; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | public function addItem($item) { |
| 100 | 100 | $item=parent::addItem($item); |
| 101 | - if (\is_subclass_of($item, HtmlFormField::class) === true) { |
|
| 101 | + if (\is_subclass_of($item, HtmlFormField::class)===true) { |
|
| 102 | 102 | $this->_fields[]=$item; |
| 103 | 103 | } |
| 104 | 104 | return $item; |
@@ -156,39 +156,39 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | |
| 158 | 158 | |
| 159 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 160 | - if(\sizeof($this->_validationParams)>0) |
|
| 159 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 160 | + if (\sizeof($this->_validationParams)>0) |
|
| 161 | 161 | $this->setProperty("novalidate", ""); |
| 162 | - return parent::compile($js,$view); |
|
| 162 | + return parent::compile($js, $view); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | public function run(JsUtils $js) { |
| 166 | - if(isset($js)){ |
|
| 166 | + if (isset($js)) { |
|
| 167 | 167 | $compo=$js->semantic()->form("#".$this->identifier); |
| 168 | - }else{ |
|
| 168 | + } else { |
|
| 169 | 169 | $compo=new Form(); |
| 170 | 170 | $compo->attach("#".$this->identifier); |
| 171 | 171 | } |
| 172 | - foreach ($this->_fields as $field){ |
|
| 173 | - if($field instanceof HtmlFormField){ |
|
| 172 | + foreach ($this->_fields as $field) { |
|
| 173 | + if ($field instanceof HtmlFormField) { |
|
| 174 | 174 | $compo=$this->addCompoValidation($compo, $field); |
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | - foreach ($this->content as $field){ |
|
| 178 | - if($field instanceof HtmlFormFields){ |
|
| 177 | + foreach ($this->content as $field) { |
|
| 178 | + if ($field instanceof HtmlFormFields) { |
|
| 179 | 179 | $items=$field->getItems(); |
| 180 | - foreach ($items as $_field){ |
|
| 181 | - if($_field instanceof HtmlFormField) |
|
| 180 | + foreach ($items as $_field) { |
|
| 181 | + if ($_field instanceof HtmlFormField) |
|
| 182 | 182 | $compo=$this->addCompoValidation($compo, $_field); |
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | - $this->_runValidationParams($compo,$js); |
|
| 186 | + $this->_runValidationParams($compo, $js); |
|
| 187 | 187 | return $this->_bsComponent; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - public function addValidationParam($paramName,$paramValue,$before="",$after=""){ |
|
| 191 | - $this->addBehavior($this->_validationParams, $paramName, $paramValue,$before,$after); |
|
| 190 | + public function addValidationParam($paramName, $paramValue, $before="", $after="") { |
|
| 191 | + $this->addBehavior($this->_validationParams, $paramName, $paramValue, $before, $after); |
|
| 192 | 192 | return $this; |
| 193 | 193 | } |
| 194 | 194 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | return $this->_validationParams; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - public function removeValidationParam($param){ |
|
| 204 | + public function removeValidationParam($param) { |
|
| 205 | 205 | unset($this->_validationParams[$param]); |
| 206 | 206 | return $this; |
| 207 | 207 | } |
@@ -13,28 +13,28 @@ discard block |
||
| 13 | 13 | * @author jc |
| 14 | 14 | * |
| 15 | 15 | */ |
| 16 | -trait FormTrait{ |
|
| 16 | +trait FormTrait { |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @return HtmlForm |
| 20 | 20 | */ |
| 21 | 21 | abstract protected function getForm(); |
| 22 | 22 | |
| 23 | - protected function addCompoValidation($compo,$field){ |
|
| 23 | + protected function addCompoValidation($compo, $field) { |
|
| 24 | 24 | $validation=$field->getValidation(); |
| 25 | - if(isset($validation)){ |
|
| 25 | + if (isset($validation)) { |
|
| 26 | 26 | $validation->setIdentifier($field->getDataField()->getIdentifier()); |
| 27 | 27 | $compo->addFieldValidation($validation); |
| 28 | 28 | } |
| 29 | 29 | return $compo; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - protected function _runValidationParams(&$compo,JsUtils $js=NULL){ |
|
| 32 | + protected function _runValidationParams(&$compo, JsUtils $js=NULL) { |
|
| 33 | 33 | $form=$this->getForm(); |
| 34 | 34 | $params=$form->getValidationParams(); |
| 35 | - if(isset($params["_ajaxSubmit"]) && $params["_ajaxSubmit"] instanceof AjaxCall){ |
|
| 35 | + if (isset($params["_ajaxSubmit"]) && $params["_ajaxSubmit"] instanceof AjaxCall) { |
|
| 36 | 36 | $compilation=$params["_ajaxSubmit"]->compile($js); |
| 37 | - $compilation=str_ireplace("\"","%quote%", $compilation); |
|
| 37 | + $compilation=str_ireplace("\"", "%quote%", $compilation); |
|
| 38 | 38 | $this->onSuccess($compilation); |
| 39 | 39 | $form->removeValidationParam("_ajaxSubmit"); |
| 40 | 40 | } |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | return $this; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function setAttached($value=true){ |
|
| 55 | + public function setAttached($value=true) { |
|
| 56 | 56 | $form=$this->getForm(); |
| 57 | - if($value) |
|
| 58 | - $form->addToPropertyCtrl("class", "attached", array ("attached" )); |
|
| 57 | + if ($value) |
|
| 58 | + $form->addToPropertyCtrl("class", "attached", array("attached")); |
|
| 59 | 59 | return $form; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function addErrorMessage(){ |
|
| 62 | + public function addErrorMessage() { |
|
| 63 | 63 | return $this->getForm()->addContent((new HtmlMessage(""))->setError()); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -75,41 +75,41 @@ discard block |
||
| 75 | 75 | * @param array $parameters |
| 76 | 76 | * @return HtmlForm |
| 77 | 77 | */ |
| 78 | - public function submitOn($event,$identifierOrElement,$url,$responseElement,$parameters=NULL){ |
|
| 78 | + public function submitOn($event, $identifierOrElement, $url, $responseElement, $parameters=NULL) { |
|
| 79 | 79 | $form=$this->getForm(); |
| 80 | - if($identifierOrElement instanceof BaseHtml) |
|
| 80 | + if ($identifierOrElement instanceof BaseHtml) |
|
| 81 | 81 | $elem=$identifierOrElement; |
| 82 | 82 | else |
| 83 | 83 | $elem=$form->getElementById($identifierOrElement, $form->getContent()); |
| 84 | - if(isset($elem)){ |
|
| 85 | - $this->_buttonAsSubmit($elem, $event,$url,$responseElement,$parameters); |
|
| 84 | + if (isset($elem)) { |
|
| 85 | + $this->_buttonAsSubmit($elem, $event, $url, $responseElement, $parameters); |
|
| 86 | 86 | } |
| 87 | 87 | return $form; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - public function submitOnClick($identifier,$url,$responseElement,$parameters=NULL){ |
|
| 91 | - return $this->submitOn("click", $identifier, $url, $responseElement,$parameters); |
|
| 90 | + public function submitOnClick($identifier, $url, $responseElement, $parameters=NULL) { |
|
| 91 | + return $this->submitOn("click", $identifier, $url, $responseElement, $parameters); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){ |
|
| 95 | - $bt=$this->getForm()->addButton($identifier, $value,$cssStyle); |
|
| 96 | - return $this->_buttonAsSubmit($bt, "click",$url,$responseElement,$parameters); |
|
| 94 | + public function addSubmit($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) { |
|
| 95 | + $bt=$this->getForm()->addButton($identifier, $value, $cssStyle); |
|
| 96 | + return $this->_buttonAsSubmit($bt, "click", $url, $responseElement, $parameters); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL){ |
|
| 99 | + protected function _buttonAsSubmit(BaseHtml&$button, $event, $url, $responseElement=NULL, $parameters=NULL) { |
|
| 100 | 100 | $form=$this->getForm(); |
| 101 | - if(isset($url) && isset($responseElement)){ |
|
| 102 | - $button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');",true,true); |
|
| 103 | - $params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url,"stopPropagation"=>true]; |
|
| 104 | - if(\is_array($parameters)) |
|
| 105 | - $params=\array_merge($params,$parameters); |
|
| 101 | + if (isset($url) && isset($responseElement)) { |
|
| 102 | + $button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');", true, true); |
|
| 103 | + $params=["form"=>$form->getIdentifier(), "responseElement"=>$responseElement, "url"=>$url, "stopPropagation"=>true]; |
|
| 104 | + if (\is_array($parameters)) |
|
| 105 | + $params=\array_merge($params, $parameters); |
|
| 106 | 106 | $form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params)); |
| 107 | 107 | } |
| 108 | 108 | return $button; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function addReset($identifier,$value,$cssStyle=NULL){ |
|
| 112 | - $bt=$this->getForm()->addButton($identifier, $value,$cssStyle); |
|
| 111 | + public function addReset($identifier, $value, $cssStyle=NULL) { |
|
| 112 | + $bt=$this->getForm()->addButton($identifier, $value, $cssStyle); |
|
| 113 | 113 | $bt->setProperty("type", "reset"); |
| 114 | 114 | return $bt; |
| 115 | 115 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * @param string $jsCode |
| 120 | 120 | * @return \Ajax\semantic\html\collections\form\HtmlForm |
| 121 | 121 | */ |
| 122 | - public function onValid($jsCode){ |
|
| 122 | + public function onValid($jsCode) { |
|
| 123 | 123 | $form=$this->getForm(); |
| 124 | 124 | $form->addValidationParam("onValid", "%function(){".$jsCode."}%"); |
| 125 | 125 | return $form; |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | * @param string $jsCode can use event and fields parameters |
| 131 | 131 | * @return HtmlForm |
| 132 | 132 | */ |
| 133 | - public function onSuccess($jsCode){ |
|
| 133 | + public function onSuccess($jsCode) { |
|
| 134 | 134 | $form=$this->getForm(); |
| 135 | - $form->addValidationParam("onSuccess", $jsCode,"%function(event,fields){","}%"); |
|
| 135 | + $form->addValidationParam("onSuccess", $jsCode, "%function(event,fields){", "}%"); |
|
| 136 | 136 | return $form; |
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | \ No newline at end of file |
@@ -7,50 +7,50 @@ |
||
| 7 | 7 | |
| 8 | 8 | class HtmlSticky extends HtmlSemDoubleElement { |
| 9 | 9 | |
| 10 | - public function __construct($identifier,$context=NULL,$content=NULL) { |
|
| 10 | + public function __construct($identifier, $context=NULL, $content=NULL) { |
|
| 11 | 11 | parent::__construct($identifier, "div", "ui sticky", $content); |
| 12 | - if(isset($content)) |
|
| 12 | + if (isset($content)) |
|
| 13 | 13 | $this->setContext($context); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - public function setContext($context){ |
|
| 16 | + public function setContext($context) { |
|
| 17 | 17 | $this->_params["context"]=$context; |
| 18 | 18 | return $this; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function setFixed($value=NULL){ |
|
| 21 | + public function setFixed($value=NULL) { |
|
| 22 | 22 | $fixed="fixed"; |
| 23 | - if(isset($value)) |
|
| 23 | + if (isset($value)) |
|
| 24 | 24 | $fixed.=" ".$value; |
| 25 | - return $this->addToProperty("class",$fixed); |
|
| 25 | + return $this->addToProperty("class", $fixed); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function setBound($value=NULL){ |
|
| 28 | + public function setBound($value=NULL) { |
|
| 29 | 29 | $bound="bound"; |
| 30 | - if(isset($value)) |
|
| 30 | + if (isset($value)) |
|
| 31 | 31 | $bound.=" ".$value; |
| 32 | - return $this->addToProperty("class",$bound); |
|
| 32 | + return $this->addToProperty("class", $bound); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * {@inheritDoc} |
| 37 | 37 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
| 38 | 38 | */ |
| 39 | - public function run(JsUtils $js){ |
|
| 39 | + public function run(JsUtils $js) { |
|
| 40 | 40 | parent::run($js); |
| 41 | - return $js->semantic()->sticky("#".$this->identifier,$this->_params); |
|
| 41 | + return $js->semantic()->sticky("#".$this->identifier, $this->_params); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function setOffset($offset=0){ |
|
| 44 | + public function setOffset($offset=0) { |
|
| 45 | 45 | $this->_params["offset"]=$offset; |
| 46 | 46 | return $this; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | |
| 51 | - public function setDebug($verbose=NULL){ |
|
| 51 | + public function setDebug($verbose=NULL) { |
|
| 52 | 52 | $this->_params["debug"]=true; |
| 53 | - if(isset($verbose)) |
|
| 53 | + if (isset($verbose)) |
|
| 54 | 54 | $this->_params["verbose"]=true; |
| 55 | 55 | return $this; |
| 56 | 56 | } |
@@ -19,10 +19,10 @@ discard block |
||
| 19 | 19 | $this->setLabel($label); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public function setChecked($value=true){ |
|
| 23 | - if($value===true){ |
|
| 22 | + public function setChecked($value=true) { |
|
| 23 | + if ($value===true) { |
|
| 24 | 24 | $this->getField()->setProperty("checked", "checked"); |
| 25 | - }else{ |
|
| 25 | + } else { |
|
| 26 | 26 | $this->getField()->removeProperty("checked"); |
| 27 | 27 | } |
| 28 | 28 | return $this; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
| 85 | 85 | */ |
| 86 | 86 | public function attachEvent($selector, $action=NULL) { |
| 87 | - if (isset($action)||\is_numeric($action)===true) { |
|
| 87 | + if (isset($action) || \is_numeric($action)===true) { |
|
| 88 | 88 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");'; |
| 89 | 89 | } else { |
| 90 | 90 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'");'; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function attachEvents($events=array()) { |
| 102 | 102 | if (\is_array($events)) { |
| 103 | - foreach ( $events as $action => $selector ) { |
|
| 103 | + foreach ($events as $action => $selector) { |
|
| 104 | 104 | $this->attachEvent($selector, $action); |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -111,24 +111,24 @@ discard block |
||
| 111 | 111 | return $this->addToProperty("class", "fitted"); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - public function setOnChecked($jsCode){ |
|
| 114 | + public function setOnChecked($jsCode) { |
|
| 115 | 115 | $this->_params["onChecked"]=$jsCode; |
| 116 | 116 | return $this; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function setOnUnchecked($jsCode){ |
|
| 119 | + public function setOnUnchecked($jsCode) { |
|
| 120 | 120 | $this->_params["onUnchecked"]=$jsCode; |
| 121 | 121 | return $this; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - public function setOnChange($jsCode){ |
|
| 124 | + public function setOnChange($jsCode) { |
|
| 125 | 125 | $this->_params["onChange"]=$jsCode; |
| 126 | 126 | return $this; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | public function run(JsUtils $js) { |
| 130 | - if(!isset($this->_bsComponent)) |
|
| 131 | - $this->_bsComponent=$js->semantic()->checkbox("#" . $this->identifier, $this->_params); |
|
| 130 | + if (!isset($this->_bsComponent)) |
|
| 131 | + $this->_bsComponent=$js->semantic()->checkbox("#".$this->identifier, $this->_params); |
|
| 132 | 132 | return parent::run($js); |
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | \ No newline at end of file |