@@ -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; |
@@ -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 | )); |
@@ -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,30 +80,30 @@ 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 | - $activeClass = $this->_self->getActiveRowClass(); |
|
| 93 | - $jsCondition = '(!$(this).closest("tr").hasClass("' . $activeClass . '") || event.target.tagName === "TR")'; |
|
| 91 | + public function getOnRow($event, $url, $responseElement="", $parameters=array()) { |
|
| 92 | + $activeClass=$this->_self->getActiveRowClass(); |
|
| 93 | + $jsCondition='(!$(this).closest("tr").hasClass("'.$activeClass.'") || event.target.tagName === "TR")'; |
|
| 94 | 94 | if (isset($parameters['jsCondition'])) { |
| 95 | - $jsCondition = '(' . $parameters['jsCondition'] . ' && ' . $jsCondition . ')'; |
|
| 95 | + $jsCondition='('.$parameters['jsCondition'].' && '.$jsCondition.')'; |
|
| 96 | 96 | } |
| 97 | - $parameters = \array_merge($parameters, [ |
|
| 97 | + $parameters=\array_merge($parameters, [ |
|
| 98 | 98 | "stopPropagation" => false, |
| 99 | 99 | "preventDefault" => false, |
| 100 | 100 | "jsCondition" => $jsCondition |
| 101 | 101 | ]); |
| 102 | - $selector = "tbody tr"; |
|
| 102 | + $selector="tbody tr"; |
|
| 103 | 103 | if (isset($parameters["selector"])) { |
| 104 | - $selector = $parameters["selector"]; |
|
| 104 | + $selector=$parameters["selector"]; |
|
| 105 | 105 | } |
| 106 | - return $this->_self->getOn($event . "{{" . $selector . "}}", $url, $responseElement, $parameters); |
|
| 106 | + return $this->_self->getOn($event."{{".$selector."}}", $url, $responseElement, $parameters); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | public function onPageChange($jsCode) { |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | return $this->_self->getBsComponent()->getScript(); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function addEventsOnRun(JsUtils $js = NULL) { |
|
| 124 | - $script = parent::addEventsOnRun($js); |
|
| 125 | - $innerScript = $this->_self->getInnerScript(); |
|
| 126 | - if (! isset($innerScript)) { |
|
| 123 | + public function addEventsOnRun(JsUtils $js=NULL) { |
|
| 124 | + $script=parent::addEventsOnRun($js); |
|
| 125 | + $innerScript=$this->_self->getInnerScript(); |
|
| 126 | + if (!isset($innerScript)) { |
|
| 127 | 127 | $this->_self->setInnerScript($script); |
| 128 | 128 | } |
| 129 | 129 | return $script; |
@@ -13,9 +13,9 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | protected $_hasCheckedList; |
| 15 | 15 | |
| 16 | - protected $_fireOnInit = false; |
|
| 16 | + protected $_fireOnInit=false; |
|
| 17 | 17 | |
| 18 | - protected $_ckItemChange = ""; |
|
| 18 | + protected $_ckItemChange=""; |
|
| 19 | 19 | |
| 20 | 20 | protected $_maxVisible; |
| 21 | 21 | |
@@ -23,25 +23,25 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | protected $_visibility; |
| 25 | 25 | |
| 26 | - public function __construct($identifier, $items = array()) { |
|
| 26 | + public function __construct($identifier, $items=array()) { |
|
| 27 | 27 | parent::__construct($identifier, "div", "ui list"); |
| 28 | 28 | $this->addItems($items); |
| 29 | - $this->_hasCheckedList = false; |
|
| 29 | + $this->_hasCheckedList=false; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | protected function createItem($value) { |
| 33 | - $count = $this->count(); |
|
| 34 | - $item = new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
| 33 | + $count=$this->count(); |
|
| 34 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
| 35 | 35 | return $item; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function addHeader($niveau, $content) { |
| 39 | - $header = new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
|
| 39 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page"); |
|
| 40 | 40 | $this->wrap($header); |
| 41 | 41 | return $header; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function getItemPart($index, $partName = "header") { |
|
| 44 | + public function getItemPart($index, $partName="header") { |
|
| 45 | 45 | return $this->getItem($index)->getPart($partName); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -49,15 +49,15 @@ discard block |
||
| 49 | 49 | return $this->contentAs($tagName); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function asLinks($hrefs = [], $target = NUll) { |
|
| 52 | + public function asLinks($hrefs=[], $target=NUll) { |
|
| 53 | 53 | $this->addToPropertyCtrl("class", "link", array( |
| 54 | 54 | "link" |
| 55 | 55 | )); |
| 56 | 56 | return parent::asLinks($hrefs, $target); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function addList($items = array()) { |
|
| 60 | - $list = new HtmlList("", $items); |
|
| 59 | + public function addList($items=array()) { |
|
| 60 | + $list=new HtmlList("", $items); |
|
| 61 | 61 | $list->setClass("list"); |
| 62 | 62 | return $this->addItem($list); |
| 63 | 63 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | protected function getItemToAdd($item) { |
| 74 | - $itemO = parent::getItemToAdd($item); |
|
| 74 | + $itemO=parent::getItemToAdd($item); |
|
| 75 | 75 | if ($itemO instanceof AbstractCheckbox) |
| 76 | 76 | $itemO->addClass("item"); |
| 77 | 77 | return $itemO; |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | public function run(JsUtils $js) { |
| 93 | - if ($this->_hasCheckedList === true) { |
|
| 94 | - $jsCode = include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php'; |
|
| 95 | - $jsCode = \str_replace("%identifier%", "#" . $this->identifier, $jsCode); |
|
| 96 | - $jsCode = \str_replace("%fireOnInit%", $this->_fireOnInit, $jsCode); |
|
| 97 | - $jsCode = \str_replace("%onChange%", $this->_ckItemChange, $jsCode); |
|
| 93 | + if ($this->_hasCheckedList===true) { |
|
| 94 | + $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
|
| 95 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
| 96 | + $jsCode=\str_replace("%fireOnInit%", $this->_fireOnInit, $jsCode); |
|
| 97 | + $jsCode=\str_replace("%onChange%", $this->_ckItemChange, $jsCode); |
|
| 98 | 98 | $this->executeOnRun($jsCode); |
| 99 | 99 | } |
| 100 | 100 | /* |
@@ -106,19 +106,19 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | protected function addFollowPoints() { |
| 109 | - $count = $this->count(); |
|
| 110 | - for ($i = $this->_maxVisible; $i < $count; $i ++) { |
|
| 109 | + $count=$this->count(); |
|
| 110 | + for ($i=$this->_maxVisible; $i<$count; $i++) { |
|
| 111 | 111 | $this->getItem($i) |
| 112 | 112 | ->addClass("notVisible") |
| 113 | 113 | ->setProperty("style", "display: none;"); |
| 114 | 114 | } |
| 115 | - $item = $this->addItem("..."); |
|
| 115 | + $item=$this->addItem("..."); |
|
| 116 | 116 | $item->addClass("points"); |
| 117 | - $item->onClick('$(this).hide();$("#' . $this->identifier . ' .notVisible").show();'); |
|
| 117 | + $item->onClick('$(this).hide();$("#'.$this->identifier.' .notVisible").show();'); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | public function onCkItemChange($jsCode) { |
| 121 | - $this->_ckItemChange = $jsCode; |
|
| 121 | + $this->_ckItemChange=$jsCode; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param boolean $fireOnInit |
| 127 | 127 | */ |
| 128 | 128 | public function setFireOnInit($fireOnInit) { |
| 129 | - $this->_fireOnInit = $fireOnInit; |
|
| 129 | + $this->_fireOnInit=$fireOnInit; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | public function setRelaxed() { |
@@ -150,15 +150,15 @@ discard block |
||
| 150 | 150 | * {@inheritdoc} |
| 151 | 151 | * @see \Ajax\common\html\HtmlCollection::compile() |
| 152 | 152 | */ |
| 153 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
| 154 | - if (isset($this->_maxVisible) && $this->_maxVisible < $this->count()) { |
|
| 153 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 154 | + if (isset($this->_maxVisible) && $this->_maxVisible<$this->count()) { |
|
| 155 | 155 | $this->addFollowPoints(); |
| 156 | 156 | if (isset($js)) { |
| 157 | - $visibility = new Visibility($js); |
|
| 158 | - $visibility->attach("#" . $this->identifier); |
|
| 157 | + $visibility=new Visibility($js); |
|
| 158 | + $visibility->attach("#".$this->identifier); |
|
| 159 | 159 | $visibility->setOnTopVisible("$(this).children('.notVisible').hide();$(this).find('.points').show();"); |
| 160 | 160 | $visibility->compile($js, $view); |
| 161 | - $this->_visibility = $visibility; |
|
| 161 | + $this->_visibility=$visibility; |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | return parent::compile($js, $view); |
@@ -173,21 +173,21 @@ discard block |
||
| 173 | 173 | * @param string $notAllChecked |
| 174 | 174 | * @return HtmlList |
| 175 | 175 | */ |
| 176 | - public function addCheckedList($items = array(), $masterItem = NULL, $values = array(), $notAllChecked = false, $name = null) { |
|
| 177 | - $count = $this->count(); |
|
| 178 | - $identifier = $this->identifier . "-" . $count; |
|
| 176 | + public function addCheckedList($items=array(), $masterItem=NULL, $values=array(), $notAllChecked=false, $name=null) { |
|
| 177 | + $count=$this->count(); |
|
| 178 | + $identifier=$this->identifier."-".$count; |
|
| 179 | 179 | if (isset($masterItem)) { |
| 180 | 180 | if (\is_array($masterItem)) { |
| 181 | - $masterO = new HtmlFormCheckbox("master-" . $identifier, @$masterItem[0], @$masterItem[1]); |
|
| 181 | + $masterO=new HtmlFormCheckbox("master-".$identifier, @$masterItem[0], @$masterItem[1]); |
|
| 182 | 182 | if (isset($name)) |
| 183 | 183 | $masterO->setName($name); |
| 184 | 184 | if (isset($masterItem[1])) { |
| 185 | - if (\array_search($masterItem[1], $values) !== false) { |
|
| 185 | + if (\array_search($masterItem[1], $values)!==false) { |
|
| 186 | 186 | $masterO->getDataField()->setProperty("checked", ""); |
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | } else { |
| 190 | - $masterO = new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
|
| 190 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
| 191 | 191 | } |
| 192 | 192 | if ($notAllChecked) { |
| 193 | 193 | $masterO->getDataField()->addClass("_notAllChecked"); |
@@ -196,36 +196,36 @@ discard block |
||
| 196 | 196 | $masterO->setClass("item"); |
| 197 | 197 | $this->addItem($masterO); |
| 198 | 198 | } |
| 199 | - $fields = array(); |
|
| 200 | - $i = 0; |
|
| 201 | - $this->setFireOnInit(UString::getBooleanStr($this->_fireOnInit || count($items) < 30)); |
|
| 199 | + $fields=array(); |
|
| 200 | + $i=0; |
|
| 201 | + $this->setFireOnInit(UString::getBooleanStr($this->_fireOnInit || count($items)<30)); |
|
| 202 | 202 | foreach ($items as $val => $caption) { |
| 203 | - $itemO = new HtmlFormCheckbox($identifier . "-" . $i ++, $caption, $val, "child"); |
|
| 204 | - if (\array_search($val, $values) !== false) { |
|
| 203 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
| 204 | + if (\array_search($val, $values)!==false) { |
|
| 205 | 205 | $itemO->getDataField()->setProperty("checked", ""); |
| 206 | 206 | } |
| 207 | 207 | if (isset($name)) |
| 208 | 208 | $itemO->setName($name); |
| 209 | 209 | $itemO->setClass("item"); |
| 210 | - $fields[] = $itemO; |
|
| 210 | + $fields[]=$itemO; |
|
| 211 | 211 | } |
| 212 | - if (isset($masterO) === true) { |
|
| 213 | - $list = new HtmlList("", $fields); |
|
| 212 | + if (isset($masterO)===true) { |
|
| 213 | + $list=new HtmlList("", $fields); |
|
| 214 | 214 | $list->setClass("list"); |
| 215 | 215 | $masterO->addContent($list); |
| 216 | 216 | } else { |
| 217 | 217 | $this->addList($fields); |
| 218 | 218 | } |
| 219 | - $this->_hasCheckedList = true; |
|
| 219 | + $this->_hasCheckedList=true; |
|
| 220 | 220 | return $this; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | public function setIcons($icons) { |
| 224 | - if (! \is_array($icons)) { |
|
| 225 | - $icons = \array_fill(0, \sizeof($this->content), $icons); |
|
| 224 | + if (!\is_array($icons)) { |
|
| 225 | + $icons=\array_fill(0, \sizeof($this->content), $icons); |
|
| 226 | 226 | } |
| 227 | - $max = \min(\sizeof($icons), \sizeof($this->content)); |
|
| 228 | - for ($i = 0; $i < $max; $i ++) { |
|
| 227 | + $max=\min(\sizeof($icons), \sizeof($this->content)); |
|
| 228 | + for ($i=0; $i<$max; $i++) { |
|
| 229 | 229 | $this->content[$i]->addIcon($icons[$i]); |
| 230 | 230 | } |
| 231 | 231 | return $this; |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * @param mixed $_maxVisible |
| 245 | 245 | */ |
| 246 | 246 | public function setMaxVisible($_maxVisible) { |
| 247 | - $this->_maxVisible = $_maxVisible; |
|
| 247 | + $this->_maxVisible=$_maxVisible; |
|
| 248 | 248 | return $this; |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -72,8 +72,9 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | protected function getItemToAdd($item) { |
| 74 | 74 | $itemO = parent::getItemToAdd($item); |
| 75 | - if ($itemO instanceof AbstractCheckbox) |
|
| 76 | - $itemO->addClass("item"); |
|
| 75 | + if ($itemO instanceof AbstractCheckbox) { |
|
| 76 | + $itemO->addClass("item"); |
|
| 77 | + } |
|
| 77 | 78 | return $itemO; |
| 78 | 79 | } |
| 79 | 80 | |
@@ -179,8 +180,9 @@ discard block |
||
| 179 | 180 | if (isset($masterItem)) { |
| 180 | 181 | if (\is_array($masterItem)) { |
| 181 | 182 | $masterO = new HtmlFormCheckbox("master-" . $identifier, @$masterItem[0], @$masterItem[1]); |
| 182 | - if (isset($name)) |
|
| 183 | - $masterO->setName($name); |
|
| 183 | + if (isset($name)) { |
|
| 184 | + $masterO->setName($name); |
|
| 185 | + } |
|
| 184 | 186 | if (isset($masterItem[1])) { |
| 185 | 187 | if (\array_search($masterItem[1], $values) !== false) { |
| 186 | 188 | $masterO->getDataField()->setProperty("checked", ""); |
@@ -204,8 +206,9 @@ discard block |
||
| 204 | 206 | if (\array_search($val, $values) !== false) { |
| 205 | 207 | $itemO->getDataField()->setProperty("checked", ""); |
| 206 | 208 | } |
| 207 | - if (isset($name)) |
|
| 208 | - $itemO->setName($name); |
|
| 209 | + if (isset($name)) { |
|
| 210 | + $itemO->setName($name); |
|
| 211 | + } |
|
| 209 | 212 | $itemO->setClass("item"); |
| 210 | 213 | $fields[] = $itemO; |
| 211 | 214 | } |
@@ -151,25 +151,29 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | public function getColPosition($colIndex) { |
| 154 | - if ($this->_container->_isMerged() !== true) |
|
| 155 | - return $colIndex; |
|
| 154 | + if ($this->_container->_isMerged() !== true) { |
|
| 155 | + return $colIndex; |
|
| 156 | + } |
|
| 156 | 157 | $pos = 0; |
| 157 | 158 | $rows = $this->_container->getContent(); |
| 158 | 159 | for ($i = 0; $i < $this->_row; $i ++) { |
| 159 | 160 | $max = \min($colIndex, $rows[$i]->count()); |
| 160 | 161 | for ($j = 0; $j < $max; $j ++) { |
| 161 | 162 | $rowspan = $rows[$i]->getItem($j)->getRowspan(); |
| 162 | - if ($rowspan + $i > $this->_row) |
|
| 163 | - $pos ++; |
|
| 163 | + if ($rowspan + $i > $this->_row) { |
|
| 164 | + $pos ++; |
|
| 165 | + } |
|
| 164 | 166 | } |
| 165 | 167 | } |
| 166 | - if ($pos > $colIndex) |
|
| 167 | - return NULL; |
|
| 168 | + if ($pos > $colIndex) { |
|
| 169 | + return NULL; |
|
| 170 | + } |
|
| 168 | 171 | $count = $this->count(); |
| 169 | 172 | for ($i = 0; $i < $count; $i ++) { |
| 170 | 173 | $pos += $this->content[$i]->getColspan(); |
| 171 | - if ($pos >= $colIndex + 1) |
|
| 172 | - return $i; |
|
| 174 | + if ($pos >= $colIndex + 1) { |
|
| 175 | + return $i; |
|
| 176 | + } |
|
| 173 | 177 | } |
| 174 | 178 | return null; |
| 175 | 179 | } |
@@ -192,8 +196,9 @@ discard block |
||
| 192 | 196 | public function containsStr($needle) { |
| 193 | 197 | $cells = $this->content; |
| 194 | 198 | foreach ($cells as $cell) { |
| 195 | - if (\strpos($cell->getContent(), $needle) !== false) |
|
| 196 | - return true; |
|
| 199 | + if (\strpos($cell->getContent(), $needle) !== false) { |
|
| 200 | + return true; |
|
| 201 | + } |
|
| 197 | 202 | } |
| 198 | 203 | return false; |
| 199 | 204 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function __construct($identifier) { |
| 24 | 24 | parent::__construct($identifier, "tr", ""); |
| 25 | - $this->_states = [ |
|
| 25 | + $this->_states=[ |
|
| 26 | 26 | State::ACTIVE, |
| 27 | 27 | State::POSITIVE, |
| 28 | 28 | State::NEGATIVE, |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function setColCount($colCount) { |
| 36 | - $count = $this->count(); |
|
| 37 | - for ($i = $count; $i < $colCount; $i ++) { |
|
| 38 | - $item = $this->addItem(NULL); |
|
| 36 | + $count=$this->count(); |
|
| 37 | + for ($i=$count; $i<$colCount; $i++) { |
|
| 38 | + $item=$this->addItem(NULL); |
|
| 39 | 39 | $item->setTagName($this->_tdTagName); |
| 40 | 40 | } |
| 41 | 41 | return $this; |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 53 | 53 | */ |
| 54 | 54 | protected function createItem($value) { |
| 55 | - $count = $this->count(); |
|
| 56 | - $td = new HtmlTD("", $value, $this->_tdTagName); |
|
| 55 | + $count=$this->count(); |
|
| 56 | + $td=new HtmlTD("", $value, $this->_tdTagName); |
|
| 57 | 57 | $td->setContainer($this->_container, $this->_row, $count); |
| 58 | 58 | return $td; |
| 59 | 59 | } |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | return parent::getItem($index); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function setTdTagName($tagName = "td") { |
|
| 70 | - $this->_tdTagName = $tagName; |
|
| 69 | + public function setTdTagName($tagName="td") { |
|
| 70 | + $this->_tdTagName=$tagName; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | * @param int $row |
| 78 | 78 | */ |
| 79 | 79 | public function setContainer($container, $row) { |
| 80 | - $this->_container = $container; |
|
| 81 | - $this->_row = $row; |
|
| 80 | + $this->_container=$container; |
|
| 81 | + $this->_row=$row; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @param mixed $values |
| 88 | 88 | */ |
| 89 | - public function setValues($values = array()) { |
|
| 90 | - return $this->_addOrSetValues($values, function (HtmlTD &$cell, $value) { |
|
| 89 | + public function setValues($values=array()) { |
|
| 90 | + return $this->_addOrSetValues($values, function(HtmlTD&$cell, $value) { |
|
| 91 | 91 | $cell->setValue($value); |
| 92 | 92 | }); |
| 93 | 93 | } |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | * @param mixed $values |
| 99 | 99 | */ |
| 100 | - public function addValues($values = array()) { |
|
| 101 | - return $this->_addOrSetValues($values, function (HtmlTD &$cell, $value) { |
|
| 100 | + public function addValues($values=array()) { |
|
| 101 | + return $this->_addOrSetValues($values, function(HtmlTD&$cell, $value) { |
|
| 102 | 102 | $cell->addValue($value); |
| 103 | 103 | }); |
| 104 | 104 | } |
@@ -109,18 +109,18 @@ discard block |
||
| 109 | 109 | * @param mixed $values |
| 110 | 110 | */ |
| 111 | 111 | protected function _addOrSetValues($values, $callback) { |
| 112 | - $count = $this->count(); |
|
| 113 | - if (! \is_array($values)) { |
|
| 114 | - $values = \array_fill(0, $count, $values); |
|
| 112 | + $count=$this->count(); |
|
| 113 | + if (!\is_array($values)) { |
|
| 114 | + $values=\array_fill(0, $count, $values); |
|
| 115 | 115 | } else { |
| 116 | - if (JArray::isAssociative($values) === true) { |
|
| 117 | - $values = \array_values($values); |
|
| 116 | + if (JArray::isAssociative($values)===true) { |
|
| 117 | + $values=\array_values($values); |
|
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | - $count = \min(\sizeof($values), $count); |
|
| 120 | + $count=\min(\sizeof($values), $count); |
|
| 121 | 121 | |
| 122 | - for ($i = 0; $i < $count; $i ++) { |
|
| 123 | - $cell = $this->content[$i]; |
|
| 122 | + for ($i=0; $i<$count; $i++) { |
|
| 123 | + $cell=$this->content[$i]; |
|
| 124 | 124 | $callback($cell, $values[$i]); |
| 125 | 125 | } |
| 126 | 126 | return $this; |
@@ -138,12 +138,12 @@ discard block |
||
| 138 | 138 | return $this; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - public function mergeCol($colIndex = 0) { |
|
| 141 | + public function mergeCol($colIndex=0) { |
|
| 142 | 142 | return $this->getItem($colIndex)->mergeCol(); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - public function mergeRow($colIndex = 0) { |
|
| 146 | - $row = $this->getItem($colIndex); |
|
| 145 | + public function mergeRow($colIndex=0) { |
|
| 146 | + $row=$this->getItem($colIndex); |
|
| 147 | 147 | if (isset($row)) { |
| 148 | 148 | $this->getItem($colIndex)->mergeRow(); |
| 149 | 149 | } |
@@ -151,31 +151,31 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | public function getColPosition($colIndex) { |
| 154 | - if ($this->_container->_isMerged() !== true) |
|
| 154 | + if ($this->_container->_isMerged()!==true) |
|
| 155 | 155 | return $colIndex; |
| 156 | - $pos = 0; |
|
| 157 | - $rows = $this->_container->getContent(); |
|
| 158 | - for ($i = 0; $i < $this->_row; $i ++) { |
|
| 159 | - $max = \min($colIndex, $rows[$i]->count()); |
|
| 160 | - for ($j = 0; $j < $max; $j ++) { |
|
| 161 | - $rowspan = $rows[$i]->getItem($j)->getRowspan(); |
|
| 162 | - if ($rowspan + $i > $this->_row) |
|
| 163 | - $pos ++; |
|
| 156 | + $pos=0; |
|
| 157 | + $rows=$this->_container->getContent(); |
|
| 158 | + for ($i=0; $i<$this->_row; $i++) { |
|
| 159 | + $max=\min($colIndex, $rows[$i]->count()); |
|
| 160 | + for ($j=0; $j<$max; $j++) { |
|
| 161 | + $rowspan=$rows[$i]->getItem($j)->getRowspan(); |
|
| 162 | + if ($rowspan+$i>$this->_row) |
|
| 163 | + $pos++; |
|
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | - if ($pos > $colIndex) |
|
| 166 | + if ($pos>$colIndex) |
|
| 167 | 167 | return NULL; |
| 168 | - $count = $this->count(); |
|
| 169 | - for ($i = 0; $i < $count; $i ++) { |
|
| 170 | - $pos += $this->content[$i]->getColspan(); |
|
| 171 | - if ($pos >= $colIndex + 1) |
|
| 168 | + $count=$this->count(); |
|
| 169 | + for ($i=0; $i<$count; $i++) { |
|
| 170 | + $pos+=$this->content[$i]->getColspan(); |
|
| 171 | + if ($pos>=$colIndex+1) |
|
| 172 | 172 | return $i; |
| 173 | 173 | } |
| 174 | 174 | return null; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | public function conditionalCellFormat($callback, $format) { |
| 178 | - $cells = $this->content; |
|
| 178 | + $cells=$this->content; |
|
| 179 | 179 | foreach ($cells as $cell) { |
| 180 | 180 | $cell->conditionalCellFormat($callback, $format); |
| 181 | 181 | } |
@@ -190,9 +190,9 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | public function containsStr($needle) { |
| 193 | - $cells = $this->content; |
|
| 193 | + $cells=$this->content; |
|
| 194 | 194 | foreach ($cells as $cell) { |
| 195 | - if (\strpos($cell->getContent(), $needle) !== false) |
|
| 195 | + if (\strpos($cell->getContent(), $needle)!==false) |
|
| 196 | 196 | return true; |
| 197 | 197 | } |
| 198 | 198 | return false; |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | public function applyCells($callback) { |
| 207 | - $cells = $this->content; |
|
| 207 | + $cells=$this->content; |
|
| 208 | 208 | foreach ($cells as $cell) { |
| 209 | 209 | $cell->apply($callback); |
| 210 | 210 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | public function toRowspanned($colIndex) { |
| 220 | - $cell = $this->getItem($colIndex); |
|
| 220 | + $cell=$this->getItem($colIndex); |
|
| 221 | 221 | $cell->addClass('rowspanned'); |
| 222 | 222 | $cell->setContent(''); |
| 223 | 223 | return $this; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | use Ajax\JsUtils; |
| 12 | 12 | |
| 13 | 13 | class HtmlTD extends HtmlSemDoubleElement { |
| 14 | - use TextAlignmentTrait,TableElementTrait; |
|
| 14 | + use TextAlignmentTrait, TableElementTrait; |
|
| 15 | 15 | |
| 16 | 16 | private $_container; |
| 17 | 17 | |
@@ -19,11 +19,11 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | private $_col; |
| 21 | 21 | |
| 22 | - private $_colMerged = false; |
|
| 22 | + private $_colMerged=false; |
|
| 23 | 23 | |
| 24 | - private $_rowMerged = false; |
|
| 24 | + private $_rowMerged=false; |
|
| 25 | 25 | |
| 26 | - private $_deleted = false; |
|
| 26 | + private $_deleted=false; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | * @param mixed $content |
| 32 | 32 | * @param string $tagName |
| 33 | 33 | */ |
| 34 | - public function __construct($identifier, $content = NULL, $tagName = "td") { |
|
| 34 | + public function __construct($identifier, $content=NULL, $tagName="td") { |
|
| 35 | 35 | parent::__construct($identifier, $tagName, "", $content); |
| 36 | - $this->_variations = [ |
|
| 36 | + $this->_variations=[ |
|
| 37 | 37 | Variation::COLLAPSING |
| 38 | 38 | ]; |
| 39 | - $this->_states = [ |
|
| 39 | + $this->_states=[ |
|
| 40 | 40 | State::ACTIVE, |
| 41 | 41 | State::POSITIVE, |
| 42 | 42 | State::NEGATIVE, |
@@ -47,13 +47,13 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | public function setContainer($container, $row, $col) { |
| 50 | - $this->_container = $container; |
|
| 51 | - $this->_row = $row; |
|
| 52 | - $this->_col = $col; |
|
| 50 | + $this->_container=$container; |
|
| 51 | + $this->_row=$row; |
|
| 52 | + $this->_col=$col; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public function setValue($value) { |
| 56 | - $this->content = $value; |
|
| 56 | + $this->content=$value; |
|
| 57 | 57 | return $this; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public function setRowspan($rowspan) { |
| 66 | - $to = min($this->_container->count(), $this->_row + $rowspan - 1); |
|
| 67 | - for ($i = $to; $i > $this->_row; $i --) { |
|
| 66 | + $to=min($this->_container->count(), $this->_row+$rowspan-1); |
|
| 67 | + for ($i=$to; $i>$this->_row; $i--) { |
|
| 68 | 68 | $this->_container->toDelete($i, $this->_col); |
| 69 | 69 | } |
| 70 | 70 | $this->setProperty("rowspan", $rowspan); |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function setRowspanned($rowspan) { |
| 75 | - $to = min($this->_container->count(), $this->_row + $rowspan - 1); |
|
| 76 | - for ($i = $to; $i > $this->_row; $i --) { |
|
| 75 | + $to=min($this->_container->count(), $this->_row+$rowspan-1); |
|
| 76 | + for ($i=$to; $i>$this->_row; $i--) { |
|
| 77 | 77 | $this->_container->toRowspanned($i, $this->_col); |
| 78 | 78 | } |
| 79 | 79 | $this->setProperty("rowspan", $rowspan); |
@@ -81,16 +81,16 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | public function mergeRow() { |
| 84 | - if (! $this->_rowMerged) { |
|
| 85 | - $this->_rowMerged = true; |
|
| 84 | + if (!$this->_rowMerged) { |
|
| 85 | + $this->_rowMerged=true; |
|
| 86 | 86 | return $this->setRowspan($this->_container->count()); |
| 87 | 87 | } |
| 88 | 88 | return $this->_container; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | public function mergeCol() { |
| 92 | - if (! $this->_colMerged) { |
|
| 93 | - $this->_colMerged = true; |
|
| 92 | + if (!$this->_colMerged) { |
|
| 93 | + $this->_colMerged=true; |
|
| 94 | 94 | return $this->setColspan($this->_container->getRow($this->_row) |
| 95 | 95 | ->count()); |
| 96 | 96 | } |
@@ -98,25 +98,25 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | public function setColspan($colspan) { |
| 101 | - $to = min($this->_container->getRow($this->_row)->count(), $this->_col + $colspan - 1); |
|
| 102 | - for ($i = $to; $i > $this->_col; $i --) { |
|
| 103 | - $this->_container->delete($this->_row, $this->_col + 1); |
|
| 101 | + $to=min($this->_container->getRow($this->_row)->count(), $this->_col+$colspan-1); |
|
| 102 | + for ($i=$to; $i>$this->_col; $i--) { |
|
| 103 | + $this->_container->delete($this->_row, $this->_col+1); |
|
| 104 | 104 | } |
| 105 | 105 | $this->setProperty("colspan", $colspan); |
| 106 | 106 | return $this->_container; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | public function getColspan() { |
| 110 | - $colspan = 1; |
|
| 110 | + $colspan=1; |
|
| 111 | 111 | if (\array_key_exists("colspan", $this->properties)) |
| 112 | - $colspan = $this->getProperty("colspan"); |
|
| 112 | + $colspan=$this->getProperty("colspan"); |
|
| 113 | 113 | return $colspan; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | public function getRowspan() { |
| 117 | - $rowspan = 1; |
|
| 117 | + $rowspan=1; |
|
| 118 | 118 | if (\array_key_exists("rowspan", $this->properties)) |
| 119 | - $rowspan = $this->getProperty("rowspan"); |
|
| 119 | + $rowspan=$this->getProperty("rowspan"); |
|
| 120 | 120 | return $rowspan; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -132,16 +132,16 @@ discard block |
||
| 132 | 132 | return $this; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - public function setSelectable($href = "#") { |
|
| 135 | + public function setSelectable($href="#") { |
|
| 136 | 136 | if (\is_string($this->content)) { |
| 137 | - $this->content = new HtmlLink("", $href, $this->content); |
|
| 137 | + $this->content=new HtmlLink("", $href, $this->content); |
|
| 138 | 138 | } |
| 139 | 139 | return $this->addToProperty("class", "selectable"); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | public function setWidth($width) { |
| 143 | 143 | if (\is_int($width)) { |
| 144 | - $width = Wide::getConstants()["W" . $width]; |
|
| 144 | + $width=Wide::getConstants()["W".$width]; |
|
| 145 | 145 | } |
| 146 | 146 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 147 | 147 | return $this->addToPropertyCtrl("class", "wide", array( |
@@ -150,12 +150,12 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | public function toDelete() { |
| 153 | - $this->_deleted = true; |
|
| 153 | + $this->_deleted=true; |
|
| 154 | 154 | return $this; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
| 158 | - if (! $this->_deleted) |
|
| 157 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 158 | + if (!$this->_deleted) |
|
| 159 | 159 | return parent::compile($js, $view); |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -108,15 +108,17 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | public function getColspan() { |
| 110 | 110 | $colspan = 1; |
| 111 | - if (\array_key_exists("colspan", $this->properties)) |
|
| 112 | - $colspan = $this->getProperty("colspan"); |
|
| 111 | + if (\array_key_exists("colspan", $this->properties)) { |
|
| 112 | + $colspan = $this->getProperty("colspan"); |
|
| 113 | + } |
|
| 113 | 114 | return $colspan; |
| 114 | 115 | } |
| 115 | 116 | |
| 116 | 117 | public function getRowspan() { |
| 117 | 118 | $rowspan = 1; |
| 118 | - if (\array_key_exists("rowspan", $this->properties)) |
|
| 119 | - $rowspan = $this->getProperty("rowspan"); |
|
| 119 | + if (\array_key_exists("rowspan", $this->properties)) { |
|
| 120 | + $rowspan = $this->getProperty("rowspan"); |
|
| 121 | + } |
|
| 120 | 122 | return $rowspan; |
| 121 | 123 | } |
| 122 | 124 | |
@@ -155,7 +157,8 @@ discard block |
||
| 155 | 157 | } |
| 156 | 158 | |
| 157 | 159 | public function compile(JsUtils $js = NULL, &$view = NULL) { |
| 158 | - if (! $this->_deleted) |
|
| 159 | - return parent::compile($js, $view); |
|
| 160 | + if (! $this->_deleted) { |
|
| 161 | + return parent::compile($js, $view); |
|
| 162 | + } |
|
| 160 | 163 | } |
| 161 | 164 | } |
@@ -16,11 +16,11 @@ discard block |
||
| 16 | 16 | class HtmlGridSystem extends HtmlBsDoubleElement { |
| 17 | 17 | private $rows; |
| 18 | 18 | |
| 19 | - public function __construct($identifier,$numRows=1,$numCols=NULL){ |
|
| 20 | - parent::__construct($identifier,"div"); |
|
| 19 | + public function __construct($identifier, $numRows=1, $numCols=NULL) { |
|
| 20 | + parent::__construct($identifier, "div"); |
|
| 21 | 21 | $this->setProperty("class", "container-fluid"); |
| 22 | 22 | $this->rows=array(); |
| 23 | - $this->setNumRows($numRows,$numCols); |
|
| 23 | + $this->setNumRows($numRows, $numCols); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | * @param int $numCols |
| 29 | 29 | * @return \Ajax\bootstrap\html\content\HtmlGridRow |
| 30 | 30 | */ |
| 31 | - public function addRow($numCols=NULL){ |
|
| 32 | - $row=new HtmlGridRow($this->identifier."-row-".(sizeof($this->rows)+1),$numCols); |
|
| 31 | + public function addRow($numCols=NULL) { |
|
| 32 | + $row=new HtmlGridRow($this->identifier."-row-".(sizeof($this->rows)+1), $numCols); |
|
| 33 | 33 | $this->rows[]=$row; |
| 34 | 34 | return $row; |
| 35 | 35 | } |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | * @param boolean $force add the row at $index if true |
| 41 | 41 | * @return \Ajax\bootstrap\html\content\HtmlGridRow |
| 42 | 42 | */ |
| 43 | - public function getRow($index,$force=true){ |
|
| 44 | - if($index<sizeof($this->rows)){ |
|
| 43 | + public function getRow($index, $force=true) { |
|
| 44 | + if ($index<sizeof($this->rows)) { |
|
| 45 | 45 | $result=$this->rows[$index-1]; |
| 46 | - }else if ($force){ |
|
| 46 | + } else if ($force) { |
|
| 47 | 47 | $this->setNumRows($index); |
| 48 | 48 | $result=$this->rows[$index-1]; |
| 49 | 49 | } |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | * @param int $numCols |
| 57 | 57 | * @return \Ajax\bootstrap\html\HtmlGridSystem |
| 58 | 58 | */ |
| 59 | - public function setNumRows($numRows,$numCols=NULL){ |
|
| 60 | - for($i=sizeof($this->rows);$i<$numRows;$i++){ |
|
| 59 | + public function setNumRows($numRows, $numCols=NULL) { |
|
| 60 | + for ($i=sizeof($this->rows); $i<$numRows; $i++) { |
|
| 61 | 61 | $this->addRow($numCols); |
| 62 | 62 | } |
| 63 | 63 | return $this; |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | * @param boolean $force add the cell at $row,$col if true |
| 70 | 70 | * @return HtmlGridCol |
| 71 | 71 | */ |
| 72 | - public function getCell($row,$col,$force=true){ |
|
| 73 | - $row=$this->getRow($row,$force); |
|
| 74 | - if(isset($row)){ |
|
| 75 | - $col=$row->getCol($col,$force); |
|
| 72 | + public function getCell($row, $col, $force=true) { |
|
| 73 | + $row=$this->getRow($row, $force); |
|
| 74 | + if (isset($row)) { |
|
| 75 | + $col=$row->getCol($col, $force); |
|
| 76 | 76 | } |
| 77 | 77 | return $col; |
| 78 | 78 | } |
@@ -82,22 +82,22 @@ discard block |
||
| 82 | 82 | * @param int $col |
| 83 | 83 | * @return HtmlGridCol |
| 84 | 84 | */ |
| 85 | - public function getCellAt($row,$col,$force=true){ |
|
| 86 | - $row=$this->getRow($row,$force); |
|
| 87 | - if(isset($row)){ |
|
| 88 | - $col=$row->getColAt($col,$force); |
|
| 85 | + public function getCellAt($row, $col, $force=true) { |
|
| 86 | + $row=$this->getRow($row, $force); |
|
| 87 | + if (isset($row)) { |
|
| 88 | + $col=$row->getColAt($col, $force); |
|
| 89 | 89 | } |
| 90 | 90 | return $col; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 94 | - foreach ($this->rows as $row){ |
|
| 94 | + foreach ($this->rows as $row) { |
|
| 95 | 95 | $this->addContent($row); |
| 96 | 96 | } |
| 97 | - return parent::compile($js,$view); |
|
| 97 | + return parent::compile($js, $view); |
|
| 98 | 98 | } |
| 99 | - public function setContentForAll($content){ |
|
| 100 | - foreach ($this->rows as $row){ |
|
| 99 | + public function setContentForAll($content) { |
|
| 100 | + foreach ($this->rows as $row) { |
|
| 101 | 101 | $row->setContentForAll($content); |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | public function getRow($index,$force=true){ |
| 44 | 44 | if($index<sizeof($this->rows)){ |
| 45 | 45 | $result=$this->rows[$index-1]; |
| 46 | - }else if ($force){ |
|
| 46 | + } else if ($force){ |
|
| 47 | 47 | $this->setNumRows($index); |
| 48 | 48 | $result=$this->rows[$index-1]; |
| 49 | 49 | } |
@@ -14,6 +14,6 @@ |
||
| 14 | 14 | |
| 15 | 15 | public function __construct(JsUtils $js) { |
| 16 | 16 | parent::__construct($js); |
| 17 | - $this->uiName = "tabs"; |
|
| 17 | + $this->uiName="tabs"; |
|
| 18 | 18 | } |
| 19 | 19 | } |