@@ -23,19 +23,19 @@ |
||
| 23 | 23 | return $this; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function addGlyph($glyphicon,$before=true){ |
|
| 26 | + public function addGlyph($glyphicon, $before=true) { |
|
| 27 | 27 | $glyph=new HtmlGlyphicon(""); |
| 28 | 28 | $glyph->setGlyphicon($glyphicon); |
| 29 | - $this->addContent($glyph,$before); |
|
| 29 | + $this->addContent($glyph, $before); |
|
| 30 | 30 | return $this; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function wrapContentWithGlyph($glyphBefore,$glyphAfter=""){ |
|
| 33 | + public function wrapContentWithGlyph($glyphBefore, $glyphAfter="") { |
|
| 34 | 34 | $before=HtmlGlyphicon::getGlyphicon($glyphBefore)." "; |
| 35 | 35 | $after=""; |
| 36 | - if($glyphAfter!==""){ |
|
| 36 | + if ($glyphAfter!=="") { |
|
| 37 | 37 | $after=" ".HtmlGlyphicon::getGlyphicon($glyphAfter); |
| 38 | 38 | } |
| 39 | - return $this->wrapContent($before,$after); |
|
| 39 | + return $this->wrapContent($before, $after); |
|
| 40 | 40 | } |
| 41 | 41 | } |
@@ -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,34 +4,34 @@ |
||
| 4 | 4 | |
| 5 | 5 | use micro\controllers\Startup; |
| 6 | 6 | use micro\utils\RequestUtils; |
| 7 | -class JsUtils extends \Ajax\JsUtils{ |
|
| 7 | +class JsUtils extends \Ajax\JsUtils { |
|
| 8 | 8 | |
| 9 | - public function getUrl($url){ |
|
| 9 | + public function getUrl($url) { |
|
| 10 | 10 | return RequestUtils::getUrl($url); |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | - public function addViewElement($identifier,$content,&$view){ |
|
| 13 | + public function addViewElement($identifier, $content, &$view) { |
|
| 14 | 14 | $controls=$view->getVar("q"); |
| 15 | - if (isset($controls) === false) { |
|
| 16 | - $controls=array (); |
|
| 15 | + if (isset($controls)===false) { |
|
| 16 | + $controls=array(); |
|
| 17 | 17 | } |
| 18 | 18 | $controls[$identifier]=$content; |
| 19 | 19 | $view->setVar("q", $controls); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public function createScriptVariable(&$view,$view_var, $output){ |
|
| 23 | - $view->setVar($view_var,$output); |
|
| 22 | + public function createScriptVariable(&$view, $view_var, $output) { |
|
| 23 | + $view->setVar($view_var, $output); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function forward($initialController,$controller,$action,$params=array()){ |
|
| 27 | - return $initialController->forward($controller,$action,$params,true,true,true); |
|
| 26 | + public function forward($initialController, $controller, $action, $params=array()) { |
|
| 27 | + return $initialController->forward($controller, $action, $params, true, true, true); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function renderContent($initialControllerInstance,$viewName, $params=NULL) { |
|
| 31 | - return $initialControllerInstance->loadView($viewName,$params,true); |
|
| 30 | + public function renderContent($initialControllerInstance, $viewName, $params=NULL) { |
|
| 31 | + return $initialControllerInstance->loadView($viewName, $params, true); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function fromDispatcher($dispatcher){ |
|
| 34 | + public function fromDispatcher($dispatcher) { |
|
| 35 | 35 | return Startup::$urlParts; |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -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 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | private function addFunction($jsCode) { |
| 18 | 18 | if (!Text::startsWith($jsCode, "function")) |
| 19 | - $jsCode="%function(){" . $jsCode . "}%"; |
|
| 19 | + $jsCode="%function(){".$jsCode."}%"; |
|
| 20 | 20 | return $jsCode; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -43,6 +43,6 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public static function submitButton(JsUtils $js, $url, $form, $responseElement, $caption="Okay") { |
| 46 | - return new DialogButton($caption, $js->postForm($url, $form, $responseElement) . ";$( this ).dialog( 'close' );"); |
|
| 46 | + return new DialogButton($caption, $js->postForm($url, $form, $responseElement).";$( this ).dialog( 'close' );"); |
|
| 47 | 47 | } |
| 48 | 48 | } |
@@ -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 | } |