@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | parent::__construct($identifier); |
| 28 | 28 | $this->tagName="ul"; |
| 29 | 29 | $this->_template='<%tagName% id="%identifier%" class="nav navbar-nav %class%">%elements%</%tagName%>'; |
| 30 | - $this->elements=array (); |
|
| 30 | + $this->elements=array(); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function setClass($value) { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function addElement($element) { |
| 42 | - if($element instanceof HtmlLink){ |
|
| 42 | + if ($element instanceof HtmlLink) { |
|
| 43 | 43 | $this->addLink($element); |
| 44 | 44 | } else if (is_object($element)) { |
| 45 | 45 | $this->elements []=$element; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | public function addElements($elements) { |
| 61 | 61 | if (\is_array($elements)) { |
| 62 | - foreach ( $elements as $key => $element ) { |
|
| 62 | + foreach ($elements as $key => $element) { |
|
| 63 | 63 | $iid=$this->getElementsCount()+1; |
| 64 | 64 | if ($element instanceof HtmlDropdownItem) |
| 65 | 65 | $this->elements []=$element; |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | public function addLink($caption, $href="#") { |
| 88 | 88 | $iid=$this->getElementsCount()+1; |
| 89 | 89 | $li=new HtmlBsDoubleElement($this->identifier."-li-".$iid, "li"); |
| 90 | - if($caption instanceof HtmlLink){ |
|
| 90 | + if ($caption instanceof HtmlLink) { |
|
| 91 | 91 | $link=$caption; |
| 92 | - }else{ |
|
| 92 | + } else { |
|
| 93 | 93 | $link=new HtmlLink($this->identifier."-link-".$iid, $href, $caption); |
| 94 | 94 | } |
| 95 | 95 | $li->setContent($link); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | public function run(JsUtils $js) { |
| 125 | - foreach ( $this->elements as $element ) { |
|
| 125 | + foreach ($this->elements as $element) { |
|
| 126 | 126 | $element->run($js); |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @param int $index |
| 144 | 144 | * @return BaseHtml |
| 145 | 145 | */ |
| 146 | - public function getElement($index){ |
|
| 146 | + public function getElement($index) { |
|
| 147 | 147 | return $this->elements[$index]; |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -62,15 +62,15 @@ |
||
| 62 | 62 | */ |
| 63 | 63 | public function setIdentifier($identifier) { |
| 64 | 64 | parent::setIdentifier($identifier); |
| 65 | - if($this->content instanceof HtmlLink){ |
|
| 65 | + if ($this->content instanceof HtmlLink) { |
|
| 66 | 66 | $this->content->setIdentifier("link-".$identifier); |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | - public function setActive($value=true){ |
|
| 70 | - $this->setProperty("class", ($value)?"active":""); |
|
| 69 | + public function setActive($value=true) { |
|
| 70 | + $this->setProperty("class", ($value) ? "active" : ""); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function disable(){ |
|
| 73 | + public function disable() { |
|
| 74 | 74 | $this->setProperty("class", "disabled"); |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -4,24 +4,24 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Illuminate\Support\Facades\App; |
| 6 | 6 | |
| 7 | -class JsUtils extends \Ajax\JsUtils{ |
|
| 8 | - public function getUrl($url){ |
|
| 7 | +class JsUtils extends \Ajax\JsUtils { |
|
| 8 | + public function getUrl($url) { |
|
| 9 | 9 | return \url($url); |
| 10 | 10 | } |
| 11 | - public function addViewElement($identifier,$content,&$view){ |
|
| 11 | + public function addViewElement($identifier, $content, &$view) { |
|
| 12 | 12 | $controls=$view->__get("q"); |
| 13 | - if (isset($controls) === false) { |
|
| 14 | - $controls=array (); |
|
| 13 | + if (isset($controls)===false) { |
|
| 14 | + $controls=array(); |
|
| 15 | 15 | } |
| 16 | 16 | $controls[$identifier]=$content; |
| 17 | 17 | $view->__set("q", $controls); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function createScriptVariable(&$view,$view_var, $output){ |
|
| 21 | - $view->__set($view_var,$output); |
|
| 20 | + public function createScriptVariable(&$view, $view_var, $output) { |
|
| 21 | + $view->__set($view_var, $output); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function forward($initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
| 24 | + public function forward($initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
| 25 | 25 | \ob_start(); |
| 26 | 26 | App::make($controllerName)->{$actionName}($params); |
| 27 | 27 | $result=\ob_get_contents(); |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | return $result; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
| 33 | - return \view()->make($viewName,$params)->render(); |
|
| 32 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
| 33 | + return \view()->make($viewName, $params)->render(); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function fromDispatcher($dispatcher){ |
|
| 36 | + public function fromDispatcher($dispatcher) { |
|
| 37 | 37 | return $dispatcher->segments(); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -8,23 +8,23 @@ discard block |
||
| 8 | 8 | use Cake\Network\Response; |
| 9 | 9 | use Cake\Core\App; |
| 10 | 10 | |
| 11 | -class _JsUtils extends \Ajax\JsUtils{ |
|
| 12 | - public function getUrl($url){ |
|
| 11 | +class _JsUtils extends \Ajax\JsUtils { |
|
| 12 | + public function getUrl($url) { |
|
| 13 | 13 | return Router::url($url); |
| 14 | 14 | } |
| 15 | - public function addViewElement($identifier,$content,&$view){ |
|
| 15 | + public function addViewElement($identifier, $content, &$view) { |
|
| 16 | 16 | $viewVars=$view->viewVars; |
| 17 | - if (isset($viewVars["q"]) === false) { |
|
| 18 | - $controls=array (); |
|
| 19 | - }else{ |
|
| 17 | + if (isset($viewVars["q"])===false) { |
|
| 18 | + $controls=array(); |
|
| 19 | + } else { |
|
| 20 | 20 | $controls=$viewVars["q"]; |
| 21 | 21 | } |
| 22 | 22 | $controls[$identifier]=$content; |
| 23 | 23 | $view->set("q", $controls); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function createScriptVariable(&$view,$view_var, $output){ |
|
| 27 | - $view->set($view_var,$output); |
|
| 26 | + public function createScriptVariable(&$view, $view_var, $output) { |
|
| 27 | + $view->set($view_var, $output); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -34,18 +34,18 @@ discard block |
||
| 34 | 34 | * @param array $params |
| 35 | 35 | * @see \Ajax\JsUtils::forward() |
| 36 | 36 | */ |
| 37 | - public function forward($initialControllerInstance,$controllerName,$actionName,$params=array()){ |
|
| 37 | + public function forward($initialControllerInstance, $controllerName, $actionName, $params=array()) { |
|
| 38 | 38 | \ob_start(); |
| 39 | - if(isset($params) && !\is_array($params)){ |
|
| 39 | + if (isset($params) && !\is_array($params)) { |
|
| 40 | 40 | $params=[$params]; |
| 41 | 41 | } |
| 42 | 42 | $url=h(Router::url(\array_merge([ |
| 43 | 43 | 'controller' => $controllerName, |
| 44 | - 'action' => $actionName],$params),false |
|
| 44 | + 'action' => $actionName], $params), false |
|
| 45 | 45 | )); |
| 46 | 46 | $base=Router::url("/"); |
| 47 | - if (substr($url, 0, strlen($base)) == $base) { |
|
| 48 | - $url = substr($url, strlen($base)); |
|
| 47 | + if (substr($url, 0, strlen($base))==$base) { |
|
| 48 | + $url=substr($url, strlen($base)); |
|
| 49 | 49 | } |
| 50 | 50 | $initialControllerInstance->requestAction($url); |
| 51 | 51 | $result=\ob_get_contents(); |
@@ -53,17 +53,17 @@ discard block |
||
| 53 | 53 | return $result; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
| 57 | - $view = new View(Router::getRequest(true), new Response()); |
|
| 58 | - if(\is_array($params)){ |
|
| 59 | - foreach ($params as $k=>$v){ |
|
| 56 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
| 57 | + $view=new View(Router::getRequest(true), new Response()); |
|
| 58 | + if (\is_array($params)) { |
|
| 59 | + foreach ($params as $k=>$v) { |
|
| 60 | 60 | $view->set($k, $v); |
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | return $view->render($viewName); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public function fromDispatcher($dispatcher){ |
|
| 66 | + public function fromDispatcher($dispatcher) { |
|
| 67 | 67 | return \explode("/", Router::getRequest(true)->url); |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Ajax\service; |
| 3 | 3 | class JQueryAjaxEffect { |
| 4 | - public static function none($responseElement,$jqueryDone="html"){ |
|
| 4 | + public static function none($responseElement, $jqueryDone="html") { |
|
| 5 | 5 | return "\t$({$responseElement}).{$jqueryDone}( data );\n"; |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | - public static function fade($responseElement,$jqueryDone="html"){ |
|
| 8 | + public static function fade($responseElement, $jqueryDone="html") { |
|
| 9 | 9 | return "\t$({$responseElement}).hide().{$jqueryDone}( data ).fadeIn();\n"; |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | - public static function slide($responseElement,$jqueryDone="html"){ |
|
| 12 | + public static function slide($responseElement, $jqueryDone="html") { |
|
| 13 | 13 | return "\t$({$responseElement}).hide().{$jqueryDone}( data ).slideDown();\n"; |
| 14 | 14 | } |
| 15 | 15 | } |
@@ -8,22 +8,22 @@ discard block |
||
| 8 | 8 | * @property string $root |
| 9 | 9 | * @property string $attr |
| 10 | 10 | */ |
| 11 | -trait NavElementTrait{ |
|
| 11 | +trait NavElementTrait { |
|
| 12 | 12 | |
| 13 | 13 | abstract public function contentAsString(); |
| 14 | 14 | /** |
| 15 | 15 | * Generate the jquery script to set the elements to the HtmlNavElement |
| 16 | 16 | * @param JsUtils $jsUtils |
| 17 | 17 | */ |
| 18 | - public function jsSetContent(JsUtils $jsUtils){ |
|
| 19 | - $jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true); |
|
| 18 | + public function jsSetContent(JsUtils $jsUtils) { |
|
| 19 | + $jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function getRoot() { |
| 23 | 23 | return $this->root; |
| 24 | 24 | } |
| 25 | 25 | public function setRoot($root) { |
| 26 | - $this->root = $root; |
|
| 26 | + $this->root=$root; |
|
| 27 | 27 | return $this; |
| 28 | 28 | } |
| 29 | 29 | public function getAttr() { |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | * @return HtmlNavElement |
| 37 | 37 | */ |
| 38 | 38 | public function setAttr($attr) { |
| 39 | - $this->attr = $attr; |
|
| 39 | + $this->attr=$attr; |
|
| 40 | 40 | return $this; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function __call($method, $args) { |
| 44 | - if(isset($this->$method) && is_callable($this->$method)) { |
|
| 44 | + if (isset($this->$method) && is_callable($this->$method)) { |
|
| 45 | 45 | return call_user_func_array( |
| 46 | 46 | $this->$method, |
| 47 | 47 | $args |
@@ -49,5 +49,5 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - abstract public function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0); |
|
| 52 | + abstract public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0); |
|
| 53 | 53 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | trait JsUtilsActionsTrait { |
| 12 | 12 | |
| 13 | - abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true); |
|
| 13 | + abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true); |
|
| 14 | 14 | /** |
| 15 | 15 | * show or hide with effect |
| 16 | 16 | * |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @param boolean $immediatly defers the execution if set to false |
| 22 | 22 | * @return string |
| 23 | 23 | */ |
| 24 | - protected function _showHideWithEffect($action,$element='this', $speed='', $callback='', $immediatly=false) { |
|
| 24 | + protected function _showHideWithEffect($action, $element='this', $speed='', $callback='', $immediatly=false) { |
|
| 25 | 25 | $element=Javascript::prep_element($element); |
| 26 | 26 | $speed=$this->_validate_speed($speed); |
| 27 | 27 | if ($callback!='') { |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | * @return string |
| 39 | 39 | */ |
| 40 | 40 | private function _validate_speed($speed) { |
| 41 | - if (in_array($speed, array ( |
|
| 42 | - 'slow','normal','fast' |
|
| 41 | + if (in_array($speed, array( |
|
| 42 | + 'slow', 'normal', 'fast' |
|
| 43 | 43 | ))) { |
| 44 | 44 | $speed='"'.$speed.'"'; |
| 45 | 45 | } elseif (preg_match("/[^0-9]/", $speed)) { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @param string $param |
| 57 | 57 | * @param boolean $immediatly delayed if false |
| 58 | 58 | */ |
| 59 | - public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) { |
|
| 59 | + public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) { |
|
| 60 | 60 | $element=Javascript::prep_element($element); |
| 61 | 61 | if (isset($param)) { |
| 62 | 62 | $param=Javascript::prep_value($param); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @param boolean $immediatly delayed if false |
| 77 | 77 | * @return string |
| 78 | 78 | */ |
| 79 | - public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) { |
|
| 79 | + public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) { |
|
| 80 | 80 | $to=Javascript::prep_element($to); |
| 81 | 81 | $element=Javascript::prep_element($element); |
| 82 | 82 | $str="$({$to}).{$jQueryCall}({$element});"; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @return string |
| 94 | 94 | */ |
| 95 | 95 | public function addClass($element='this', $class='', $immediatly=false) { |
| 96 | - return $this->_genericCallValue('addClass',$element, $class, $immediatly); |
|
| 96 | + return $this->_genericCallValue('addClass', $element, $class, $immediatly); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | * @param boolean $immediatly defers the execution if set to false |
| 104 | 104 | * @return string |
| 105 | 105 | */ |
| 106 | - public function after($to, $element, $immediatly=false){ |
|
| 107 | - return $this->_genericCallElement('after',$to, $element, $immediatly); |
|
| 106 | + public function after($to, $element, $immediatly=false) { |
|
| 107 | + return $this->_genericCallElement('after', $to, $element, $immediatly); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | * @param boolean $immediatly defers the execution if set to false |
| 115 | 115 | * @return string |
| 116 | 116 | */ |
| 117 | - public function before($to, $element, $immediatly=false){ |
|
| 118 | - return $this->_genericCallElement('before',$to, $element, $immediatly); |
|
| 117 | + public function before($to, $element, $immediatly=false) { |
|
| 118 | + return $this->_genericCallElement('before', $to, $element, $immediatly); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | * @param string $value |
| 144 | 144 | * @param boolean $immediatly defers the execution if set to false |
| 145 | 145 | */ |
| 146 | - public function val($element='this',$value='',$immediatly=false){ |
|
| 147 | - return $this->_genericCallValue('val',$element,$value,$immediatly); |
|
| 146 | + public function val($element='this', $value='', $immediatly=false) { |
|
| 147 | + return $this->_genericCallValue('val', $element, $value, $immediatly); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @param boolean $immediatly defers the execution if set to false |
| 155 | 155 | */ |
| 156 | 156 | public function html($element='this', $value='', $immediatly=false) { |
| 157 | - return $this->_genericCallValue('html',$element, $value, $immediatly); |
|
| 157 | + return $this->_genericCallValue('html', $element, $value, $immediatly); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $animations="\t\t\t"; |
| 175 | 175 | if (\is_array($params)) { |
| 176 | - foreach ( $params as $param => $value ) { |
|
| 176 | + foreach ($params as $param => $value) { |
|
| 177 | 177 | $animations.=$param.': \''.$value.'\', '; |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * @return string |
| 203 | 203 | */ |
| 204 | 204 | public function append($to, $element, $immediatly=false) { |
| 205 | - return $this->_genericCallElement('append',$to, $element, $immediatly); |
|
| 205 | + return $this->_genericCallElement('append', $to, $element, $immediatly); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * @return string |
| 214 | 214 | */ |
| 215 | 215 | public function prepend($to, $element, $immediatly=false) { |
| 216 | - return $this->_genericCallElement('prepend',$to, $element, $immediatly); |
|
| 216 | + return $this->_genericCallElement('prepend', $to, $element, $immediatly); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | * @return string |
| 227 | 227 | */ |
| 228 | 228 | public function fadeIn($element='this', $speed='', $callback='', $immediatly=false) { |
| 229 | - return $this->_showHideWithEffect("fadeIn",$element,$speed,$callback,$immediatly); |
|
| 229 | + return $this->_showHideWithEffect("fadeIn", $element, $speed, $callback, $immediatly); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | * @return string |
| 240 | 240 | */ |
| 241 | 241 | public function fadeOut($element='this', $speed='', $callback='', $immediatly=false) { |
| 242 | - return $this->_showHideWithEffect("fadeOut",$element,$speed,$callback,$immediatly); |
|
| 242 | + return $this->_showHideWithEffect("fadeOut", $element, $speed, $callback, $immediatly); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * @return string |
| 253 | 253 | */ |
| 254 | 254 | public function slideUp($element='this', $speed='', $callback='', $immediatly=false) { |
| 255 | - return $this->_showHideWithEffect("slideUp",$element,$speed,$callback,$immediatly); |
|
| 255 | + return $this->_showHideWithEffect("slideUp", $element, $speed, $callback, $immediatly); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | /** |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * @return string |
| 265 | 265 | */ |
| 266 | 266 | public function removeClass($element='this', $class='', $immediatly=false) { |
| 267 | - return $this->_genericCall('removeClass',$element, $class, $immediatly); |
|
| 267 | + return $this->_genericCall('removeClass', $element, $class, $immediatly); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | * @return string |
| 278 | 278 | */ |
| 279 | 279 | public function slideDown($element='this', $speed='', $callback='', $immediatly=false) { |
| 280 | - return $this->_showHideWithEffect("slideDown",$element,$speed,$callback,$immediatly); |
|
| 280 | + return $this->_showHideWithEffect("slideDown", $element, $speed, $callback, $immediatly); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | * @return string |
| 291 | 291 | */ |
| 292 | 292 | public function slideToggle($element='this', $speed='', $callback='', $immediatly=false) { |
| 293 | - return $this->_showHideWithEffect("slideToggle",$element,$speed,$callback,$immediatly); |
|
| 293 | + return $this->_showHideWithEffect("slideToggle", $element, $speed, $callback, $immediatly); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /** |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * @return string |
| 304 | 304 | */ |
| 305 | 305 | public function hide($element='this', $speed='', $callback='', $immediatly=false) { |
| 306 | - return $this->_showHideWithEffect("hide",$element,$speed,$callback,$immediatly); |
|
| 306 | + return $this->_showHideWithEffect("hide", $element, $speed, $callback, $immediatly); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | /** |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | * @return string |
| 317 | 317 | */ |
| 318 | 318 | public function toggle($element='this', $speed='', $callback='', $immediatly=false) { |
| 319 | - return $this->_showHideWithEffect("toggle",$element,$speed,$callback,$immediatly); |
|
| 319 | + return $this->_showHideWithEffect("toggle", $element, $speed, $callback, $immediatly); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | /** |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | * @return string |
| 328 | 328 | */ |
| 329 | 329 | public function toggleClass($element='this', $class='', $immediatly=false) { |
| 330 | - return $this->_genericCallValue('toggleClass',$element, $class, $immediatly); |
|
| 330 | + return $this->_genericCallValue('toggleClass', $element, $class, $immediatly); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | * @return string |
| 356 | 356 | */ |
| 357 | 357 | public function show($element='this', $speed='', $callback='', $immediatly=false) { |
| 358 | - return $this->_showHideWithEffect("show",$element,$speed,$callback,$immediatly); |
|
| 358 | + return $this->_showHideWithEffect("show", $element, $speed, $callback, $immediatly); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | /** |
@@ -367,8 +367,8 @@ discard block |
||
| 367 | 367 | */ |
| 368 | 368 | public function sortable($element, $options=array()) { |
| 369 | 369 | if (count($options)>0) { |
| 370 | - $sort_options=array (); |
|
| 371 | - foreach ( $options as $k => $v ) { |
|
| 370 | + $sort_options=array(); |
|
| 371 | + foreach ($options as $k => $v) { |
|
| 372 | 372 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
| 373 | 373 | } |
| 374 | 374 | $sort_options=implode(",", $sort_options); |
@@ -465,8 +465,8 @@ discard block |
||
| 465 | 465 | * @param boolean $immediatly |
| 466 | 466 | * @return string |
| 467 | 467 | */ |
| 468 | - private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="",$immediatly=true) { |
|
| 469 | - return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 468 | + private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true) { |
|
| 469 | + return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | /** |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | $preventDefault=false; |
| 485 | 485 | $immediatly=true; |
| 486 | 486 | extract($parameters); |
| 487 | - return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback,$immediatly); |
|
| 487 | + return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback, $immediatly); |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | /** |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | $preventDefault=false; |
| 514 | 514 | $immediatly=true; |
| 515 | 515 | extract($parameters); |
| 516 | - $script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation,$immediatly); |
|
| 516 | + $script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation, $immediatly); |
|
| 517 | 517 | return $script; |
| 518 | 518 | } |
| 519 | 519 | } |
@@ -18,27 +18,27 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public function __construct(JsUtils $js=NULL) { |
| 20 | 20 | parent::__construct($js); |
| 21 | - $this->events=array (); |
|
| 21 | + $this->events=array(); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | protected function compileEvents() { |
| 25 | - foreach ( $this->events as $event => $jsCode ) { |
|
| 25 | + foreach ($this->events as $event => $jsCode) { |
|
| 26 | 26 | $itemSelector=JString::getValueBetween($event); |
| 27 | - if($event=="execute"){ |
|
| 27 | + if ($event=="execute") { |
|
| 28 | 28 | $this->jquery_code_for_compile []=$jsCode; |
| 29 | - }else if($event=="beforeExecute"){ |
|
| 29 | + } else if ($event=="beforeExecute") { |
|
| 30 | 30 | \array_unshift($this->jquery_code_for_compile, $jsCode); |
| 31 | - }else{ |
|
| 31 | + } else { |
|
| 32 | 32 | $selector=$this->_createSelector($itemSelector, $this->attachTo); |
| 33 | 33 | $this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - protected function _createSelector($itemSelector,$selector){ |
|
| 39 | - if(!isset($itemSelector)) |
|
| 38 | + protected function _createSelector($itemSelector, $selector) { |
|
| 39 | + if (!isset($itemSelector)) |
|
| 40 | 40 | $itemSelector=$this->itemSelector; |
| 41 | - if(isset($itemSelector) && $itemSelector!=="") |
|
| 41 | + if (isset($itemSelector) && $itemSelector!=="") |
|
| 42 | 42 | $selector.=" ".$itemSelector; |
| 43 | 43 | return $selector; |
| 44 | 44 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $result=implode("\n", $this->jquery_code_for_compile); |
| 48 | 48 | $result=str_ireplace("\"%", "", $result); |
| 49 | 49 | $result=str_ireplace("%\"", "", $result); |
| 50 | - $result=str_replace(array ( |
|
| 50 | + $result=str_replace(array( |
|
| 51 | 51 | "\\n", |
| 52 | 52 | "\\r", |
| 53 | 53 | "\\t" |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function getScript() { |
| 59 | 59 | $allParams=$this->params; |
| 60 | - $this->jquery_code_for_compile=array (); |
|
| 60 | + $this->jquery_code_for_compile=array(); |
|
| 61 | 61 | $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).");"; |
| 62 | 62 | $this->compileEvents(); |
| 63 | 63 | return $this->compileJQueryCode(); |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | public function __construct($identifier) { |
| 17 | 17 | parent::__construct($identifier, "form"); |
| 18 | 18 | $this->_template='<form id="%identifier%" name="%identifier%" %properties%>%content%</form>'; |
| 19 | - $this->futureElements=array (); |
|
| 20 | - $this->formGroups=array (); |
|
| 19 | + $this->futureElements=array(); |
|
| 20 | + $this->formGroups=array(); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /* |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 28 | 28 | if (isset($js)) { |
| 29 | 29 | $this->formElementsPrefix=$js->config()->getVar("formElementsPrefix"); |
| 30 | - foreach ( $this->futureElements as $futureElement ) { |
|
| 30 | + foreach ($this->futureElements as $futureElement) { |
|
| 31 | 31 | $futureElementValue=$this->getPrefix($futureElement); |
| 32 | 32 | $futureElementValues=explode("_", $futureElementValue); |
| 33 | - switch($futureElementValues [0]) { |
|
| 33 | + switch ($futureElementValues [0]) { |
|
| 34 | 34 | case "input": |
| 35 | 35 | $control=new HtmlInput($futureElement); |
| 36 | 36 | $control->setClass("form-control"); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $control->setLabel($label, false); |
| 49 | 49 | break; |
| 50 | 50 | case "select": |
| 51 | - $control=new HtmlSelect($futureElement,""); |
|
| 51 | + $control=new HtmlSelect($futureElement, ""); |
|
| 52 | 52 | $control->setProperty("size", $futureElementValues [1]); |
| 53 | 53 | $control->setClass("form-control"); |
| 54 | 54 | break; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $this->addElement($control); |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | - foreach ( $this->formGroups as $group ) { |
|
| 64 | + foreach ($this->formGroups as $group) { |
|
| 65 | 65 | $this->addContent($group); |
| 66 | 66 | } |
| 67 | 67 | return parent::compile($js, $view); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | protected function getPrefix($element) { |
| 91 | 91 | $result="input_text"; |
| 92 | - foreach ( $this->formElementsPrefix as $k => $v ) { |
|
| 92 | + foreach ($this->formElementsPrefix as $k => $v) { |
|
| 93 | 93 | if (JString::startswith($element, $k)) { |
| 94 | 94 | $result=$v; |
| 95 | 95 | break; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | public function getElement($name) { |
| 121 | 121 | $element=null; |
| 122 | - foreach ( $this->formGroups as $group ) { |
|
| 122 | + foreach ($this->formGroups as $group) { |
|
| 123 | 123 | } |
| 124 | 124 | return $element; |
| 125 | 125 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @see \Ajax\bootstrap\html\base\HtmlSingleElement::fromArray() |
| 130 | 130 | */ |
| 131 | 131 | public function fromArray($array) { |
| 132 | - foreach ( $array as $value ) { |
|
| 132 | + foreach ($array as $value) { |
|
| 133 | 133 | if (is_string($value)) { |
| 134 | 134 | $this->futureElements []=$value; |
| 135 | 135 | } |