@@ -15,46 +15,46 @@ discard block |
||
| 15 | 15 | * @property string $identifier |
| 16 | 16 | */ |
| 17 | 17 | trait FieldsTrait { |
| 18 | - abstract public function addFields($fields=NULL,$label=NULL); |
|
| 18 | + abstract public function addFields($fields=NULL, $label=NULL); |
|
| 19 | 19 | abstract public function addItem($item); |
| 20 | 20 | |
| 21 | - protected function createItem($value){ |
|
| 22 | - if(\is_array($value)){ |
|
| 23 | - $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null))); |
|
| 21 | + protected function createItem($value) { |
|
| 22 | + if (\is_array($value)) { |
|
| 23 | + $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id", ""), JArray::getDefaultValue($value, "label", null), JArray::getDefaultValue($value, "type", "text"), JArray::getDefaultValue($value, "value", ""), JArray::getDefaultValue($value, "placeholder", JArray::getDefaultValue($value, "label", null))); |
|
| 24 | 24 | return $itemO; |
| 25 | - }elseif(\is_object($value)){ |
|
| 25 | + }elseif (\is_object($value)) { |
|
| 26 | 26 | $itemO=new HtmlFormField("field-".$this->identifier, $value); |
| 27 | 27 | return $itemO; |
| 28 | - }else |
|
| 28 | + } else |
|
| 29 | 29 | return new HtmlFormInput($value); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - protected function createCondition($value){ |
|
| 32 | + protected function createCondition($value) { |
|
| 33 | 33 | return \is_object($value)===false || $value instanceof \Ajax\semantic\html\elements\HtmlInput; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function addInputs($inputs,$fieldslabel=null){ |
|
| 36 | + public function addInputs($inputs, $fieldslabel=null) { |
|
| 37 | 37 | $fields=array(); |
| 38 | - foreach ($inputs as $input){ |
|
| 38 | + foreach ($inputs as $input) { |
|
| 39 | 39 | \extract($input); |
| 40 | - $f=new HtmlFormInput("",""); |
|
| 40 | + $f=new HtmlFormInput("", ""); |
|
| 41 | 41 | $f->fromArray($input); |
| 42 | 42 | $fields[]=$f; |
| 43 | 43 | } |
| 44 | - return $this->addFields($fields,$fieldslabel); |
|
| 44 | + return $this->addFields($fields, $fieldslabel); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function addFieldRule($index,$type,$prompt=NULL,$value=NULL){ |
|
| 47 | + public function addFieldRule($index, $type, $prompt=NULL, $value=NULL) { |
|
| 48 | 48 | $field=$this->getItem($index); |
| 49 | - if(isset($field)){ |
|
| 50 | - $field->addRule($type,$prompt,$value); |
|
| 49 | + if (isset($field)) { |
|
| 50 | + $field->addRule($type, $prompt, $value); |
|
| 51 | 51 | } |
| 52 | 52 | return $this; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function addFieldRules($index,$rules){ |
|
| 55 | + public function addFieldRules($index, $rules) { |
|
| 56 | 56 | $field=$this->getItem($index); |
| 57 | - if(isset($field)){ |
|
| 57 | + if (isset($field)) { |
|
| 58 | 58 | $field->addRules($rules); |
| 59 | 59 | } |
| 60 | 60 | return $this; |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | * @param boolean $multiple |
| 69 | 69 | * @return \Ajax\common\html\HtmlDoubleElement |
| 70 | 70 | */ |
| 71 | - public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){ |
|
| 72 | - return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple)); |
|
| 71 | + public function addDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false) { |
|
| 72 | + return $this->addItem(new HtmlFormDropdown($identifier, $items, $label, $value, $multiple)); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -80,23 +80,23 @@ discard block |
||
| 80 | 80 | * @param string $placeholder |
| 81 | 81 | * @return HtmlFormInput |
| 82 | 82 | */ |
| 83 | - public function addInput($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL){ |
|
| 84 | - return $this->addItem(new HtmlFormInput($identifier,$label,$type,$value,$placeholder)); |
|
| 83 | + public function addInput($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
| 84 | + return $this->addItem(new HtmlFormInput($identifier, $label, $type, $value, $placeholder)); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public function addPassword($identifier, $label=NULL){ |
|
| 88 | - return $this->addItem(new HtmlFormInput($identifier,$label,"password","","")); |
|
| 87 | + public function addPassword($identifier, $label=NULL) { |
|
| 88 | + return $this->addItem(new HtmlFormInput($identifier, $label, "password", "", "")); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){ |
|
| 92 | - return $this->addItem(new HtmlButton($identifier,$value,$cssStyle,$onClick)); |
|
| 91 | + public function addButton($identifier, $value, $cssStyle=NULL, $onClick=NULL) { |
|
| 92 | + return $this->addItem(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){ |
|
| 96 | - return $this->addItem(new HtmlFormCheckbox($identifier,$label,$value,$type)); |
|
| 95 | + public function addCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) { |
|
| 96 | + return $this->addItem(new HtmlFormCheckbox($identifier, $label, $value, $type)); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function addRadio($identifier, $name,$label=NULL,$value=NULL){ |
|
| 100 | - return $this->addItem(new HtmlFormRadio($identifier,$name,$label,$value)); |
|
| 99 | + public function addRadio($identifier, $name, $label=NULL, $value=NULL) { |
|
| 100 | + return $this->addItem(new HtmlFormRadio($identifier, $name, $label, $value)); |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | \ No newline at end of file |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function setDisabled($disable=true) { |
| 28 | - if($disable) |
|
| 28 | + if ($disable) |
|
| 29 | 29 | $this->addState(State::DISABLED); |
| 30 | 30 | return $this; |
| 31 | 31 | } |
@@ -9,15 +9,15 @@ discard block |
||
| 9 | 9 | protected $image; |
| 10 | 10 | |
| 11 | 11 | public function __construct($identifier, $content=NULL) { |
| 12 | - parent::__construct($identifier,"item",$content); |
|
| 12 | + parent::__construct($identifier, "item", $content); |
|
| 13 | 13 | } |
| 14 | - protected function initContent($content){ |
|
| 15 | - if(\is_array($content)){ |
|
| 16 | - if(JArray::isAssociative($content)===false){ |
|
| 14 | + protected function initContent($content) { |
|
| 15 | + if (\is_array($content)) { |
|
| 16 | + if (JArray::isAssociative($content)===false) { |
|
| 17 | 17 | $icon=@$content[0]; |
| 18 | 18 | $title=@$content[1]; |
| 19 | 19 | $desc=@$content[2]; |
| 20 | - }else{ |
|
| 20 | + } else { |
|
| 21 | 21 | $icon=@$content["icon"]; |
| 22 | 22 | $image=@$content["image"]; |
| 23 | 23 | $title=@$content["title"]; |
@@ -25,21 +25,21 @@ discard block |
||
| 25 | 25 | $desc=@$content["description"]; |
| 26 | 26 | $items=@$content["items"]; |
| 27 | 27 | } |
| 28 | - if(isset($icon)){ |
|
| 28 | + if (isset($icon)) { |
|
| 29 | 29 | $this->setIcon($icon); |
| 30 | 30 | } |
| 31 | - if(isset($image)){ |
|
| 31 | + if (isset($image)) { |
|
| 32 | 32 | $this->setImage($image); |
| 33 | 33 | } |
| 34 | - if(isset($title)){ |
|
| 35 | - $this->setTitle($title,$desc); |
|
| 36 | - }elseif (isset($header)){ |
|
| 37 | - $this->setTitle($header,$desc,"header"); |
|
| 34 | + if (isset($title)) { |
|
| 35 | + $this->setTitle($title, $desc); |
|
| 36 | + }elseif (isset($header)) { |
|
| 37 | + $this->setTitle($header, $desc, "header"); |
|
| 38 | 38 | } |
| 39 | - if(isset($items)){ |
|
| 39 | + if (isset($items)) { |
|
| 40 | 40 | $this->addList($items); |
| 41 | 41 | } |
| 42 | - }else{ |
|
| 42 | + } else { |
|
| 43 | 43 | $this->setContent($content); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | return $list; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function getList(){ |
|
| 53 | + public function getList() { |
|
| 54 | 54 | return $this->content["list"]; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public function getItem($index){ |
|
| 57 | + public function getItem($index) { |
|
| 58 | 58 | return $this->getList()->getItem($index); |
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | \ No newline at end of file |
@@ -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 |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | $output=$input; |
| 13 | 13 | } |
| 14 | 14 | if (\is_array($input)) { |
| 15 | - if (sizeof($input) > 0) { |
|
| 16 | - if (self::containsElement($input) === false) { |
|
| 15 | + if (sizeof($input)>0) { |
|
| 16 | + if (self::containsElement($input)===false) { |
|
| 17 | 17 | $output=self::wrapStrings($input, $js, $separator=' ', $valueQuote='"'); |
| 18 | 18 | } else { |
| 19 | 19 | $output=self::wrapObjects($input, $js, $separator, $valueQuote); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | private static function containsElement($input) { |
| 27 | - foreach ( $input as $v ) { |
|
| 27 | + foreach ($input as $v) { |
|
| 28 | 28 | if (\is_object($v) || \is_array($v)) |
| 29 | 29 | return true; |
| 30 | 30 | } |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | public static function wrapStrings($input, $js, $separator=' ', $valueQuote='"') { |
| 35 | - if (JArray::isAssociative($input) === true) { |
|
| 36 | - $result=implode($separator, array_map(function ($v, $k) use($valueQuote) { |
|
| 37 | - return $k . '=' . $valueQuote . $v . $valueQuote; |
|
| 35 | + if (JArray::isAssociative($input)===true) { |
|
| 36 | + $result=implode($separator, array_map(function($v, $k) use($valueQuote) { |
|
| 37 | + return $k.'='.$valueQuote.$v.$valueQuote; |
|
| 38 | 38 | }, $input, array_keys($input))); |
| 39 | 39 | } else { |
| 40 | 40 | $result=implode($separator, array_values($input)); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public static function wrapObjects($input, $js=NULL, $separator=' ', $valueQuote='"') { |
| 46 | - return implode($separator, array_map(function ($v) use($js, $separator, $valueQuote) { |
|
| 46 | + return implode($separator, array_map(function($v) use($js, $separator, $valueQuote) { |
|
| 47 | 47 | if (is_object($v)) |
| 48 | 48 | return $v->compile($js); |
| 49 | 49 | elseif (\is_array($v)) { |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function setActive($value) { |
| 32 | - if(\is_array($this->content)){ |
|
| 33 | - foreach ($this->content as $pb){ |
|
| 32 | + if (\is_array($this->content)) { |
|
| 33 | + foreach ($this->content as $pb) { |
|
| 34 | 34 | $pb->setActive($value); |
| 35 | 35 | } |
| 36 | - }else{ |
|
| 36 | + } else { |
|
| 37 | 37 | if ($value===true) |
| 38 | 38 | $this->active="active"; |
| 39 | 39 | else |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public function setStriped($value) { |
| 46 | - if(\is_array($this->content)){ |
|
| 47 | - foreach ($this->content as $pb){ |
|
| 46 | + if (\is_array($this->content)) { |
|
| 47 | + foreach ($this->content as $pb) { |
|
| 48 | 48 | $pb->setStriped($value); |
| 49 | 49 | } |
| 50 | - }else{ |
|
| 50 | + } else { |
|
| 51 | 51 | if ($value===true) |
| 52 | 52 | $this->striped="progress-bar-striped"; |
| 53 | 53 | else |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | public function showCaption($value) { |
| 60 | - if(\is_array($this->content)){ |
|
| 61 | - foreach ($this->content as $pb){ |
|
| 60 | + if (\is_array($this->content)) { |
|
| 61 | + foreach ($this->content as $pb) { |
|
| 62 | 62 | $pb->showCaption($value); |
| 63 | 63 | } |
| 64 | - }else{ |
|
| 64 | + } else { |
|
| 65 | 65 | if ($value===true) |
| 66 | 66 | $this->caption="%value%%"; |
| 67 | 67 | else |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $progressBar->setStriped($this->striped!=="" || $progressBar->isStriped()); |
| 82 | 82 | $progressBar->setActive($this->active==="active" || $progressBar->isActive()); |
| 83 | 83 | if (!is_array($this->content)) { |
| 84 | - $this->content=array (); |
|
| 84 | + $this->content=array(); |
|
| 85 | 85 | } |
| 86 | 86 | $this->content []=$progressBar; |
| 87 | 87 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @return \Ajax\bootstrap\html\HtmlProgressbar default : "" |
| 126 | 126 | */ |
| 127 | 127 | public function setStyle($cssStyle) { |
| 128 | - return $this->setMemberCtrl($this->style,CssRef::getStyle($cssStyle, "progress-bar"), CssRef::Styles("progress-bar")); |
|
| 128 | + return $this->setMemberCtrl($this->style, CssRef::getStyle($cssStyle, "progress-bar"), CssRef::Styles("progress-bar")); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /* |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 136 | 136 | $actualStyle=$this->style; |
| 137 | - if(isset($this->styleLimits)&& JArray::isAssociative($this->styleLimits)){ |
|
| 138 | - foreach ($this->styleLimits as $k=>$v){ |
|
| 137 | + if (isset($this->styleLimits) && JArray::isAssociative($this->styleLimits)) { |
|
| 138 | + foreach ($this->styleLimits as $k=>$v) { |
|
| 139 | 139 | $actualStyle=$k; |
| 140 | - if($v>$this->value) |
|
| 140 | + if ($v>$this->value) |
|
| 141 | 141 | break; |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -16,12 +16,12 @@ discard block |
||
| 16 | 16 | * @version 1.001 |
| 17 | 17 | */ |
| 18 | 18 | class HtmlCarousel extends BaseHtml { |
| 19 | - protected $indicators=array (); |
|
| 20 | - protected $slides=array (); |
|
| 19 | + protected $indicators=array(); |
|
| 20 | + protected $slides=array(); |
|
| 21 | 21 | protected $leftControl=""; |
| 22 | 22 | protected $rightControl=""; |
| 23 | 23 | protected $_base=""; |
| 24 | - protected $_glyphs=array (); |
|
| 24 | + protected $_glyphs=array(); |
|
| 25 | 25 | |
| 26 | 26 | public function __construct($identifier, $images=NULL) { |
| 27 | 27 | parent::__construct($identifier); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function setBase($_base) { |
| 41 | - foreach ($this->slides as $slide){ |
|
| 41 | + foreach ($this->slides as $slide) { |
|
| 42 | 42 | $imgSrc=$slide->getImageSrc(); |
| 43 | 43 | $slide->setImageSrc(str_replace($this->_base.$imgSrc, $_base.$imgSrc, $imgSrc)); |
| 44 | 44 | } |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | public function addImage($imageSrc, $imageAlt="", $caption=NULL, $description=NULL) { |
| 96 | - if(\is_array($imageSrc)){ |
|
| 97 | - $this->addImage($imageSrc[0],@$imageSrc[1],@$imageSrc[2],@$imageSrc[3]); |
|
| 98 | - }else{ |
|
| 96 | + if (\is_array($imageSrc)) { |
|
| 97 | + $this->addImage($imageSrc[0], @$imageSrc[1], @$imageSrc[2], @$imageSrc[3]); |
|
| 98 | + } else { |
|
| 99 | 99 | $image=new HtmlCarouselItem("item-".$this->identifier); |
| 100 | 100 | $image->setImageSrc($this->_base.$imageSrc); |
| 101 | 101 | $image->setImageAlt($imageAlt); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public function fromArray($array) { |
| 120 | 120 | if (\is_array($array) && sizeof($array)>0) { |
| 121 | - foreach ( $array as $value ) { |
|
| 121 | + foreach ($array as $value) { |
|
| 122 | 122 | if (\is_array($value)) { |
| 123 | 123 | $this->addImage($value ["src"], @$value ["alt"], @$value ["caption"], @$value ["description"]); |
| 124 | 124 | } else { |