@@ -22,9 +22,9 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function __construct($identifier, $elements=array()) { |
| 24 | 24 | parent::__construct($identifier, "form", "ui form"); |
| 25 | - $this->_states=[ State::ERROR,State::SUCCESS,State::WARNING,State::DISABLED ]; |
|
| 25 | + $this->_states=[State::ERROR, State::SUCCESS, State::WARNING, State::DISABLED]; |
|
| 26 | 26 | $this->setProperty("name", $this->identifier); |
| 27 | - $this->_fields=array (); |
|
| 27 | + $this->_fields=array(); |
|
| 28 | 28 | $this->addItems($elements); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -35,29 +35,29 @@ discard block |
||
| 35 | 35 | return $this->addItem($header); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function addDivider($caption=NULL){ |
|
| 39 | - return $this->addContent(new HtmlDivider("",$caption)); |
|
| 38 | + public function addDivider($caption=NULL) { |
|
| 39 | + return $this->addContent(new HtmlDivider("", $caption)); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function addFields($fields=NULL, $label=NULL) { |
| 43 | 43 | if (isset($fields)) { |
| 44 | 44 | if (!$fields instanceof HtmlFormFields) { |
| 45 | - if (\is_array($fields) === false) { |
|
| 45 | + if (\is_array($fields)===false) { |
|
| 46 | 46 | $fields=\func_get_args(); |
| 47 | 47 | $end=\end($fields); |
| 48 | 48 | if (\is_string($end)) { |
| 49 | 49 | $label=$end; |
| 50 | 50 | \array_pop($fields); |
| 51 | - } else |
|
| 51 | + }else |
|
| 52 | 52 | $label=NULL; |
| 53 | 53 | } |
| 54 | 54 | $this->_fields=\array_merge($this->_fields, $fields); |
| 55 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields); |
|
| 55 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields); |
|
| 56 | 56 | } |
| 57 | 57 | if (isset($label)) |
| 58 | 58 | $fields=new HtmlFormField("", $fields, $label); |
| 59 | - } else { |
|
| 60 | - $fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count()); |
|
| 59 | + }else { |
|
| 60 | + $fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count()); |
|
| 61 | 61 | } |
| 62 | 62 | $this->addItem($fields); |
| 63 | 63 | return $fields; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function addItem($item) { |
| 67 | 67 | $item=parent::addItem($item); |
| 68 | - if (\is_subclass_of($item, HtmlFormField::class) === true) { |
|
| 68 | + if (\is_subclass_of($item, HtmlFormField::class)===true) { |
|
| 69 | 69 | $this->_fields[]=$item; |
| 70 | 70 | } |
| 71 | 71 | return $item; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | public function getField($index) { |
| 75 | 75 | if (\is_string($index)) { |
| 76 | 76 | $field=$this->getElementById($index, $this->_fields); |
| 77 | - } else { |
|
| 77 | + }else { |
|
| 78 | 78 | $field=$this->_fields[$index]; |
| 79 | 79 | } |
| 80 | 80 | return $field; |
@@ -7,19 +7,19 @@ |
||
| 7 | 7 | |
| 8 | 8 | use Ajax\semantic\html\elements\HtmlIcon; |
| 9 | 9 | |
| 10 | -class HtmlPaginationMenu extends HtmlMenu{ |
|
| 10 | +class HtmlPaginationMenu extends HtmlMenu { |
|
| 11 | 11 | |
| 12 | - public function __construct( $identifier, $items=array() ){ |
|
| 13 | - parent::__construct( $identifier,$items); |
|
| 12 | + public function __construct($identifier, $items=array()) { |
|
| 13 | + parent::__construct($identifier, $items); |
|
| 14 | 14 | } |
| 15 | 15 | /** |
| 16 | 16 | * {@inheritDoc} |
| 17 | 17 | * @see \Ajax\common\html\BaseHtml::compile() |
| 18 | 18 | */ |
| 19 | - public function compile(JsUtils $js=NULL,$view=NULL){ |
|
| 19 | + public function compile(JsUtils $js=NULL, $view=NULL) { |
|
| 20 | 20 | $this->insertItem(new HtmlIcon("", "left chevron")); |
| 21 | 21 | $this->addItem(new HtmlIcon("", "right chevron")); |
| 22 | 22 | $this->asPagination(); |
| 23 | - return parent::compile($js,$view); |
|
| 23 | + return parent::compile($js, $view); |
|
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | \ No newline at end of file |
@@ -17,31 +17,31 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | protected $mClass="menu"; |
| 19 | 19 | protected $mTagName="div"; |
| 20 | - protected $items=array (); |
|
| 21 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
| 20 | + protected $items=array(); |
|
| 21 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
| 22 | 22 | protected $input; |
| 23 | 23 | |
| 24 | 24 | public function __construct($identifier, $value="", $items=array()) { |
| 25 | 25 | parent::__construct($identifier, "div"); |
| 26 | 26 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
| 27 | 27 | $this->setProperty("class", "ui dropdown"); |
| 28 | - $content=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
| 28 | + $content=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
| 29 | 29 | $content->setClass("text"); |
| 30 | 30 | $content->setContent($value); |
| 31 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
| 31 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
| 32 | 32 | $this->content=array($content); |
| 33 | 33 | $this->tagName="div"; |
| 34 | 34 | $this->addItems($items); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
| 38 | - $itemO=$this->beforeAddItem($item,$value,$image); |
|
| 37 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
| 38 | + $itemO=$this->beforeAddItem($item, $value, $image); |
|
| 39 | 39 | $this->items[]=$itemO; |
| 40 | 40 | return $itemO; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
| 44 | - $this->addIconP($icon,$before,$labeled); |
|
| 43 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 44 | + $this->addIconP($icon, $before, $labeled); |
|
| 45 | 45 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
| 46 | 46 | } |
| 47 | 47 | /** |
@@ -50,20 +50,20 @@ discard block |
||
| 50 | 50 | * @param number $position |
| 51 | 51 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 52 | 52 | */ |
| 53 | - public function insertItem($item,$position=0){ |
|
| 53 | + public function insertItem($item, $position=0) { |
|
| 54 | 54 | $itemO=$this->beforeAddItem($item); |
| 55 | - $start = array_slice($this->items, 0, $position); |
|
| 56 | - $end = array_slice($this->items, $position); |
|
| 57 | - $start[] = $item; |
|
| 55 | + $start=array_slice($this->items, 0, $position); |
|
| 56 | + $end=array_slice($this->items, $position); |
|
| 57 | + $start[]=$item; |
|
| 58 | 58 | $this->items=array_merge($start, $end); |
| 59 | 59 | return $itemO; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - protected function beforeAddItem($item,$value=NULL,$image=NULL){ |
|
| 62 | + protected function beforeAddItem($item, $value=NULL, $image=NULL) { |
|
| 63 | 63 | $itemO=$item; |
| 64 | - if(!$item instanceof HtmlDropdownItem){ |
|
| 65 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
|
| 66 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 64 | + if (!$item instanceof HtmlDropdownItem) { |
|
| 65 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image); |
|
| 66 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
| 67 | 67 | $this->addToProperty("class", "vertical"); |
| 68 | 68 | } |
| 69 | 69 | return $itemO; |
@@ -76,76 +76,76 @@ discard block |
||
| 76 | 76 | $this->addItem($function($object)); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public function addInput($name){ |
|
| 80 | - if(!isset($name)) |
|
| 79 | + public function addInput($name) { |
|
| 80 | + if (!isset($name)) |
|
| 81 | 81 | $name="input-".$this->identifier; |
| 82 | 82 | $this->setAction("activate"); |
| 83 | - $this->input=new HtmlInput($name,"hidden"); |
|
| 83 | + $this->input=new HtmlInput($name, "hidden"); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function addItems($items){ |
|
| 87 | - if(JArray::isAssociative($items)){ |
|
| 88 | - foreach ($items as $k=>$v){ |
|
| 86 | + public function addItems($items) { |
|
| 87 | + if (JArray::isAssociative($items)) { |
|
| 88 | + foreach ($items as $k=>$v) { |
|
| 89 | 89 | $this->addItem($v)->setData($k); |
| 90 | 90 | } |
| 91 | - }else{ |
|
| 92 | - foreach ($items as $item){ |
|
| 91 | + }else { |
|
| 92 | + foreach ($items as $item) { |
|
| 93 | 93 | $this->addItem($item); |
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - public function count(){ |
|
| 98 | + public function count() { |
|
| 99 | 99 | return \sizeof($this->items); |
| 100 | 100 | } |
| 101 | 101 | /** |
| 102 | 102 | * @param boolean $dropdown |
| 103 | 103 | */ |
| 104 | - public function asDropdown($dropdown){ |
|
| 105 | - if($dropdown===false){ |
|
| 104 | + public function asDropdown($dropdown) { |
|
| 105 | + if ($dropdown===false) { |
|
| 106 | 106 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 107 | 107 | $dropdown="menu"; |
| 108 | - }else{ |
|
| 108 | + }else { |
|
| 109 | 109 | $dropdown="dropdown"; |
| 110 | 110 | $this->mClass="menu"; |
| 111 | 111 | } |
| 112 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
| 112 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - public function setVertical(){ |
|
| 116 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
| 115 | + public function setVertical() { |
|
| 116 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function setSimple(){ |
|
| 120 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
| 119 | + public function setSimple() { |
|
| 120 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function asButton($floating=false){ |
|
| 124 | - if($floating) |
|
| 123 | + public function asButton($floating=false) { |
|
| 124 | + if ($floating) |
|
| 125 | 125 | $this->addToProperty("class", "floating"); |
| 126 | 126 | return $this->addToProperty("class", "button"); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
| 130 | - if(isset($name)) |
|
| 129 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 130 | + if (isset($name)) |
|
| 131 | 131 | $this->addInput($name); |
| 132 | - if($multiple) |
|
| 132 | + if ($multiple) |
|
| 133 | 133 | $this->addToProperty("class", "multiple"); |
| 134 | 134 | if ($selection) |
| 135 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 135 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
| 136 | 136 | return $this; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - public function asSearch($name=NULL,$multiple=false,$selection=false){ |
|
| 140 | - $this->asSelect($name,$multiple,$selection); |
|
| 139 | + public function asSearch($name=NULL, $multiple=false, $selection=false) { |
|
| 140 | + $this->asSelect($name, $multiple, $selection); |
|
| 141 | 141 | return $this->addToProperty("class", "search"); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - public function setSelect($name=NULL,$multiple=false){ |
|
| 145 | - if(!isset($name)) |
|
| 144 | + public function setSelect($name=NULL, $multiple=false) { |
|
| 145 | + if (!isset($name)) |
|
| 146 | 146 | $name="select-".$this->identifier; |
| 147 | 147 | $this->input=null; |
| 148 | - if($multiple){ |
|
| 148 | + if ($multiple) { |
|
| 149 | 149 | $this->setProperty("multiple", true); |
| 150 | 150 | $this->addToProperty("class", "multiple"); |
| 151 | 151 | } |
@@ -153,32 +153,32 @@ discard block |
||
| 153 | 153 | $this->tagName="select"; |
| 154 | 154 | $this->setProperty("name", $name); |
| 155 | 155 | $this->content=null; |
| 156 | - foreach ($this->items as $item){ |
|
| 156 | + foreach ($this->items as $item) { |
|
| 157 | 157 | $item->asOption(); |
| 158 | 158 | } |
| 159 | 159 | return $this; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - public function asSubmenu($pointing=NULL){ |
|
| 162 | + public function asSubmenu($pointing=NULL) { |
|
| 163 | 163 | $this->setClass("ui dropdown link item"); |
| 164 | - if(isset($pointing)){ |
|
| 164 | + if (isset($pointing)) { |
|
| 165 | 165 | $this->setPointing($pointing); |
| 166 | 166 | } |
| 167 | 167 | return $this; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - public function setPointing($value=Direction::NONE){ |
|
| 171 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
| 170 | + public function setPointing($value=Direction::NONE) { |
|
| 171 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - public function setValue($value){ |
|
| 175 | - if(isset($this->input)){ |
|
| 174 | + public function setValue($value) { |
|
| 175 | + if (isset($this->input)) { |
|
| 176 | 176 | $this->input->setProperty("value", $value); |
| 177 | - }else{ |
|
| 177 | + }else { |
|
| 178 | 178 | $this->setProperty("value", $value); |
| 179 | 179 | } |
| 180 | 180 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 181 | - if(isset($textElement)) |
|
| 181 | + if (isset($textElement)) |
|
| 182 | 182 | $textElement->setContent($value); |
| 183 | 183 | return $this; |
| 184 | 184 | } |
@@ -188,23 +188,23 @@ discard block |
||
| 188 | 188 | * @see BaseHtml::run() |
| 189 | 189 | */ |
| 190 | 190 | public function run(JsUtils $js) { |
| 191 | - if($this->propertyContains("class", "simple")===false){ |
|
| 192 | - if(isset($this->_bsComponent)===false) |
|
| 193 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 191 | + if ($this->propertyContains("class", "simple")===false) { |
|
| 192 | + if (isset($this->_bsComponent)===false) |
|
| 193 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
| 194 | 194 | $this->addEventsOnRun($js); |
| 195 | 195 | return $this->_bsComponent; |
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - public function setCompact(){ |
|
| 199 | + public function setCompact() { |
|
| 200 | 200 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - public function setAction($action){ |
|
| 203 | + public function setAction($action) { |
|
| 204 | 204 | $this->_params["action"]=$action; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - public function setFullTextSearch($value){ |
|
| 207 | + public function setFullTextSearch($value) { |
|
| 208 | 208 | $this->_params["fullTextSearch"]=$value; |
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | \ No newline at end of file |
@@ -17,21 +17,21 @@ discard block |
||
| 17 | 17 | * jQuery Class |
| 18 | 18 | */ |
| 19 | 19 | class Jquery { |
| 20 | - use JqueryEventsTrait,JqueryAjaxTrait,JqueryActionsTrait; |
|
| 20 | + use JqueryEventsTrait, JqueryAjaxTrait, JqueryActionsTrait; |
|
| 21 | 21 | protected $_ui; |
| 22 | 22 | protected $_bootstrap; |
| 23 | 23 | protected $_semantic; |
| 24 | 24 | protected $libraryFile; |
| 25 | 25 | protected $_javascript_folder='js'; |
| 26 | - protected $jquery_code_for_load=array (); |
|
| 27 | - protected $jquery_code_for_compile=array (); |
|
| 26 | + protected $jquery_code_for_load=array(); |
|
| 27 | + protected $jquery_code_for_compile=array(); |
|
| 28 | 28 | protected $jquery_corner_active=FALSE; |
| 29 | 29 | protected $jquery_table_sorter_active=FALSE; |
| 30 | 30 | protected $jquery_table_sorter_pager_active=FALSE; |
| 31 | 31 | protected $jsUtils; |
| 32 | 32 | |
| 33 | - protected $jquery_events=array ( |
|
| 34 | - "bind","blur","change","click","dblclick","delegate","die","error","focus","focusin","focusout","hover","keydown","keypress","keyup","live","load","mousedown","mousseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","off","on","one","ready","resize","scroll","select","submit","toggle","trigger","triggerHandler","undind","undelegate","unload" |
|
| 33 | + protected $jquery_events=array( |
|
| 34 | + "bind", "blur", "change", "click", "dblclick", "delegate", "die", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "live", "load", "mousedown", "mousseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "off", "on", "one", "ready", "resize", "scroll", "select", "submit", "toggle", "trigger", "triggerHandler", "undind", "undelegate", "unload" |
|
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | 37 | public function ui($ui=NULL) { |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | return $this->_semantic; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function __construct($params,$jsUtils) { |
|
| 58 | + public function __construct($params, $jsUtils) { |
|
| 59 | 59 | $this->params=array(); |
| 60 | - foreach ( $params as $key => $val ) { |
|
| 60 | + foreach ($params as $key => $val) { |
|
| 61 | 61 | $this->params[$key]=$params[$key]; |
| 62 | 62 | } |
| 63 | 63 | $this->jsUtils=$jsUtils; |
@@ -125,12 +125,12 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function _output($array_js='') { |
| 127 | 127 | if (!is_array($array_js)) { |
| 128 | - $array_js=array ( |
|
| 128 | + $array_js=array( |
|
| 129 | 129 | $array_js |
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - foreach ( $array_js as $js ) { |
|
| 133 | + foreach ($array_js as $js) { |
|
| 134 | 134 | $this->jquery_code_for_compile[]="\t$js\n"; |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -142,12 +142,12 @@ discard block |
||
| 142 | 142 | * @param string $param |
| 143 | 143 | * @param boolean $immediatly delayed if false |
| 144 | 144 | */ |
| 145 | - public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) { |
|
| 145 | + public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) { |
|
| 146 | 146 | $element=$this->_prep_element($element); |
| 147 | 147 | if (isset($param)) { |
| 148 | 148 | $param=$this->_prep_value($param); |
| 149 | 149 | $str="$({$element}).{$jQueryCall}({$param});"; |
| 150 | - } else |
|
| 150 | + }else |
|
| 151 | 151 | $str="$({$element}).{$jQueryCall}();"; |
| 152 | 152 | if ($immediatly) |
| 153 | 153 | $this->jquery_code_for_compile[]=$str; |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @param boolean $immediatly delayed if false |
| 162 | 162 | * @return string |
| 163 | 163 | */ |
| 164 | - public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) { |
|
| 164 | + public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) { |
|
| 165 | 165 | $to=$this->_prep_element($to); |
| 166 | 166 | $element=$this->_prep_element($element); |
| 167 | 167 | $str="$({$to}).{$jQueryCall}({$element});"; |
@@ -179,12 +179,12 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public function sortable($element, $options=array()) { |
| 181 | 181 | if (count($options)>0) { |
| 182 | - $sort_options=array (); |
|
| 183 | - foreach ( $options as $k => $v ) { |
|
| 182 | + $sort_options=array(); |
|
| 183 | + foreach ($options as $k => $v) { |
|
| 184 | 184 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
| 185 | 185 | } |
| 186 | 186 | $sort_options=implode(",", $sort_options); |
| 187 | - } else { |
|
| 187 | + }else { |
|
| 188 | 188 | $sort_options=''; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * @param boolean $stopPropagation Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. |
| 213 | 213 | * @return string |
| 214 | 214 | */ |
| 215 | - public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true) { |
|
| 215 | + public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true) { |
|
| 216 | 216 | if (is_array($js)) { |
| 217 | 217 | $js=implode("\n\t\t", $js); |
| 218 | 218 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
| 227 | 227 | else |
| 228 | 228 | $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
| 229 | - if($immediatly) |
|
| 229 | + if ($immediatly) |
|
| 230 | 230 | $this->jquery_code_for_compile[]=$event; |
| 231 | 231 | return $event; |
| 232 | 232 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | // External references |
| 268 | 268 | $external_scripts=implode('', $this->jquery_code_for_load); |
| 269 | - extract(array ( |
|
| 269 | + extract(array( |
|
| 270 | 270 | 'library_src' => $external_scripts |
| 271 | 271 | )); |
| 272 | 272 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $script.='});'; |
| 282 | 282 | |
| 283 | 283 | $this->jquery_code_for_compile=array(); |
| 284 | - if($this->params["debug"]==false){ |
|
| 284 | + if ($this->params["debug"]==false) { |
|
| 285 | 285 | $script=$this->minify($script); |
| 286 | 286 | } |
| 287 | 287 | $output=($script_tags===FALSE) ? $script : $this->inline($script); |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | * @return void |
| 302 | 302 | */ |
| 303 | 303 | public function _clear_compile() { |
| 304 | - $this->jquery_code_for_compile=array (); |
|
| 304 | + $this->jquery_code_for_compile=array(); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
@@ -310,12 +310,12 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | public function _document_ready($js) { |
| 312 | 312 | if (!is_array($js)) { |
| 313 | - $js=array ( |
|
| 313 | + $js=array( |
|
| 314 | 314 | $js |
| 315 | 315 | ); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - foreach ( $js as $script ) { |
|
| 318 | + foreach ($js as $script) { |
|
| 319 | 319 | $this->jquery_code_for_compile[]=$script; |
| 320 | 320 | } |
| 321 | 321 | } |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | * @return string |
| 330 | 330 | */ |
| 331 | 331 | public function _prep_element($element) { |
| 332 | - if (strrpos($element, 'this')===false&&strrpos($element, 'event')===false&&strrpos($element, 'self')===false) { |
|
| 332 | + if (strrpos($element, 'this')===false && strrpos($element, 'event')===false && strrpos($element, 'self')===false) { |
|
| 333 | 333 | $element='"'.addslashes($element).'"'; |
| 334 | 334 | } |
| 335 | 335 | return $element; |
@@ -347,14 +347,14 @@ discard block |
||
| 347 | 347 | if (is_array($value)) { |
| 348 | 348 | $value=implode(",", $value); |
| 349 | 349 | } |
| 350 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false&&strrpos($value, 'self')===false) { |
|
| 350 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false && strrpos($value, 'self')===false) { |
|
| 351 | 351 | $value='"'.$value.'"'; |
| 352 | 352 | } |
| 353 | 353 | return $value; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | private function minify($input) { |
| 357 | - if(trim($input) === "") return $input; |
|
| 357 | + if (trim($input)==="") return $input; |
|
| 358 | 358 | return preg_replace( |
| 359 | 359 | array( |
| 360 | 360 | // Remove comment(s) |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | /** |
| 23 | 23 | * JsUtils Class : Service to be injected |
| 24 | 24 | */ |
| 25 | -abstract class JsUtils{ |
|
| 26 | - use JsUtilsEventsTrait,JsUtilsActionsTrait,JsUtilsAjaxTrait; |
|
| 25 | +abstract class JsUtils { |
|
| 26 | + use JsUtilsEventsTrait, JsUtilsActionsTrait, JsUtilsAjaxTrait; |
|
| 27 | 27 | |
| 28 | 28 | protected $js; |
| 29 | 29 | protected $cdns; |
@@ -50,19 +50,19 @@ discard block |
||
| 50 | 50 | protected $config; |
| 51 | 51 | |
| 52 | 52 | protected function _setDi($di) { |
| 53 | - if ($this->js!=null&&$di!=null) |
|
| 53 | + if ($this->js!=null && $di!=null) |
|
| 54 | 54 | $this->js->setDi($di); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public abstract function getUrl($url); |
| 58 | - public abstract function addViewElement($identifier,$content,$view); |
|
| 58 | + public abstract function addViewElement($identifier, $content, $view); |
|
| 59 | 59 | /** |
| 60 | 60 | * render the content of $controller::$action and set the response to the modal content |
| 61 | 61 | * @param Controller $initialController |
| 62 | 62 | * @param string $controller a Phalcon controller |
| 63 | 63 | * @param string $action a Phalcon action |
| 64 | 64 | */ |
| 65 | - public abstract function forward($initialController,$controller,$action); |
|
| 65 | + public abstract function forward($initialController, $controller, $action); |
|
| 66 | 66 | /** |
| 67 | 67 | * render the content of an existing view : $controller/$action and set the response to the modal content |
| 68 | 68 | * @param View $view |
@@ -162,18 +162,18 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | public function __construct($params=array()) { |
| 165 | - $defaults=array ( |
|
| 165 | + $defaults=array( |
|
| 166 | 166 | 'driver' => 'Jquery', |
| 167 | 167 | 'debug' => true |
| 168 | 168 | ); |
| 169 | - foreach ( $defaults as $key => $val ) { |
|
| 170 | - if (isset($params[$key])&&$params[$key]!=="") { |
|
| 169 | + foreach ($defaults as $key => $val) { |
|
| 170 | + if (isset($params[$key]) && $params[$key]!=="") { |
|
| 171 | 171 | $defaults[$key]=$params[$key]; |
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | extract($defaults); |
| 175 | - $this->js=new Jquery($defaults,$this); |
|
| 176 | - $this->cdns=array (); |
|
| 175 | + $this->js=new Jquery($defaults, $this); |
|
| 176 | + $this->cdns=array(); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | public function addToCompile($jsScript) { |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public function compile($view=NULL, $view_var='script_foot', $script_tags=TRUE) { |
| 212 | 212 | $bs=$this->_bootstrap; |
| 213 | - if (isset($bs)&&isset($view)) { |
|
| 213 | + if (isset($bs) && isset($view)) { |
|
| 214 | 214 | $bs->compileHtml($this, $view); |
| 215 | 215 | } |
| 216 | 216 | $sem=$this->_semantic; |
| 217 | - if (isset($sem)&&isset($view)) { |
|
| 217 | + if (isset($sem) && isset($view)) { |
|
| 218 | 218 | $sem->compileHtml($this, $view); |
| 219 | 219 | } |
| 220 | 220 | return $this->js->_compile($view, $view_var, $script_tags); |
@@ -281,27 +281,27 @@ discard block |
||
| 281 | 281 | $json_result=$result->result_array(); |
| 282 | 282 | } elseif (is_array($result)) { |
| 283 | 283 | $json_result=$result; |
| 284 | - } else { |
|
| 284 | + }else { |
|
| 285 | 285 | return $this->_prep_args($result); |
| 286 | 286 | } |
| 287 | - } else { |
|
| 287 | + }else { |
|
| 288 | 288 | return 'null'; |
| 289 | 289 | } |
| 290 | 290 | return $this->_create_json($json_result, $match_array_type); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | private function _create_json($json_result, $match_array_type) { |
| 294 | - $json=array (); |
|
| 294 | + $json=array(); |
|
| 295 | 295 | $_is_assoc=TRUE; |
| 296 | - if (!is_array($json_result)&&empty($json_result)) { |
|
| 296 | + if (!is_array($json_result) && empty($json_result)) { |
|
| 297 | 297 | show_error("Generate JSON Failed - Illegal key, value pair."); |
| 298 | 298 | } elseif ($match_array_type) { |
| 299 | 299 | $_is_assoc=$this->_is_associative_array($json_result); |
| 300 | 300 | } |
| 301 | - foreach ( $json_result as $k => $v ) { |
|
| 301 | + foreach ($json_result as $k => $v) { |
|
| 302 | 302 | if ($_is_assoc) { |
| 303 | 303 | $json[]=$this->_prep_args($k, TRUE).':'.$this->generate_json($v, $match_array_type); |
| 304 | - } else { |
|
| 304 | + }else { |
|
| 305 | 305 | $json[]=$this->generate_json($v, $match_array_type); |
| 306 | 306 | } |
| 307 | 307 | } |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | * @return type |
| 317 | 317 | */ |
| 318 | 318 | public function _is_associative_array($arr) { |
| 319 | - foreach ( array_keys($arr) as $key => $val ) { |
|
| 319 | + foreach (array_keys($arr) as $key => $val) { |
|
| 320 | 320 | if ($key!==$val) { |
| 321 | 321 | return TRUE; |
| 322 | 322 | } |
@@ -335,11 +335,11 @@ discard block |
||
| 335 | 335 | return 'null'; |
| 336 | 336 | } elseif (is_bool($result)) { |
| 337 | 337 | return ($result===TRUE) ? 'true' : 'false'; |
| 338 | - } elseif (is_string($result)||$is_key) { |
|
| 339 | - return '"'.str_replace(array ( |
|
| 340 | - '\\',"\t","\n","\r",'"','/' |
|
| 341 | - ), array ( |
|
| 342 | - '\\\\','\\t','\\n',"\\r",'\"','\/' |
|
| 338 | + } elseif (is_string($result) || $is_key) { |
|
| 339 | + return '"'.str_replace(array( |
|
| 340 | + '\\', "\t", "\n", "\r", '"', '/' |
|
| 341 | + ), array( |
|
| 342 | + '\\\\', '\\t', '\\n', "\\r", '\"', '\/' |
|
| 343 | 343 | ), $result).'"'; |
| 344 | 344 | } elseif (is_scalar($result)) { |
| 345 | 345 | return $result; |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | public function setCDNs($cdns) { |
| 354 | 354 | if (is_array($cdns)===false) { |
| 355 | - $cdns=array ( |
|
| 355 | + $cdns=array( |
|
| 356 | 356 | $cdns |
| 357 | 357 | ); |
| 358 | 358 | } |
@@ -364,9 +364,9 @@ discard block |
||
| 364 | 364 | $hasJQueryUI=false; |
| 365 | 365 | $hasBootstrap=false; |
| 366 | 366 | $hasSemantic=false; |
| 367 | - $result=array (); |
|
| 368 | - foreach ( $this->cdns as $cdn ) { |
|
| 369 | - switch(get_class($cdn)) { |
|
| 367 | + $result=array(); |
|
| 368 | + foreach ($this->cdns as $cdn) { |
|
| 369 | + switch (get_class($cdn)) { |
|
| 370 | 370 | case "Ajax\lib\CDNJQuery": |
| 371 | 371 | $hasJQuery=true; |
| 372 | 372 | $result[0]=$cdn; |
@@ -376,11 +376,11 @@ discard block |
||
| 376 | 376 | $result[1]=$cdn; |
| 377 | 377 | break; |
| 378 | 378 | case "Ajax\lib\CDNCoreCss": |
| 379 | - if($cdn->getFramework()==="Bootstrap") |
|
| 379 | + if ($cdn->getFramework()==="Bootstrap") |
|
| 380 | 380 | $hasBootstrap=true; |
| 381 | - elseif($cdn->getFramework()==="Semantic") |
|
| 381 | + elseif ($cdn->getFramework()==="Semantic") |
|
| 382 | 382 | $hasSemantic=true; |
| 383 | - if($hasSemantic || $hasBootstrap) |
|
| 383 | + if ($hasSemantic || $hasBootstrap) |
|
| 384 | 384 | $result[2]=$cdn; |
| 385 | 385 | break; |
| 386 | 386 | } |
@@ -388,14 +388,14 @@ discard block |
||
| 388 | 388 | if ($hasJQuery===false) { |
| 389 | 389 | $result[0]=new CDNJQuery("x"); |
| 390 | 390 | } |
| 391 | - if ($hasJQueryUI===false&&isset($this->_ui)) { |
|
| 391 | + if ($hasJQueryUI===false && isset($this->_ui)) { |
|
| 392 | 392 | $result[1]=new CDNGuiGen("x", $template); |
| 393 | 393 | } |
| 394 | - if ($hasBootstrap===false&&isset($this->_bootstrap)) { |
|
| 395 | - $result[2]=new CDNCoreCss("Bootstrap","x"); |
|
| 394 | + if ($hasBootstrap===false && isset($this->_bootstrap)) { |
|
| 395 | + $result[2]=new CDNCoreCss("Bootstrap", "x"); |
|
| 396 | 396 | } |
| 397 | - if ($hasSemantic===false&&isset($this->_semantic)) { |
|
| 398 | - $result[2]=new CDNCoreCss("Semantic","x"); |
|
| 397 | + if ($hasSemantic===false && isset($this->_semantic)) { |
|
| 398 | + $result[2]=new CDNCoreCss("Semantic", "x"); |
|
| 399 | 399 | } |
| 400 | 400 | ksort($result); |
| 401 | 401 | return implode("\n", $result); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | use Phalcon\Mvc\View; |
| 8 | 8 | use Phalcon\Mvc\Controller; |
| 9 | 9 | |
| 10 | -class JsUtils extends \Ajax\JsUtils implements InjectionAwareInterface{ |
|
| 10 | +class JsUtils extends \Ajax\JsUtils implements InjectionAwareInterface { |
|
| 11 | 11 | protected $_di; |
| 12 | 12 | public function setDi(DiInterface $di) { |
| 13 | 13 | $this->_di=$di; |
@@ -18,45 +18,45 @@ discard block |
||
| 18 | 18 | return $this->_di; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function getUrl($url){ |
|
| 21 | + public function getUrl($url) { |
|
| 22 | 22 | return $this->_di->get("url")->get($url); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function addViewElement($identifier,$content,$view){ |
|
| 25 | + public function addViewElement($identifier, $content, $view) { |
|
| 26 | 26 | $controls=$view->getVar("q"); |
| 27 | - if (isset($controls) === false) { |
|
| 28 | - $controls=array (); |
|
| 27 | + if (isset($controls)===false) { |
|
| 28 | + $controls=array(); |
|
| 29 | 29 | } |
| 30 | 30 | $controls[$identifier]=$content; |
| 31 | 31 | $view->setVar("q", $controls); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function forward($initialController,$controller,$action){ |
|
| 35 | - $dispatcher = $initialController->dispatcher; |
|
| 34 | + public function forward($initialController, $controller, $action) { |
|
| 35 | + $dispatcher=$initialController->dispatcher; |
|
| 36 | 36 | $dispatcher->setControllerName($controller); |
| 37 | 37 | $dispatcher->setActionName($action); |
| 38 | 38 | $dispatcher->dispatch(); |
| 39 | - $template=$initialController->view->getRender($dispatcher->getControllerName(), $dispatcher->getActionName(),$dispatcher->getParams(), function ($view) { |
|
| 39 | + $template=$initialController->view->getRender($dispatcher->getControllerName(), $dispatcher->getActionName(), $dispatcher->getParams(), function($view) { |
|
| 40 | 40 | $view->setRenderLevel(View::LEVEL_ACTION_VIEW); |
| 41 | 41 | }); |
| 42 | 42 | return $template; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public function renderContent($view, $controller, $action, $params=NULL) { |
| 46 | - $template=$view->getRender($controller, $action, $params, function ($view) { |
|
| 46 | + $template=$view->getRender($controller, $action, $params, function($view) { |
|
| 47 | 47 | $view->setRenderLevel(View::LEVEL_ACTION_VIEW); |
| 48 | 48 | }); |
| 49 | 49 | return $template; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function fromDispatcher($dispatcher){ |
|
| 52 | + public function fromDispatcher($dispatcher) { |
|
| 53 | 53 | $params=$dispatcher->getParams(); |
| 54 | 54 | $action=$dispatcher->getActionName(); |
| 55 | 55 | $items=array($dispatcher->getControllerName()); |
| 56 | - if(\sizeof($params)>0 || \strtolower($action)!="index" ){ |
|
| 56 | + if (\sizeof($params)>0 || \strtolower($action)!="index") { |
|
| 57 | 57 | $items[]=$action; |
| 58 | - foreach ($params as $p){ |
|
| 59 | - if(\is_object($p)===false) |
|
| 58 | + foreach ($params as $p) { |
|
| 59 | + if (\is_object($p)===false) |
|
| 60 | 60 | $items[]=$p; |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -45,70 +45,70 @@ discard block |
||
| 45 | 45 | /** |
| 46 | 46 | * @param string $identifier |
| 47 | 47 | */ |
| 48 | - public function __construct($identifier,$from=1,$to=1,$active=NULL,$countVisible=NULL){ |
|
| 49 | - parent::__construct($identifier,"ul"); |
|
| 48 | + public function __construct($identifier, $from=1, $to=1, $active=NULL, $countVisible=NULL) { |
|
| 49 | + parent::__construct($identifier, "ul"); |
|
| 50 | 50 | $this->setProperty("class", "pagination"); |
| 51 | 51 | $this->active=$active; |
| 52 | 52 | $this->from=$from; |
| 53 | 53 | $this->to=$to; |
| 54 | 54 | $this->urlMask="%page%"; |
| 55 | - if(!isset($countVisible)) |
|
| 55 | + if (!isset($countVisible)) |
|
| 56 | 56 | $this->countVisible=$to-$from+1; |
| 57 | 57 | else |
| 58 | 58 | $this->countVisible=$countVisible; |
| 59 | 59 | $this->createContent(); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - private function createElement($num,$content,$disabled=false,$current=false){ |
|
| 62 | + private function createElement($num, $content, $disabled=false, $current=false) { |
|
| 63 | 63 | $count=sizeof($this->content)+1; |
| 64 | - $elem=new HtmlBsDoubleElement("li-".$this->identifier."-".$count,"li"); |
|
| 65 | - if($disabled){ |
|
| 64 | + $elem=new HtmlBsDoubleElement("li-".$this->identifier."-".$count, "li"); |
|
| 65 | + if ($disabled) { |
|
| 66 | 66 | $elem->setProperty("class", "disabled"); |
| 67 | 67 | } |
| 68 | - if($current){ |
|
| 68 | + if ($current) { |
|
| 69 | 69 | $content.="<span class='sr-only'>(current)</span>"; |
| 70 | 70 | $elem->setProperty("class", "active"); |
| 71 | 71 | } |
| 72 | - if(!$disabled){ |
|
| 72 | + if (!$disabled) { |
|
| 73 | 73 | $url=$this->getUrl($num); |
| 74 | - $href=new HtmlLink("a-".$this->identifier."-".$count,$url,$content); |
|
| 74 | + $href=new HtmlLink("a-".$this->identifier."-".$count, $url, $content); |
|
| 75 | 75 | $href->setProperty($this->attr, $url); |
| 76 | 76 | $elem->setContent($href); |
| 77 | - }else{ |
|
| 77 | + }else { |
|
| 78 | 78 | $elem->setContent($content); |
| 79 | 79 | } |
| 80 | 80 | $this->content[]=$elem; |
| 81 | 81 | return $this; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - protected function createContent(){ |
|
| 84 | + protected function createContent() { |
|
| 85 | 85 | $this->content=array(); |
| 86 | - $this->createElement($this->active-1,"<span aria-hidden='true'>«</span>",$this->active===1); |
|
| 86 | + $this->createElement($this->active-1, "<span aria-hidden='true'>«</span>", $this->active===1); |
|
| 87 | 87 | $start=$this->getStart(); |
| 88 | - $end=min($start+$this->countVisible-1,$this->to); |
|
| 89 | - for($index=$start;$index<=$end;$index++){ |
|
| 90 | - $this->createElement($index,$index,false,$index===$this->active); |
|
| 88 | + $end=min($start+$this->countVisible-1, $this->to); |
|
| 89 | + for ($index=$start; $index<=$end; $index++) { |
|
| 90 | + $this->createElement($index, $index, false, $index===$this->active); |
|
| 91 | 91 | } |
| 92 | - $this->createElement($this->active+1,"<span aria-hidden='true'>»</span>",$this->active===$this->to); |
|
| 92 | + $this->createElement($this->active+1, "<span aria-hidden='true'>»</span>", $this->active===$this->to); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - protected function half(){ |
|
| 96 | - return (int)($this->countVisible/2); |
|
| 95 | + protected function half() { |
|
| 96 | + return (int) ($this->countVisible / 2); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - protected function getStart(){ |
|
| 99 | + protected function getStart() { |
|
| 100 | 100 | $result=1; |
| 101 | - if($this->countVisible!==$this->to-$this->from+1){ |
|
| 102 | - $result=max($this->active-$this->half(),$result); |
|
| 101 | + if ($this->countVisible!==$this->to-$this->from+1) { |
|
| 102 | + $result=max($this->active-$this->half(), $result); |
|
| 103 | 103 | } |
| 104 | 104 | return $result; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public function _addEvent($event, $jsCode) { |
| 108 | - foreach ($this->content as $li){ |
|
| 108 | + foreach ($this->content as $li) { |
|
| 109 | 109 | $content=$li->getContent(); |
| 110 | - if($content instanceof BaseHtml) |
|
| 111 | - $content->_addEvent($event,$jsCode); |
|
| 110 | + if ($content instanceof BaseHtml) |
|
| 111 | + $content->_addEvent($event, $jsCode); |
|
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | /** |
@@ -117,14 +117,14 @@ discard block |
||
| 117 | 117 | * @param Dispatcher $dispatcher the request dispatcher |
| 118 | 118 | * @return \Ajax\bootstrap\html\HtmlPagination |
| 119 | 119 | */ |
| 120 | - public function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0){ |
|
| 120 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
| 121 | 121 | $items=$js->fromDispatcher($dispatcher); |
| 122 | 122 | $url=implode("/", $items); |
| 123 | - if($this->urlMask==="%page%"){ |
|
| 123 | + if ($this->urlMask==="%page%") { |
|
| 124 | 124 | $this->urlMask=preg_replace("/[0-9]/", "%page%", $url); |
| 125 | 125 | } |
| 126 | - for($index=$this->from;$index<=$this->to;$index++){ |
|
| 127 | - if($this->getUrl($index)==$url){ |
|
| 126 | + for ($index=$this->from; $index<=$this->to; $index++) { |
|
| 127 | + if ($this->getUrl($index)==$url) { |
|
| 128 | 128 | $this->setActive($index); |
| 129 | 129 | break; |
| 130 | 130 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | return $this; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - public function getUrl($index){ |
|
| 135 | + public function getUrl($index) { |
|
| 136 | 136 | return str_ireplace("%page%", $index, $this->urlMask); |
| 137 | 137 | } |
| 138 | 138 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | if (is_int($size)) { |
| 147 | 147 | return $this->addToPropertyUnique("class", CssRef::sizes("pagination")[$size], CssRef::sizes("pagination")); |
| 148 | 148 | } |
| 149 | - if(!PhalconUtils::startsWith($size, "pagination-") && $size!=="") |
|
| 149 | + if (!PhalconUtils::startsWith($size, "pagination-") && $size!=="") |
|
| 150 | 150 | $size="pagination-".$size; |
| 151 | 151 | return $this->addToPropertyCtrl("class", $size, CssRef::sizes("pagination")); |
| 152 | 152 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | return $this->from; |
| 156 | 156 | } |
| 157 | 157 | public function setFrom($from) { |
| 158 | - $this->from = $from; |
|
| 158 | + $this->from=$from; |
|
| 159 | 159 | $this->createContent(); |
| 160 | 160 | return $this; |
| 161 | 161 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | return $this->to; |
| 164 | 164 | } |
| 165 | 165 | public function setTo($to) { |
| 166 | - $this->to = $to; |
|
| 166 | + $this->to=$to; |
|
| 167 | 167 | $this->createContent(); |
| 168 | 168 | return $this; |
| 169 | 169 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | return $this->active; |
| 172 | 172 | } |
| 173 | 173 | public function setActive($active) { |
| 174 | - $this->active = $active; |
|
| 174 | + $this->active=$active; |
|
| 175 | 175 | $this->createContent(); |
| 176 | 176 | return $this; |
| 177 | 177 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | return $this->urlMask; |
| 180 | 180 | } |
| 181 | 181 | public function setUrlMask($urlMask) { |
| 182 | - $this->urlMask = $urlMask; |
|
| 182 | + $this->urlMask=$urlMask; |
|
| 183 | 183 | $this->createContent(); |
| 184 | 184 | return $this; |
| 185 | 185 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | return $this->countVisible; |
| 188 | 188 | } |
| 189 | 189 | public function setCountVisible($countVisible) { |
| 190 | - $this->countVisible = $countVisible; |
|
| 190 | + $this->countVisible=$countVisible; |
|
| 191 | 191 | $this->createContent(); |
| 192 | 192 | return $this; |
| 193 | 193 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | class HtmlModal extends BaseHtml { |
| 17 | 17 | protected $title="Titre de ma boîte"; |
| 18 | 18 | protected $content=""; |
| 19 | - protected $buttons=array (); |
|
| 19 | + protected $buttons=array(); |
|
| 20 | 20 | protected $showOnStartup=false; |
| 21 | 21 | protected $draggable=false; |
| 22 | 22 | protected $validCondition=NULL; |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | public function __construct($identifier, $title="", $content="", $buttonCaptions=array()) { |
| 30 | 30 | parent::__construct($identifier); |
| 31 | 31 | $this->_template=include 'templates/tplModal.php'; |
| 32 | - $this->buttons=array (); |
|
| 32 | + $this->buttons=array(); |
|
| 33 | 33 | $this->title=$title; |
| 34 | 34 | $this->content=$content; |
| 35 | - foreach ( $buttonCaptions as $button ) { |
|
| 35 | + foreach ($buttonCaptions as $button) { |
|
| 36 | 36 | $this->addButton($button); |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @param string $value |
| 68 | 68 | * @return HtmlButton |
| 69 | 69 | */ |
| 70 | - public function addOkayButton($value="Okay",$jsCode="") { |
|
| 70 | + public function addOkayButton($value="Okay", $jsCode="") { |
|
| 71 | 71 | $btn=$this->addButton($value, "btn-primary"); |
| 72 | 72 | $btn->onClick("if(".$this->getValidCondition()."){ ".$jsCode."$('#".$this->identifier."').modal('hide');}"); |
| 73 | 73 | return $btn; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public function getValidCondition() { |
| 85 | 85 | if ($this->validCondition==NULL) { |
| 86 | 86 | return $this->getDefaultValidCondition(); |
| 87 | - } else { |
|
| 87 | + }else { |
|
| 88 | 88 | return $this->validCondition; |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | * @param string $action a Phalcon action |
| 118 | 118 | * @param $params The parameters to pass to the view |
| 119 | 119 | */ |
| 120 | - public function renderContent($initialController,$view, $controller, $action, $params=NULL) { |
|
| 121 | - $this->content=$initialController->jquery->renderContent($view, $controller, $action,$params); |
|
| 120 | + public function renderContent($initialController, $view, $controller, $action, $params=NULL) { |
|
| 121 | + $this->content=$initialController->jquery->renderContent($view, $controller, $action, $params); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @param string $controller a Phalcon controller |
| 128 | 128 | * @param string $action a Phalcon action |
| 129 | 129 | */ |
| 130 | - public function forward($initialController,$controller,$action){ |
|
| 130 | + public function forward($initialController, $controller, $action) { |
|
| 131 | 131 | $this->content=$initialController->jquery->forward($initialController, $controller, $action); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -136,10 +136,10 @@ discard block |
||
| 136 | 136 | * @see BaseHtml::run() |
| 137 | 137 | */ |
| 138 | 138 | public function run(JsUtils $js) { |
| 139 | - if($this->content instanceof BaseHtml){ |
|
| 139 | + if ($this->content instanceof BaseHtml) { |
|
| 140 | 140 | $this->content->run($js); |
| 141 | 141 | } |
| 142 | - $this->_bsComponent=$js->bootstrap()->modal("#".$this->identifier, array ( |
|
| 142 | + $this->_bsComponent=$js->bootstrap()->modal("#".$this->identifier, array( |
|
| 143 | 143 | "show" => $this->showOnStartup |
| 144 | 144 | )); |
| 145 | 145 | if ($this->draggable) |
@@ -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(JsUtils $js,$dispatcher,$startIndex=0); |
|
| 81 | + public abstract function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0); |
|
| 82 | 82 | |
| 83 | 83 | } |
| 84 | 84 | \ No newline at end of file |