@@ -5,5 +5,5 @@ |
||
| 5 | 5 | use Ajax\common\BaseEnum; |
| 6 | 6 | |
| 7 | 7 | abstract class Emphasis extends BaseEnum { |
| 8 | - const PRIMARY="primary",SECONDARY="secondary",TERTIARY="tertiary"; |
|
| 8 | + const PRIMARY="primary", SECONDARY="secondary", TERTIARY="tertiary"; |
|
| 9 | 9 | } |
| 10 | 10 | \ No newline at end of file |
@@ -96,10 +96,11 @@ |
||
| 96 | 96 | |
| 97 | 97 | protected function setDivider($divider,$index){ |
| 98 | 98 | if(isset($index)){ |
| 99 | - if(\is_array($this->_contentSeparator)===false) |
|
| 100 | - $this->_contentSeparator=array_fill (0, $this->count()-1,$this->_contentSeparator); |
|
| 99 | + if(\is_array($this->_contentSeparator)===false) { |
|
| 100 | + $this->_contentSeparator=array_fill (0, $this->count()-1,$this->_contentSeparator); |
|
| 101 | + } |
|
| 101 | 102 | $this->_contentSeparator[$index]=$divider; |
| 102 | - }else{ |
|
| 103 | + } else{ |
|
| 103 | 104 | $this->_contentSeparator=$divider; |
| 104 | 105 | } |
| 105 | 106 | return $this; |
@@ -22,6 +22,11 @@ discard block |
||
| 22 | 22 | protected $_contentSeparator=""; |
| 23 | 23 | |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param string $identifier |
|
| 27 | + * @param string $tagName |
|
| 28 | + * @param string $baseClass |
|
| 29 | + */ |
|
| 25 | 30 | public function __construct($identifier,$tagName,$baseClass){ |
| 26 | 31 | parent::__construct($identifier,$tagName,$baseClass); |
| 27 | 32 | $this->root=""; |
@@ -31,7 +36,7 @@ discard block |
||
| 31 | 36 | /** |
| 32 | 37 | * Associate an ajax get to the elements, displayed in $targetSelector |
| 33 | 38 | * @param string $targetSelector the target of the get |
| 34 | - * @return HtmlNavElement |
|
| 39 | + * @return HtmlSemNavElement |
|
| 35 | 40 | */ |
| 36 | 41 | public function autoGetOnClick($targetSelector){ |
| 37 | 42 | return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
@@ -63,7 +68,7 @@ discard block |
||
| 63 | 68 | /** |
| 64 | 69 | * Define the html attribute for each element url in ajax |
| 65 | 70 | * @param string $attr html attribute |
| 66 | - * @return HtmlNavElement |
|
| 71 | + * @return HtmlSemNavElement |
|
| 67 | 72 | */ |
| 68 | 73 | public function setAttr($attr) { |
| 69 | 74 | $this->attr = $attr; |
@@ -103,6 +108,9 @@ discard block |
||
| 103 | 108 | return $this; |
| 104 | 109 | } |
| 105 | 110 | |
| 111 | + /** |
|
| 112 | + * @param integer $index |
|
| 113 | + */ |
|
| 106 | 114 | protected function getContentDivider($index){ |
| 107 | 115 | if(\is_array($this->_contentSeparator)===true){ |
| 108 | 116 | return @$this->_contentSeparator[$index]; |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | protected $_contentSeparator=""; |
| 23 | 23 | |
| 24 | 24 | |
| 25 | - public function __construct($identifier,$tagName,$baseClass){ |
|
| 26 | - parent::__construct($identifier,$tagName,$baseClass); |
|
| 25 | + public function __construct($identifier, $tagName, $baseClass) { |
|
| 26 | + parent::__construct($identifier, $tagName, $baseClass); |
|
| 27 | 27 | $this->root=""; |
| 28 | 28 | $this->attr="data-ajax"; |
| 29 | 29 | } |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | * @param string $targetSelector the target of the get |
| 34 | 34 | * @return HtmlNavElement |
| 35 | 35 | */ |
| 36 | - public function autoGetOnClick($targetSelector){ |
|
| 37 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
| 36 | + public function autoGetOnClick($targetSelector) { |
|
| 37 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function contentAsString(){ |
|
| 40 | + public function contentAsString() { |
|
| 41 | 41 | return JArray::implode($this->_contentSeparator, $this->content); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -45,15 +45,15 @@ discard block |
||
| 45 | 45 | * Generate the jquery script to set the elements to the HtmlNavElement |
| 46 | 46 | * @param JsUtils $jsUtils |
| 47 | 47 | */ |
| 48 | - public function jsSetContent(JsUtils $jsUtils){ |
|
| 49 | - $jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true); |
|
| 48 | + public function jsSetContent(JsUtils $jsUtils) { |
|
| 49 | + $jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function getRoot() { |
| 53 | 53 | return $this->root; |
| 54 | 54 | } |
| 55 | 55 | public function setRoot($root) { |
| 56 | - $this->root = $root; |
|
| 56 | + $this->root=$root; |
|
| 57 | 57 | return $this; |
| 58 | 58 | } |
| 59 | 59 | public function getAttr() { |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | * @return HtmlNavElement |
| 67 | 67 | */ |
| 68 | 68 | public function setAttr($attr) { |
| 69 | - $this->attr = $attr; |
|
| 69 | + $this->attr=$attr; |
|
| 70 | 70 | return $this; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | public function __call($method, $args) { |
| 74 | - if(isset($this->$method) && is_callable($this->$method)) { |
|
| 74 | + if (isset($this->$method) && is_callable($this->$method)) { |
|
| 75 | 75 | return call_user_func_array( |
| 76 | 76 | $this->$method, |
| 77 | 77 | $args |
@@ -79,32 +79,32 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public abstract function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0); |
|
| 82 | + public abstract function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0); |
|
| 83 | 83 | |
| 84 | 84 | |
| 85 | - public function setContentDivider($divider,$index=NULL) { |
|
| 85 | + public function setContentDivider($divider, $index=NULL) { |
|
| 86 | 86 | $divider="<div class='divider'> {$divider} </div>"; |
| 87 | 87 | return $this->setDivider($divider, $index); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - public function setIconContentDivider($iconContentDivider,$index=NULL) { |
|
| 90 | + public function setIconContentDivider($iconContentDivider, $index=NULL) { |
|
| 91 | 91 | $contentDivider="<i class='".$iconContentDivider." icon divider'></i>"; |
| 92 | 92 | return $this->setDivider($contentDivider, $index); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - protected function setDivider($divider,$index){ |
|
| 96 | - if(isset($index)){ |
|
| 97 | - if(\is_array($this->_contentSeparator)===false) |
|
| 98 | - $this->_contentSeparator=array_fill (0, $this->count()-1,$this->_contentSeparator); |
|
| 95 | + protected function setDivider($divider, $index) { |
|
| 96 | + if (isset($index)) { |
|
| 97 | + if (\is_array($this->_contentSeparator)===false) |
|
| 98 | + $this->_contentSeparator=array_fill(0, $this->count()-1, $this->_contentSeparator); |
|
| 99 | 99 | $this->_contentSeparator[$index]=$divider; |
| 100 | - }else{ |
|
| 100 | + }else { |
|
| 101 | 101 | $this->_contentSeparator=$divider; |
| 102 | 102 | } |
| 103 | 103 | return $this; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - protected function getContentDivider($index){ |
|
| 107 | - if(\is_array($this->_contentSeparator)===true){ |
|
| 106 | + protected function getContentDivider($index) { |
|
| 107 | + if (\is_array($this->_contentSeparator)===true) { |
|
| 108 | 108 | return @$this->_contentSeparator[$index]; |
| 109 | 109 | } |
| 110 | 110 | return $this->_contentSeparator; |
@@ -13,17 +13,17 @@ |
||
| 13 | 13 | * @param boolean $labeled |
| 14 | 14 | * @return \Ajax\semantic\html\elements\HtmlIcon |
| 15 | 15 | */ |
| 16 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
| 16 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 17 | 17 | $iconO=$icon; |
| 18 | - if(\is_string($icon)){ |
|
| 18 | + if (\is_string($icon)) { |
|
| 19 | 19 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
| 20 | 20 | } |
| 21 | - if($labeled!==false){ |
|
| 22 | - $direction=($before===true)?Direction::LEFT:Direction::RIGHT; |
|
| 21 | + if ($labeled!==false) { |
|
| 22 | + $direction=($before===true) ? Direction::LEFT : Direction::RIGHT; |
|
| 23 | 23 | $this->addToProperty("class", $direction." labeled icon"); |
| 24 | 24 | $this->tagName="div"; |
| 25 | 25 | } |
| 26 | - $this->addContent($iconO,$before); |
|
| 26 | + $this->addContent($iconO, $before); |
|
| 27 | 27 | return $iconO; |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | \ No newline at end of file |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | * @param string $action one of "select","auto","activate","combo","nothing","hide" |
| 18 | 18 | * @return \Ajax\semantic\components\Dropdown |
| 19 | 19 | */ |
| 20 | - public function setAction($action){ |
|
| 21 | - return $this->setParamCtrl("action", $action,array("select","auto","activate","combo","nothing","hide")); |
|
| 20 | + public function setAction($action) { |
|
| 21 | + return $this->setParamCtrl("action", $action, array("select", "auto", "activate", "combo", "nothing", "hide")); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | * @param string $event Event used to trigger dropdown (Hover, Click, Custom Event) |
| 27 | 27 | * @return \Ajax\semantic\components\Dropdown |
| 28 | 28 | */ |
| 29 | - public function setOn($event){ |
|
| 29 | + public function setOn($event) { |
|
| 30 | 30 | return $this->setParam("on", $event); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function setFullTextSearch($value){ |
|
| 33 | + public function setFullTextSearch($value) { |
|
| 34 | 34 | return $this->setParam("fullTextSearch", $value); |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | \ No newline at end of file |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -return array ( |
|
| 3 | - "JQuery" => array ( |
|
| 4 | - "MaxCDN" => array ( |
|
| 2 | +return array( |
|
| 3 | + "JQuery" => array( |
|
| 4 | + "MaxCDN" => array( |
|
| 5 | 5 | "url" => "http://code.jquery.com/jquery-%version%.min.js", |
| 6 | - "versions" => array ( |
|
| 6 | + "versions" => array( |
|
| 7 | 7 | "2.2.3", |
| 8 | 8 | "2.2.1", |
| 9 | 9 | "2.1.4", |
@@ -11,9 +11,9 @@ discard block |
||
| 11 | 11 | "1.11.2" |
| 12 | 12 | ) |
| 13 | 13 | ), |
| 14 | - "Google" => array ( |
|
| 14 | + "Google" => array( |
|
| 15 | 15 | "url" => "https://ajax.googleapis.com/ajax/libs/jquery/%version%/jquery.min.js", |
| 16 | - "versions" => array ( |
|
| 16 | + "versions" => array( |
|
| 17 | 17 | "2.2.2", |
| 18 | 18 | "2.2.1", |
| 19 | 19 | "2.2.0", |
@@ -25,17 +25,17 @@ discard block |
||
| 25 | 25 | ) |
| 26 | 26 | ) |
| 27 | 27 | ), |
| 28 | - "JQueryUI" => array ( |
|
| 29 | - "MaxCDN" => array ( |
|
| 28 | + "JQueryUI" => array( |
|
| 29 | + "MaxCDN" => array( |
|
| 30 | 30 | "core" => "http://code.jquery.com/ui/%version%/jquery-ui.min.js", |
| 31 | 31 | "css" => "http://code.jquery.com/ui/%version%/themes/%theme%/jquery-ui.css", |
| 32 | - "versions" => array ( |
|
| 32 | + "versions" => array( |
|
| 33 | 33 | "1.11.4", |
| 34 | 34 | "1.11.3", |
| 35 | 35 | "1.11.2", |
| 36 | 36 | "1.10.4" |
| 37 | 37 | ), |
| 38 | - "themes" => array ( |
|
| 38 | + "themes" => array( |
|
| 39 | 39 | "black-tie", |
| 40 | 40 | "blitzer", |
| 41 | 41 | "cupertino", |
@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | "vader" |
| 63 | 63 | ) |
| 64 | 64 | ), |
| 65 | - "Google" => array ( |
|
| 65 | + "Google" => array( |
|
| 66 | 66 | "core" => "https://ajax.googleapis.com/ajax/libs/jqueryui/%version%/jquery-ui.min.js", |
| 67 | 67 | "css" => "https://ajax.googleapis.com/ajax/libs/jqueryui/%version%/themes/%theme%/jquery-ui.css", |
| 68 | - "versions" => array ( |
|
| 68 | + "versions" => array( |
|
| 69 | 69 | "1.11.4", |
| 70 | 70 | "1.11.3", |
| 71 | 71 | "1.11.2", |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | "1.10.4", |
| 75 | 75 | "1.10.0" |
| 76 | 76 | ), |
| 77 | - "themes" => array ( |
|
| 77 | + "themes" => array( |
|
| 78 | 78 | "black-tie", |
| 79 | 79 | "blitzer", |
| 80 | 80 | "cupertino", |
@@ -102,25 +102,25 @@ discard block |
||
| 102 | 102 | ) |
| 103 | 103 | ) |
| 104 | 104 | ), |
| 105 | - "Bootstrap" => array ( |
|
| 106 | - "MaxCDN" => array ( |
|
| 105 | + "Bootstrap" => array( |
|
| 106 | + "MaxCDN" => array( |
|
| 107 | 107 | "core" => "http://maxcdn.bootstrapcdn.com/bootstrap/%version%/js/bootstrap.min.js", |
| 108 | 108 | "css" => "http://maxcdn.bootstrapcdn.com/bootstrap/%version%/css/bootstrap.min.css", |
| 109 | - "versions" => array ( |
|
| 109 | + "versions" => array( |
|
| 110 | 110 | "3.3.6", |
| 111 | 111 | "3.3.5" |
| 112 | 112 | ), |
| 113 | - "themes" => array () |
|
| 113 | + "themes" => array() |
|
| 114 | 114 | ) |
| 115 | 115 | ), |
| 116 | - "Semantic" => array ( |
|
| 117 | - "cdnjs" => array ( |
|
| 116 | + "Semantic" => array( |
|
| 117 | + "cdnjs" => array( |
|
| 118 | 118 | "core" => "https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/%version%/semantic.min.js", |
| 119 | 119 | "css" => "https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/%version%/semantic.min.js", |
| 120 | - "versions" => array ( |
|
| 120 | + "versions" => array( |
|
| 121 | 121 | "2.1.8" |
| 122 | 122 | ), |
| 123 | - "themes" => array () |
|
| 123 | + "themes" => array() |
|
| 124 | 124 | ) |
| 125 | 125 | ) |
| 126 | 126 | ); |
| 127 | 127 | \ No newline at end of file |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | protected $localCss; |
| 10 | 10 | protected $framework; |
| 11 | 11 | |
| 12 | - public function __construct($framework,$version, $provider="MaxCDN") { |
|
| 12 | + public function __construct($framework, $version, $provider="MaxCDN") { |
|
| 13 | 13 | parent::__construct($version, $provider); |
| 14 | 14 | $this->framework=$framework; |
| 15 | 15 | $this->data=$this->data [$framework]; |
@@ -50,8 +50,9 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | protected function _setDi($di) { |
| 52 | 52 | $this->_di=$di; |
| 53 | - if ($this->js!=null&&$di!=null) |
|
| 54 | - $this->js->setDi($di); |
|
| 53 | + if ($this->js!=null&&$di!=null) { |
|
| 54 | + $this->js->setDi($di); |
|
| 55 | + } |
|
| 55 | 56 | } |
| 56 | 57 | |
| 57 | 58 | /** |
@@ -1130,12 +1131,14 @@ discard block |
||
| 1130 | 1131 | $result[1]=$cdn; |
| 1131 | 1132 | break; |
| 1132 | 1133 | case "Ajax\lib\CDNCoreCss": |
| 1133 | - if($cdn->getFramework()==="Bootstrap") |
|
| 1134 | - $hasBootstrap=true; |
|
| 1135 | - elseif($cdn->getFramework()==="Semantic") |
|
| 1136 | - $hasSemantic=true; |
|
| 1137 | - if($hasSemantic || $hasBootstrap) |
|
| 1138 | - $result[2]=$cdn; |
|
| 1134 | + if($cdn->getFramework()==="Bootstrap") { |
|
| 1135 | + $hasBootstrap=true; |
|
| 1136 | + } elseif($cdn->getFramework()==="Semantic") { |
|
| 1137 | + $hasSemantic=true; |
|
| 1138 | + } |
|
| 1139 | + if($hasSemantic || $hasBootstrap) { |
|
| 1140 | + $result[2]=$cdn; |
|
| 1141 | + } |
|
| 1139 | 1142 | break; |
| 1140 | 1143 | } |
| 1141 | 1144 | } |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | public abstract function forward($initialController,$controller,$action); |
| 65 | 65 | /** |
| 66 | 66 | * render the content of an existing view : $viewName and set the response to the modal content |
| 67 | - * @param Controller $initialControllerInstance |
|
| 67 | + * @param Controller $initialControllerInstance |
|
| 68 | 68 | * @param View $viewName |
| 69 | 69 | * @param $params The parameters to pass to the view |
| 70 | 70 | */ |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | /** |
| 22 | 22 | * JsUtils Class : Service to be injected |
| 23 | 23 | */ |
| 24 | -abstract class JsUtils{ |
|
| 25 | - use JsUtilsEventsTrait,JsUtilsActionsTrait,JsUtilsAjaxTrait; |
|
| 24 | +abstract class JsUtils { |
|
| 25 | + use JsUtilsEventsTrait, JsUtilsActionsTrait, JsUtilsAjaxTrait; |
|
| 26 | 26 | |
| 27 | 27 | protected $js; |
| 28 | 28 | protected $cdns; |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | protected $config; |
| 52 | 52 | |
| 53 | 53 | protected function _setDi($di) { |
| 54 | - if ($this->js!=null&&$di!=null) |
|
| 54 | + if ($this->js!=null && $di!=null) |
|
| 55 | 55 | $this->js->setDi($di); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public abstract function getUrl($url); |
| 59 | - public abstract function addViewElement($identifier,$content,&$view); |
|
| 60 | - public abstract function createScriptVariable(&$view,$view_var, $output); |
|
| 59 | + public abstract function addViewElement($identifier, $content, &$view); |
|
| 60 | + public abstract function createScriptVariable(&$view, $view_var, $output); |
|
| 61 | 61 | /** |
| 62 | 62 | * render the content of $controller::$action and set the response to the modal content |
| 63 | 63 | * @param Controller $initialController |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | * @param string $action a Phalcon action |
| 66 | 66 | * @param array $params |
| 67 | 67 | */ |
| 68 | - public abstract function forward($initialController,$controller,$action,$params); |
|
| 68 | + public abstract function forward($initialController, $controller, $action, $params); |
|
| 69 | 69 | /** |
| 70 | 70 | * render the content of an existing view : $viewName and set the response to the modal content |
| 71 | 71 | * @param Controller $initialControllerInstance |
| 72 | 72 | * @param View $viewName |
| 73 | 73 | * @param $params The parameters to pass to the view |
| 74 | 74 | */ |
| 75 | - public abstract function renderContent($initialControllerInstance,$viewName, $params=NULL); |
|
| 75 | + public abstract function renderContent($initialControllerInstance, $viewName, $params=NULL); |
|
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * Collect url parts from the request dispatcher : controllerName, actionName, parameters |
@@ -163,28 +163,28 @@ discard block |
||
| 163 | 163 | return $this->config; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - public function __construct($params=array(),$injected=NULL) { |
|
| 167 | - $defaults=array ( |
|
| 166 | + public function __construct($params=array(), $injected=NULL) { |
|
| 167 | + $defaults=array( |
|
| 168 | 168 | 'driver' => 'Jquery', |
| 169 | 169 | 'debug' => true |
| 170 | 170 | ); |
| 171 | - foreach ( $defaults as $key => $val ) { |
|
| 171 | + foreach ($defaults as $key => $val) { |
|
| 172 | 172 | if (isset($params[$key])===false || $params[$key]==="") { |
| 173 | 173 | $params[$key]=$defaults[$key]; |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | - $this->js=new Jquery($params,$this); |
|
| 176 | + $this->js=new Jquery($params, $this); |
|
| 177 | 177 | |
| 178 | - if(\array_key_exists("semantic", $params)){ |
|
| 178 | + if (\array_key_exists("semantic", $params)) { |
|
| 179 | 179 | $this->semantic(new Semantic()); |
| 180 | 180 | } |
| 181 | - $this->cdns=array (); |
|
| 181 | + $this->cdns=array(); |
|
| 182 | 182 | $this->params=$params; |
| 183 | 183 | $this->injected=$injected; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - public function __set($property, $value){ |
|
| 187 | - switch ($property){ |
|
| 186 | + public function __set($property, $value) { |
|
| 187 | + switch ($property) { |
|
| 188 | 188 | case "bootstrap": |
| 189 | 189 | $this->bootstrap($value); |
| 190 | 190 | break; |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - public function getParam($key){ |
|
| 202 | + public function getParam($key) { |
|
| 203 | 203 | return $this->params[$key]; |
| 204 | 204 | } |
| 205 | 205 | |
@@ -237,11 +237,11 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | public function compile(&$view=NULL, $view_var='script_foot', $script_tags=TRUE) { |
| 239 | 239 | $bs=$this->_bootstrap; |
| 240 | - if (isset($bs)&&isset($view)) { |
|
| 240 | + if (isset($bs) && isset($view)) { |
|
| 241 | 241 | $bs->compileHtml($this, $view); |
| 242 | 242 | } |
| 243 | 243 | $sem=$this->_semantic; |
| 244 | - if (isset($sem)&&isset($view)) { |
|
| 244 | + if (isset($sem) && isset($view)) { |
|
| 245 | 245 | $sem->compileHtml($this, $view); |
| 246 | 246 | } |
| 247 | 247 | return $this->js->_compile($view, $view_var, $script_tags); |
@@ -308,27 +308,27 @@ discard block |
||
| 308 | 308 | $json_result=$result->result_array(); |
| 309 | 309 | } elseif (is_array($result)) { |
| 310 | 310 | $json_result=$result; |
| 311 | - } else { |
|
| 311 | + }else { |
|
| 312 | 312 | return $this->_prep_args($result); |
| 313 | 313 | } |
| 314 | - } else { |
|
| 314 | + }else { |
|
| 315 | 315 | return 'null'; |
| 316 | 316 | } |
| 317 | 317 | return $this->_create_json($json_result, $match_array_type); |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | private function _create_json($json_result, $match_array_type) { |
| 321 | - $json=array (); |
|
| 321 | + $json=array(); |
|
| 322 | 322 | $_is_assoc=TRUE; |
| 323 | - if (!is_array($json_result)&&empty($json_result)) { |
|
| 323 | + if (!is_array($json_result) && empty($json_result)) { |
|
| 324 | 324 | show_error("Generate JSON Failed - Illegal key, value pair."); |
| 325 | 325 | } elseif ($match_array_type) { |
| 326 | 326 | $_is_assoc=$this->_is_associative_array($json_result); |
| 327 | 327 | } |
| 328 | - foreach ( $json_result as $k => $v ) { |
|
| 328 | + foreach ($json_result as $k => $v) { |
|
| 329 | 329 | if ($_is_assoc) { |
| 330 | 330 | $json[]=$this->_prep_args($k, TRUE).':'.$this->generate_json($v, $match_array_type); |
| 331 | - } else { |
|
| 331 | + }else { |
|
| 332 | 332 | $json[]=$this->generate_json($v, $match_array_type); |
| 333 | 333 | } |
| 334 | 334 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | * @return type |
| 344 | 344 | */ |
| 345 | 345 | public function _is_associative_array($arr) { |
| 346 | - foreach ( array_keys($arr) as $key => $val ) { |
|
| 346 | + foreach (array_keys($arr) as $key => $val) { |
|
| 347 | 347 | if ($key!==$val) { |
| 348 | 348 | return TRUE; |
| 349 | 349 | } |
@@ -362,11 +362,11 @@ discard block |
||
| 362 | 362 | return 'null'; |
| 363 | 363 | } elseif (is_bool($result)) { |
| 364 | 364 | return ($result===TRUE) ? 'true' : 'false'; |
| 365 | - } elseif (is_string($result)||$is_key) { |
|
| 366 | - return '"'.str_replace(array ( |
|
| 367 | - '\\',"\t","\n","\r",'"','/' |
|
| 368 | - ), array ( |
|
| 369 | - '\\\\','\\t','\\n',"\\r",'\"','\/' |
|
| 365 | + } elseif (is_string($result) || $is_key) { |
|
| 366 | + return '"'.str_replace(array( |
|
| 367 | + '\\', "\t", "\n", "\r", '"', '/' |
|
| 368 | + ), array( |
|
| 369 | + '\\\\', '\\t', '\\n', "\\r", '\"', '\/' |
|
| 370 | 370 | ), $result).'"'; |
| 371 | 371 | } elseif (is_scalar($result)) { |
| 372 | 372 | return $result; |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | public function setCDNs($cdns) { |
| 381 | 381 | if (is_array($cdns)===false) { |
| 382 | - $cdns=array ( |
|
| 382 | + $cdns=array( |
|
| 383 | 383 | $cdns |
| 384 | 384 | ); |
| 385 | 385 | } |
@@ -391,9 +391,9 @@ discard block |
||
| 391 | 391 | $hasJQueryUI=false; |
| 392 | 392 | $hasBootstrap=false; |
| 393 | 393 | $hasSemantic=false; |
| 394 | - $result=array (); |
|
| 395 | - foreach ( $this->cdns as $cdn ) { |
|
| 396 | - switch(get_class($cdn)) { |
|
| 394 | + $result=array(); |
|
| 395 | + foreach ($this->cdns as $cdn) { |
|
| 396 | + switch (get_class($cdn)) { |
|
| 397 | 397 | case "Ajax\lib\CDNJQuery": |
| 398 | 398 | $hasJQuery=true; |
| 399 | 399 | $result[0]=$cdn; |
@@ -403,11 +403,11 @@ discard block |
||
| 403 | 403 | $result[1]=$cdn; |
| 404 | 404 | break; |
| 405 | 405 | case "Ajax\lib\CDNCoreCss": |
| 406 | - if($cdn->getFramework()==="Bootstrap") |
|
| 406 | + if ($cdn->getFramework()==="Bootstrap") |
|
| 407 | 407 | $hasBootstrap=true; |
| 408 | - elseif($cdn->getFramework()==="Semantic") |
|
| 408 | + elseif ($cdn->getFramework()==="Semantic") |
|
| 409 | 409 | $hasSemantic=true; |
| 410 | - if($hasSemantic || $hasBootstrap) |
|
| 410 | + if ($hasSemantic || $hasBootstrap) |
|
| 411 | 411 | $result[2]=$cdn; |
| 412 | 412 | break; |
| 413 | 413 | } |
@@ -415,14 +415,14 @@ discard block |
||
| 415 | 415 | if ($hasJQuery===false) { |
| 416 | 416 | $result[0]=new CDNJQuery("x"); |
| 417 | 417 | } |
| 418 | - if ($hasJQueryUI===false&&isset($this->_ui)) { |
|
| 418 | + if ($hasJQueryUI===false && isset($this->_ui)) { |
|
| 419 | 419 | $result[1]=new CDNGuiGen("x", $template); |
| 420 | 420 | } |
| 421 | - if ($hasBootstrap===false&&isset($this->_bootstrap)) { |
|
| 422 | - $result[2]=new CDNCoreCss("Bootstrap","x"); |
|
| 421 | + if ($hasBootstrap===false && isset($this->_bootstrap)) { |
|
| 422 | + $result[2]=new CDNCoreCss("Bootstrap", "x"); |
|
| 423 | 423 | } |
| 424 | - if ($hasSemantic===false&&isset($this->_semantic)) { |
|
| 425 | - $result[2]=new CDNCoreCss("Semantic","x"); |
|
| 424 | + if ($hasSemantic===false && isset($this->_semantic)) { |
|
| 425 | + $result[2]=new CDNCoreCss("Semantic", "x"); |
|
| 426 | 426 | } |
| 427 | 427 | ksort($result); |
| 428 | 428 | return implode("\n", $result); |
@@ -2,5 +2,5 @@ |
||
| 2 | 2 | namespace Ajax\semantic\html\base\constants; |
| 3 | 3 | use Ajax\common\BaseEnum; |
| 4 | 4 | abstract class Social extends BaseEnum { |
| 5 | - const FACEBOOK="facebook", TWITTER="twitter",GOOGLEPLUS="google plus",VK="vk",LINKEDIN="linkedin",INSTAGRAM="instagram",YOUTUBE="youtube"; |
|
| 5 | + const FACEBOOK="facebook", TWITTER="twitter", GOOGLEPLUS="google plus", VK="vk", LINKEDIN="linkedin", INSTAGRAM="instagram", YOUTUBE="youtube"; |
|
| 6 | 6 | } |
| 7 | 7 | \ No newline at end of file |
@@ -34,8 +34,9 @@ |
||
| 34 | 34 | * @see BaseHtml::run() |
| 35 | 35 | */ |
| 36 | 36 | public function run(JsUtils $js) { |
| 37 | - if(isset($this->_bsComponent)===false) |
|
| 38 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
| 37 | + if(isset($this->_bsComponent)===false) { |
|
| 38 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
| 39 | + } |
|
| 39 | 40 | $this->addEventsOnRun($js); |
| 40 | 41 | return $this->_bsComponent; |
| 41 | 42 | } |
@@ -10,6 +10,9 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | protected $params=array(); |
| 12 | 12 | |
| 13 | + /** |
|
| 14 | + * @param string $identifier |
|
| 15 | + */ |
|
| 13 | 16 | public function __construct( $identifier, $tagName="div", $baseClass="ui"){ |
| 14 | 17 | parent::__construct( $identifier, "div", "ui accordion"); |
| 15 | 18 | } |
@@ -29,6 +32,9 @@ discard block |
||
| 29 | 32 | return ($value instanceof HtmlAccordionItem)===false; |
| 30 | 33 | } |
| 31 | 34 | |
| 35 | + /** |
|
| 36 | + * @param string $title |
|
| 37 | + */ |
|
| 32 | 38 | public function addPanel($title,$content){ |
| 33 | 39 | return $this->addItem([$title,$content]); |
| 34 | 40 | } |
@@ -6,31 +6,31 @@ discard block |
||
| 6 | 6 | use Ajax\semantic\html\content\HtmlAccordionItem; |
| 7 | 7 | use Ajax\JsUtils; |
| 8 | 8 | |
| 9 | -class HtmlAccordion extends HtmlSemCollection{ |
|
| 9 | +class HtmlAccordion extends HtmlSemCollection { |
|
| 10 | 10 | |
| 11 | 11 | protected $params=array(); |
| 12 | 12 | |
| 13 | - public function __construct( $identifier, $tagName="div", $baseClass="ui"){ |
|
| 14 | - parent::__construct( $identifier, "div", "ui accordion"); |
|
| 13 | + public function __construct($identifier, $tagName="div", $baseClass="ui") { |
|
| 14 | + parent::__construct($identifier, "div", "ui accordion"); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | |
| 18 | - protected function createItem($value){ |
|
| 18 | + protected function createItem($value) { |
|
| 19 | 19 | $count=$this->count(); |
| 20 | 20 | $title=$value; |
| 21 | 21 | $content=NULL; |
| 22 | - if(\is_array($value)){ |
|
| 23 | - $title=@$value[0];$content=@$value[1]; |
|
| 22 | + if (\is_array($value)) { |
|
| 23 | + $title=@$value[0]; $content=@$value[1]; |
|
| 24 | 24 | } |
| 25 | - return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title,$content); |
|
| 25 | + return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title, $content); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - protected function createCondition($value){ |
|
| 28 | + protected function createCondition($value) { |
|
| 29 | 29 | return ($value instanceof HtmlAccordionItem)===false; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function addPanel($title,$content){ |
|
| 33 | - return $this->addItem([$title,$content]); |
|
| 32 | + public function addPanel($title, $content) { |
|
| 33 | + return $this->addItem([$title, $content]); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @param string $action a Phalcon action |
| 43 | 43 | * @param array $params |
| 44 | 44 | */ |
| 45 | - public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
| 46 | - return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params)); |
|
| 45 | + public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
| 46 | + return $this->addPanel($title, $js->forward($initialController, $controller, $action, $params)); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -54,30 +54,30 @@ discard block |
||
| 54 | 54 | * @param string $viewName |
| 55 | 55 | * @param $params The parameters to pass to the view |
| 56 | 56 | */ |
| 57 | - public function renderViewPanel(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
| 58 | - return $this->addPanel($title, $js->renderContent($initialController, $viewName,$params)); |
|
| 57 | + public function renderViewPanel(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
| 58 | + return $this->addPanel($title, $js->renderContent($initialController, $viewName, $params)); |
|
| 59 | 59 | } |
| 60 | 60 | /* |
| 61 | 61 | * (non-PHPdoc) |
| 62 | 62 | * @see BaseHtml::run() |
| 63 | 63 | */ |
| 64 | 64 | public function run(JsUtils $js) { |
| 65 | - if(isset($this->_bsComponent)===false) |
|
| 66 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
| 65 | + if (isset($this->_bsComponent)===false) |
|
| 66 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier, $this->params); |
|
| 67 | 67 | $this->addEventsOnRun($js); |
| 68 | 68 | return $this->_bsComponent; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function setStyled(){ |
|
| 71 | + public function setStyled() { |
|
| 72 | 72 | return $this->addToProperty("class", "styled"); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function setActive($index){ |
|
| 75 | + public function setActive($index) { |
|
| 76 | 76 | $this->getItem($index)->setActive(true); |
| 77 | 77 | return $this; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function setExclusive($value){ |
|
| 80 | + public function setExclusive($value) { |
|
| 81 | 81 | $this->params["exclusive"]=$value; |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | \ No newline at end of file |