@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | class HtmlTabs extends HtmlBsDoubleElement { |
| 19 | - protected $tabs=array (); |
|
| 19 | + protected $tabs=array(); |
|
| 20 | 20 | protected $_tabsType="tabs"; |
| 21 | 21 | protected $stacked=""; |
| 22 | 22 | |
@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | protected function addTab_($tab, $index=null) { |
| 30 | - if($tab instanceof HtmlDropdown){ |
|
| 30 | + if ($tab instanceof HtmlDropdown) { |
|
| 31 | 31 | $tab->setMTagName("li"); |
| 32 | 32 | } |
| 33 | 33 | if (isset($index)) { |
| 34 | - $inserted=array ( |
|
| 34 | + $inserted=array( |
|
| 35 | 35 | $tab |
| 36 | 36 | ); |
| 37 | 37 | array_splice($this->tabs, $index, 0, $inserted); |
@@ -39,14 +39,14 @@ discard block |
||
| 39 | 39 | $this->tabs []=$tab; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function setActive($index){ |
|
| 42 | + public function setActive($index) { |
|
| 43 | 43 | $size=\sizeof($this->tabs); |
| 44 | - for ($i=0;$i<$size;$i++){ |
|
| 44 | + for ($i=0; $i<$size; $i++) { |
|
| 45 | 45 | $this->tabs[$i]->setActive($i==$index); |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function disable($index){ |
|
| 49 | + public function disable($index) { |
|
| 50 | 50 | $this->tabs[$index]->disable(); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public function addTabs($tabs) { |
| 80 | - foreach ( $tabs as $tab ) { |
|
| 80 | + foreach ($tabs as $tab) { |
|
| 81 | 81 | $this->addTab($tab); |
| 82 | 82 | } |
| 83 | 83 | return $this; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function run(JsUtils $js) { |
| 109 | 109 | $this->_bsComponent=new Tabs($js); |
| 110 | - foreach ( $this->tabs as $tab ) { |
|
| 110 | + foreach ($this->tabs as $tab) { |
|
| 111 | 111 | $this->_bsComponent->addTab($tab->run($js)); |
| 112 | 112 | } |
| 113 | 113 | $this->addEventsOnRun($js); |
@@ -116,11 +116,11 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | public function createTabContents() { |
| 118 | 118 | $tabContent=new HtmlTabContent("tabcontent-".$this->identifier); |
| 119 | - foreach ( $this->tabs as $tab ) { |
|
| 119 | + foreach ($this->tabs as $tab) { |
|
| 120 | 120 | if ($tab instanceof HtmlTabItem) |
| 121 | 121 | $tabContent->addTabItem($tab->getHref()); |
| 122 | 122 | elseif ($tab instanceof HtmlDropdown) { |
| 123 | - foreach ( $tab->getItems() as $dropdownItem ) { |
|
| 123 | + foreach ($tab->getItems() as $dropdownItem) { |
|
| 124 | 124 | $tabContent->addTabItem($dropdownItem->getHref()); |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -155,21 +155,21 @@ discard block |
||
| 155 | 155 | if (sizeof($this->content->getTabItems())>0) { |
| 156 | 156 | $this->content->getTabItem(0)->addToProperty("class", "fade in"); |
| 157 | 157 | $size=sizeof($this->tabs); |
| 158 | - for($index=0; $index<$size; $index++) { |
|
| 158 | + for ($index=0; $index<$size; $index++) { |
|
| 159 | 159 | $this->content->getTabItem($index)->addToProperty("class", "fade"); |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - public function on($event, $jsCode,$stopPropagation=false,$preventDefault=false){ |
|
| 165 | - foreach ($this->tabs as $tab){ |
|
| 166 | - $tab->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
| 164 | + public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
| 165 | + foreach ($this->tabs as $tab) { |
|
| 166 | + $tab->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
| 167 | 167 | } |
| 168 | 168 | return $this; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - public function setStacked($stacked=true){ |
|
| 172 | - if($stacked) |
|
| 171 | + public function setStacked($stacked=true) { |
|
| 172 | + if ($stacked) |
|
| 173 | 173 | $this->stacked="nav-stacked"; |
| 174 | 174 | else $this->stacked=""; |
| 175 | 175 | } |
@@ -14,14 +14,14 @@ discard block |
||
| 14 | 14 | * @author jc |
| 15 | 15 | * @version 1.001 |
| 16 | 16 | */ |
| 17 | -class HtmlTab extends HtmlSemCollection{ |
|
| 17 | +class HtmlTab extends HtmlSemCollection { |
|
| 18 | 18 | |
| 19 | 19 | protected $params=array("debug"=>true); |
| 20 | 20 | |
| 21 | - public function __construct( $identifier, $tabs=array()){ |
|
| 22 | - parent::__construct( $identifier, "div", ""); |
|
| 21 | + public function __construct($identifier, $tabs=array()) { |
|
| 22 | + parent::__construct($identifier, "div", ""); |
|
| 23 | 23 | $menu=new HtmlMenu("menu".$this->identifier); |
| 24 | - $menu->asTab(false)->setAttachment(NULL,Side::TOP); |
|
| 24 | + $menu->asTab(false)->setAttachment(NULL, Side::TOP); |
|
| 25 | 25 | $this->content["menu"]=$menu; |
| 26 | 26 | $this->addItems($tabs); |
| 27 | 27 | } |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 32 | 32 | * @return HtmlSegment |
| 33 | 33 | */ |
| 34 | - protected function createItem($value){ |
|
| 34 | + protected function createItem($value) { |
|
| 35 | 35 | $count=$this->count(); |
| 36 | 36 | $title=$value; |
| 37 | 37 | $content=NULL; |
| 38 | - if(\is_array($value)){ |
|
| 39 | - $title=@$value[0];$content=@$value[1]; |
|
| 38 | + if (\is_array($value)) { |
|
| 39 | + $title=@$value[0]; $content=@$value[1]; |
|
| 40 | 40 | } |
| 41 | 41 | $menuItem=$this->content["menu"]->addItem($title); |
| 42 | 42 | $menuItem->addToProperty("data-tab", $menuItem->getIdentifier()); |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | * @param string $datatab |
| 51 | 51 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 52 | 52 | */ |
| 53 | - private function createSegment($count,$content,$datatab){ |
|
| 53 | + private function createSegment($count, $content, $datatab) { |
|
| 54 | 54 | $segment=new HtmlSegment("item-".$this->identifier."-".$count, $content); |
| 55 | - $segment->setAttachment(NULL,Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab",$datatab); |
|
| 55 | + $segment->setAttachment(NULL, Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab", $datatab); |
|
| 56 | 56 | return $segment; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -62,12 +62,12 @@ discard block |
||
| 62 | 62 | * @param String $content new content |
| 63 | 63 | * @return \Ajax\semantic\html\modules\HtmlTab |
| 64 | 64 | */ |
| 65 | - public function setTabContent($index,$content){ |
|
| 65 | + public function setTabContent($index, $content) { |
|
| 66 | 66 | $menu=$this->content["menu"]; |
| 67 | - if($index<$menu->count()){ |
|
| 68 | - if(isset($this->content[$index])===false){ |
|
| 67 | + if ($index<$menu->count()) { |
|
| 68 | + if (isset($this->content[$index])===false) { |
|
| 69 | 69 | $this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index)->getIdentifier()); |
| 70 | - }else |
|
| 70 | + } else |
|
| 71 | 71 | $this->content[$index]->setContent($content); |
| 72 | 72 | } |
| 73 | 73 | return $this; |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | * @param array $contents |
| 79 | 79 | * @return \Ajax\semantic\html\modules\HtmlTab |
| 80 | 80 | */ |
| 81 | - public function setTabsContent($contents){ |
|
| 81 | + public function setTabsContent($contents) { |
|
| 82 | 82 | $size=\sizeof($contents); |
| 83 | - for($i=0;$i<$size;$i++){ |
|
| 83 | + for ($i=0; $i<$size; $i++) { |
|
| 84 | 84 | $this->setTabContent($i, $contents[$i]); |
| 85 | 85 | } |
| 86 | 86 | return $this; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @param int $index |
| 92 | 92 | * @return \Ajax\semantic\html\modules\HtmlTab |
| 93 | 93 | */ |
| 94 | - public function activate($index){ |
|
| 94 | + public function activate($index) { |
|
| 95 | 95 | $this->content["menu"]->getItem($index)->setActive(true); |
| 96 | 96 | $this->content[$index]->setActive(true); |
| 97 | 97 | return $this; |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | * @param string $content |
| 104 | 104 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 105 | 105 | */ |
| 106 | - public function addTab($title,$content){ |
|
| 107 | - return $this->addItem([$title,$content]); |
|
| 106 | + public function addTab($title, $content) { |
|
| 107 | + return $this->addItem([$title, $content]); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | * @param array $params |
| 119 | 119 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 120 | 120 | */ |
| 121 | - public function forwardTab($index,JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
| 122 | - if(\array_key_exists($index, $this->content)){ |
|
| 123 | - $this->content[$index]=$js->forward($initialController, $controller, $action,$params); |
|
| 121 | + public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
| 122 | + if (\array_key_exists($index, $this->content)) { |
|
| 123 | + $this->content[$index]=$js->forward($initialController, $controller, $action, $params); |
|
| 124 | 124 | return $this->content[$index]; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - return $this->addAndForwardTab($js, $title, $initialController, $controller, $action,$params); |
|
| 127 | + return $this->addAndForwardTab($js, $title, $initialController, $controller, $action, $params); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -137,12 +137,12 @@ discard block |
||
| 137 | 137 | * @param $params The parameters to pass to the view |
| 138 | 138 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 139 | 139 | */ |
| 140 | - public function renderViewTab($index,JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
| 141 | - if(\array_key_exists($index, $this->content)){ |
|
| 142 | - $this->content[$index]=$js->renderContent($initialController, $viewName,$params); |
|
| 140 | + public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
| 141 | + if (\array_key_exists($index, $this->content)) { |
|
| 142 | + $this->content[$index]=$js->renderContent($initialController, $viewName, $params); |
|
| 143 | 143 | return $this->content[$index]; |
| 144 | 144 | } |
| 145 | - return $this->addAndRenderViewTab($js, $title, $initialController, $viewName,$params); |
|
| 145 | + return $this->addAndRenderViewTab($js, $title, $initialController, $viewName, $params); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | * @param array $params |
| 157 | 157 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 158 | 158 | */ |
| 159 | - public function addAndForwardTab(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
| 160 | - return $this->addTab($title, $js->forward($initialController, $controller, $action,$params)); |
|
| 159 | + public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
| 160 | + return $this->addTab($title, $js->forward($initialController, $controller, $action, $params)); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | * @param $params The parameters to pass to the view |
| 170 | 170 | * @return \Ajax\semantic\html\elements\HtmlSegment |
| 171 | 171 | */ |
| 172 | - public function addAndRenderViewTab(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
| 173 | - return $this->addTab($title, $js->renderContent($initialController, $viewName,$params)); |
|
| 172 | + public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
| 173 | + return $this->addTab($title, $js->renderContent($initialController, $viewName, $params)); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | public function setPointing($value=Direction::NONE) { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @param int $index |
| 187 | 187 | * @return Ajax\semantic\html\content\HtmlMenuItem |
| 188 | 188 | */ |
| 189 | - public function getMenuTab($index){ |
|
| 189 | + public function getMenuTab($index) { |
|
| 190 | 190 | return $this->content["menu"]->getItem($index); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @param int $index |
| 196 | 196 | * @return HtmlSegment |
| 197 | 197 | */ |
| 198 | - public function getTab($index){ |
|
| 198 | + public function getTab($index) { |
|
| 199 | 199 | return $this->content[$index]; |
| 200 | 200 | } |
| 201 | 201 | |
@@ -204,22 +204,22 @@ discard block |
||
| 204 | 204 | * @param HtmlMenu $menu |
| 205 | 205 | * @return \Ajax\semantic\html\modules\HtmlTab |
| 206 | 206 | */ |
| 207 | - public function setMenu($menu){ |
|
| 207 | + public function setMenu($menu) { |
|
| 208 | 208 | $contentSize=\sizeof($this->content); |
| 209 | - for($i=0;$i<$contentSize;$i++){ |
|
| 210 | - if($menu->getItem($i)!==NULL){ |
|
| 211 | - if(isset($this->content[$i])){ |
|
| 212 | - $menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab")); |
|
| 209 | + for ($i=0; $i<$contentSize; $i++) { |
|
| 210 | + if ($menu->getItem($i)!==NULL) { |
|
| 211 | + if (isset($this->content[$i])) { |
|
| 212 | + $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | $menuSize=$menu->count(); |
| 217 | - for($i=0;$i<$menuSize;$i++){ |
|
| 217 | + for ($i=0; $i<$menuSize; $i++) { |
|
| 218 | 218 | $menu->getItem($i)->removeProperty("href"); |
| 219 | - if(isset($this->content[$i])===false){ |
|
| 219 | + if (isset($this->content[$i])===false) { |
|
| 220 | 220 | $this->content[$i]=$this->createSegment($i, "New content", $menu->getItem($i)->getIdentifier()); |
| 221 | 221 | } |
| 222 | - $menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab")); |
|
| 222 | + $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | $this->content["menu"]=$menu; |
@@ -231,15 +231,15 @@ discard block |
||
| 231 | 231 | * @see BaseHtml::run() |
| 232 | 232 | */ |
| 233 | 233 | public function run(JsUtils $js) { |
| 234 | - if(isset($this->_bsComponent)===false) |
|
| 235 | - $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
| 234 | + if (isset($this->_bsComponent)===false) |
|
| 235 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item", $this->params); |
|
| 236 | 236 | $this->addEventsOnRun($js); |
| 237 | 237 | return $this->_bsComponent; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 241 | - if($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
| 241 | + if ($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
| 242 | 242 | $this->activate(0); |
| 243 | - return parent::compile($js,$view); |
|
| 243 | + return parent::compile($js, $view); |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | \ No newline at end of file |
@@ -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,20 +95,20 @@ 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 | 104 | $valuesSize=\sizeof($values); |
| 105 | - if($force===true){ |
|
| 106 | - for($i=$count;$i<$valuesSize;$i++){ |
|
| 107 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
| 105 | + if ($force===true) { |
|
| 106 | + for ($i=$count; $i<$valuesSize; $i++) { |
|
| 107 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | - $count=\min(array($this->count(),$valuesSize)); |
|
| 111 | - for($i=0;$i<$count;$i++){ |
|
| 110 | + $count=\min(array($this->count(), $valuesSize)); |
|
| 111 | + for ($i=0; $i<$count; $i++) { |
|
| 112 | 112 | $this->content[$i]->setValue($values[$i]); |
| 113 | 113 | } |
| 114 | 114 | return $this; |
@@ -118,15 +118,15 @@ discard block |
||
| 118 | 118 | * {@inheritDoc} |
| 119 | 119 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 120 | 120 | */ |
| 121 | - protected function createItem($value){ |
|
| 122 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
| 121 | + protected function createItem($value) { |
|
| 122 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
| 123 | 123 | return $col; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 127 | - if($this->_implicite===true){ |
|
| 126 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 127 | + if ($this->_implicite===true) { |
|
| 128 | 128 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
| 129 | 129 | } |
| 130 | - return parent::compile($js,$view); |
|
| 130 | + return parent::compile($js, $view); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | \ No newline at end of file |
@@ -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,10 +48,10 @@ discard block |
||
| 48 | 48 | * @param int $wide |
| 49 | 49 | */ |
| 50 | 50 | public function setWide($wide) { |
| 51 | - if(isset(Wide::getConstants()["W" . $wide])){ |
|
| 52 | - $wide=Wide::getConstants()["W" . $wide]; |
|
| 51 | + if (isset(Wide::getConstants()["W".$wide])) { |
|
| 52 | + $wide=Wide::getConstants()["W".$wide]; |
|
| 53 | 53 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
| 54 | - return $this->addToPropertyCtrl("class", "column", array ("column" )); |
|
| 54 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
| 55 | 55 | } |
| 56 | 56 | return $this; |
| 57 | 57 | } |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | * @return mixed |
| 72 | 72 | */ |
| 73 | 73 | public function addRow($colsCount=NULL) { |
| 74 | - $rowCount=$this->rowCount() + 1; |
|
| 74 | + $rowCount=$this->rowCount()+1; |
|
| 75 | 75 | $this->setRowsCount($rowCount, $colsCount, true); |
| 76 | - return $this->content[$rowCount - 1]; |
|
| 76 | + return $this->content[$rowCount-1]; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | * @return mixed|\Ajax\semantic\html\collections\HtmlGrid |
| 83 | 83 | */ |
| 84 | 84 | public function addCol($width=NULL) { |
| 85 | - $colCount=$this->colCount() + 1; |
|
| 85 | + $colCount=$this->colCount()+1; |
|
| 86 | 86 | $this->setColsCount($colCount, true, $width); |
| 87 | 87 | if ($this->hasOnlyCols($this->count())) |
| 88 | - return $this->content[$colCount - 1]; |
|
| 88 | + return $this->content[$colCount-1]; |
|
| 89 | 89 | return $this; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 96 | 96 | */ |
| 97 | 97 | public function addCols($sizes=array()) { |
| 98 | - foreach ( $sizes as $size ) { |
|
| 98 | + foreach ($sizes as $size) { |
|
| 99 | 99 | $this->addCol($size); |
| 100 | 100 | } |
| 101 | 101 | return $this; |
@@ -109,19 +109,19 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) { |
| 111 | 111 | $count=$this->count(); |
| 112 | - if ($rowsCount < 2 && $force === false) { |
|
| 113 | - for($i=$count; $i < $colsCount; $i++) { |
|
| 114 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i)); |
|
| 112 | + if ($rowsCount<2 && $force===false) { |
|
| 113 | + for ($i=$count; $i<$colsCount; $i++) { |
|
| 114 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
|
| 115 | 115 | } |
| 116 | 116 | } else { |
| 117 | 117 | if ($this->hasOnlyCols($count)) { |
| 118 | 118 | $tmpContent=$this->content; |
| 119 | 119 | $item=$this->addItem($colsCount); |
| 120 | 120 | $item->setContent($tmpContent); |
| 121 | - $this->content=array (); |
|
| 121 | + $this->content=array(); |
|
| 122 | 122 | $count=1; |
| 123 | 123 | } |
| 124 | - for($i=$count; $i < $rowsCount; $i++) { |
|
| 124 | + for ($i=$count; $i<$rowsCount; $i++) { |
|
| 125 | 125 | $this->addItem($colsCount); |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | protected function hasOnlyCols($count) { |
| 132 | - return $count > 0 && $this->content[0] instanceof HtmlGridCol; |
|
| 132 | + return $count>0 && $this->content[0] instanceof HtmlGridCol; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -143,14 +143,14 @@ discard block |
||
| 143 | 143 | if (isset($width)===false) { |
| 144 | 144 | $this->setWide($numCols); |
| 145 | 145 | } |
| 146 | - if ($toCreate === true) { |
|
| 146 | + if ($toCreate===true) { |
|
| 147 | 147 | $count=$this->count(); |
| 148 | - if ($count == 0 || $this->hasOnlyCols($count)) { |
|
| 149 | - for($i=$count; $i < $numCols; $i++) { |
|
| 150 | - $this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i, $width)); |
|
| 148 | + if ($count==0 || $this->hasOnlyCols($count)) { |
|
| 149 | + for ($i=$count; $i<$numCols; $i++) { |
|
| 150 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width)); |
|
| 151 | 151 | } |
| 152 | 152 | } else { |
| 153 | - for($i=0; $i < $count; $i++) { |
|
| 153 | + for ($i=0; $i<$count; $i++) { |
|
| 154 | 154 | $this->getItem($i)->setColsCount($numCols); |
| 155 | 155 | } |
| 156 | 156 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $count=$this->count(); |
| 187 | 187 | if ($this->hasOnlyCols($count)) |
| 188 | 188 | return $count; |
| 189 | - if ($count > 0) |
|
| 189 | + if ($count>0) |
|
| 190 | 190 | return $this->getItem(0)->count(); |
| 191 | 191 | return 0; |
| 192 | 192 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 199 | 199 | */ |
| 200 | 200 | public function getCell($row, $col) { |
| 201 | - if ($row < 2 && $this->hasOnlyCols($this->count())) |
|
| 201 | + if ($row<2 && $this->hasOnlyCols($this->count())) |
|
| 202 | 202 | return $this->getItem($col); |
| 203 | 203 | $row=$this->getItem($row); |
| 204 | 204 | if (isset($row)) { |
@@ -213,8 +213,8 @@ discard block |
||
| 213 | 213 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 214 | 214 | */ |
| 215 | 215 | public function setDivided($vertically=false) { |
| 216 | - $value=($vertically === true) ? "vertically divided" : "divided"; |
|
| 217 | - return $this->addToPropertyCtrl("class", $value, array ("divided" )); |
|
| 216 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
| 217 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -223,15 +223,15 @@ discard block |
||
| 223 | 223 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 224 | 224 | */ |
| 225 | 225 | public function setCelled($internally=false) { |
| 226 | - $value=($internally === true) ? "internally celled" : "celled"; |
|
| 227 | - return $this->addToPropertyCtrl("class", $value, array ("celled","internally celled" )); |
|
| 226 | + $value=($internally===true) ? "internally celled" : "celled"; |
|
| 227 | + return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled")); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | /** |
| 231 | 231 | * A grid can have its columns centered |
| 232 | 232 | */ |
| 233 | 233 | public function setCentered() { |
| 234 | - return $this->addToPropertyCtrl("class", "centered", array ("centered" )); |
|
| 234 | + return $this->addToPropertyCtrl("class", "centered", array("centered")); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | public function setPadded($value=NULL) { |
| 251 | 251 | if (isset($value)) |
| 252 | - $this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" )); |
|
| 252 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
| 253 | 253 | return $this->addToProperty("class", "padded"); |
| 254 | 254 | } |
| 255 | 255 | |
@@ -259,12 +259,12 @@ discard block |
||
| 259 | 259 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 260 | 260 | */ |
| 261 | 261 | public function setRelaxed($very=false) { |
| 262 | - $value=($very === true) ? "very relaxed" : "relaxed"; |
|
| 263 | - return $this->addToPropertyCtrl("class", $value, array ("relaxed","very relaxed" )); |
|
| 262 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
| 263 | + return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed")); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
| 267 | - return $this->addToPropertyCtrl("class", $value . " aligned", VerticalAlignment::getConstantValues("aligned")); |
|
| 267 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | /** |
@@ -274,9 +274,9 @@ discard block |
||
| 274 | 274 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 275 | 275 | */ |
| 276 | 276 | protected function createItem($value) { |
| 277 | - if ($this->_createCols === false) |
|
| 277 | + if ($this->_createCols===false) |
|
| 278 | 278 | $value=null; |
| 279 | - $item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows); |
|
| 279 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
| 280 | 280 | return $item; |
| 281 | 281 | } |
| 282 | 282 | |
@@ -287,15 +287,15 @@ discard block |
||
| 287 | 287 | public function setValues($values, $force=true) { |
| 288 | 288 | $count=$this->count(); |
| 289 | 289 | $valuesSize=\sizeof($values); |
| 290 | - if ($this->_createCols === false || $force === true) { |
|
| 291 | - for($i=$count; $i < $valuesSize; $i++) { |
|
| 290 | + if ($this->_createCols===false || $force===true) { |
|
| 291 | + for ($i=$count; $i<$valuesSize; $i++) { |
|
| 292 | 292 | $colSize=\sizeof($values[$i]); |
| 293 | - $this->addItem(new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
| 293 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | - $count=\min(array ($this->count(),$valuesSize )); |
|
| 297 | - for($i=0; $i < $count; $i++) { |
|
| 298 | - $this->content[$i]->setValues($values[$i], $this->_createCols === false); |
|
| 296 | + $count=\min(array($this->count(), $valuesSize)); |
|
| 297 | + for ($i=0; $i<$count; $i++) { |
|
| 298 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | 301 | |