@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | class JArray { |
| 6 | 6 | |
| 7 | 7 | public static function isAssociative($array) { |
| 8 | - return (array_values($array) !== $array); |
|
| 8 | + return (array_values($array)!==$array); |
|
| 9 | 9 | // return (array_keys($array)!==range(0, count($array)-1)); |
| 10 | 10 | } |
| 11 | 11 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | return $array[$key]; |
| 15 | 15 | } |
| 16 | 16 | $values=array_values($array); |
| 17 | - if ($pos < sizeof($values)) |
|
| 17 | + if ($pos<sizeof($values)) |
|
| 18 | 18 | return $values[$pos]; |
| 19 | 19 | } |
| 20 | 20 | |
@@ -22,12 +22,12 @@ discard block |
||
| 22 | 22 | $result=NULL; |
| 23 | 23 | if (array_key_exists($key, $array)) { |
| 24 | 24 | $result=$array[$key]; |
| 25 | - if ($condition($result) === true) |
|
| 25 | + if ($condition($result)===true) |
|
| 26 | 26 | return $result; |
| 27 | 27 | } |
| 28 | 28 | $values=array_values($array); |
| 29 | - foreach ( $values as $val ) { |
|
| 30 | - if ($condition($val) === true) |
|
| 29 | + foreach ($values as $val) { |
|
| 30 | + if ($condition($val)===true) |
|
| 31 | 31 | return $val; |
| 32 | 32 | } |
| 33 | 33 | return $result; |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | $result=""; |
| 45 | 45 | if (\is_array($glue)) { |
| 46 | 46 | $size=\sizeof($pieces); |
| 47 | - if ($size > 0) { |
|
| 48 | - for($i=0; $i < $size - 1; $i++) { |
|
| 49 | - $result.=$pieces[$i] . @$glue[$i]; |
|
| 47 | + if ($size>0) { |
|
| 48 | + for ($i=0; $i<$size-1; $i++) { |
|
| 49 | + $result.=$pieces[$i].@$glue[$i]; |
|
| 50 | 50 | } |
| 51 | - $result.=$pieces[$size - 1]; |
|
| 51 | + $result.=$pieces[$size-1]; |
|
| 52 | 52 | } |
| 53 | 53 | } else { |
| 54 | 54 | $result=\implode($glue, $pieces); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | public static function dimension($array) { |
| 60 | 60 | if (is_array(reset($array))) { |
| 61 | - $return=self::dimension(reset($array)) + 1; |
|
| 61 | + $return=self::dimension(reset($array))+1; |
|
| 62 | 62 | } else { |
| 63 | 63 | $return=1; |
| 64 | 64 | } |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | public static function sortAssociative($array, $sortedKeys=array()) { |
| 69 | - $newArray=array (); |
|
| 70 | - foreach ( $sortedKeys as $key ) { |
|
| 69 | + $newArray=array(); |
|
| 70 | + foreach ($sortedKeys as $key) { |
|
| 71 | 71 | if (\array_key_exists($key, $array)) { |
| 72 | 72 | $newArray[$key]=$array[$key]; |
| 73 | 73 | } |
@@ -75,27 +75,27 @@ discard block |
||
| 75 | 75 | return $newArray; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - public static function modelArray($objects,$identifierFunction=NULL,$modelFunction=NULL){ |
|
| 78 | + public static function modelArray($objects, $identifierFunction=NULL, $modelFunction=NULL) { |
|
| 79 | 79 | $result=[]; |
| 80 | - if(isset($modelFunction)===false){ |
|
| 80 | + if (isset($modelFunction)===false) { |
|
| 81 | 81 | $modelFunction="__toString"; |
| 82 | 82 | } |
| 83 | - if(isset($identifierFunction)===false){ |
|
| 84 | - foreach ($objects as $object){ |
|
| 83 | + if (isset($identifierFunction)===false) { |
|
| 84 | + foreach ($objects as $object) { |
|
| 85 | 85 | $result[]=self::callFunction($object, $modelFunction); |
| 86 | 86 | } |
| 87 | - }else{ |
|
| 88 | - foreach ($objects as $object){ |
|
| 87 | + } else { |
|
| 88 | + foreach ($objects as $object) { |
|
| 89 | 89 | $result[self::callFunction($object, $identifierFunction)]=self::callFunction($object, $modelFunction); |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | return $result; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - private static function callFunction($object,$callback){ |
|
| 96 | - if(\is_string($callback)) |
|
| 97 | - return \call_user_func(array($object, $callback),[]); |
|
| 98 | - else if (\is_callable($callback)){ |
|
| 95 | + private static function callFunction($object, $callback) { |
|
| 96 | + if (\is_string($callback)) |
|
| 97 | + return \call_user_func(array($object, $callback), []); |
|
| 98 | + else if (\is_callable($callback)) { |
|
| 99 | 99 | return $callback($object); |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -14,21 +14,24 @@ discard block |
||
| 14 | 14 | return $array[$key]; |
| 15 | 15 | } |
| 16 | 16 | $values=array_values($array); |
| 17 | - if ($pos < sizeof($values)) |
|
| 18 | - return $values[$pos]; |
|
| 17 | + if ($pos < sizeof($values)) { |
|
| 18 | + return $values[$pos]; |
|
| 19 | + } |
|
| 19 | 20 | } |
| 20 | 21 | |
| 21 | 22 | public static function getConditionalValue($array, $key, $condition) { |
| 22 | 23 | $result=NULL; |
| 23 | 24 | if (array_key_exists($key, $array)) { |
| 24 | 25 | $result=$array[$key]; |
| 25 | - if ($condition($result) === true) |
|
| 26 | - return $result; |
|
| 26 | + if ($condition($result) === true) { |
|
| 27 | + return $result; |
|
| 28 | + } |
|
| 27 | 29 | } |
| 28 | 30 | $values=array_values($array); |
| 29 | 31 | foreach ( $values as $val ) { |
| 30 | - if ($condition($val) === true) |
|
| 31 | - return $val; |
|
| 32 | + if ($condition($val) === true) { |
|
| 33 | + return $val; |
|
| 34 | + } |
|
| 32 | 35 | } |
| 33 | 36 | return $result; |
| 34 | 37 | } |
@@ -36,8 +39,9 @@ discard block |
||
| 36 | 39 | public static function getDefaultValue($array, $key, $default=NULL) { |
| 37 | 40 | if (array_key_exists($key, $array)) { |
| 38 | 41 | return $array[$key]; |
| 39 | - } else |
|
| 40 | - return $default; |
|
| 42 | + } else { |
|
| 43 | + return $default; |
|
| 44 | + } |
|
| 41 | 45 | } |
| 42 | 46 | |
| 43 | 47 | public static function implode($glue, $pieces) { |
@@ -84,7 +88,7 @@ discard block |
||
| 84 | 88 | foreach ($objects as $object){ |
| 85 | 89 | $result[]=self::callFunction($object, $modelFunction); |
| 86 | 90 | } |
| 87 | - }else{ |
|
| 91 | + } else{ |
|
| 88 | 92 | foreach ($objects as $object){ |
| 89 | 93 | $result[self::callFunction($object, $identifierFunction)]=self::callFunction($object, $modelFunction); |
| 90 | 94 | } |
@@ -93,9 +97,9 @@ discard block |
||
| 93 | 97 | } |
| 94 | 98 | |
| 95 | 99 | private static function callFunction($object,$callback){ |
| 96 | - if(\is_string($callback)) |
|
| 97 | - return \call_user_func(array($object, $callback),[]); |
|
| 98 | - else if (\is_callable($callback)){ |
|
| 100 | + if(\is_string($callback)) { |
|
| 101 | + return \call_user_func(array($object, $callback),[]); |
|
| 102 | + } else if (\is_callable($callback)){ |
|
| 99 | 103 | return $callback($object); |
| 100 | 104 | } |
| 101 | 105 | } |
@@ -13,43 +13,43 @@ discard block |
||
| 13 | 13 | use Ajax\semantic\html\collections\form\traits\FieldTrait; |
| 14 | 14 | |
| 15 | 15 | class HtmlDropdown extends HtmlSemDoubleElement { |
| 16 | - use FieldTrait,LabeledIconTrait { |
|
| 16 | + use FieldTrait, LabeledIconTrait { |
|
| 17 | 17 | addIcon as addIconP; |
| 18 | 18 | } |
| 19 | 19 | protected $mClass="menu"; |
| 20 | 20 | protected $mTagName="div"; |
| 21 | - protected $items=array (); |
|
| 22 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
| 21 | + protected $items=array(); |
|
| 22 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
| 23 | 23 | protected $input; |
| 24 | 24 | protected $value; |
| 25 | 25 | protected $_associative; |
| 26 | 26 | |
| 27 | - public function __construct($identifier, $value="", $items=array(),$associative=true) { |
|
| 27 | + public function __construct($identifier, $value="", $items=array(), $associative=true) { |
|
| 28 | 28 | parent::__construct($identifier, "div"); |
| 29 | 29 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
| 30 | 30 | $this->setProperty("class", "ui dropdown"); |
| 31 | - $content=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
| 31 | + $content=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
| 32 | 32 | $content->setClass("text"); |
| 33 | 33 | $this->setValue($value); |
| 34 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
| 34 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
| 35 | 35 | $this->content=array($content); |
| 36 | 36 | $this->tagName="div"; |
| 37 | 37 | $this->_associative=$associative; |
| 38 | 38 | $this->addItems($items); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function getField(){ |
|
| 41 | + public function getField() { |
|
| 42 | 42 | return $this->input; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function addItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
| 46 | - $itemO=$this->beforeAddItem($item,$value,$image,$description); |
|
| 45 | + public function addItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 46 | + $itemO=$this->beforeAddItem($item, $value, $image, $description); |
|
| 47 | 47 | $this->items[]=$itemO; |
| 48 | 48 | return $itemO; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
| 52 | - $this->addIconP($icon,$before,$labeled); |
|
| 51 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 52 | + $this->addIconP($icon, $before, $labeled); |
|
| 53 | 53 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -59,26 +59,26 @@ discard block |
||
| 59 | 59 | * @param number $position |
| 60 | 60 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 61 | 61 | */ |
| 62 | - public function insertItem($item,$position=0){ |
|
| 62 | + public function insertItem($item, $position=0) { |
|
| 63 | 63 | $itemO=$this->beforeAddItem($item); |
| 64 | - $start = array_slice($this->items, 0, $position); |
|
| 65 | - $end = array_slice($this->items, $position); |
|
| 66 | - $start[] = $item; |
|
| 64 | + $start=array_slice($this->items, 0, $position); |
|
| 65 | + $end=array_slice($this->items, $position); |
|
| 66 | + $start[]=$item; |
|
| 67 | 67 | $this->items=array_merge($start, $end); |
| 68 | 68 | return $itemO; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
| 71 | + protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 72 | 72 | $itemO=$item; |
| 73 | - if(\is_array($item)){ |
|
| 73 | + if (\is_array($item)) { |
|
| 74 | 74 | $description=JArray::getValue($item, "description", 3); |
| 75 | 75 | $value=JArray::getValue($item, "value", 1); |
| 76 | 76 | $image=JArray::getValue($item, "image", 2); |
| 77 | 77 | $item=JArray::getValue($item, "item", 0); |
| 78 | 78 | } |
| 79 | - if(!$item instanceof HtmlDropdownItem){ |
|
| 80 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
|
| 81 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 79 | + if (!$item instanceof HtmlDropdownItem) { |
|
| 80 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description); |
|
| 81 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
| 82 | 82 | $this->addToProperty("class", "vertical"); |
| 83 | 83 | } |
| 84 | 84 | return $itemO; |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | $this->addItem($function($object)); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - public function addInput($name){ |
|
| 95 | - if(!isset($name)) |
|
| 94 | + public function addInput($name) { |
|
| 95 | + if (!isset($name)) |
|
| 96 | 96 | $name="input-".$this->identifier; |
| 97 | 97 | $this->setAction("activate"); |
| 98 | - $this->input=new HtmlInput($name,"hidden"); |
|
| 98 | + $this->input=new HtmlInput($name, "hidden"); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -104,15 +104,15 @@ discard block |
||
| 104 | 104 | * @param string $icon |
| 105 | 105 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 106 | 106 | */ |
| 107 | - public function addSearchInputItem($placeHolder=NULL,$icon=NULL){ |
|
| 108 | - return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon)); |
|
| 107 | + public function addSearchInputItem($placeHolder=NULL, $icon=NULL) { |
|
| 108 | + return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon)); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | * Adds a divider item |
| 113 | 113 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 114 | 114 | */ |
| 115 | - public function addDividerItem(){ |
|
| 115 | + public function addDividerItem() { |
|
| 116 | 116 | return $this->addItem(HtmlDropdownItem::divider()); |
| 117 | 117 | } |
| 118 | 118 | |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | * @param string $icon |
| 123 | 123 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 124 | 124 | */ |
| 125 | - public function addHeaderItem($caption=NULL,$icon=NULL){ |
|
| 126 | - return $this->addItem(HtmlDropdownItem::header($caption,$icon)); |
|
| 125 | + public function addHeaderItem($caption=NULL, $icon=NULL) { |
|
| 126 | + return $this->addItem(HtmlDropdownItem::header($caption, $icon)); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @param string $color |
| 133 | 133 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 134 | 134 | */ |
| 135 | - public function addCircularLabelItem($caption,$color){ |
|
| 135 | + public function addCircularLabelItem($caption, $color) { |
|
| 136 | 136 | return $this->addItem(HtmlDropdownItem::circular($caption, $color)); |
| 137 | 137 | } |
| 138 | 138 | |
@@ -141,87 +141,87 @@ discard block |
||
| 141 | 141 | * @param string $image |
| 142 | 142 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 143 | 143 | */ |
| 144 | - public function addMiniAvatarImageItem($caption,$image){ |
|
| 144 | + public function addMiniAvatarImageItem($caption, $image) { |
|
| 145 | 145 | return $this->addItem(HtmlDropdownItem::avatar($caption, $image)); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - public function addItems($items){ |
|
| 149 | - if(\is_array($items) && $this->_associative){ |
|
| 150 | - foreach ($items as $k=>$v){ |
|
| 148 | + public function addItems($items) { |
|
| 149 | + if (\is_array($items) && $this->_associative) { |
|
| 150 | + foreach ($items as $k=>$v) { |
|
| 151 | 151 | $this->addItem($v)->setData($k); |
| 152 | 152 | } |
| 153 | - }else{ |
|
| 154 | - foreach ($items as $item){ |
|
| 153 | + } else { |
|
| 154 | + foreach ($items as $item) { |
|
| 155 | 155 | $this->addItem($item); |
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - public function getItem($index){ |
|
| 160 | + public function getItem($index) { |
|
| 161 | 161 | return $this->items[$index]; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
| 165 | 165 | * @return int |
| 166 | 166 | */ |
| 167 | - public function count(){ |
|
| 167 | + public function count() { |
|
| 168 | 168 | return \sizeof($this->items); |
| 169 | 169 | } |
| 170 | 170 | /** |
| 171 | 171 | * @param boolean $dropdown |
| 172 | 172 | */ |
| 173 | - public function asDropdown($dropdown){ |
|
| 174 | - if($dropdown===false){ |
|
| 173 | + public function asDropdown($dropdown) { |
|
| 174 | + if ($dropdown===false) { |
|
| 175 | 175 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 176 | 176 | $dropdown="menu"; |
| 177 | - }else{ |
|
| 177 | + } else { |
|
| 178 | 178 | $dropdown="dropdown"; |
| 179 | 179 | $this->mClass="menu"; |
| 180 | 180 | } |
| 181 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
| 181 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - public function setVertical(){ |
|
| 185 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
| 184 | + public function setVertical() { |
|
| 185 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - public function setInline(){ |
|
| 189 | - return $this->addToPropertyCtrl("class", "inline",["inline"]); |
|
| 188 | + public function setInline() { |
|
| 189 | + return $this->addToPropertyCtrl("class", "inline", ["inline"]); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - public function setSimple(){ |
|
| 193 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
| 192 | + public function setSimple() { |
|
| 193 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - public function asButton($floating=false){ |
|
| 197 | - if($floating) |
|
| 196 | + public function asButton($floating=false) { |
|
| 197 | + if ($floating) |
|
| 198 | 198 | $this->addToProperty("class", "floating"); |
| 199 | 199 | $this->removePropertyValue("class", "selection"); |
| 200 | 200 | return $this->addToProperty("class", "button"); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
| 204 | - if(isset($name)) |
|
| 203 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 204 | + if (isset($name)) |
|
| 205 | 205 | $this->addInput($name); |
| 206 | - if($multiple) |
|
| 206 | + if ($multiple) |
|
| 207 | 207 | $this->addToProperty("class", "multiple"); |
| 208 | - if ($selection){ |
|
| 209 | - if($this->propertyContains("class", "button")===false) |
|
| 210 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 208 | + if ($selection) { |
|
| 209 | + if ($this->propertyContains("class", "button")===false) |
|
| 210 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
| 211 | 211 | } |
| 212 | 212 | return $this; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - public function asSearch($name=NULL,$multiple=false,$selection=true){ |
|
| 216 | - $this->asSelect($name,$multiple,$selection); |
|
| 215 | + public function asSearch($name=NULL, $multiple=false, $selection=true) { |
|
| 216 | + $this->asSelect($name, $multiple, $selection); |
|
| 217 | 217 | return $this->addToProperty("class", "search"); |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - public function setSelect($name=NULL,$multiple=false){ |
|
| 221 | - if(!isset($name)) |
|
| 220 | + public function setSelect($name=NULL, $multiple=false) { |
|
| 221 | + if (!isset($name)) |
|
| 222 | 222 | $name="select-".$this->identifier; |
| 223 | 223 | $this->input=null; |
| 224 | - if($multiple){ |
|
| 224 | + if ($multiple) { |
|
| 225 | 225 | $this->setProperty("multiple", true); |
| 226 | 226 | $this->addToProperty("class", "multiple"); |
| 227 | 227 | } |
@@ -229,37 +229,37 @@ discard block |
||
| 229 | 229 | $this->tagName="select"; |
| 230 | 230 | $this->setProperty("name", $name); |
| 231 | 231 | $this->content=null; |
| 232 | - foreach ($this->items as $item){ |
|
| 232 | + foreach ($this->items as $item) { |
|
| 233 | 233 | $item->asOption(); |
| 234 | 234 | } |
| 235 | 235 | return $this; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - public function asSubmenu($pointing=NULL){ |
|
| 238 | + public function asSubmenu($pointing=NULL) { |
|
| 239 | 239 | $this->setClass("ui dropdown link item"); |
| 240 | - if(isset($pointing)){ |
|
| 240 | + if (isset($pointing)) { |
|
| 241 | 241 | $this->setPointing($pointing); |
| 242 | 242 | } |
| 243 | 243 | return $this; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - public function setPointing($value=Direction::NONE){ |
|
| 247 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
| 246 | + public function setPointing($value=Direction::NONE) { |
|
| 247 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - public function setValue($value){ |
|
| 250 | + public function setValue($value) { |
|
| 251 | 251 | $this->value=$value; |
| 252 | 252 | return $this; |
| 253 | 253 | } |
| 254 | - private function applyValue(){ |
|
| 254 | + private function applyValue() { |
|
| 255 | 255 | $value=$this->value; |
| 256 | - if(isset($this->input) && isset($value)){ |
|
| 256 | + if (isset($this->input) && isset($value)) { |
|
| 257 | 257 | $this->input->setProperty("value", $value); |
| 258 | - }else{ |
|
| 258 | + } else { |
|
| 259 | 259 | $this->setProperty("value", $value); |
| 260 | 260 | } |
| 261 | 261 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 262 | - if(isset($textElement)) |
|
| 262 | + if (isset($textElement)) |
|
| 263 | 263 | $textElement->setContent($value); |
| 264 | 264 | return $this; |
| 265 | 265 | } |
@@ -269,29 +269,29 @@ discard block |
||
| 269 | 269 | * @see BaseHtml::run() |
| 270 | 270 | */ |
| 271 | 271 | public function run(JsUtils $js) { |
| 272 | - if($this->propertyContains("class", "simple")===false){ |
|
| 273 | - if(isset($this->_bsComponent)===false) |
|
| 274 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 272 | + if ($this->propertyContains("class", "simple")===false) { |
|
| 273 | + if (isset($this->_bsComponent)===false) |
|
| 274 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
| 275 | 275 | $this->addEventsOnRun($js); |
| 276 | 276 | return $this->_bsComponent; |
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - public function setCompact(){ |
|
| 280 | + public function setCompact() { |
|
| 281 | 281 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - public function setAction($action){ |
|
| 284 | + public function setAction($action) { |
|
| 285 | 285 | $this->_params["action"]=$action; |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - public function setFullTextSearch($value){ |
|
| 288 | + public function setFullTextSearch($value) { |
|
| 289 | 289 | $this->_params["fullTextSearch"]=$value; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 293 | 293 | $this->applyValue(); |
| 294 | - return parent::compile($js,$view); |
|
| 294 | + return parent::compile($js, $view); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | public function getInput() { |
@@ -7,21 +7,21 @@ |
||
| 7 | 7 | |
| 8 | 8 | class HtmlFormDropdown extends HtmlFormField { |
| 9 | 9 | |
| 10 | - public function __construct($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false,$associative=true) { |
|
| 11 | - parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier,$value,$items,$associative))->asSelect($identifier,$multiple), $label); |
|
| 10 | + public function __construct($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false, $associative=true) { |
|
| 11 | + parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier, $value, $items, $associative))->asSelect($identifier, $multiple), $label); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - public function setItems($items){ |
|
| 14 | + public function setItems($items) { |
|
| 15 | 15 | return $this->getField()->setItems($items); |
| 16 | 16 | } |
| 17 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
| 18 | - return $this->getField()->addItem($item,$value,$image); |
|
| 17 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
| 18 | + return $this->getField()->addItem($item, $value, $image); |
|
| 19 | 19 | } |
| 20 | - public static function multipleDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$associative=true){ |
|
| 21 | - return new HtmlFormDropdown($identifier,$items,$label,$value,true,$associative); |
|
| 20 | + public static function multipleDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $associative=true) { |
|
| 21 | + return new HtmlFormDropdown($identifier, $items, $label, $value, true, $associative); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function getDataField(){ |
|
| 24 | + public function getDataField() { |
|
| 25 | 25 | return $this->getField()->getInput(); |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | \ No newline at end of file |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @return HtmlModal |
| 87 | 87 | */ |
| 88 | 88 | public function htmlModal($identifier, $header="", $content="", $actions=array()) { |
| 89 | - return $this->addHtmlComponent(new HtmlModal($identifier, $header,$content,$actions)); |
|
| 89 | + return $this->addHtmlComponent(new HtmlModal($identifier, $header, $content, $actions)); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | * @param boolean $associative |
| 118 | 118 | * @return HtmlDropdown |
| 119 | 119 | */ |
| 120 | - public function htmlDropdown($identifier, $value="", $items=array(),$associative=true) { |
|
| 121 | - return $this->addHtmlComponent(new HtmlDropdown($identifier, $value, $items,$associative)); |
|
| 120 | + public function htmlDropdown($identifier, $value="", $items=array(), $associative=true) { |
|
| 121 | + return $this->addHtmlComponent(new HtmlDropdown($identifier, $value, $items, $associative)); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |