@@ -84,6 +84,9 @@ discard block |
||
| 84 | 84 | return $this; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | + /** |
|
| 88 | + * @param integer $index |
|
| 89 | + */ |
|
| 87 | 90 | public function removeItem($index){ |
| 88 | 91 | return array_splice($this->content, $index, 1); |
| 89 | 92 | } |
@@ -99,6 +102,9 @@ discard block |
||
| 99 | 102 | return $this->addItem($function($object)); |
| 100 | 103 | } |
| 101 | 104 | |
| 105 | + /** |
|
| 106 | + * @param \Closure $callBack |
|
| 107 | + */ |
|
| 102 | 108 | public function apply($callBack){ |
| 103 | 109 | foreach ($this->content as $item){ |
| 104 | 110 | $callBack($item); |
@@ -12,36 +12,36 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | abstract class HtmlCollection extends HtmlDoubleElement { |
| 14 | 14 | |
| 15 | - public function __construct($identifier,$tagName="div"){ |
|
| 16 | - parent::__construct($identifier,$tagName); |
|
| 15 | + public function __construct($identifier, $tagName="div") { |
|
| 16 | + parent::__construct($identifier, $tagName); |
|
| 17 | 17 | $this->content=array(); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function addItems($items){ |
|
| 21 | - if(JArray::isAssociative($items)){ |
|
| 22 | - foreach ($items as $k=>$v){ |
|
| 23 | - $this->addItem([$k,$v]); |
|
| 20 | + public function addItems($items) { |
|
| 21 | + if (JArray::isAssociative($items)) { |
|
| 22 | + foreach ($items as $k=>$v) { |
|
| 23 | + $this->addItem([$k, $v]); |
|
| 24 | 24 | } |
| 25 | - }else{ |
|
| 26 | - foreach ($items as $item){ |
|
| 25 | + } else { |
|
| 26 | + foreach ($items as $item) { |
|
| 27 | 27 | $this->addItem($item); |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | return $this; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function setItems($items){ |
|
| 33 | + public function setItems($items) { |
|
| 34 | 34 | $this->content=$items; |
| 35 | 35 | return $this; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function getItems(){ |
|
| 38 | + public function getItems() { |
|
| 39 | 39 | return $this->content; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - protected function getItemToAdd($item){ |
|
| 42 | + protected function getItemToAdd($item) { |
|
| 43 | 43 | $itemO=$item; |
| 44 | - if($this->createCondition($item)===true){ |
|
| 44 | + if ($this->createCondition($item)===true) { |
|
| 45 | 45 | $itemO=$this->createItem($item); |
| 46 | 46 | } |
| 47 | 47 | return $itemO; |
@@ -52,15 +52,15 @@ discard block |
||
| 52 | 52 | * @param HtmlDoubleElement|string $item |
| 53 | 53 | * @return \Ajax\common\html\HtmlDoubleElement |
| 54 | 54 | */ |
| 55 | - public function addItem($item){ |
|
| 55 | + public function addItem($item) { |
|
| 56 | 56 | $itemO=$this->getItemToAdd($item); |
| 57 | 57 | $this->addContent($itemO); |
| 58 | 58 | return $itemO; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function insertItem($item,$position=0){ |
|
| 61 | + public function insertItem($item, $position=0) { |
|
| 62 | 62 | $itemO=$this->getItemToAdd($item); |
| 63 | - \array_splice( $this->content, $position, 0, array($itemO)); |
|
| 63 | + \array_splice($this->content, $position, 0, array($itemO)); |
|
| 64 | 64 | return $itemO; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | return $this; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function removeItem($index){ |
|
| 86 | + public function removeItem($index) { |
|
| 87 | 87 | return array_splice($this->content, $index, 1); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - public function count(){ |
|
| 90 | + public function count() { |
|
| 91 | 91 | return \sizeof($this->content); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | return $this->addItem($function($object)); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - public function apply($callBack){ |
|
| 102 | - foreach ($this->content as $item){ |
|
| 101 | + public function apply($callBack) { |
|
| 102 | + foreach ($this->content as $item) { |
|
| 103 | 103 | $callBack($item); |
| 104 | 104 | } |
| 105 | 105 | return $this; |
@@ -119,40 +119,40 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | protected abstract function createItem($value); |
| 121 | 121 | |
| 122 | - protected function createCondition($value){ |
|
| 122 | + protected function createCondition($value) { |
|
| 123 | 123 | return \is_object($value)===false; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - protected function contentAs($tagName){ |
|
| 127 | - foreach ($this->content as $item){ |
|
| 126 | + protected function contentAs($tagName) { |
|
| 127 | + foreach ($this->content as $item) { |
|
| 128 | 128 | $item->setTagName($tagName); |
| 129 | 129 | } |
| 130 | 130 | return $this; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - public function setProperties($properties){ |
|
| 133 | + public function setProperties($properties) { |
|
| 134 | 134 | $i=0; |
| 135 | - foreach ($properties as $k=>$v){ |
|
| 135 | + foreach ($properties as $k=>$v) { |
|
| 136 | 136 | $c=$this->content[$i++]; |
| 137 | - if(isset($c)) |
|
| 138 | - $c->setProperty($k,$v); |
|
| 137 | + if (isset($c)) |
|
| 138 | + $c->setProperty($k, $v); |
|
| 139 | 139 | else |
| 140 | 140 | return $this; |
| 141 | 141 | } |
| 142 | 142 | return $this; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - public function setPropertyValues($property,$values){ |
|
| 145 | + public function setPropertyValues($property, $values) { |
|
| 146 | 146 | $i=0; |
| 147 | - if(\is_array($values)===false){ |
|
| 148 | - $values=\array_fill(0, $this->count(),$values); |
|
| 147 | + if (\is_array($values)===false) { |
|
| 148 | + $values=\array_fill(0, $this->count(), $values); |
|
| 149 | 149 | } |
| 150 | - foreach ($values as $value){ |
|
| 150 | + foreach ($values as $value) { |
|
| 151 | 151 | $c=$this->content[$i++]; |
| 152 | - if(isset($c)===true){ |
|
| 153 | - $c->setProperty($property,$value); |
|
| 152 | + if (isset($c)===true) { |
|
| 153 | + $c->setProperty($property, $value); |
|
| 154 | 154 | } |
| 155 | - else{ |
|
| 155 | + else { |
|
| 156 | 156 | return $this; |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | foreach ($items as $k=>$v){ |
| 23 | 23 | $this->addItem([$k,$v]); |
| 24 | 24 | } |
| 25 | - }else{ |
|
| 25 | + } else{ |
|
| 26 | 26 | foreach ($items as $item){ |
| 27 | 27 | $this->addItem($item); |
| 28 | 28 | } |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | * @return \Ajax\common\html\HtmlDoubleElement |
| 71 | 71 | */ |
| 72 | 72 | public function getItem($index) { |
| 73 | - if (is_int($index)) |
|
| 74 | - return $this->content[$index]; |
|
| 75 | - else { |
|
| 73 | + if (is_int($index)) { |
|
| 74 | + return $this->content[$index]; |
|
| 75 | + } else { |
|
| 76 | 76 | $elm=$this->getElementById($index, $this->content); |
| 77 | 77 | return $elm; |
| 78 | 78 | } |
@@ -134,10 +134,11 @@ discard block |
||
| 134 | 134 | $i=0; |
| 135 | 135 | foreach ($properties as $k=>$v){ |
| 136 | 136 | $c=$this->content[$i++]; |
| 137 | - if(isset($c)) |
|
| 138 | - $c->setProperty($k,$v); |
|
| 139 | - else |
|
| 140 | - return $this; |
|
| 137 | + if(isset($c)) { |
|
| 138 | + $c->setProperty($k,$v); |
|
| 139 | + } else { |
|
| 140 | + return $this; |
|
| 141 | + } |
|
| 141 | 142 | } |
| 142 | 143 | return $this; |
| 143 | 144 | } |
@@ -151,8 +152,7 @@ discard block |
||
| 151 | 152 | $c=$this->content[$i++]; |
| 152 | 153 | if(isset($c)===true){ |
| 153 | 154 | $c->setProperty($property,$value); |
| 154 | - } |
|
| 155 | - else{ |
|
| 155 | + } else{ |
|
| 156 | 156 | return $this; |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -429,7 +429,7 @@ |
||
| 429 | 429 | * |
| 430 | 430 | * @access public |
| 431 | 431 | * @param array an associative array of key/values |
| 432 | - * @return array |
|
| 432 | + * @return string |
|
| 433 | 433 | * |
| 434 | 434 | */ |
| 435 | 435 | function assoc_to_uri($array) { |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @access public |
| 11 | 11 | * |
| 12 | 12 | */ |
| 13 | - var $keyval=array (); |
|
| 13 | + var $keyval=array(); |
|
| 14 | 14 | /** |
| 15 | 15 | * Current uri string |
| 16 | 16 | * |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @access public |
| 27 | 27 | * |
| 28 | 28 | */ |
| 29 | - var $segments=array (); |
|
| 29 | + var $segments=array(); |
|
| 30 | 30 | /** |
| 31 | 31 | * Re-indexed list of uri segments |
| 32 | 32 | * Starts at 1 instead of 0 |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @access public |
| 36 | 36 | * |
| 37 | 37 | */ |
| 38 | - var $rsegments=array (); |
|
| 38 | + var $rsegments=array(); |
|
| 39 | 39 | var $permitted_uri_chars="a-z 0-9~%.:_\-"; |
| 40 | 40 | var $enable_query_strings=false; |
| 41 | 41 | |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | function _fetch_uri_string() { |
| 77 | 77 | $uri=""; |
| 78 | - if ($this->uri_protocol == 'AUTO') { |
|
| 78 | + if ($this->uri_protocol=='AUTO') { |
|
| 79 | 79 | // Is the request coming from the command line? |
| 80 | - if (php_sapi_name() == 'cli' or defined('STDIN')) { |
|
| 80 | + if (php_sapi_name()=='cli' or defined('STDIN')) { |
|
| 81 | 81 | $this->_set_uri_string($this->_parse_cli_args()); |
| 82 | 82 | return; |
| 83 | 83 | } |
@@ -91,20 +91,20 @@ discard block |
||
| 91 | 91 | // Is there a PATH_INFO variable? |
| 92 | 92 | // Note: some servers seem to have trouble with getenv() so we'll test it two ways |
| 93 | 93 | $path=(isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO'); |
| 94 | - if (trim($path, '/') != '' && $path != "/" . SELF) { |
|
| 94 | + if (trim($path, '/')!='' && $path!="/".SELF) { |
|
| 95 | 95 | $this->_set_uri_string($path); |
| 96 | 96 | return; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | // No PATH_INFO?... What about QUERY_STRING? |
| 100 | 100 | $path=(isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING'); |
| 101 | - if (trim($path, '/') != '') { |
|
| 101 | + if (trim($path, '/')!='') { |
|
| 102 | 102 | $this->_set_uri_string($path); |
| 103 | 103 | return; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | // As a last ditch effort lets try using the $_GET array |
| 107 | - if (is_array($_GET) && count($_GET) == 1 && trim(key($_GET), '/') != '') { |
|
| 107 | + if (is_array($_GET) && count($_GET)==1 && trim(key($_GET), '/')!='') { |
|
| 108 | 108 | $this->_set_uri_string(key($_GET)); |
| 109 | 109 | return; |
| 110 | 110 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | return; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if ($uri == 'REQUEST_URI') { |
|
| 117 | + if ($uri=='REQUEST_URI') { |
|
| 118 | 118 | $this->_set_uri_string($this->_detect_uri()); |
| 119 | 119 | return; |
| 120 | 120 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | // $str = remove_invisible_characters($str, FALSE); |
| 139 | 139 | |
| 140 | 140 | // If the URI contains only a slash we'll kill it |
| 141 | - $this->uri_string=($str == '/') ? '' : $str; |
|
| 141 | + $this->uri_string=($str=='/') ? '' : $str; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | // -------------------------------------------------------------------- |
@@ -159,15 +159,15 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $uri=$_SERVER['REQUEST_URI']; |
| 162 | - if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) { |
|
| 162 | + if (strpos($uri, $_SERVER['SCRIPT_NAME'])===0) { |
|
| 163 | 163 | $uri=substr($uri, strlen($_SERVER['SCRIPT_NAME'])); |
| 164 | - } elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) { |
|
| 164 | + } elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME']))===0) { |
|
| 165 | 165 | $uri=substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME']))); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | // This section ensures that even on servers that require the URI to be in the query string (Nginx) a correct |
| 169 | 169 | // URI is found, and also fixes the QUERY_STRING server var and $_GET array. |
| 170 | - if (strncmp($uri, '?/', 2) === 0) { |
|
| 170 | + if (strncmp($uri, '?/', 2)===0) { |
|
| 171 | 171 | $uri=substr($uri, 2); |
| 172 | 172 | } |
| 173 | 173 | $parts=preg_split('#\?#i', $uri, 2); |
@@ -177,17 +177,17 @@ discard block |
||
| 177 | 177 | parse_str($_SERVER['QUERY_STRING'], $_GET); |
| 178 | 178 | } else { |
| 179 | 179 | $_SERVER['QUERY_STRING']=''; |
| 180 | - $_GET=array (); |
|
| 180 | + $_GET=array(); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if ($uri == '/' || empty($uri)) { |
|
| 183 | + if ($uri=='/' || empty($uri)) { |
|
| 184 | 184 | return '/'; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | $uri=parse_url($uri, PHP_URL_PATH); |
| 188 | 188 | |
| 189 | 189 | // Do some final cleaning of the URI and return it |
| 190 | - return str_replace(array ('//','../' ), '/', trim($uri, '/')); |
|
| 190 | + return str_replace(array('//', '../'), '/', trim($uri, '/')); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | // -------------------------------------------------------------------- |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | private function _parse_cli_args() { |
| 205 | 205 | $args=array_slice($_SERVER['argv'], 1); |
| 206 | 206 | |
| 207 | - return $args ? '/' . implode('/', $args) : ''; |
|
| 207 | + return $args ? '/'.implode('/', $args) : ''; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | // -------------------------------------------------------------------- |
@@ -218,17 +218,17 @@ discard block |
||
| 218 | 218 | * |
| 219 | 219 | */ |
| 220 | 220 | function _filter_uri($str) { |
| 221 | - if ($str != '' && $this->permitted_uri_chars != '' && $this->enable_query_strings == FALSE) { |
|
| 221 | + if ($str!='' && $this->permitted_uri_chars!='' && $this->enable_query_strings==FALSE) { |
|
| 222 | 222 | // preg_quote() in PHP 5.3 escapes -, so the str_replace() and addition of - to preg_quote() is to maintain backwards |
| 223 | 223 | // compatibility as many are unaware of how characters in the permitted_uri_chars will be parsed as a regex pattern |
| 224 | - if (!preg_match("|^[" . str_replace(array ('\\-','\-' ), '-', preg_quote($this->permitted_uri_chars, '-')) . "]+$|i", $str)) { |
|
| 224 | + if (!preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->permitted_uri_chars, '-'))."]+$|i", $str)) { |
|
| 225 | 225 | show_error('The URI you submitted has disallowed characters.', 400); |
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | // Convert programatic characters to entities |
| 230 | - $bad=array ('$','(',')','%28','%29' ); |
|
| 231 | - $good=array ('$','(',')','(',')' ); |
|
| 230 | + $bad=array('$', '(', ')', '%28', '%29'); |
|
| 231 | + $good=array('$', '(', ')', '(', ')'); |
|
| 232 | 232 | |
| 233 | 233 | return str_replace($bad, $good, $str); |
| 234 | 234 | } |
@@ -243,11 +243,11 @@ discard block |
||
| 243 | 243 | * |
| 244 | 244 | */ |
| 245 | 245 | function _explode_segments() { |
| 246 | - foreach ( explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $this->uri_string)) as $val ) { |
|
| 246 | + foreach (explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $this->uri_string)) as $val) { |
|
| 247 | 247 | // Filter segments for security |
| 248 | 248 | $val=trim($this->_filter_uri($val)); |
| 249 | 249 | |
| 250 | - if ($val != '') { |
|
| 250 | + if ($val!='') { |
|
| 251 | 251 | $this->segments[]=$val; |
| 252 | 252 | } |
| 253 | 253 | } |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | * |
| 365 | 365 | */ |
| 366 | 366 | function _uri_to_assoc($n=3, $default=array(), $which='segment') { |
| 367 | - if ($which == 'segment') { |
|
| 367 | + if ($which=='segment') { |
|
| 368 | 368 | $total_segments='total_segments'; |
| 369 | 369 | $segment_array='segment_array'; |
| 370 | 370 | } else { |
@@ -380,25 +380,25 @@ discard block |
||
| 380 | 380 | return $this->keyval[$n]; |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - if ($this->$total_segments() < $n) { |
|
| 384 | - if (count($default) == 0) { |
|
| 385 | - return array (); |
|
| 383 | + if ($this->$total_segments()<$n) { |
|
| 384 | + if (count($default)==0) { |
|
| 385 | + return array(); |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - $retval=array (); |
|
| 389 | - foreach ( $default as $val ) { |
|
| 388 | + $retval=array(); |
|
| 389 | + foreach ($default as $val) { |
|
| 390 | 390 | $retval[$val]=FALSE; |
| 391 | 391 | } |
| 392 | 392 | return $retval; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - $segments=array_slice($this->$segment_array(), ($n - 1)); |
|
| 395 | + $segments=array_slice($this->$segment_array(), ($n-1)); |
|
| 396 | 396 | |
| 397 | 397 | $i=0; |
| 398 | 398 | $lastval=''; |
| 399 | - $retval=array (); |
|
| 400 | - foreach ( $segments as $seg ) { |
|
| 401 | - if ($i % 2) { |
|
| 399 | + $retval=array(); |
|
| 400 | + foreach ($segments as $seg) { |
|
| 401 | + if ($i%2) { |
|
| 402 | 402 | $retval[$lastval]=$seg; |
| 403 | 403 | } else { |
| 404 | 404 | $retval[$seg]=FALSE; |
@@ -408,8 +408,8 @@ discard block |
||
| 408 | 408 | $i++; |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | - if (count($default) > 0) { |
|
| 412 | - foreach ( $default as $val ) { |
|
| 411 | + if (count($default)>0) { |
|
| 412 | + foreach ($default as $val) { |
|
| 413 | 413 | if (!array_key_exists($val, $retval)) { |
| 414 | 414 | $retval[$val]=FALSE; |
| 415 | 415 | } |
@@ -433,8 +433,8 @@ discard block |
||
| 433 | 433 | * |
| 434 | 434 | */ |
| 435 | 435 | function assoc_to_uri($array) { |
| 436 | - $temp=array (); |
|
| 437 | - foreach ( ( array ) $array as $key => $val ) { |
|
| 436 | + $temp=array(); |
|
| 437 | + foreach ((array)$array as $key => $val) { |
|
| 438 | 438 | $temp[]=$key; |
| 439 | 439 | $temp[]=$val; |
| 440 | 440 | } |
@@ -488,13 +488,13 @@ discard block |
||
| 488 | 488 | $leading='/'; |
| 489 | 489 | $trailing='/'; |
| 490 | 490 | |
| 491 | - if ($where == 'trailing') { |
|
| 491 | + if ($where=='trailing') { |
|
| 492 | 492 | $leading=''; |
| 493 | - } elseif ($where == 'leading') { |
|
| 493 | + } elseif ($where=='leading') { |
|
| 494 | 494 | $trailing=''; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - return $leading . $this->$which($n) . $trailing; |
|
| 497 | + return $leading.$this->$which($n).$trailing; |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | // -------------------------------------------------------------------- |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | * |
| 573 | 573 | */ |
| 574 | 574 | function ruri_string() { |
| 575 | - return '/' . implode('/', $this->rsegment_array()); |
|
| 575 | + return '/'.implode('/', $this->rsegment_array()); |
|
| 576 | 576 | } |
| 577 | 577 | } |
| 578 | 578 | // END URI Class |
| 579 | 579 | \ No newline at end of file |
@@ -6,6 +6,9 @@ |
||
| 6 | 6 | |
| 7 | 7 | trait CheckboxTrait { |
| 8 | 8 | |
| 9 | + /** |
|
| 10 | + * @param string $name |
|
| 11 | + */ |
|
| 9 | 12 | public abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
| 10 | 13 | |
| 11 | 14 | public function setType($checkboxType) { |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | return $this->getField()->attachEvents($events); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function getField(){ |
|
| 34 | + public function getField() { |
|
| 35 | 35 | return $this->content["field"]->getField(); |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | \ No newline at end of file |
@@ -64,8 +64,7 @@ discard block |
||
| 64 | 64 | * Associate an ajax get to the breadcrumb elements, displayed in $targetSelector |
| 65 | 65 | * $attr member is used to build each element url |
| 66 | 66 | * @param string $targetSelector the target of the get |
| 67 | - * @param string $attr the html attribute used to build the elements url |
|
| 68 | - * @return HtmlBreadcrumbs |
|
| 67 | + * @return HtmlBreadcrumb |
|
| 69 | 68 | */ |
| 70 | 69 | public function autoGetOnClick($targetSelector) { |
| 71 | 70 | return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr )); |
@@ -91,7 +90,7 @@ discard block |
||
| 91 | 90 | * Add new elements in breadcrumbs corresponding to request dispatcher : controllerName, actionName, parameters |
| 92 | 91 | * @param JsUtils $js |
| 93 | 92 | * @param Dispatcher $dispatcher the request dispatcher |
| 94 | - * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
|
| 93 | + * @return HtmlBreadcrumb |
|
| 95 | 94 | */ |
| 96 | 95 | public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) { |
| 97 | 96 | return $this->addItems($js->fromDispatcher($dispatcher)); |
@@ -120,7 +119,7 @@ discard block |
||
| 120 | 119 | * sets the function who generates the href elements. |
| 121 | 120 | * default : function($element){return $element->getContent()} |
| 122 | 121 | * @param function $_hrefFunction |
| 123 | - * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
|
| 122 | + * @return HtmlBreadcrumb |
|
| 124 | 123 | */ |
| 125 | 124 | public function setHrefFunction($_hrefFunction) { |
| 126 | 125 | $this->_hrefFunction=$_hrefFunction; |
@@ -181,9 +181,9 @@ |
||
| 181 | 181 | protected function createItem($value) { |
| 182 | 182 | $count=$this->count(); |
| 183 | 183 | $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
| 184 | - if (\is_array($value)) |
|
| 185 | - $itemO->fromArray($value); |
|
| 186 | - else { |
|
| 184 | + if (\is_array($value)) { |
|
| 185 | + $itemO->fromArray($value); |
|
| 186 | + } else { |
|
| 187 | 187 | $itemO->setContent($value); |
| 188 | 188 | } |
| 189 | 189 | return $itemO; |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
| 6 | 6 | use Ajax\JsUtils; |
| 7 | 7 | use Ajax\service\JArray; |
| 8 | - |
|
| 9 | 8 | use Ajax\semantic\html\base\constants\State; |
| 10 | 9 | |
| 11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $this->startIndex=$startIndex; |
| 52 | 52 | $this->autoActive=$autoActive; |
| 53 | 53 | $this->_contentSeparator="<div class='divider'> / </div>"; |
| 54 | - $this->_hrefFunction=function ($e) { |
|
| 54 | + $this->_hrefFunction=function($e) { |
|
| 55 | 55 | return $e->getContent(); |
| 56 | 56 | }; |
| 57 | 57 | if (isset($hrefFunction)) { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @return HtmlBreadcrumbs |
| 69 | 69 | */ |
| 70 | 70 | public function autoGetOnClick($targetSelector) { |
| 71 | - return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr )); |
|
| 71 | + return $this->getOnClick($this->root, $targetSelector, array("attr" => $this->attr)); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function contentAsString() { |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | public function setActive($index=null) { |
| 82 | 82 | if (!isset($index)) { |
| 83 | - $index=sizeof($this->content) - 1; |
|
| 83 | + $index=sizeof($this->content)-1; |
|
| 84 | 84 | } |
| 85 | 85 | $activeItem=$this->content[$index]; |
| 86 | 86 | $activeItem->addToProperty("class", "active"); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param Dispatcher $dispatcher the request dispatcher |
| 94 | 94 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 95 | 95 | */ |
| 96 | - public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) { |
|
| 96 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
| 97 | 97 | return $this->addItems($js->fromDispatcher($dispatcher)); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -107,12 +107,12 @@ discard block |
||
| 107 | 107 | if (!isset($index)) { |
| 108 | 108 | $index=sizeof($this->content); |
| 109 | 109 | } |
| 110 | - if ($this->absolutePaths === true) { |
|
| 110 | + if ($this->absolutePaths===true) { |
|
| 111 | 111 | return $this->_hrefFunction($this->content[$index]); |
| 112 | 112 | } else { |
| 113 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
| 113 | + return $this->root.implode($separator, array_slice(array_map(function($e) { |
|
| 114 | 114 | return $this->_hrefFunction($e); |
| 115 | - }, $this->content), $this->startIndex, $index + 1)); |
|
| 115 | + }, $this->content), $this->startIndex, $index+1)); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | $this->setActive(); |
| 147 | 147 | } |
| 148 | 148 | $count=$this->count(); |
| 149 | - for($i=1; $i < $count; $i++) { |
|
| 150 | - $this->content[$i]->wrap($this->getContentDivider($i - 1)); |
|
| 149 | + for ($i=1; $i<$count; $i++) { |
|
| 150 | + $this->content[$i]->wrap($this->getContentDivider($i-1)); |
|
| 151 | 151 | } |
| 152 | 152 | return parent::compile($js, $view); |
| 153 | 153 | } |
@@ -157,15 +157,15 @@ discard block |
||
| 157 | 157 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 158 | 158 | */ |
| 159 | 159 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 160 | - foreach ( $this->content as $element ) { |
|
| 160 | + foreach ($this->content as $element) { |
|
| 161 | 161 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
| 162 | 162 | } |
| 163 | 163 | return $this; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 167 | - foreach ( $this->content as $element ) { |
|
| 168 | - if ($element->getProperty($this->attr) != NULL){ |
|
| 167 | + foreach ($this->content as $element) { |
|
| 168 | + if ($element->getProperty($this->attr)!=NULL) { |
|
| 169 | 169 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
| 170 | 170 | } |
| 171 | 171 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | protected function createItem($value) { |
| 182 | 182 | $count=$this->count(); |
| 183 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
| 183 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
| 184 | 184 | if (\is_array($value)) |
| 185 | 185 | $itemO->fromArray($value); |
| 186 | 186 | else { |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | public function addIconAt($icon, $index) { |
| 193 | 193 | $item=$this->getItem($index); |
| 194 | 194 | if (isset($item)) { |
| 195 | - $icon=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 195 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 196 | 196 | $item->wrapContent($icon); |
| 197 | 197 | } |
| 198 | 198 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | public function addItem($item) { |
| 201 | 201 | $count=$this->count(); |
| 202 | 202 | $itemO=parent::addItem($item); |
| 203 | - $this->addToPropertyCtrl("class", "section", array ("section" )); |
|
| 203 | + $this->addToPropertyCtrl("class", "section", array("section")); |
|
| 204 | 204 | $itemO->setProperty($this->attr, $this->getHref($count)); |
| 205 | 205 | return $itemO; |
| 206 | 206 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | public function setAbsolutePaths($absolutePaths) { |
| 217 | 217 | $this->absolutePaths=$absolutePaths; |
| 218 | 218 | $size=\sizeof($this->content); |
| 219 | - for($i=0;$i<$size;$i++){ |
|
| 219 | + for ($i=0; $i<$size; $i++) { |
|
| 220 | 220 | $this->content[$i]->setProperty($this->attr, $this->getHref($i)); |
| 221 | 221 | } |
| 222 | 222 | return $this; |
@@ -22,6 +22,9 @@ discard block |
||
| 22 | 22 | private $_colSizing=true; |
| 23 | 23 | private $_implicitRows=false; |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param string $identifier |
|
| 27 | + */ |
|
| 25 | 28 | public function __construct($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
| 26 | 29 | parent::__construct($identifier, "div", "ui grid"); |
| 27 | 30 | $this->_implicitRows=$implicitRows; |
@@ -158,7 +161,7 @@ discard block |
||
| 158 | 161 | /** |
| 159 | 162 | * return the row at $index |
| 160 | 163 | * @param int $index |
| 161 | - * @return \Ajax\semantic\html\collections\HtmlGridRow |
|
| 164 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
| 162 | 165 | */ |
| 163 | 166 | public function getRow($index) { |
| 164 | 167 | return $this->getItem($index); |
@@ -297,7 +300,7 @@ discard block |
||
| 297 | 300 | |
| 298 | 301 | /** |
| 299 | 302 | * stretch the row contents to take up the entire column height |
| 300 | - * @return \Ajax\semantic\html\content\HtmlGridRow |
|
| 303 | + * @return HtmlGrid |
|
| 301 | 304 | */ |
| 302 | 305 | public function setStretched() { |
| 303 | 306 | return $this->addToProperty("class", "stretched"); |
@@ -36,11 +36,11 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function asSegment() { |
| 39 | - return $this->addToPropertyCtrl("class", "segment", array ("segment" )); |
|
| 39 | + return $this->addToPropertyCtrl("class", "segment", array("segment")); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function asContainer() { |
| 43 | - return $this->addToPropertyCtrl("class", "container", array ("container" )); |
|
| 43 | + return $this->addToPropertyCtrl("class", "container", array("container")); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | * @param int $wide |
| 49 | 49 | */ |
| 50 | 50 | public function setWide($wide) { |
| 51 | - $wide=Wide::getConstants()["W" . $wide]; |
|
| 51 | + $wide=Wide::getConstants()["W".$wide]; |
|
| 52 | 52 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
| 53 | - return $this->addToPropertyCtrl("class", "column", array ("column" )); |
|
| 53 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | * @return mixed |
| 69 | 69 | */ |
| 70 | 70 | public function addRow($colsCount=NULL) { |
| 71 | - $rowCount=$this->rowCount() + 1; |
|
| 71 | + $rowCount=$this->rowCount()+1; |
|
| 72 | 72 | $this->setRowsCount($rowCount, $colsCount, true); |
| 73 | - return $this->content[$rowCount - 1]; |
|
| 73 | + return $this->content[$rowCount-1]; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | * @return mixed|\Ajax\semantic\html\collections\HtmlGrid |
| 80 | 80 | */ |
| 81 | 81 | public function addCol($width=NULL) { |
| 82 | - $colCount=$this->colCount() + 1; |
|
| 82 | + $colCount=$this->colCount()+1; |
|
| 83 | 83 | $this->setColsCount($colCount, true, $width); |
| 84 | 84 | if ($this->hasOnlyCols($this->count())) |
| 85 | - return $this->content[$colCount - 1]; |
|
| 85 | + return $this->content[$colCount-1]; |
|
| 86 | 86 | return $this; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 93 | 93 | */ |
| 94 | 94 | public function addCols($sizes=array()) { |
| 95 | - foreach ( $sizes as $size ) { |
|
| 95 | + foreach ($sizes as $size) { |
|
| 96 | 96 | $this->addCol($size); |
| 97 | 97 | } |
| 98 | 98 | return $this; |
@@ -106,19 +106,19 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) { |
| 108 | 108 | $count=$this->count(); |
| 109 | - if ($rowsCount < 2 && $force === false) { |
|
| 110 | - for($i=$count; $i < $colsCount; $i++) { |
|
| 111 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i)); |
|
| 109 | + if ($rowsCount<2 && $force===false) { |
|
| 110 | + for ($i=$count; $i<$colsCount; $i++) { |
|
| 111 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
|
| 112 | 112 | } |
| 113 | 113 | } else { |
| 114 | 114 | if ($this->hasOnlyCols($count)) { |
| 115 | 115 | $tmpContent=$this->content; |
| 116 | 116 | $item=$this->addItem($colsCount); |
| 117 | 117 | $item->setContent($tmpContent); |
| 118 | - $this->content=array (); |
|
| 118 | + $this->content=array(); |
|
| 119 | 119 | $count=1; |
| 120 | 120 | } |
| 121 | - for($i=$count; $i < $rowsCount; $i++) { |
|
| 121 | + for ($i=$count; $i<$rowsCount; $i++) { |
|
| 122 | 122 | $this->addItem($colsCount); |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | protected function hasOnlyCols($count) { |
| 129 | - return $count > 0 && $this->content[0] instanceof HtmlGridCol; |
|
| 129 | + return $count>0 && $this->content[0] instanceof HtmlGridCol; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -140,14 +140,14 @@ discard block |
||
| 140 | 140 | /*if (isset($width)==false) { |
| 141 | 141 | $this->setWide($numCols); |
| 142 | 142 | }*/ |
| 143 | - if ($toCreate == true) { |
|
| 143 | + if ($toCreate==true) { |
|
| 144 | 144 | $count=$this->count(); |
| 145 | - if ($count == 0 || $this->hasOnlyCols($count)) { |
|
| 146 | - for($i=$count; $i < $numCols; $i++) { |
|
| 147 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i, $width)); |
|
| 145 | + if ($count==0 || $this->hasOnlyCols($count)) { |
|
| 146 | + for ($i=$count; $i<$numCols; $i++) { |
|
| 147 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width)); |
|
| 148 | 148 | } |
| 149 | 149 | } else { |
| 150 | - for($i=0; $i < $count; $i++) { |
|
| 150 | + for ($i=0; $i<$count; $i++) { |
|
| 151 | 151 | $this->getItem($i)->setColsCount($numCols); |
| 152 | 152 | } |
| 153 | 153 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $count=$this->count(); |
| 184 | 184 | if ($this->hasOnlyCols($count)) |
| 185 | 185 | return $count; |
| 186 | - if ($count > 0) |
|
| 186 | + if ($count>0) |
|
| 187 | 187 | return $this->getItem(0)->count(); |
| 188 | 188 | return 0; |
| 189 | 189 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 196 | 196 | */ |
| 197 | 197 | public function getCell($row, $col) { |
| 198 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
| 198 | + if ($row<2 && $this->hasOnlyCols($this->count())) |
|
| 199 | 199 | return $this->getItem($col); |
| 200 | 200 | $row=$this->getItem($row); |
| 201 | 201 | if (isset($row)) { |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 211 | 211 | */ |
| 212 | 212 | public function setDivided($vertically=false) { |
| 213 | - $value=($vertically === true) ? "vertically divided" : "divided"; |
|
| 214 | - return $this->addToPropertyCtrl("class", $value, array ("divided" )); |
|
| 213 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
| 214 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
@@ -220,15 +220,15 @@ discard block |
||
| 220 | 220 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 221 | 221 | */ |
| 222 | 222 | public function setCelled($internally=false) { |
| 223 | - $value=($internally === true) ? "internally celled" : "celled"; |
|
| 224 | - return $this->addToPropertyCtrl("class", $value, array ("celled","internally celled" )); |
|
| 223 | + $value=($internally===true) ? "internally celled" : "celled"; |
|
| 224 | + return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled")); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** |
| 228 | 228 | * A grid can have its columns centered |
| 229 | 229 | */ |
| 230 | 230 | public function setCentered() { |
| 231 | - return $this->addToPropertyCtrl("class", "centered", array ("centered" )); |
|
| 231 | + return $this->addToPropertyCtrl("class", "centered", array("centered")); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /** |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function setPadded($value=NULL) { |
| 248 | 248 | if (isset($value)) |
| 249 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
| 249 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
| 250 | 250 | return $this->addToProperty("class", "padded"); |
| 251 | 251 | } |
| 252 | 252 | |
@@ -256,12 +256,12 @@ discard block |
||
| 256 | 256 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 257 | 257 | */ |
| 258 | 258 | public function setRelaxed($very=false) { |
| 259 | - $value=($very === true) ? "very relaxed" : "relaxed"; |
|
| 260 | - return $this->addToPropertyCtrl("class", $value, array ("relaxed","very relaxed" )); |
|
| 259 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
| 260 | + return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed")); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
| 264 | - return $this->addToPropertyCtrl("class", $value . " aligned", VerticalAlignment::getConstantValues("aligned")); |
|
| 264 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -271,9 +271,9 @@ discard block |
||
| 271 | 271 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 272 | 272 | */ |
| 273 | 273 | protected function createItem($value) { |
| 274 | - if ($this->_createCols === false) |
|
| 274 | + if ($this->_createCols===false) |
|
| 275 | 275 | $value=null; |
| 276 | - $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
|
| 276 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
| 277 | 277 | return $item; |
| 278 | 278 | } |
| 279 | 279 | |
@@ -283,15 +283,15 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | public function setValues($values, $force=true) { |
| 285 | 285 | $count=$this->count(); |
| 286 | - if ($this->_createCols === false || $force === true) { |
|
| 287 | - for($i=$count; $i < \sizeof($values); $i++) { |
|
| 286 | + if ($this->_createCols===false || $force===true) { |
|
| 287 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
| 288 | 288 | $colSize=\sizeof($values[$i]); |
| 289 | - $this->addItem(new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
| 289 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | - $count=\min(array ($this->count(),\sizeof($values) )); |
|
| 293 | - for($i=0; $i < $count; $i++) { |
|
| 294 | - $this->content[$i]->setValues($values[$i], $this->_createCols === false); |
|
| 292 | + $count=\min(array($this->count(), \sizeof($values))); |
|
| 293 | + for ($i=0; $i<$count; $i++) { |
|
| 294 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | 297 | |
@@ -81,8 +81,9 @@ discard block |
||
| 81 | 81 | public function addCol($width=NULL) { |
| 82 | 82 | $colCount=$this->colCount() + 1; |
| 83 | 83 | $this->setColsCount($colCount, true, $width); |
| 84 | - if ($this->hasOnlyCols($this->count())) |
|
| 85 | - return $this->content[$colCount - 1]; |
|
| 84 | + if ($this->hasOnlyCols($this->count())) { |
|
| 85 | + return $this->content[$colCount - 1]; |
|
| 86 | + } |
|
| 86 | 87 | return $this; |
| 87 | 88 | } |
| 88 | 89 | |
@@ -170,8 +171,9 @@ discard block |
||
| 170 | 171 | */ |
| 171 | 172 | public function rowCount() { |
| 172 | 173 | $count=$this->count(); |
| 173 | - if ($this->hasOnlyCols($count)) |
|
| 174 | - return 0; |
|
| 174 | + if ($this->hasOnlyCols($count)) { |
|
| 175 | + return 0; |
|
| 176 | + } |
|
| 175 | 177 | return $count; |
| 176 | 178 | } |
| 177 | 179 | |
@@ -181,10 +183,12 @@ discard block |
||
| 181 | 183 | */ |
| 182 | 184 | public function colCount() { |
| 183 | 185 | $count=$this->count(); |
| 184 | - if ($this->hasOnlyCols($count)) |
|
| 185 | - return $count; |
|
| 186 | - if ($count > 0) |
|
| 187 | - return $this->getItem(0)->count(); |
|
| 186 | + if ($this->hasOnlyCols($count)) { |
|
| 187 | + return $count; |
|
| 188 | + } |
|
| 189 | + if ($count > 0) { |
|
| 190 | + return $this->getItem(0)->count(); |
|
| 191 | + } |
|
| 188 | 192 | return 0; |
| 189 | 193 | } |
| 190 | 194 | |
@@ -195,8 +199,9 @@ discard block |
||
| 195 | 199 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 196 | 200 | */ |
| 197 | 201 | public function getCell($row, $col) { |
| 198 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
| 199 | - return $this->getItem($col); |
|
| 202 | + if ($row < 2 && $this->hasOnlyCols($this->count())) { |
|
| 203 | + return $this->getItem($col); |
|
| 204 | + } |
|
| 200 | 205 | $row=$this->getItem($row); |
| 201 | 206 | if (isset($row)) { |
| 202 | 207 | $col=$row->getItem($col); |
@@ -245,8 +250,9 @@ discard block |
||
| 245 | 250 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 246 | 251 | */ |
| 247 | 252 | public function setPadded($value=NULL) { |
| 248 | - if (isset($value)) |
|
| 249 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
| 253 | + if (isset($value)) { |
|
| 254 | + $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
| 255 | + } |
|
| 250 | 256 | return $this->addToProperty("class", "padded"); |
| 251 | 257 | } |
| 252 | 258 | |
@@ -271,8 +277,9 @@ discard block |
||
| 271 | 277 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 272 | 278 | */ |
| 273 | 279 | protected function createItem($value) { |
| 274 | - if ($this->_createCols === false) |
|
| 275 | - $value=null; |
|
| 280 | + if ($this->_createCols === false) { |
|
| 281 | + $value=null; |
|
| 282 | + } |
|
| 276 | 283 | $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
| 277 | 284 | return $item; |
| 278 | 285 | } |
@@ -17,6 +17,11 @@ discard block |
||
| 17 | 17 | class HtmlTable extends HtmlSemDoubleElement { |
| 18 | 18 | private $_colCount; |
| 19 | 19 | |
| 20 | + /** |
|
| 21 | + * @param string $identifier |
|
| 22 | + * @param integer $rowCount |
|
| 23 | + * @param integer $colCount |
|
| 24 | + */ |
|
| 20 | 25 | public function __construct($identifier, $rowCount, $colCount) { |
| 21 | 26 | parent::__construct($identifier, "table", "ui table"); |
| 22 | 27 | $this->content=array (); |
@@ -96,7 +101,7 @@ discard block |
||
| 96 | 101 | /** |
| 97 | 102 | * Retuns the row at $rowIndex |
| 98 | 103 | * @param int $rowIndex |
| 99 | - * @return \Ajax\semantic\html\content\HtmlTR |
|
| 104 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
| 100 | 105 | */ |
| 101 | 106 | public function getRow($rowIndex) { |
| 102 | 107 | return $this->getBody()->getRow($rowIndex); |
@@ -172,6 +177,9 @@ discard block |
||
| 172 | 177 | return $this->colAlign($colIndex, "colLeft"); |
| 173 | 178 | } |
| 174 | 179 | |
| 180 | + /** |
|
| 181 | + * @param string $function |
|
| 182 | + */ |
|
| 175 | 183 | private function colAlign($colIndex, $function) { |
| 176 | 184 | if (\is_array($colIndex)) { |
| 177 | 185 | foreach ( $colIndex as $cIndex ) { |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public function __construct($identifier, $rowCount, $colCount) { |
| 21 | 21 | parent::__construct($identifier, "table", "ui table"); |
| 22 | - $this->content=array (); |
|
| 22 | + $this->content=array(); |
|
| 23 | 23 | $this->setRowCount($rowCount, $colCount); |
| 24 | - $this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ]; |
|
| 24 | + $this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT]; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | * @return HtmlTableContent |
| 31 | 31 | */ |
| 32 | 32 | private function getPart($key) { |
| 33 | - if (\array_key_exists($key, $this->content) === false) { |
|
| 33 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 34 | 34 | $this->content[$key]=new HtmlTableContent("", $key); |
| 35 | - if ($key !== "tbody") { |
|
| 35 | + if ($key!=="tbody") { |
|
| 36 | 36 | $this->content[$key]->setRowCount(1, $this->_colCount); |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @return boolean |
| 70 | 70 | */ |
| 71 | 71 | public function hasPart($key) { |
| 72 | - return \array_key_exists($key, $this->content) === true; |
|
| 72 | + return \array_key_exists($key, $this->content)===true; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | private function colAlign($colIndex, $function) { |
| 176 | 176 | if (\is_array($colIndex)) { |
| 177 | - foreach ( $colIndex as $cIndex ) { |
|
| 177 | + foreach ($colIndex as $cIndex) { |
|
| 178 | 178 | $this->colAlign($cIndex, $function); |
| 179 | 179 | } |
| 180 | 180 | } else { |
@@ -192,8 +192,8 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | public function setBasic($very=false) { |
| 194 | 194 | if ($very) |
| 195 | - $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 196 | - return $this->addToPropertyCtrl("class", "basic", array ("basic" )); |
|
| 195 | + $this->addToPropertyCtrl("class", "very", array("very")); |
|
| 196 | + return $this->addToPropertyCtrl("class", "basic", array("basic")); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | public function setCollapsing() { |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 255 | 255 | */ |
| 256 | 256 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 257 | - $this->content=JArray::sortAssociative($this->content, [ "thead","tbody","tfoot" ]); |
|
| 257 | + $this->content=JArray::sortAssociative($this->content, ["thead", "tbody", "tfoot"]); |
|
| 258 | 258 | if ($this->propertyContains("class", "sortable")) { |
| 259 | - $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort();"); |
|
| 259 | + $this->addEvent("execute", "$('#".$this->identifier."').tablesort();"); |
|
| 260 | 260 | } |
| 261 | 261 | return parent::compile($js, $view); |
| 262 | 262 | } |
@@ -191,8 +191,9 @@ |
||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | public function setBasic($very=false) { |
| 194 | - if ($very) |
|
| 195 | - $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 194 | + if ($very) { |
|
| 195 | + $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 196 | + } |
|
| 196 | 197 | return $this->addToPropertyCtrl("class", "basic", array ("basic" )); |
| 197 | 198 | } |
| 198 | 199 | |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
| 6 | 6 | use Ajax\JsUtils; |
| 7 | 7 | use Ajax\service\JArray; |
| 8 | - |
|
| 9 | 8 | use Ajax\semantic\html\base\constants\State; |
| 10 | 9 | |
| 11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * Sets the menu type |
| 35 | 35 | * @param string $type one of text,item |
| 36 | - * @return \Ajax\semantic\html\collections\HtmlMenu |
|
| 36 | + * @return HtmlMenu |
|
| 37 | 37 | */ |
| 38 | 38 | public function setType($type="") { |
| 39 | 39 | return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
@@ -81,6 +81,7 @@ discard block |
||
| 81 | 81 | * {@inheritDoc} |
| 82 | 82 | * |
| 83 | 83 | * @see \Ajax\common\html\HtmlCollection::insertItem() |
| 84 | + * @param HtmlIcon $item |
|
| 84 | 85 | */ |
| 85 | 86 | public function insertItem($item, $position=0) { |
| 86 | 87 | $item=parent::insertItem($this->getItemToInsert($item), $position); |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | * @return \Ajax\semantic\html\collections\HtmlMenu |
| 39 | 39 | */ |
| 40 | 40 | public function setType($type="") { |
| 41 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
| 41 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function setActiveItem($index) { |
| 45 | 45 | $item=$this->getItem($index); |
| 46 | - if ($item !== null) { |
|
| 46 | + if ($item!==null) { |
|
| 47 | 47 | $item->addToProperty("class", "active"); |
| 48 | 48 | } |
| 49 | 49 | return $this; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | private function getItemToInsert($item) { |
| 53 | 53 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButton || ($item instanceof HtmlDropdown && $this->propertyContains("class", "vertical")===false)) { |
| 54 | - $itemO=new HtmlMenuItem("item-" . $this->identifier, $item); |
|
| 54 | + $itemO=new HtmlMenuItem("item-".$this->identifier, $item); |
|
| 55 | 55 | $item=$itemO; |
| 56 | 56 | } |
| 57 | 57 | return $item; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | private function afterInsert($item) { |
| 61 | 61 | if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) |
| 62 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 62 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
| 63 | 63 | else { |
| 64 | 64 | $this->setSecondary(); |
| 65 | 65 | } |
@@ -90,15 +90,15 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | public function generateMenuAsItem($menu, $header=null) { |
| 92 | 92 | $count=$this->count(); |
| 93 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
| 93 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
| 94 | 94 | if (isset($header)) { |
| 95 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
| 95 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
| 96 | 96 | $headerItem->setContent($header); |
| 97 | 97 | $item->addContent($headerItem); |
| 98 | 98 | $this->_itemHeader=$headerItem; |
| 99 | 99 | } |
| 100 | - if(\is_array($menu)){ |
|
| 101 | - $menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu); |
|
| 100 | + if (\is_array($menu)) { |
|
| 101 | + $menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu); |
|
| 102 | 102 | } |
| 103 | 103 | $menu->setClass("menu"); |
| 104 | 104 | $item->addContent($menu); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
| 114 | 114 | $value->addContent(new HtmlIcon("", "dropdown")); |
| 115 | 115 | $value=$this->addItem($value); |
| 116 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
| 116 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
| 117 | 117 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
| 118 | 118 | $this->wrap("", $popup); |
| 119 | 119 | return $popup; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | public function addDropdownAsItem($value, $items=NULL) { |
| 123 | 123 | $dd=$value; |
| 124 | 124 | if (\is_string($value)) { |
| 125 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
| 125 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
| 126 | 126 | } |
| 127 | 127 | $this->addItem($dd); |
| 128 | 128 | return $dd; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 136 | 136 | */ |
| 137 | 137 | protected function createItem($value) { |
| 138 | - $itemO=new HtmlMenuItem($this->identifier."item" . \sizeof($this->content),""); |
|
| 138 | + $itemO=new HtmlMenuItem($this->identifier."item".\sizeof($this->content), ""); |
|
| 139 | 139 | $itemO->setTagName("a"); |
| 140 | 140 | $itemO->setContent($value); |
| 141 | 141 | return $itemO; |
@@ -146,35 +146,35 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | public function setSecondary($value=true) { |
| 149 | - if($value) |
|
| 149 | + if ($value) |
|
| 150 | 150 | $this->addToProperty("class", "secondary"); |
| 151 | 151 | else |
| 152 | 152 | $this->removePropertyValue("class", "secondary"); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | public function setVertical() { |
| 156 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
| 156 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | public function setPosition($value="right") { |
| 160 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
| 160 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | public function setPointing($value=Direction::NONE) { |
| 164 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
| 164 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | public function asTab($vertical=false) { |
| 168 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 168 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
| 169 | 169 | $item->setTagName("a"); |
| 170 | 170 | }); |
| 171 | - if ($vertical === true) |
|
| 171 | + if ($vertical===true) |
|
| 172 | 172 | $this->setVertical(); |
| 173 | 173 | return $this->addToProperty("class", "tabular"); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | public function asPagination() { |
| 177 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 177 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
| 178 | 178 | $item->setTagName("a"); |
| 179 | 179 | }); |
| 180 | 180 | return $this->addToProperty("class", "pagination"); |
@@ -211,10 +211,10 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | public function setWidth($width) { |
| 213 | 213 | if (\is_int($width)) { |
| 214 | - $width=Wide::getConstants()["W" . $width]; |
|
| 214 | + $width=Wide::getConstants()["W".$width]; |
|
| 215 | 215 | } |
| 216 | 216 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 217 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 217 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | public function addImage($identifier, $src="", $alt="") { |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | private function afterInsert($item) { |
| 61 | - if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) |
|
| 62 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 63 | - else { |
|
| 61 | + if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) { |
|
| 62 | + $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 63 | + } else { |
|
| 64 | 64 | $this->setSecondary(); |
| 65 | 65 | } |
| 66 | 66 | return $item; |
@@ -146,10 +146,11 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | public function setSecondary($value=true) { |
| 149 | - if($value) |
|
| 150 | - $this->addToProperty("class", "secondary"); |
|
| 151 | - else |
|
| 152 | - $this->removePropertyValue("class", "secondary"); |
|
| 149 | + if($value) { |
|
| 150 | + $this->addToProperty("class", "secondary"); |
|
| 151 | + } else { |
|
| 152 | + $this->removePropertyValue("class", "secondary"); |
|
| 153 | + } |
|
| 153 | 154 | } |
| 154 | 155 | |
| 155 | 156 | public function setVertical() { |
@@ -168,8 +169,9 @@ discard block |
||
| 168 | 169 | $this->apply(function (HtmlDoubleElement &$item) { |
| 169 | 170 | $item->setTagName("a"); |
| 170 | 171 | }); |
| 171 | - if ($vertical === true) |
|
| 172 | - $this->setVertical(); |
|
| 172 | + if ($vertical === true) { |
|
| 173 | + $this->setVertical(); |
|
| 174 | + } |
|
| 173 | 175 | return $this->addToProperty("class", "tabular"); |
| 174 | 176 | } |
| 175 | 177 | |
@@ -198,10 +200,11 @@ discard block |
||
| 198 | 200 | */ |
| 199 | 201 | public function fromDatabaseObject($object, $function) { |
| 200 | 202 | $return=$function($object); |
| 201 | - if (\is_array($return)) |
|
| 202 | - $this->addItems($return); |
|
| 203 | - else |
|
| 204 | - $this->addItem($return); |
|
| 203 | + if (\is_array($return)) { |
|
| 204 | + $this->addItems($return); |
|
| 205 | + } else { |
|
| 206 | + $this->addItem($return); |
|
| 207 | + } |
|
| 205 | 208 | } |
| 206 | 209 | |
| 207 | 210 | /** |
@@ -11,6 +11,9 @@ |
||
| 11 | 11 | |
| 12 | 12 | abstract class HtmlAbsractItem extends HtmlSemDoubleElement { |
| 13 | 13 | |
| 14 | + /** |
|
| 15 | + * @param string $baseClass |
|
| 16 | + */ |
|
| 14 | 17 | public function __construct($identifier, $baseClass,$content=NULL) { |
| 15 | 18 | parent::__construct($identifier, "div", $baseClass); |
| 16 | 19 | $this->content=array(); |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
| 6 | 6 | use Ajax\JsUtils; |
| 7 | 7 | use Ajax\service\JArray; |
| 8 | - |
|
| 9 | 8 | use Ajax\semantic\html\base\constants\State; |
| 10 | 9 | |
| 11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | abstract class HtmlAbsractItem extends HtmlSemDoubleElement { |
| 13 | 13 | |
| 14 | - public function __construct($identifier, $baseClass,$content=NULL) { |
|
| 14 | + public function __construct($identifier, $baseClass, $content=NULL) { |
|
| 15 | 15 | parent::__construct($identifier, "div", $baseClass); |
| 16 | 16 | $this->content=array(); |
| 17 | 17 | $this->initContent($content); |
@@ -19,53 +19,53 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | protected abstract function initContent($content); |
| 21 | 21 | |
| 22 | - public function setIcon($icon){ |
|
| 22 | + public function setIcon($icon) { |
|
| 23 | 23 | $this->content["icon"]=new HtmlIcon("icon-".$this->identifier, $icon); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function setImage($image){ |
|
| 26 | + public function setImage($image) { |
|
| 27 | 27 | $image=new HtmlImg("icon-".$this->identifier, $image); |
| 28 | 28 | $image->asAvatar(); |
| 29 | 29 | $this->content["image"]=$image; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - private function createContent(){ |
|
| 33 | - $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier,"div","content"); |
|
| 32 | + private function createContent() { |
|
| 33 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content"); |
|
| 34 | 34 | return $this->content["content"]; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function setTitle($title,$description=NULL,$baseClass="title"){ |
|
| 38 | - $title=new HtmlSemDoubleElement("","div",$baseClass,$title); |
|
| 39 | - if(\array_key_exists("content", $this->content)===false){ |
|
| 37 | + public function setTitle($title, $description=NULL, $baseClass="title") { |
|
| 38 | + $title=new HtmlSemDoubleElement("", "div", $baseClass, $title); |
|
| 39 | + if (\array_key_exists("content", $this->content)===false) { |
|
| 40 | 40 | $this->createContent(); |
| 41 | 41 | } |
| 42 | 42 | $this->content["content"]->addContent($title); |
| 43 | - if(isset($description)){ |
|
| 44 | - $description=new HtmlSemDoubleElement("","div","description",$description); |
|
| 43 | + if (isset($description)) { |
|
| 44 | + $description=new HtmlSemDoubleElement("", "div", "description", $description); |
|
| 45 | 45 | $this->content["content"]->addContent($description); |
| 46 | 46 | } |
| 47 | 47 | return $this; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function getPart($partName="header"){ |
|
| 51 | - $content=\array_merge($this->content["content"]->getContent(),array(@$this->content["icon"],@$this->content["image"])); |
|
| 50 | + public function getPart($partName="header") { |
|
| 51 | + $content=\array_merge($this->content["content"]->getContent(), array(@$this->content["icon"], @$this->content["image"])); |
|
| 52 | 52 | return $this->getElementByPropertyValue("class", $partName, $content); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function setActive($value=true){ |
|
| 56 | - if($value){ |
|
| 55 | + public function setActive($value=true) { |
|
| 56 | + if ($value) { |
|
| 57 | 57 | $this->setTagName("div"); |
| 58 | 58 | $this->removeProperty("href"); |
| 59 | 59 | $this->addToPropertyCtrl("class", "active", array("active")); |
| 60 | - }else{ |
|
| 60 | + } else { |
|
| 61 | 61 | $this->removePropertyValue("class", "active"); |
| 62 | 62 | } |
| 63 | 63 | return $this; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public function asLink($href=NULL,$part=NULL){ |
|
| 66 | + public function asLink($href=NULL, $part=NULL) { |
|
| 67 | 67 | $this->setTagName("a"); |
| 68 | - if(isset($href)) |
|
| 68 | + if (isset($href)) |
|
| 69 | 69 | $this->setProperty("href", $href); |
| 70 | 70 | return $this; |
| 71 | 71 | } |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 78 | 78 | */ |
| 79 | 79 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 80 | - if(\is_array($this->content)) |
|
| 81 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 80 | + if (\is_array($this->content)) |
|
| 81 | + $this->content=JArray::sortAssociative($this->content, ["icon", "image", "content"]); |
|
| 82 | 82 | return parent::compile($js, $view); |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | \ No newline at end of file |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $this->setTagName("div"); |
| 58 | 58 | $this->removeProperty("href"); |
| 59 | 59 | $this->addToPropertyCtrl("class", "active", array("active")); |
| 60 | - }else{ |
|
| 60 | + } else{ |
|
| 61 | 61 | $this->removePropertyValue("class", "active"); |
| 62 | 62 | } |
| 63 | 63 | return $this; |
@@ -65,8 +65,9 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function asLink($href=NULL,$part=NULL){ |
| 67 | 67 | $this->setTagName("a"); |
| 68 | - if(isset($href)) |
|
| 69 | - $this->setProperty("href", $href); |
|
| 68 | + if(isset($href)) { |
|
| 69 | + $this->setProperty("href", $href); |
|
| 70 | + } |
|
| 70 | 71 | return $this; |
| 71 | 72 | } |
| 72 | 73 | |
@@ -77,8 +78,9 @@ discard block |
||
| 77 | 78 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 78 | 79 | */ |
| 79 | 80 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 80 | - if(\is_array($this->content)) |
|
| 81 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 81 | + if(\is_array($this->content)) { |
|
| 82 | + $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 83 | + } |
|
| 82 | 84 | return parent::compile($js, $view); |
| 83 | 85 | } |
| 84 | 86 | } |
| 85 | 87 | \ No newline at end of file |
@@ -22,6 +22,9 @@ discard block |
||
| 22 | 22 | private $_colSize; |
| 23 | 23 | private $_implicite=false; |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param string $identifier |
|
| 27 | + */ |
|
| 25 | 28 | public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
| 26 | 29 | parent::__construct( $identifier,"div","row"); |
| 27 | 30 | $this->_implicite=$implicite; |
@@ -55,7 +58,7 @@ discard block |
||
| 55 | 58 | /** |
| 56 | 59 | * return the col at $index |
| 57 | 60 | * @param int $index |
| 58 | - * @return \Ajax\semantic\html\collections\HtmlGridCol |
|
| 61 | + * @return \Ajax\common\html\HtmlDoubleElement |
|
| 59 | 62 | */ |
| 60 | 63 | public function getCol($index){ |
| 61 | 64 | return $this->getItem($index); |
@@ -16,24 +16,24 @@ discard block |
||
| 16 | 16 | * @author jc |
| 17 | 17 | * @version 1.001 |
| 18 | 18 | */ |
| 19 | -class HtmlGridRow extends HtmlSemCollection{ |
|
| 19 | +class HtmlGridRow extends HtmlSemCollection { |
|
| 20 | 20 | use TextAlignmentTrait; |
| 21 | 21 | |
| 22 | 22 | private $_colSize; |
| 23 | 23 | private $_implicite=false; |
| 24 | 24 | |
| 25 | - public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
|
| 26 | - parent::__construct( $identifier,"div","row"); |
|
| 25 | + public function __construct($identifier, $numCols=NULL, $colSizing=false, $implicite=false) { |
|
| 26 | + parent::__construct($identifier, "div", "row"); |
|
| 27 | 27 | $this->_implicite=$implicite; |
| 28 | 28 | $width=null; |
| 29 | - if(isset($numCols)){ |
|
| 30 | - $numCols=min(16,$numCols); |
|
| 31 | - $numCols=max(1,$numCols); |
|
| 32 | - if($colSizing) |
|
| 29 | + if (isset($numCols)) { |
|
| 30 | + $numCols=min(16, $numCols); |
|
| 31 | + $numCols=max(1, $numCols); |
|
| 32 | + if ($colSizing) |
|
| 33 | 33 | $width=(int)(16/$numCols); |
| 34 | 34 | else |
| 35 | 35 | $this->_colSize=16/$numCols; |
| 36 | - for ($i=0;$i<$numCols;$i++){ |
|
| 36 | + for ($i=0; $i<$numCols; $i++) { |
|
| 37 | 37 | $this->addItem($width); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | * @param int $width |
| 45 | 45 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 46 | 46 | */ |
| 47 | - public function setWidth($width){ |
|
| 48 | - if(\is_int($width)){ |
|
| 47 | + public function setWidth($width) { |
|
| 48 | + if (\is_int($width)) { |
|
| 49 | 49 | $width=Wide::getConstants()["W".$width]; |
| 50 | 50 | } |
| 51 | 51 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 52 | - return $this->addToPropertyCtrl("class", "column",array("column")); |
|
| 52 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -57,29 +57,29 @@ discard block |
||
| 57 | 57 | * @param int $index |
| 58 | 58 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 59 | 59 | */ |
| 60 | - public function getCol($index){ |
|
| 60 | + public function getCol($index) { |
|
| 61 | 61 | return $this->getItem($index); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function setColsCount($colsCount,$toCreate=true){ |
|
| 64 | + public function setColsCount($colsCount, $toCreate=true) { |
|
| 65 | 65 | $this->setWidth($colsCount); |
| 66 | - if($toCreate===true){ |
|
| 66 | + if ($toCreate===true) { |
|
| 67 | 67 | $count=$this->count(); |
| 68 | - for($i=$count;$i<$colsCount;$i++){ |
|
| 68 | + for ($i=$count; $i<$colsCount; $i++) { |
|
| 69 | 69 | $this->addItem(null); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | return $this; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function addCols($colCount){ |
|
| 76 | - for($i=0;$i<$colCount;$i++){ |
|
| 75 | + public function addCols($colCount) { |
|
| 76 | + for ($i=0; $i<$colCount; $i++) { |
|
| 77 | 77 | $this->addItem(null); |
| 78 | 78 | } |
| 79 | 79 | return $this; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function addCol($width=NULL){ |
|
| 82 | + public function addCol($width=NULL) { |
|
| 83 | 83 | return $this->addItem($width); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * stretch the row contents to take up the entire column height |
| 88 | 88 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 89 | 89 | */ |
| 90 | - public function setStretched(){ |
|
| 90 | + public function setStretched() { |
|
| 91 | 91 | return $this->addToProperty("class", "stretched"); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -95,19 +95,19 @@ discard block |
||
| 95 | 95 | * @param string $color |
| 96 | 96 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 97 | 97 | */ |
| 98 | - public function setColor($color){ |
|
| 99 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
| 98 | + public function setColor($color) { |
|
| 99 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function setValues($values,$force=false){ |
|
| 102 | + public function setValues($values, $force=false) { |
|
| 103 | 103 | $count=$this->count(); |
| 104 | - if($force===true){ |
|
| 105 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
| 106 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
| 104 | + if ($force===true) { |
|
| 105 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
| 106 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | - $count=\min(array($this->count(),\sizeof($values))); |
|
| 110 | - for($i=0;$i<$count;$i++){ |
|
| 109 | + $count=\min(array($this->count(), \sizeof($values))); |
|
| 110 | + for ($i=0; $i<$count; $i++) { |
|
| 111 | 111 | $this->content[$i]->setValue($values[$i]); |
| 112 | 112 | } |
| 113 | 113 | return $this; |
@@ -117,15 +117,15 @@ discard block |
||
| 117 | 117 | * {@inheritDoc} |
| 118 | 118 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 119 | 119 | */ |
| 120 | - protected function createItem($value){ |
|
| 121 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
| 120 | + protected function createItem($value) { |
|
| 121 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
| 122 | 122 | return $col; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 126 | - if($this->_implicite===true){ |
|
| 125 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 126 | + if ($this->_implicite===true) { |
|
| 127 | 127 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
| 128 | 128 | } |
| 129 | - return parent::compile($js,$view); |
|
| 129 | + return parent::compile($js, $view); |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | \ No newline at end of file |
@@ -29,10 +29,11 @@ |
||
| 29 | 29 | if(isset($numCols)){ |
| 30 | 30 | $numCols=min(16,$numCols); |
| 31 | 31 | $numCols=max(1,$numCols); |
| 32 | - if($colSizing) |
|
| 33 | - $width=(int)(16/$numCols); |
|
| 34 | - else |
|
| 35 | - $this->_colSize=16/$numCols; |
|
| 32 | + if($colSizing) { |
|
| 33 | + $width=(int)(16/$numCols); |
|
| 34 | + } else { |
|
| 35 | + $this->_colSize=16/$numCols; |
|
| 36 | + } |
|
| 36 | 37 | for ($i=0;$i<$numCols;$i++){ |
| 37 | 38 | $this->addItem($width); |
| 38 | 39 | } |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
| 6 | 6 | use Ajax\JsUtils; |
| 7 | 7 | use Ajax\service\JArray; |
| 8 | - |
|
| 9 | 8 | use Ajax\semantic\html\base\constants\State; |
| 10 | 9 | |
| 11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |