@@ -17,21 +17,21 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | protected $_paramParts=array(); |
| 19 | 19 | public function __construct($identifier, $content='') { |
| 20 | - parent::__construct($identifier, 'div','ui slider'); |
|
| 20 | + parent::__construct($identifier, 'div', 'ui slider'); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function setLabeled(){ |
|
| 23 | + public function setLabeled() { |
|
| 24 | 24 | return $this->addClass('labeled'); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function setTicked(){ |
|
| 28 | - if(!$this->propertyContains('class', 'labeled')){ |
|
| 27 | + public function setTicked() { |
|
| 28 | + if (!$this->propertyContains('class', 'labeled')) { |
|
| 29 | 29 | $this->addClass('labeled'); |
| 30 | 30 | } |
| 31 | 31 | return $this->addClass('ticked'); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function setLabels($labels){ |
|
| 34 | + public function setLabels($labels) { |
|
| 35 | 35 | $this->_params['interpretLabel']=$labels; |
| 36 | 36 | return $this; |
| 37 | 37 | } |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | * $values is an associative array with keys (min,max,start,end,step,smooth) |
| 41 | 41 | * @param array $values |
| 42 | 42 | */ |
| 43 | - public function asRange($values=NULL){ |
|
| 43 | + public function asRange($values=NULL) { |
|
| 44 | 44 | $this->addClass('range'); |
| 45 | - if(\is_array($values)){ |
|
| 46 | - $this->_params=\array_merge($this->_params,$values); |
|
| 45 | + if (\is_array($values)) { |
|
| 46 | + $this->_params=\array_merge($this->_params, $values); |
|
| 47 | 47 | } |
| 48 | 48 | return $this; |
| 49 | 49 | } |
@@ -52,22 +52,22 @@ discard block |
||
| 52 | 52 | * $values is an associative array with keys (min,max,start,step,smooth) |
| 53 | 53 | * @param array $values |
| 54 | 54 | */ |
| 55 | - public function setValues($values=NULL){ |
|
| 56 | - if(\is_array($values)){ |
|
| 57 | - $this->_params=\array_merge($this->_params,$values); |
|
| 55 | + public function setValues($values=NULL) { |
|
| 56 | + if (\is_array($values)) { |
|
| 57 | + $this->_params=\array_merge($this->_params, $values); |
|
| 58 | 58 | } |
| 59 | 59 | return $this; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function setReversed($value=true){ |
|
| 63 | - if($value){ |
|
| 62 | + public function setReversed($value=true) { |
|
| 63 | + if ($value) { |
|
| 64 | 64 | $this->addClass('reversed'); |
| 65 | 65 | } |
| 66 | 66 | return $this; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function setVertical($value=true){ |
|
| 70 | - if($value){ |
|
| 69 | + public function setVertical($value=true) { |
|
| 70 | + if ($value) { |
|
| 71 | 71 | $this->addClass('vertical'); |
| 72 | 72 | } |
| 73 | 73 | return $this; |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | * @see BaseHtml::run() |
| 79 | 79 | */ |
| 80 | 80 | public function run(JsUtils $js) { |
| 81 | - if(isset($this->_bsComponent)===false){ |
|
| 82 | - $this->_bsComponent=$js->semantic()->slider('#'.$this->identifier,$this->_params,$this->_paramParts); |
|
| 81 | + if (isset($this->_bsComponent)===false) { |
|
| 82 | + $this->_bsComponent=$js->semantic()->slider('#'.$this->identifier, $this->_params, $this->_paramParts); |
|
| 83 | 83 | } |
| 84 | 84 | $this->addEventsOnRun($js); |
| 85 | 85 | return $this->_bsComponent; |
@@ -19,56 +19,56 @@ |
||
| 19 | 19 | $this->uiName='toast'; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public function close(){ |
|
| 22 | + public function close() { |
|
| 23 | 23 | return $this->addBehavior('close'); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function setClass($value){ |
|
| 26 | + public function setClass($value) { |
|
| 27 | 27 | $this->params['class']=$value; |
| 28 | 28 | return $this; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function setCloseIcon(){ |
|
| 31 | + public function setCloseIcon() { |
|
| 32 | 32 | $this->params['closeIcon']=true; |
| 33 | 33 | return $this; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function setShowIcon($value=false){ |
|
| 36 | + public function setShowIcon($value=false) { |
|
| 37 | 37 | $this->params['showIcon']=$value; |
| 38 | 38 | return $this; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function setCloseOnClick($value){ |
|
| 41 | + public function setCloseOnClick($value) { |
|
| 42 | 42 | $this->params['closeOnClick']=$value; |
| 43 | 43 | return $this; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function setTitle($title){ |
|
| 46 | + public function setTitle($title) { |
|
| 47 | 47 | $this->params['title']=$title; |
| 48 | 48 | return $this; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function setMessage($message){ |
|
| 51 | + public function setMessage($message) { |
|
| 52 | 52 | $this->params['message']=$message; |
| 53 | 53 | return $this; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function setPosition($position){ |
|
| 56 | + public function setPosition($position) { |
|
| 57 | 57 | $this->params['position']=$position; |
| 58 | 58 | return $this; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function setDisplayTime($time){ |
|
| 61 | + public function setDisplayTime($time) { |
|
| 62 | 62 | $this->params['displayTime']=$time; |
| 63 | 63 | return $this; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public function setShowProgress($value='top'){ |
|
| 66 | + public function setShowProgress($value='top') { |
|
| 67 | 67 | $this->params['showProgress']=$value; |
| 68 | 68 | return $this; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function setClassProgress($value){ |
|
| 71 | + public function setClassProgress($value) { |
|
| 72 | 72 | $this->params['classProgress']=$value; |
| 73 | 73 | return $this; |
| 74 | 74 | } |
@@ -54,22 +54,22 @@ |
||
| 54 | 54 | * @param string $target |
| 55 | 55 | * @return HtmlEmoji |
| 56 | 56 | */ |
| 57 | - public function asLink($href=NULL,$target=NULL) { |
|
| 57 | + public function asLink($href=NULL, $target=NULL) { |
|
| 58 | 58 | if (isset($href)) { |
| 59 | 59 | $_target=""; |
| 60 | - if(isset($target)) |
|
| 60 | + if (isset($target)) |
|
| 61 | 61 | $_target="target='{$target}'"; |
| 62 | - $this->wrap("<a href='" . $href . "' {$_target}>", "</a>"); |
|
| 62 | + $this->wrap("<a href='".$href."' {$_target}>", "</a>"); |
|
| 63 | 63 | } |
| 64 | 64 | return $this->addToProperty("class", "link"); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | public function addLabel($label, $before=false, $emoji=null) { |
| 68 | - if($before) |
|
| 68 | + if ($before) |
|
| 69 | 69 | $this->wrap($label); |
| 70 | 70 | else |
| 71 | 71 | $this->wrap("", $label); |
| 72 | - if($emoji!=null) |
|
| 72 | + if ($emoji!=null) |
|
| 73 | 73 | $this->setEmoji($emoji); |
| 74 | 74 | return $this; |
| 75 | 75 | } |
@@ -57,20 +57,23 @@ |
||
| 57 | 57 | public function asLink($href=NULL,$target=NULL) { |
| 58 | 58 | if (isset($href)) { |
| 59 | 59 | $_target=""; |
| 60 | - if(isset($target)) |
|
| 61 | - $_target="target='{$target}'"; |
|
| 60 | + if(isset($target)) { |
|
| 61 | + $_target="target='{$target}'"; |
|
| 62 | + } |
|
| 62 | 63 | $this->wrap("<a href='" . $href . "' {$_target}>", "</a>"); |
| 63 | 64 | } |
| 64 | 65 | return $this->addToProperty("class", "link"); |
| 65 | 66 | } |
| 66 | 67 | |
| 67 | 68 | public function addLabel($label, $before=false, $emoji=null) { |
| 68 | - if($before) |
|
| 69 | - $this->wrap($label); |
|
| 70 | - else |
|
| 71 | - $this->wrap("", $label); |
|
| 72 | - if($emoji!=null) |
|
| 73 | - $this->setEmoji($emoji); |
|
| 69 | + if($before) { |
|
| 70 | + $this->wrap($label); |
|
| 71 | + } else { |
|
| 72 | + $this->wrap("", $label); |
|
| 73 | + } |
|
| 74 | + if($emoji!=null) { |
|
| 75 | + $this->setEmoji($emoji); |
|
| 76 | + } |
|
| 74 | 77 | return $this; |
| 75 | 78 | } |
| 76 | 79 | |
@@ -8,23 +8,23 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | protected $image; |
| 10 | 10 | |
| 11 | - public function __construct($identifier, $content = NULL) { |
|
| 11 | + public function __construct($identifier, $content=NULL) { |
|
| 12 | 12 | parent::__construct($identifier, "item", $content); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | protected function initContent($content) { |
| 16 | 16 | if (\is_array($content)) { |
| 17 | - if (JArray::isAssociative($content) === false) { |
|
| 18 | - $icon = $content[0] ?? null; |
|
| 19 | - $title = $content[1] ?? null; |
|
| 20 | - $desc = $content[2] ?? null; |
|
| 17 | + if (JArray::isAssociative($content)===false) { |
|
| 18 | + $icon=$content[0] ?? null; |
|
| 19 | + $title=$content[1] ?? null; |
|
| 20 | + $desc=$content[2] ?? null; |
|
| 21 | 21 | } else { |
| 22 | - $icon = $content["icon"] ?? null; |
|
| 23 | - $image = $content["image"] ?? null; |
|
| 24 | - $title = $content["title"] ?? null; |
|
| 25 | - $header = $content["header"] ?? null; |
|
| 26 | - $desc = $content["description"] ?? null; |
|
| 27 | - $items = $content["items"] ?? null; |
|
| 22 | + $icon=$content["icon"] ?? null; |
|
| 23 | + $image=$content["image"] ?? null; |
|
| 24 | + $title=$content["title"] ?? null; |
|
| 25 | + $header=$content["header"] ?? null; |
|
| 26 | + $desc=$content["description"] ?? null; |
|
| 27 | + $items=$content["items"] ?? null; |
|
| 28 | 28 | } |
| 29 | 29 | if (isset($icon)) { |
| 30 | 30 | $this->setIcon($icon); |
@@ -45,12 +45,12 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function addList($items = array(), $ordered = false) { |
|
| 49 | - $list = new HtmlList("", $items); |
|
| 48 | + public function addList($items=array(), $ordered=false) { |
|
| 49 | + $list=new HtmlList("", $items); |
|
| 50 | 50 | if ($ordered) |
| 51 | 51 | $list->setOrdered(); |
| 52 | 52 | $list->setClass("list"); |
| 53 | - $this->content["list"] = $list; |
|
| 53 | + $this->content["list"]=$list; |
|
| 54 | 54 | return $list; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -47,8 +47,9 @@ |
||
| 47 | 47 | |
| 48 | 48 | public function addList($items = array(), $ordered = false) { |
| 49 | 49 | $list = new HtmlList("", $items); |
| 50 | - if ($ordered) |
|
| 51 | - $list->setOrdered(); |
|
| 50 | + if ($ordered) { |
|
| 51 | + $list->setOrdered(); |
|
| 52 | + } |
|
| 52 | 53 | $list->setClass("list"); |
| 53 | 54 | $this->content["list"] = $list; |
| 54 | 55 | return $list; |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | protected $_placeholder; |
| 11 | 11 | |
| 12 | - public function __construct($identifier, $type = "text", $value = NULL, $placeholder = NULL) { |
|
| 12 | + public function __construct($identifier, $type="text", $value=NULL, $placeholder=NULL) { |
|
| 13 | 13 | parent::__construct($identifier, "input"); |
| 14 | 14 | $this->setProperty("name", $identifier); |
| 15 | 15 | $this->setValue($value); |
@@ -27,23 +27,23 @@ discard block |
||
| 27 | 27 | return $this->setProperty("type", $value); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function forceValue($value = 'true') { |
|
| 31 | - $this->wrap('<input type="hidden" value="false" name="' . $this->identifier . '"/>'); |
|
| 30 | + public function forceValue($value='true') { |
|
| 31 | + $this->wrap('<input type="hidden" value="false" name="'.$this->identifier.'"/>'); |
|
| 32 | 32 | $this->setValue($value); |
| 33 | 33 | return $this; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function setPlaceholder($value) { |
| 37 | 37 | if (JString::isNotNull($value)) |
| 38 | - $this->_placeholder = $value; |
|
| 38 | + $this->_placeholder=$value; |
|
| 39 | 39 | return $this; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
| 43 | - $value = $this->_placeholder; |
|
| 42 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 43 | + $value=$this->_placeholder; |
|
| 44 | 44 | if (JString::isNull($value)) { |
| 45 | 45 | if (JString::isNotNull($this->getProperty("name"))) |
| 46 | - $value = \ucfirst($this->getProperty("name")); |
|
| 46 | + $value=\ucfirst($this->getProperty("name")); |
|
| 47 | 47 | } |
| 48 | 48 | $this->setProperty("placeholder", $value); |
| 49 | 49 | return parent::compile($js, $view); |
@@ -18,8 +18,9 @@ discard block |
||
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function setValue($value) { |
| 21 | - if (isset($value)) |
|
| 22 | - $this->setProperty("value", $value); |
|
| 21 | + if (isset($value)) { |
|
| 22 | + $this->setProperty("value", $value); |
|
| 23 | + } |
|
| 23 | 24 | return $this; |
| 24 | 25 | } |
| 25 | 26 | |
@@ -34,16 +35,18 @@ discard block |
||
| 34 | 35 | } |
| 35 | 36 | |
| 36 | 37 | public function setPlaceholder($value) { |
| 37 | - if (JString::isNotNull($value)) |
|
| 38 | - $this->_placeholder = $value; |
|
| 38 | + if (JString::isNotNull($value)) { |
|
| 39 | + $this->_placeholder = $value; |
|
| 40 | + } |
|
| 39 | 41 | return $this; |
| 40 | 42 | } |
| 41 | 43 | |
| 42 | 44 | public function compile(JsUtils $js = NULL, &$view = NULL) { |
| 43 | 45 | $value = $this->_placeholder; |
| 44 | 46 | if (JString::isNull($value)) { |
| 45 | - if (JString::isNotNull($this->getProperty("name"))) |
|
| 46 | - $value = \ucfirst($this->getProperty("name")); |
|
| 47 | + if (JString::isNotNull($this->getProperty("name"))) { |
|
| 48 | + $value = \ucfirst($this->getProperty("name")); |
|
| 49 | + } |
|
| 47 | 50 | } |
| 48 | 51 | $this->setProperty("placeholder", $value); |
| 49 | 52 | return parent::compile($js, $view); |
@@ -4,64 +4,64 @@ |
||
| 4 | 4 | class JString { |
| 5 | 5 | |
| 6 | 6 | public static function contains($hay, $needle) { |
| 7 | - return strpos($hay, "$needle") !== false; |
|
| 7 | + return strpos($hay, "$needle")!==false; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | public static function startswith($hay, $needle) { |
| 11 | - return substr($hay, 0, strlen($needle)) === $needle; |
|
| 11 | + return substr($hay, 0, strlen($needle))===$needle; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | public static function endswith($hay, $needle) { |
| 15 | - return substr($hay, - strlen($needle)) === $needle; |
|
| 15 | + return substr($hay, - strlen($needle))===$needle; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public static function isNull($s) { |
| 19 | - return (! isset($s) || NULL === $s || "" === $s); |
|
| 19 | + return (!isset($s) || NULL===$s || ""===$s); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public static function isNotNull($s) { |
| 23 | - return (isset($s) && NULL !== $s && "" !== $s); |
|
| 23 | + return (isset($s) && NULL!==$s && ""!==$s); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function isBoolean($value) { |
| 27 | - return \is_bool($value) || $value == 1 || $value == 0; |
|
| 27 | + return \is_bool($value) || $value==1 || $value==0; |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public static function isBooleanTrue($value) { |
| 31 | - return $value == 1 || $value; |
|
| 31 | + return $value==1 || $value; |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public static function isBooleanFalse($value) { |
| 35 | - return $value == 0 || ! $value; |
|
| 35 | + return $value==0 || !$value; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public static function camelCaseToSeparated($input, $separator = " ") { |
|
| 39 | - return strtolower(preg_replace('/(?<!^)[A-Z]/', $separator . '$0', $input)); |
|
| 38 | + public static function camelCaseToSeparated($input, $separator=" ") { |
|
| 39 | + return strtolower(preg_replace('/(?<!^)[A-Z]/', $separator.'$0', $input)); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public static function replaceAtFirst($subject, $from, $to) { |
| 43 | - $from = '/\A' . preg_quote($from, '/') . '/'; |
|
| 43 | + $from='/\A'.preg_quote($from, '/').'/'; |
|
| 44 | 44 | return \preg_replace($from, $to, $subject, 1); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public static function replaceAtLast($subject, $from, $to) { |
| 48 | - $from = '/' . preg_quote($from, '/') . '\z/'; |
|
| 48 | + $from='/'.preg_quote($from, '/').'\z/'; |
|
| 49 | 49 | return \preg_replace($from, $to, $subject, 1); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public static function replaceAtFirstAndLast($subject, $fromFirst, $toFirst, $fromLast, $toLast) { |
| 53 | - $s = self::replaceAtFirst($subject, $fromFirst, $toFirst); |
|
| 53 | + $s=self::replaceAtFirst($subject, $fromFirst, $toFirst); |
|
| 54 | 54 | return self::replaceAtLast($s, $fromLast, $toLast); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public static function getValueBetween(&$str, $before = "{{", $after = "}}") { |
|
| 58 | - $matches = []; |
|
| 59 | - $result = null; |
|
| 60 | - $_before = \preg_quote($before); |
|
| 61 | - $_after = \preg_quote($after); |
|
| 62 | - if (\preg_match('/' . $_before . '(.*?)' . $_after . '/s', $str, $matches) === 1) { |
|
| 63 | - $result = $matches[1]; |
|
| 64 | - $str = \str_replace($before . $result . $after, "", $str); |
|
| 57 | + public static function getValueBetween(&$str, $before="{{", $after="}}") { |
|
| 58 | + $matches=[]; |
|
| 59 | + $result=null; |
|
| 60 | + $_before=\preg_quote($before); |
|
| 61 | + $_after=\preg_quote($after); |
|
| 62 | + if (\preg_match('/'.$_before.'(.*?)'.$_after.'/s', $str, $matches)===1) { |
|
| 63 | + $result=$matches[1]; |
|
| 64 | + $str=\str_replace($before.$result.$after, "", $str); |
|
| 65 | 65 | } |
| 66 | 66 | return $result; |
| 67 | 67 | } |
@@ -67,8 +67,9 @@ |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | public static function doubleBackSlashes($value) { |
| 70 | - if (\is_string($value)) |
|
| 71 | - return \str_replace("\\", "\\\\", $value); |
|
| 70 | + if (\is_string($value)) { |
|
| 71 | + return \str_replace("\\", "\\\\", $value); |
|
| 72 | + } |
|
| 72 | 73 | return $value; |
| 73 | 74 | } |
| 74 | 75 | |
@@ -13,21 +13,21 @@ discard block |
||
| 13 | 13 | use Ajax\semantic\html\elements\html5\HtmlDatalist; |
| 14 | 14 | |
| 15 | 15 | class HtmlInput extends HtmlSemDoubleElement { |
| 16 | - use IconTrait,TextFieldsTrait,FieldTrait; |
|
| 16 | + use IconTrait, TextFieldsTrait, FieldTrait; |
|
| 17 | 17 | |
| 18 | - public function __construct($identifier, $type = "text", $value = "", $placeholder = "") { |
|
| 19 | - parent::__construct("div-" . $identifier, "div", "ui input"); |
|
| 20 | - $this->_identifier = $identifier; |
|
| 21 | - $this->_libraryId = $identifier; |
|
| 22 | - $this->content = [ |
|
| 18 | + public function __construct($identifier, $type="text", $value="", $placeholder="") { |
|
| 19 | + parent::__construct("div-".$identifier, "div", "ui input"); |
|
| 20 | + $this->_identifier=$identifier; |
|
| 21 | + $this->_libraryId=$identifier; |
|
| 22 | + $this->content=[ |
|
| 23 | 23 | "field" => new HtmlInput5($identifier, $type, $value, $placeholder) |
| 24 | 24 | ]; |
| 25 | - $this->_states = [ |
|
| 25 | + $this->_states=[ |
|
| 26 | 26 | State::DISABLED, |
| 27 | 27 | State::FOCUS, |
| 28 | 28 | State::ERROR |
| 29 | 29 | ]; |
| 30 | - $this->_variations = [ |
|
| 30 | + $this->_variations=[ |
|
| 31 | 31 | Variation::TRANSPARENT |
| 32 | 32 | ]; |
| 33 | 33 | } |
@@ -40,16 +40,16 @@ discard block |
||
| 40 | 40 | return $this->content["field"]; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public static function outline($identifier, $icon, $value = "", $placeholder = "") { |
|
| 44 | - $result = new HtmlInput($identifier, "text", $value, $placeholder); |
|
| 43 | + public static function outline($identifier, $icon, $value="", $placeholder="") { |
|
| 44 | + $result=new HtmlInput($identifier, "text", $value, $placeholder); |
|
| 45 | 45 | $result->addToProperty("class", "transparent"); |
| 46 | 46 | $result->addIcon($icon)->setOutline(); |
| 47 | 47 | return $result; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function run(JsUtils $js) { |
| 51 | - $result = parent::run($js); |
|
| 52 | - $result->attach("#" . $this->getDataField() |
|
| 51 | + $result=parent::run($js); |
|
| 52 | + $result->attach("#".$this->getDataField() |
|
| 53 | 53 | ->getIdentifier()); |
| 54 | 54 | return $result; |
| 55 | 55 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | return $this->addToProperty("class", "transparent"); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function compile_once(\Ajax\JsUtils $js = NULL, &$view = NULL) { |
|
| 61 | + public function compile_once(\Ajax\JsUtils $js=NULL, &$view=NULL) { |
|
| 62 | 62 | parent::compile_once($js, $view); |
| 63 | 63 | if (isset($this->content['file'])) { |
| 64 | 64 | $this->onCreate(Javascript::fileUploadBehavior($this->identifier)); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | public function addDataList($items) { |
| 69 | - $dl = new HtmlDatalist('list-' . $this->identifier); |
|
| 69 | + $dl=new HtmlDatalist('list-'.$this->identifier); |
|
| 70 | 70 | $dl->addItems($items); |
| 71 | 71 | $this->getDataField()->setProperty('list', $dl->getIdentifier()); |
| 72 | 72 | $this->getDataField()->wrap($dl); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | protected function createItem($value) { |
| 14 | - $elm = new HtmlDoubleElement("", "option"); |
|
| 14 | + $elm=new HtmlDoubleElement("", "option"); |
|
| 15 | 15 | $elm->setProperty("value", $value); |
| 16 | 16 | $elm->setContent($value); |
| 17 | 17 | return $elm; |
@@ -10,9 +10,9 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | trait TableTrait { |
| 12 | 12 | |
| 13 | - abstract public function addEvent($event, $jsCode, $stopPropagation = false, $preventDefault = false); |
|
| 13 | + abstract public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false); |
|
| 14 | 14 | |
| 15 | - abstract public function getOn($event, $url, $responseElement = "", $parameters = array()); |
|
| 15 | + abstract public function getOn($event, $url, $responseElement="", $parameters=array()); |
|
| 16 | 16 | |
| 17 | 17 | protected function addToPropertyTable($property, $value) { |
| 18 | 18 | return $this->_self->addToProperty($property, $value); |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | return $this->addToPropertyTable("class", "celled"); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function setBasic($very = false) { |
|
| 26 | - $table = $this->_self; |
|
| 25 | + public function setBasic($very=false) { |
|
| 26 | + $table=$this->_self; |
|
| 27 | 27 | if ($very) |
| 28 | 28 | $table->addToPropertyCtrl("class", "very", array( |
| 29 | 29 | "very" |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | )); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function setCompact($very = false) { |
|
| 37 | - $table = $this->_self; |
|
| 36 | + public function setCompact($very=false) { |
|
| 37 | + $table=$this->_self; |
|
| 38 | 38 | if ($very) |
| 39 | 39 | $table->addToPropertyCtrl("class", "very", array( |
| 40 | 40 | "very" |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | return $this->addToPropertyTable("class", "structured"); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function setSortable($colIndex = NULL) { |
|
| 60 | - $table = $this->_self; |
|
| 59 | + public function setSortable($colIndex=NULL) { |
|
| 60 | + $table=$this->_self; |
|
| 61 | 61 | if (isset($colIndex) && $table->hasPart("thead")) { |
| 62 | 62 | $table->getHeader()->sort($colIndex); |
| 63 | 63 | } |
@@ -80,29 +80,29 @@ discard block |
||
| 80 | 80 | return $this->addToPropertyTable("class", "striped"); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function onRowClick($jsCode, $stopPropagation = false, $preventDefault = false) { |
|
| 83 | + public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false) { |
|
| 84 | 84 | return $this->onRow("click", $jsCode, $stopPropagation, $preventDefault); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public function onRow($event, $jsCode, $stopPropagation = false, $preventDefault = false) { |
|
| 88 | - return $this->_self->addEvent($event . "{{tbody tr}}", $jsCode, $stopPropagation, $preventDefault); |
|
| 87 | + public function onRow($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
| 88 | + return $this->_self->addEvent($event."{{tbody tr}}", $jsCode, $stopPropagation, $preventDefault); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function getOnRow($event, $url, $responseElement = "", $parameters = array()) { |
|
| 92 | - $jsCondition = '!$(this).closest("tr").hasClass("active")'; |
|
| 91 | + public function getOnRow($event, $url, $responseElement="", $parameters=array()) { |
|
| 92 | + $jsCondition='!$(this).closest("tr").hasClass("active")'; |
|
| 93 | 93 | if (isset($parameters['jsCondition'])) { |
| 94 | - $jsCondition = '(' . $parameters['jsCondition'] . ' && ' . $jsCondition . ')'; |
|
| 94 | + $jsCondition='('.$parameters['jsCondition'].' && '.$jsCondition.')'; |
|
| 95 | 95 | } |
| 96 | - $parameters = \array_merge($parameters, [ |
|
| 96 | + $parameters=\array_merge($parameters, [ |
|
| 97 | 97 | "stopPropagation" => false, |
| 98 | 98 | "preventDefault" => false, |
| 99 | 99 | "jsCondition" => $jsCondition |
| 100 | 100 | ]); |
| 101 | - $selector = "tbody tr"; |
|
| 101 | + $selector="tbody tr"; |
|
| 102 | 102 | if (isset($parameters["selector"])) { |
| 103 | - $selector = $parameters["selector"]; |
|
| 103 | + $selector=$parameters["selector"]; |
|
| 104 | 104 | } |
| 105 | - return $this->_self->getOn($event . "{{" . $selector . "}}", $url, $responseElement, $parameters); |
|
| 105 | + return $this->_self->getOn($event."{{".$selector."}}", $url, $responseElement, $parameters); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | public function onPageChange($jsCode) { |
@@ -119,10 +119,10 @@ discard block |
||
| 119 | 119 | return $this->_self->getBsComponent()->getScript(); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - public function addEventsOnRun(JsUtils $js = NULL) { |
|
| 123 | - $script = parent::addEventsOnRun($js); |
|
| 124 | - $innerScript = $this->_self->getInnerScript(); |
|
| 125 | - if (! isset($innerScript)) { |
|
| 122 | + public function addEventsOnRun(JsUtils $js=NULL) { |
|
| 123 | + $script=parent::addEventsOnRun($js); |
|
| 124 | + $innerScript=$this->_self->getInnerScript(); |
|
| 125 | + if (!isset($innerScript)) { |
|
| 126 | 126 | $this->_self->setInnerScript($script); |
| 127 | 127 | } |
| 128 | 128 | return $script; |
@@ -24,10 +24,11 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public function setBasic($very = false) { |
| 26 | 26 | $table = $this->_self; |
| 27 | - if ($very) |
|
| 28 | - $table->addToPropertyCtrl("class", "very", array( |
|
| 27 | + if ($very) { |
|
| 28 | + $table->addToPropertyCtrl("class", "very", array( |
|
| 29 | 29 | "very" |
| 30 | 30 | )); |
| 31 | + } |
|
| 31 | 32 | return $table->addToPropertyCtrl("class", "basic", array( |
| 32 | 33 | "basic" |
| 33 | 34 | )); |
@@ -35,10 +36,11 @@ discard block |
||
| 35 | 36 | |
| 36 | 37 | public function setCompact($very = false) { |
| 37 | 38 | $table = $this->_self; |
| 38 | - if ($very) |
|
| 39 | - $table->addToPropertyCtrl("class", "very", array( |
|
| 39 | + if ($very) { |
|
| 40 | + $table->addToPropertyCtrl("class", "very", array( |
|
| 40 | 41 | "very" |
| 41 | 42 | )); |
| 43 | + } |
|
| 42 | 44 | return $table->addToPropertyCtrl("class", "compact", array( |
| 43 | 45 | "compact" |
| 44 | 46 | )); |