@@ -10,30 +10,30 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | class HtmlDropdownItem extends HtmlSemDoubleElement { |
| 12 | 12 | |
| 13 | - public function __construct($identifier, $content="",$value=NULL,$image=NULL) { |
|
| 13 | + public function __construct($identifier, $content="", $value=NULL, $image=NULL) { |
|
| 14 | 14 | parent::__construct($identifier, "div"); |
| 15 | 15 | $this->setClass("item"); |
| 16 | 16 | $this->setContent($content); |
| 17 | - if($value!==NULL) |
|
| 17 | + if ($value!==NULL) |
|
| 18 | 18 | $this->setData($value); |
| 19 | - if($image!==NULL) |
|
| 19 | + if ($image!==NULL) |
|
| 20 | 20 | $this->asMiniAvatar($image); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function setDescription($description){ |
|
| 24 | - $descO=new HtmlDoubleElement("desc-".$this->identifier,"span"); |
|
| 23 | + public function setDescription($description) { |
|
| 24 | + $descO=new HtmlDoubleElement("desc-".$this->identifier, "span"); |
|
| 25 | 25 | $descO->setClass("description"); |
| 26 | 26 | $descO->setContent($description); |
| 27 | - return $this->addContent($descO,true); |
|
| 27 | + return $this->addContent($descO, true); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function setData($value){ |
|
| 30 | + public function setData($value) { |
|
| 31 | 31 | $this->setProperty("data-value", $value); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function asOption(){ |
|
| 34 | + public function asOption() { |
|
| 35 | 35 | $this->tagName="option"; |
| 36 | - if($this->getProperty("data-value")!==null) |
|
| 36 | + if ($this->getProperty("data-value")!==null) |
|
| 37 | 37 | $this->setProperty("value", $this->getProperty("data-value")); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -41,58 +41,58 @@ discard block |
||
| 41 | 41 | * @param string $image the image src |
| 42 | 42 | * @return \Ajax\common\html\html5\HtmlImg |
| 43 | 43 | */ |
| 44 | - public function asMiniAvatar($image){ |
|
| 44 | + public function asMiniAvatar($image) { |
|
| 45 | 45 | $this->tagName="div"; |
| 46 | - $img=new HtmlImg("image-".$this->identifier,$image); |
|
| 46 | + $img=new HtmlImg("image-".$this->identifier, $image); |
|
| 47 | 47 | $img->setClass("ui mini avatar image"); |
| 48 | - $this->addContent($img,true); |
|
| 48 | + $this->addContent($img, true); |
|
| 49 | 49 | return $img; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function asSearchInput($placeholder=NULL,$icon=NULL){ |
|
| 52 | + public function asSearchInput($placeholder=NULL, $icon=NULL) { |
|
| 53 | 53 | $this->setClass("ui icon search input"); |
| 54 | 54 | $input=new HtmlInput("search-".$this->identifier); |
| 55 | - if(isset($placeholder)) |
|
| 55 | + if (isset($placeholder)) |
|
| 56 | 56 | $input->setProperty("placeholder", $placeholder); |
| 57 | 57 | $this->content=$input; |
| 58 | - if(isset($icon)) |
|
| 58 | + if (isset($icon)) |
|
| 59 | 59 | $this->addIcon($icon); |
| 60 | 60 | return $this; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - public function setContent($content){ |
|
| 64 | - if($content==="-"){ |
|
| 63 | + public function setContent($content) { |
|
| 64 | + if ($content==="-") { |
|
| 65 | 65 | $this->asDivider(); |
| 66 | - }elseif($content==="-search-"){ |
|
| 67 | - $values=\explode(",",$content,-1); |
|
| 68 | - $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
|
| 66 | + }elseif ($content==="-search-") { |
|
| 67 | + $values=\explode(",", $content, -1); |
|
| 68 | + $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search")); |
|
| 69 | 69 | }else |
| 70 | 70 | parent::setContent($content); |
| 71 | 71 | return $this; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function asDivider(){ |
|
| 74 | + public function asDivider() { |
|
| 75 | 75 | $this->content=NULL; |
| 76 | 76 | $this->setClass("divider"); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public function asHeader($caption=NULL,$icon=NULL){ |
|
| 79 | + public function asHeader($caption=NULL, $icon=NULL) { |
|
| 80 | 80 | $this->setClass("header"); |
| 81 | 81 | $this->content=$caption; |
| 82 | - if(isset($icon)) |
|
| 83 | - $this->addIcon($icon,true); |
|
| 82 | + if (isset($icon)) |
|
| 83 | + $this->addIcon($icon, true); |
|
| 84 | 84 | return $this; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public static function searchInput($placeholder=NULL,$icon=NULL){ |
|
| 88 | - return (new HtmlDropdownItem(""))->asSearchInput($placeholder,$icon); |
|
| 87 | + public static function searchInput($placeholder=NULL, $icon=NULL) { |
|
| 88 | + return (new HtmlDropdownItem(""))->asSearchInput($placeholder, $icon); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public static function divider($placeholder=NULL,$icon=NULL){ |
|
| 91 | + public static function divider($placeholder=NULL, $icon=NULL) { |
|
| 92 | 92 | return (new HtmlDropdownItem(""))->asDivider(); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - public static function header($caption=NULL,$icon=NULL){ |
|
| 96 | - return (new HtmlDropdownItem(""))->asHeader($caption,$icon); |
|
| 95 | + public static function header($caption=NULL, $icon=NULL) { |
|
| 96 | + return (new HtmlDropdownItem(""))->asHeader($caption, $icon); |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | \ No newline at end of file |
@@ -2,21 +2,21 @@ |
||
| 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 | 23 | \ No newline at end of file |
@@ -24,38 +24,38 @@ discard block |
||
| 24 | 24 | $this->setContent($content); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function addHeader($header){ |
|
| 27 | + public function addHeader($header) { |
|
| 28 | 28 | $headerO=$header; |
| 29 | - if(\is_string($header)){ |
|
| 30 | - $headerO=new HtmlSemDoubleElement("header-".$this->identifier,"div"); |
|
| 29 | + if (\is_string($header)) { |
|
| 30 | + $headerO=new HtmlSemDoubleElement("header-".$this->identifier, "div"); |
|
| 31 | 31 | $headerO->setClass("header"); |
| 32 | 32 | $headerO->setContent($header); |
| 33 | 33 | } |
| 34 | - return $this->addContent($headerO,true); |
|
| 34 | + return $this->addContent($headerO, true); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function addList($elements,$ordered=false){ |
|
| 38 | - $list=new HtmlList("list-".$this->identifier,$elements); |
|
| 37 | + public function addList($elements, $ordered=false) { |
|
| 38 | + $list=new HtmlList("list-".$this->identifier, $elements); |
|
| 39 | 39 | $list->setOrdered($ordered); |
| 40 | 40 | $list->setClass("ui list"); |
| 41 | 41 | $this->addContent($list); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function setIcon($icon){ |
|
| 44 | + public function setIcon($icon) { |
|
| 45 | 45 | $this->addToProperty("class", "icon"); |
| 46 | - $this->wrapContent("<div class='content'>","</div>"); |
|
| 46 | + $this->wrapContent("<div class='content'>", "</div>"); |
|
| 47 | 47 | $this->icon=new HtmlIcon("icon-".$this->identifier, $icon); |
| 48 | 48 | return $this; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function addLoader($loaderIcon="notched circle"){ |
|
| 51 | + public function addLoader($loaderIcon="notched circle") { |
|
| 52 | 52 | $this->setIcon($loaderIcon); |
| 53 | 53 | $this->icon->addToIcon("loading"); |
| 54 | 54 | return $this; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public function setDismissable($dismiss=true){ |
|
| 58 | - if($dismiss===true) |
|
| 57 | + public function setDismissable($dismiss=true) { |
|
| 58 | + if ($dismiss===true) |
|
| 59 | 59 | $this->close=new HtmlIcon("close-".$this->identifier, "close"); |
| 60 | 60 | else |
| 61 | 61 | $this->close=NULL; |
@@ -66,28 +66,28 @@ discard block |
||
| 66 | 66 | * {@inheritDoc} |
| 67 | 67 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
| 68 | 68 | */ |
| 69 | - public function run(JsUtils $js){ |
|
| 69 | + public function run(JsUtils $js) { |
|
| 70 | 70 | parent::run($js); |
| 71 | - if(isset($this->close)){ |
|
| 71 | + if (isset($this->close)) { |
|
| 72 | 72 | $js->execOn("click", "#".$this->identifier." .close", "$(this).closest('.message').transition('fade')"); |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - public function setState($visible=true){ |
|
| 77 | - $visible=($visible===true)?"visible":"hidden"; |
|
| 78 | - return $this->addToPropertyCtrl("class", $visible, array("visible","hidden")); |
|
| 76 | + public function setState($visible=true) { |
|
| 77 | + $visible=($visible===true) ? "visible" : "hidden"; |
|
| 78 | + return $this->addToPropertyCtrl("class", $visible, array("visible", "hidden")); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - public function setVariation($value="floating"){ |
|
| 82 | - return $this->addToPropertyCtrl("class", $value, array("floating","compact")); |
|
| 81 | + public function setVariation($value="floating") { |
|
| 82 | + return $this->addToPropertyCtrl("class", $value, array("floating", "compact")); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public function setStyle($style){ |
|
| 85 | + public function setStyle($style) { |
|
| 86 | 86 | return $this->addToPropertyCtrl("class", $style, Style::getConstants()); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - public function setAttached(HtmlDoubleElement $toElement=NULL){ |
|
| 90 | - if(isset($toElement)){ |
|
| 89 | + public function setAttached(HtmlDoubleElement $toElement=NULL) { |
|
| 90 | + if (isset($toElement)) { |
|
| 91 | 91 | $toElement->addToProperty("class", "attached"); |
| 92 | 92 | } |
| 93 | 93 | return $this->addToProperty("class", "attached"); |
@@ -13,8 +13,8 @@ |
||
| 13 | 13 | parent::__construct($identifier, "ul"); |
| 14 | 14 | $this->addItems($items); |
| 15 | 15 | } |
| 16 | - public function setOrdered($ordered=true){ |
|
| 17 | - $this->tagName=($ordered===true)?"ol":"ul"; |
|
| 16 | + public function setOrdered($ordered=true) { |
|
| 17 | + $this->tagName=($ordered===true) ? "ol" : "ul"; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | /** |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | protected $attr; |
| 20 | 20 | |
| 21 | 21 | |
| 22 | - public function __construct($identifier,$tagName){ |
|
| 23 | - parent::__construct($identifier,$tagName); |
|
| 22 | + public function __construct($identifier, $tagName) { |
|
| 23 | + parent::__construct($identifier, $tagName); |
|
| 24 | 24 | $this->root=""; |
| 25 | 25 | $this->attr="data-ajax"; |
| 26 | 26 | } |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | * @param string $attr the html attribute used to build the elements url |
| 33 | 33 | * @return HtmlNavElement |
| 34 | 34 | */ |
| 35 | - public function autoGetOnClick($targetSelector){ |
|
| 36 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
| 35 | + public function autoGetOnClick($targetSelector) { |
|
| 36 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public function contentAsString(){ |
|
| 39 | + public function contentAsString() { |
|
| 40 | 40 | return implode("", $this->content); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -44,15 +44,15 @@ discard block |
||
| 44 | 44 | * Generate the jquery script to set the elements to the HtmlNavElement |
| 45 | 45 | * @param JsUtils $jsUtils |
| 46 | 46 | */ |
| 47 | - public function jsSetContent(JsUtils $jsUtils){ |
|
| 48 | - $jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true); |
|
| 47 | + public function jsSetContent(JsUtils $jsUtils) { |
|
| 48 | + $jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public function getRoot() { |
| 52 | 52 | return $this->root; |
| 53 | 53 | } |
| 54 | 54 | public function setRoot($root) { |
| 55 | - $this->root = $root; |
|
| 55 | + $this->root=$root; |
|
| 56 | 56 | return $this; |
| 57 | 57 | } |
| 58 | 58 | public function getAttr() { |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | * @return HtmlNavElement |
| 66 | 66 | */ |
| 67 | 67 | public function setAttr($attr) { |
| 68 | - $this->attr = $attr; |
|
| 68 | + $this->attr=$attr; |
|
| 69 | 69 | return $this; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | public function __call($method, $args) { |
| 73 | - if(isset($this->$method) && is_callable($this->$method)) { |
|
| 73 | + if (isset($this->$method) && is_callable($this->$method)) { |
|
| 74 | 74 | return call_user_func_array( |
| 75 | 75 | $this->$method, |
| 76 | 76 | $args |
@@ -78,6 +78,6 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - public abstract function fromDispatcher($dispatcher,$startIndex=0); |
|
| 81 | + public abstract function fromDispatcher($dispatcher, $startIndex=0); |
|
| 82 | 82 | |
| 83 | 83 | } |
| 84 | 84 | \ No newline at end of file |
@@ -44,70 +44,70 @@ discard block |
||
| 44 | 44 | /** |
| 45 | 45 | * @param string $identifier |
| 46 | 46 | */ |
| 47 | - public function __construct($identifier,$from=1,$to=1,$active=NULL,$countVisible=NULL){ |
|
| 48 | - parent::__construct($identifier,"ul"); |
|
| 47 | + public function __construct($identifier, $from=1, $to=1, $active=NULL, $countVisible=NULL) { |
|
| 48 | + parent::__construct($identifier, "ul"); |
|
| 49 | 49 | $this->setProperty("class", "pagination"); |
| 50 | 50 | $this->active=$active; |
| 51 | 51 | $this->from=$from; |
| 52 | 52 | $this->to=$to; |
| 53 | 53 | $this->urlMask="%page%"; |
| 54 | - if(!isset($countVisible)) |
|
| 54 | + if (!isset($countVisible)) |
|
| 55 | 55 | $this->countVisible=$to-$from+1; |
| 56 | 56 | else |
| 57 | 57 | $this->countVisible=$countVisible; |
| 58 | 58 | $this->createContent(); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - private function createElement($num,$content,$disabled=false,$current=false){ |
|
| 61 | + private function createElement($num, $content, $disabled=false, $current=false) { |
|
| 62 | 62 | $count=sizeof($this->content)+1; |
| 63 | - $elem=new HtmlBsDoubleElement("li-".$this->identifier."-".$count,"li"); |
|
| 64 | - if($disabled){ |
|
| 63 | + $elem=new HtmlBsDoubleElement("li-".$this->identifier."-".$count, "li"); |
|
| 64 | + if ($disabled) { |
|
| 65 | 65 | $elem->setProperty("class", "disabled"); |
| 66 | 66 | } |
| 67 | - if($current){ |
|
| 67 | + if ($current) { |
|
| 68 | 68 | $content.="<span class='sr-only'>(current)</span>"; |
| 69 | 69 | $elem->setProperty("class", "active"); |
| 70 | 70 | } |
| 71 | - if(!$disabled){ |
|
| 71 | + if (!$disabled) { |
|
| 72 | 72 | $url=$this->getUrl($num); |
| 73 | - $href=new HtmlLink("a-".$this->identifier."-".$count,$url,$content); |
|
| 73 | + $href=new HtmlLink("a-".$this->identifier."-".$count, $url, $content); |
|
| 74 | 74 | $href->setProperty($this->attr, $url); |
| 75 | 75 | $elem->setContent($href); |
| 76 | - }else{ |
|
| 76 | + }else { |
|
| 77 | 77 | $elem->setContent($content); |
| 78 | 78 | } |
| 79 | 79 | $this->content[]=$elem; |
| 80 | 80 | return $this; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - protected function createContent(){ |
|
| 83 | + protected function createContent() { |
|
| 84 | 84 | $this->content=array(); |
| 85 | - $this->createElement($this->active-1,"<span aria-hidden='true'>«</span>",$this->active===1); |
|
| 85 | + $this->createElement($this->active-1, "<span aria-hidden='true'>«</span>", $this->active===1); |
|
| 86 | 86 | $start=$this->getStart(); |
| 87 | - $end=min($start+$this->countVisible-1,$this->to); |
|
| 88 | - for($index=$start;$index<=$end;$index++){ |
|
| 89 | - $this->createElement($index,$index,false,$index===$this->active); |
|
| 87 | + $end=min($start+$this->countVisible-1, $this->to); |
|
| 88 | + for ($index=$start; $index<=$end; $index++) { |
|
| 89 | + $this->createElement($index, $index, false, $index===$this->active); |
|
| 90 | 90 | } |
| 91 | - $this->createElement($this->active+1,"<span aria-hidden='true'>»</span>",$this->active===$this->to); |
|
| 91 | + $this->createElement($this->active+1, "<span aria-hidden='true'>»</span>", $this->active===$this->to); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - protected function half(){ |
|
| 95 | - return (int)($this->countVisible/2); |
|
| 94 | + protected function half() { |
|
| 95 | + return (int) ($this->countVisible / 2); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - protected function getStart(){ |
|
| 98 | + protected function getStart() { |
|
| 99 | 99 | $result=1; |
| 100 | - if($this->countVisible!==$this->to-$this->from+1){ |
|
| 101 | - $result=max($this->active-$this->half(),$result); |
|
| 100 | + if ($this->countVisible!==$this->to-$this->from+1) { |
|
| 101 | + $result=max($this->active-$this->half(), $result); |
|
| 102 | 102 | } |
| 103 | 103 | return $result; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | public function _addEvent($event, $jsCode) { |
| 107 | - foreach ($this->content as $li){ |
|
| 107 | + foreach ($this->content as $li) { |
|
| 108 | 108 | $content=$li->getContent(); |
| 109 | - if($content instanceof BaseHtml) |
|
| 110 | - $content->_addEvent($event,$jsCode); |
|
| 109 | + if ($content instanceof BaseHtml) |
|
| 110 | + $content->_addEvent($event, $jsCode); |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | /** |
@@ -115,15 +115,15 @@ discard block |
||
| 115 | 115 | * @param Dispatcher $dispatcher the request dispatcher |
| 116 | 116 | * @return \Ajax\bootstrap\html\HtmlPagination |
| 117 | 117 | */ |
| 118 | - public function fromDispatcher($dispatcher,$startIndex=0){ |
|
| 119 | - $items=array($dispatcher->getControllerName(),$dispatcher->getActionName()); |
|
| 120 | - $items=array_merge($items,$dispatcher->getParams()); |
|
| 118 | + public function fromDispatcher($dispatcher, $startIndex=0) { |
|
| 119 | + $items=array($dispatcher->getControllerName(), $dispatcher->getActionName()); |
|
| 120 | + $items=array_merge($items, $dispatcher->getParams()); |
|
| 121 | 121 | $url=implode("/", $items); |
| 122 | - if($this->urlMask==="%page%"){ |
|
| 122 | + if ($this->urlMask==="%page%") { |
|
| 123 | 123 | $this->urlMask=preg_replace("/[0-9]/", "%page%", $url); |
| 124 | 124 | } |
| 125 | - for($index=$this->from;$index<=$this->to;$index++){ |
|
| 126 | - if($this->getUrl($index)==$url){ |
|
| 125 | + for ($index=$this->from; $index<=$this->to; $index++) { |
|
| 126 | + if ($this->getUrl($index)==$url) { |
|
| 127 | 127 | $this->setActive($index); |
| 128 | 128 | break; |
| 129 | 129 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | return $this; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - public function getUrl($index){ |
|
| 134 | + public function getUrl($index) { |
|
| 135 | 135 | return str_ireplace("%page%", $index, $this->urlMask); |
| 136 | 136 | } |
| 137 | 137 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | if (is_int($size)) { |
| 146 | 146 | return $this->addToPropertyUnique("class", CssRef::sizes("pagination")[$size], CssRef::sizes("pagination")); |
| 147 | 147 | } |
| 148 | - if(!PhalconUtils::startsWith($size, "pagination-") && $size!=="") |
|
| 148 | + if (!PhalconUtils::startsWith($size, "pagination-") && $size!=="") |
|
| 149 | 149 | $size="pagination-".$size; |
| 150 | 150 | return $this->addToPropertyCtrl("class", $size, CssRef::sizes("pagination")); |
| 151 | 151 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | return $this->from; |
| 155 | 155 | } |
| 156 | 156 | public function setFrom($from) { |
| 157 | - $this->from = $from; |
|
| 157 | + $this->from=$from; |
|
| 158 | 158 | $this->createContent(); |
| 159 | 159 | return $this; |
| 160 | 160 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | return $this->to; |
| 163 | 163 | } |
| 164 | 164 | public function setTo($to) { |
| 165 | - $this->to = $to; |
|
| 165 | + $this->to=$to; |
|
| 166 | 166 | $this->createContent(); |
| 167 | 167 | return $this; |
| 168 | 168 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | return $this->active; |
| 171 | 171 | } |
| 172 | 172 | public function setActive($active) { |
| 173 | - $this->active = $active; |
|
| 173 | + $this->active=$active; |
|
| 174 | 174 | $this->createContent(); |
| 175 | 175 | return $this; |
| 176 | 176 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | return $this->urlMask; |
| 179 | 179 | } |
| 180 | 180 | public function setUrlMask($urlMask) { |
| 181 | - $this->urlMask = $urlMask; |
|
| 181 | + $this->urlMask=$urlMask; |
|
| 182 | 182 | $this->createContent(); |
| 183 | 183 | return $this; |
| 184 | 184 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | return $this->countVisible; |
| 187 | 187 | } |
| 188 | 188 | public function setCountVisible($countVisible) { |
| 189 | - $this->countVisible = $countVisible; |
|
| 189 | + $this->countVisible=$countVisible; |
|
| 190 | 190 | $this->createContent(); |
| 191 | 191 | return $this; |
| 192 | 192 | } |
@@ -41,15 +41,15 @@ discard block |
||
| 41 | 41 | * @param boolean $autoActive sets the last element's class to <b>active</b> if true |
| 42 | 42 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
| 43 | 43 | */ |
| 44 | - public function __construct($identifier,$elements=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
| 45 | - parent::__construct($identifier,"ol"); |
|
| 44 | + public function __construct($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
| 45 | + parent::__construct($identifier, "ol"); |
|
| 46 | 46 | $this->startIndex=$startIndex; |
| 47 | 47 | $this->setProperty("class", "breadcrumb"); |
| 48 | 48 | $this->content=array(); |
| 49 | 49 | $this->autoActive=$autoActive; |
| 50 | 50 | $this->absolutePaths; |
| 51 | - $this->_hrefFunction=function ($e){return $e->getContent();}; |
|
| 52 | - if(isset($hrefFunction)){ |
|
| 51 | + $this->_hrefFunction=function($e) {return $e->getContent(); }; |
|
| 52 | + if (isset($hrefFunction)) { |
|
| 53 | 53 | $this->_hrefFunction=$hrefFunction; |
| 54 | 54 | } |
| 55 | 55 | $this->addElements($elements); |
@@ -60,43 +60,43 @@ discard block |
||
| 60 | 60 | * @param string $href |
| 61 | 61 | * @return \Ajax\bootstrap\html\HtmlLink |
| 62 | 62 | */ |
| 63 | - public function addElement($element,$href="",$glyph=NULL){ |
|
| 63 | + public function addElement($element, $href="", $glyph=NULL) { |
|
| 64 | 64 | $size=sizeof($this->content); |
| 65 | - if(is_array($element)){ |
|
| 65 | + if (is_array($element)) { |
|
| 66 | 66 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
| 67 | 67 | $elm->fromArray($element); |
| 68 | - }else if($element instanceof HtmlLink){ |
|
| 68 | + }else if ($element instanceof HtmlLink) { |
|
| 69 | 69 | $elm=$element; |
| 70 | - }else{ |
|
| 71 | - $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
|
| 72 | - if(isset($glyph)){ |
|
| 70 | + }else { |
|
| 71 | + $elm=new HtmlLink("lnk-".$this->identifier."-".$size, $href, $element); |
|
| 72 | + if (isset($glyph)) { |
|
| 73 | 73 | $elm->wrapContentWithGlyph($glyph); |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | - $elm->wrap("<li>","</li>"); |
|
| 76 | + $elm->wrap("<li>", "</li>"); |
|
| 77 | 77 | $this->content[]=$elm; |
| 78 | 78 | $elm->setProperty($this->attr, $this->getHref($size)); |
| 79 | 79 | return $elm; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function setActive($index=null){ |
|
| 83 | - if(!isset($index)){ |
|
| 82 | + public function setActive($index=null) { |
|
| 83 | + if (!isset($index)) { |
|
| 84 | 84 | $index=sizeof($this->content)-1; |
| 85 | 85 | } |
| 86 | - $li=new HtmlBsDoubleElement("","li"); |
|
| 86 | + $li=new HtmlBsDoubleElement("", "li"); |
|
| 87 | 87 | $li->setClass("active"); |
| 88 | 88 | $li->setContent($this->content[$index]->getContent()); |
| 89 | 89 | $this->content[$index]=$li; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function addElements($elements){ |
|
| 93 | - foreach ( $elements as $element ) { |
|
| 92 | + public function addElements($elements) { |
|
| 93 | + foreach ($elements as $element) { |
|
| 94 | 94 | $this->addElement($element); |
| 95 | 95 | } |
| 96 | 96 | return $this; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function fromArray($array){ |
|
| 99 | + public function fromArray($array) { |
|
| 100 | 100 | $array=parent::fromArray($array); |
| 101 | 101 | $this->addElements($array); |
| 102 | 102 | return $array; |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | * @param string $separator |
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | - public function getHref($index=null,$separator="/"){ |
|
| 112 | - if(!isset($index)){ |
|
| 111 | + public function getHref($index=null, $separator="/") { |
|
| 112 | + if (!isset($index)) { |
|
| 113 | 113 | $index=sizeof($this->content); |
| 114 | 114 | } |
| 115 | - if($this->absolutePaths===true){ |
|
| 115 | + if ($this->absolutePaths===true) { |
|
| 116 | 116 | return $this->_hrefFunction($this->content[$index]); |
| 117 | - }else{ |
|
| 118 | - return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
|
| 117 | + }else { |
|
| 118 | + return $this->root.implode($separator, array_slice(array_map(function($e) {return $this->_hrefFunction($e); }, $this->content), $this->startIndex, $index+1)); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @see \Ajax\bootstrap\html\BaseHtml::compile() |
| 125 | 125 | */ |
| 126 | 126 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 127 | - if($this->autoActive){ |
|
| 127 | + if ($this->autoActive) { |
|
| 128 | 128 | $this->setActive(); |
| 129 | 129 | } |
| 130 | 130 | return parent::compile($js, $view); |
@@ -142,19 +142,19 @@ discard block |
||
| 142 | 142 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 143 | 143 | */ |
| 144 | 144 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 145 | - foreach ($this->content as $element){ |
|
| 146 | - $element->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
| 145 | + foreach ($this->content as $element) { |
|
| 146 | + $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
| 147 | 147 | } |
| 148 | 148 | return $this; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | public function setAutoActive($autoActive) { |
| 152 | - $this->autoActive = $autoActive; |
|
| 152 | + $this->autoActive=$autoActive; |
|
| 153 | 153 | return $this; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 157 | - foreach ($this->content as $element){ |
|
| 157 | + foreach ($this->content as $element) { |
|
| 158 | 158 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
| 159 | 159 | } |
| 160 | 160 | return $this; |
@@ -167,18 +167,18 @@ discard block |
||
| 167 | 167 | * @param string $attr the html attribute used to build the elements url |
| 168 | 168 | * @return HtmlBreadcrumbs |
| 169 | 169 | */ |
| 170 | - public function autoGetOnClick($targetSelector){ |
|
| 171 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
| 170 | + public function autoGetOnClick($targetSelector) { |
|
| 171 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - public function contentAsString(){ |
|
| 175 | - if($this->autoActive){ |
|
| 174 | + public function contentAsString() { |
|
| 175 | + if ($this->autoActive) { |
|
| 176 | 176 | $this->setActive(); |
| 177 | 177 | } |
| 178 | 178 | return parent::contentAsString(); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - public function getElement($index){ |
|
| 181 | + public function getElement($index) { |
|
| 182 | 182 | return $this->content[$index]; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @param mixed $glyph |
| 188 | 188 | * @param int $index |
| 189 | 189 | */ |
| 190 | - public function addGlyph($glyph,$index=0){ |
|
| 190 | + public function addGlyph($glyph, $index=0) { |
|
| 191 | 191 | $elm=$this->getElement($index); |
| 192 | 192 | return $elm->wrapContentWithGlyph($glyph); |
| 193 | 193 | } |
@@ -197,15 +197,15 @@ discard block |
||
| 197 | 197 | * @param Dispatcher $dispatcher the request dispatcher |
| 198 | 198 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 199 | 199 | */ |
| 200 | - public function fromDispatcher($dispatcher,$startIndex=0){ |
|
| 200 | + public function fromDispatcher($dispatcher, $startIndex=0) { |
|
| 201 | 201 | $this->startIndex=$startIndex; |
| 202 | 202 | $params=$dispatcher->getParams(); |
| 203 | 203 | $action=$dispatcher->getActionName(); |
| 204 | 204 | $items=array($dispatcher->getControllerName()); |
| 205 | - if(\sizeof($params)>0 || \strtolower($action)!="index" ){ |
|
| 205 | + if (\sizeof($params)>0 || \strtolower($action)!="index") { |
|
| 206 | 206 | $items[]=$action; |
| 207 | - foreach ($params as $p){ |
|
| 208 | - if(\is_object($p)===false) |
|
| 207 | + foreach ($params as $p) { |
|
| 208 | + if (\is_object($p)===false) |
|
| 209 | 209 | $items[]=$p; |
| 210 | 210 | } |
| 211 | 211 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 220 | 220 | */ |
| 221 | 221 | public function setHrefFunction($_hrefFunction) { |
| 222 | - $this->_hrefFunction = $_hrefFunction; |
|
| 222 | + $this->_hrefFunction=$_hrefFunction; |
|
| 223 | 223 | return $this; |
| 224 | 224 | } |
| 225 | 225 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | public static function getConstants() { |
| 15 | 15 | if (self::$constCacheArray==NULL) { |
| 16 | - self::$constCacheArray=[ ]; |
|
| 16 | + self::$constCacheArray=[]; |
|
| 17 | 17 | } |
| 18 | 18 | $calledClass=get_called_class(); |
| 19 | 19 | if (!array_key_exists($calledClass, self::$constCacheArray)) { |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | return self::$constCacheArray [$calledClass]; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public static function getConstantValues($postFix=""){ |
|
| 27 | - if($postFix!=="") |
|
| 26 | + public static function getConstantValues($postFix="") { |
|
| 27 | + if ($postFix!=="") |
|
| 28 | 28 | return \array_values(self::getConstants()); |
| 29 | - else{ |
|
| 30 | - return \array_map(function ($elem) use ($postFix) {return $elem." ".$postFix;},\array_values(self::getConstants())); |
|
| 29 | + else { |
|
| 30 | + return \array_map(function($elem) use ($postFix) {return $elem." ".$postFix; },\array_values(self::getConstants())); |
|
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | |
| 14 | 14 | class HtmlSemSingleElement extends HtmlSingleElement { |
| 15 | 15 | use BaseTrait; |
| 16 | - public function __construct($identifier, $tagName="br",$baseClass="ui") { |
|
| 16 | + public function __construct($identifier, $tagName="br", $baseClass="ui") { |
|
| 17 | 17 | parent::__construct($identifier, $tagName); |
| 18 | 18 | $this->_baseClass=$baseClass; |
| 19 | 19 | $this->setClass($baseClass); |