@@ -17,19 +17,19 @@ discard block |
||
| 17 | 17 | class HtmlCard extends HtmlSemDoubleElement { |
| 18 | 18 | |
| 19 | 19 | public function __construct($identifier) { |
| 20 | - parent::__construct($identifier, "div", "ui card", array ()); |
|
| 20 | + parent::__construct($identifier, "div", "ui card", array()); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | private function createContent($content, $baseClass="content") { |
| 24 | 24 | $count=\sizeof($this->content); |
| 25 | - $result=new HtmlCardContent("content-" . $count . "-" . $this->identifier, $content); |
|
| 25 | + $result=new HtmlCardContent("content-".$count."-".$this->identifier, $content); |
|
| 26 | 26 | $result->setClass($baseClass); |
| 27 | 27 | return $result; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | private function addElementInContent($key, $element) { |
| 31 | - if (\array_key_exists($key, $this->content) === false) { |
|
| 32 | - $this->content[$key]=array (); |
|
| 31 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 32 | + $this->content[$key]=array(); |
|
| 33 | 33 | } |
| 34 | 34 | $this->content[$key][]=$element; |
| 35 | 35 | return $element; |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public function addHeader($header, $niveau=4, $type="page") { |
| 48 | 48 | if (!$header instanceof HtmlHeader) { |
| 49 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $header, $type); |
|
| 49 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $header, $type); |
|
| 50 | 50 | } |
| 51 | 51 | $this->content["header"]=$this->createContent($header); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function addImage($image, $title="") { |
| 55 | 55 | if (!$image instanceof HtmlImage) { |
| 56 | - $image=new HtmlImage("image-" . $this->identifier, $image, $title); |
|
| 56 | + $image=new HtmlImage("image-".$this->identifier, $image, $title); |
|
| 57 | 57 | } |
| 58 | 58 | $image->setClass("image"); |
| 59 | 59 | return $this->addElementInContent("content", $image); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL) { |
| 63 | 63 | $reveal=$visibleContent; |
| 64 | 64 | if (!$visibleContent instanceof HtmlReveal) { |
| 65 | - $reveal=new HtmlReveal("reveral-" . $this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
| 65 | + $reveal=new HtmlReveal("reveral-".$this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
| 66 | 66 | } |
| 67 | 67 | return $this->addElementInContent("content", $reveal); |
| 68 | 68 | } |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | * @param boolean $asIcons |
| 92 | 92 | * @return \Ajax\semantic\html\elements\HtmlButtonGroups |
| 93 | 93 | */ |
| 94 | - public function addButtons($elements=array(), $asIcons=false){ |
|
| 95 | - $buttons=new HtmlButtonGroups("buttons-".$this->identifier,$elements,$asIcons); |
|
| 94 | + public function addButtons($elements=array(), $asIcons=false) { |
|
| 95 | + $buttons=new HtmlButtonGroups("buttons-".$this->identifier, $elements, $asIcons); |
|
| 96 | 96 | $this->addElementInContent("content", $buttons); |
| 97 | 97 | return $buttons; |
| 98 | 98 | } |
@@ -101,12 +101,12 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | public function addCardHeaderContent($header, $metas=array(), $description=NULL) { |
| 103 | 103 | $count=\sizeof($this->content); |
| 104 | - return $this->addElementInContent("content", new HtmlCardHeaderContent("content-" . $count . "-" . $this->identifier, $header, $metas, $description)); |
|
| 104 | + return $this->addElementInContent("content", new HtmlCardHeaderContent("content-".$count."-".$this->identifier, $header, $metas, $description)); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public function addCardContent($content=array()) { |
| 108 | 108 | $count=\sizeof($this->content); |
| 109 | - return $this->addElementInContent("content", new HtmlCardContent("content-" . $count . "-" . $this->identifier, $content)); |
|
| 109 | + return $this->addElementInContent("content", new HtmlCardContent("content-".$count."-".$this->identifier, $content)); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | public function getCardContent($index=NULL) { |
@@ -132,13 +132,13 @@ discard block |
||
| 132 | 132 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 133 | 133 | */ |
| 134 | 134 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 135 | - $this->content=JArray::sortAssociative($this->content, [ "header","image","content","extra-content" ]); |
|
| 135 | + $this->content=JArray::sortAssociative($this->content, ["header", "image", "content", "extra-content"]); |
|
| 136 | 136 | return parent::compile($js, $view); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | public function asLink($href="") { |
| 140 | 140 | $this->addToProperty("class", "link"); |
| 141 | - if ($href !== "") { |
|
| 141 | + if ($href!=="") { |
|
| 142 | 142 | $this->setProperty("href", $href); |
| 143 | 143 | } |
| 144 | 144 | return $this; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | if (isset($label)) |
| 37 | 37 | $this->setLabel($label); |
| 38 | - foreach ( $fields as $field ) { |
|
| 38 | + foreach ($fields as $field) { |
|
| 39 | 39 | $this->addItem($field); |
| 40 | 40 | } |
| 41 | 41 | return $this; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function addItem($item) { |
| 59 | 59 | $item=parent::addItem($item); |
| 60 | - if($item instanceof HtmlFormField) |
|
| 60 | + if ($item instanceof HtmlFormField) |
|
| 61 | 61 | $item->setContainer($this); |
| 62 | 62 | return $item; |
| 63 | 63 | } |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) { |
| 101 | - $fields=array (); |
|
| 101 | + $fields=array(); |
|
| 102 | 102 | $i=0; |
| 103 | - foreach ( $items as $val => $caption ) { |
|
| 103 | + foreach ($items as $val => $caption) { |
|
| 104 | 104 | $itemO=new HtmlFormRadio($name."-".$i++, $name, $caption, $val, $type); |
| 105 | 105 | if ($val===$value) { |
| 106 | 106 | $itemO->getField()->setProperty("checked", ""); |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | public static function checkeds($name, $items=array(), $label=NULL, $values=array(), $type=NULL) { |
| 117 | - $fields=array (); |
|
| 117 | + $fields=array(); |
|
| 118 | 118 | $i=0; |
| 119 | - foreach ( $items as $val => $caption ) { |
|
| 119 | + foreach ($items as $val => $caption) { |
|
| 120 | 120 | $itemO=new HtmlFormCheckbox($name."-".$i++, $name, $caption, $val, $type); |
| 121 | 121 | if (\array_search($val, $values)!==false) { |
| 122 | 122 | //TODO check getField |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | abstract public function addToProperty($name, $value, $separator=" "); |
| 18 | 18 | abstract public function addLabel($caption, $style="label-default", $leftSeparator=" "); |
| 19 | - abstract public function addContent($content,$before=false); |
|
| 19 | + abstract public function addContent($content, $before=false); |
|
| 20 | 20 | abstract public function getField(); |
| 21 | 21 | abstract public function getDataField(); |
| 22 | 22 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function addLoading() { |
| 28 | - if ($this->_hasIcon === false) { |
|
| 28 | + if ($this->_hasIcon===false) { |
|
| 29 | 29 | throw new \Exception("Input must have an icon for showing a loader, use addIcon before"); |
| 30 | 30 | } |
| 31 | 31 | return $this->addToProperty("class", State::LOADING); |
@@ -33,56 +33,56 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public function labeled($label, $direction=Direction::LEFT, $icon=NULL) { |
| 35 | 35 | $field=$this->getField(); |
| 36 | - $labelO=$field->addLabel($label,$direction===Direction::LEFT,$icon); |
|
| 37 | - $field->addToProperty("class", $direction . " labeled"); |
|
| 36 | + $labelO=$field->addLabel($label, $direction===Direction::LEFT, $icon); |
|
| 37 | + $field->addToProperty("class", $direction." labeled"); |
|
| 38 | 38 | return $labelO; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public function labeledToCorner($icon, $direction=Direction::LEFT) { |
| 42 | - return $this->labeled("", $direction . " corner", $icon)->toCorner($direction); |
|
| 42 | + return $this->labeled("", $direction." corner", $icon)->toCorner($direction); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) { |
| 46 | 46 | $field=$this->getField(); |
| 47 | 47 | $actionO=$action; |
| 48 | - if (\is_object($action) === false) { |
|
| 49 | - $actionO=new HtmlButton("action-" . $this->identifier, $action); |
|
| 48 | + if (\is_object($action)===false) { |
|
| 49 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
| 50 | 50 | if (isset($icon)) |
| 51 | 51 | $actionO->addIcon($icon, true, $labeled); |
| 52 | 52 | } |
| 53 | - $field->addToProperty("class", $direction . " action"); |
|
| 54 | - $field->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
|
| 53 | + $field->addToProperty("class", $direction." action"); |
|
| 54 | + $field->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
| 55 | 55 | return $actionO; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function addDropdown($label="", $items=array(),$direction=Direction::RIGHT){ |
|
| 59 | - $labelO=new HtmlDropdown("dd-".$this->identifier,$label,$items); |
|
| 60 | - $labelO->asSelect("select-".$this->identifier,false,true); |
|
| 61 | - return $this->labeled($labelO,$direction); |
|
| 58 | + public function addDropdown($label="", $items=array(), $direction=Direction::RIGHT) { |
|
| 59 | + $labelO=new HtmlDropdown("dd-".$this->identifier, $label, $items); |
|
| 60 | + $labelO->asSelect("select-".$this->identifier, false, true); |
|
| 61 | + return $this->labeled($labelO, $direction); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | public function setTransparent() { |
| 65 | 65 | return $this->getField()->addToProperty("class", "transparent"); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function setReadonly(){ |
|
| 68 | + public function setReadonly() { |
|
| 69 | 69 | $this->getDataField()->setProperty("readonly", ""); |
| 70 | 70 | return $this; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function setName($name){ |
|
| 74 | - $this->getDataField()->setProperty("name",$name); |
|
| 73 | + public function setName($name) { |
|
| 74 | + $this->getDataField()->setProperty("name", $name); |
|
| 75 | 75 | return $this; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - public function setFluid(){ |
|
| 79 | - $this->getField()->addToProperty("class","fluid"); |
|
| 78 | + public function setFluid() { |
|
| 79 | + $this->getField()->addToProperty("class", "fluid"); |
|
| 80 | 80 | return $this; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | public function setDisabled($disable=true) { |
| 84 | 84 | $field=$this->getField(); |
| 85 | - if($disable) |
|
| 85 | + if ($disable) |
|
| 86 | 86 | $field->addToProperty("class", "disabled"); |
| 87 | 87 | return $this; |
| 88 | 88 | } |
@@ -38,18 +38,18 @@ discard block |
||
| 38 | 38 | return $this->getHtmlCk()->attachEvents($events); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function getField(){ |
|
| 41 | + public function getField() { |
|
| 42 | 42 | //TODO check getField() ? |
| 43 | 43 | return $this->content["field"]; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function getHtmlCk(){ |
|
| 46 | + public function getHtmlCk() { |
|
| 47 | 47 | return $this->content["field"]; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function getDataField(){ |
|
| 51 | - $field= $this->getField(); |
|
| 52 | - if($field instanceof AbstractCheckbox) |
|
| 50 | + public function getDataField() { |
|
| 51 | + $field=$this->getField(); |
|
| 52 | + if ($field instanceof AbstractCheckbox) |
|
| 53 | 53 | $field=$field->getField(); |
| 54 | 54 | return $field; |
| 55 | 55 | } |
@@ -59,10 +59,10 @@ discard block |
||
| 59 | 59 | * @param boolean $value |
| 60 | 60 | * @return HtmlFormField |
| 61 | 61 | */ |
| 62 | - public function setChecked($value=true){ |
|
| 63 | - if($value===true){ |
|
| 62 | + public function setChecked($value=true) { |
|
| 63 | + if ($value===true) { |
|
| 64 | 64 | $this->getDataField()->setProperty("checked", "checked"); |
| 65 | - }else{ |
|
| 65 | + } else { |
|
| 66 | 66 | $this->getDataField()->removeProperty("checked"); |
| 67 | 67 | } |
| 68 | 68 | return $this; |
@@ -14,34 +14,34 @@ discard block |
||
| 14 | 14 | use FieldTrait; |
| 15 | 15 | protected $_container; |
| 16 | 16 | protected $_validation; |
| 17 | - public function __construct($identifier, $field,$label=NULL) { |
|
| 18 | - parent::__construct($identifier, "div","field"); |
|
| 17 | + public function __construct($identifier, $field, $label=NULL) { |
|
| 18 | + parent::__construct($identifier, "div", "field"); |
|
| 19 | 19 | $this->content=array(); |
| 20 | - $this->_states=[State::ERROR,State::DISABLED]; |
|
| 21 | - if(isset($label)) |
|
| 20 | + $this->_states=[State::ERROR, State::DISABLED]; |
|
| 21 | + if (isset($label)) |
|
| 22 | 22 | $this->setLabel($label); |
| 23 | 23 | $this->setField($field); |
| 24 | 24 | $this->_validation=NULL; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function addPointingLabel($label,$pointing=Direction::NONE){ |
|
| 28 | - $labelO=new HtmlLabel("",$label); |
|
| 27 | + public function addPointingLabel($label, $pointing=Direction::NONE) { |
|
| 28 | + $labelO=new HtmlLabel("", $label); |
|
| 29 | 29 | $labelO->setPointing($pointing); |
| 30 | - $this->addContent($labelO,$pointing==="below" || $pointing==="right"); |
|
| 30 | + $this->addContent($labelO, $pointing==="below" || $pointing==="right"); |
|
| 31 | 31 | return $labelO; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function setLabel($label){ |
|
| 34 | + public function setLabel($label) { |
|
| 35 | 35 | $labelO=$label; |
| 36 | - if(\is_string($label)){ |
|
| 37 | - $labelO=new HtmlSemDoubleElement("","label",""); |
|
| 36 | + if (\is_string($label)) { |
|
| 37 | + $labelO=new HtmlSemDoubleElement("", "label", ""); |
|
| 38 | 38 | $labelO->setContent($label); |
| 39 | - $labelO->setProperty("for", \str_replace("field-", "",$this->identifier)); |
|
| 39 | + $labelO->setProperty("for", \str_replace("field-", "", $this->identifier)); |
|
| 40 | 40 | } |
| 41 | 41 | $this->content["label"]=$labelO; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function setField($field){ |
|
| 44 | + public function setField($field) { |
|
| 45 | 45 | $this->content["field"]=$field; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | * Returns the label or null |
| 50 | 50 | * @return mixed |
| 51 | 51 | */ |
| 52 | - public function getLabel(){ |
|
| 53 | - if(\array_key_exists("label", $this->content)) |
|
| 52 | + public function getLabel() { |
|
| 53 | + if (\array_key_exists("label", $this->content)) |
|
| 54 | 54 | return $this->content["label"]; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * Return the field |
| 59 | 59 | * @return mixed |
| 60 | 60 | */ |
| 61 | - public function getField(){ |
|
| 61 | + public function getField() { |
|
| 62 | 62 | return $this->content["field"]; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -66,14 +66,14 @@ discard block |
||
| 66 | 66 | * Return the field with data |
| 67 | 67 | * @return mixed |
| 68 | 68 | */ |
| 69 | - public function getDataField(){ |
|
| 69 | + public function getDataField() { |
|
| 70 | 70 | return $this->content["field"]; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * puts the label before or behind |
| 75 | 75 | */ |
| 76 | - public function swapLabel(){ |
|
| 76 | + public function swapLabel() { |
|
| 77 | 77 | $label=$this->getLabel(); |
| 78 | 78 | unset($this->content["label"]); |
| 79 | 79 | $this->content["label"]=$label; |
@@ -84,31 +84,31 @@ discard block |
||
| 84 | 84 | * @param int $width |
| 85 | 85 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
| 86 | 86 | */ |
| 87 | - public function setWidth($width){ |
|
| 88 | - if(\is_int($width)){ |
|
| 87 | + public function setWidth($width) { |
|
| 88 | + if (\is_int($width)) { |
|
| 89 | 89 | $width=Wide::getConstants()["W".$width]; |
| 90 | 90 | } |
| 91 | 91 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 92 | - if(isset($this->_container)){ |
|
| 92 | + if (isset($this->_container)) { |
|
| 93 | 93 | $this->_container->setEqualWidth(false); |
| 94 | 94 | } |
| 95 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
| 95 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * Field displays an error state |
| 100 | 100 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
| 101 | 101 | */ |
| 102 | - public function setError(){ |
|
| 102 | + public function setError() { |
|
| 103 | 103 | return $this->addToProperty("class", "error"); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - public function setInline(){ |
|
| 106 | + public function setInline() { |
|
| 107 | 107 | return $this->addToProperty("class", "inline"); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public function jsState($state){ |
|
| 111 | - return $this->jsDoJquery("addClass",$state); |
|
| 110 | + public function jsState($state) { |
|
| 111 | + return $this->jsDoJquery("addClass", $state); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | public function setContainer($_container) { |
@@ -116,34 +116,34 @@ discard block |
||
| 116 | 116 | return $this; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function setReadonly(){ |
|
| 119 | + public function setReadonly() { |
|
| 120 | 120 | $this->getField()->setProperty("readonly", ""); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function addRule($type,$prompt=NULL,$value=NULL){ |
|
| 123 | + public function addRule($type, $prompt=NULL, $value=NULL) { |
|
| 124 | 124 | $field=$this->getDataField(); |
| 125 | - if(isset($field)){ |
|
| 126 | - if(!isset($this->_validation)){ |
|
| 125 | + if (isset($field)) { |
|
| 126 | + if (!isset($this->_validation)) { |
|
| 127 | 127 | $this->_validation=new FieldValidation($field->getIdentifier()); |
| 128 | 128 | } |
| 129 | - if($type==="empty"){ |
|
| 130 | - $this->addToProperty("class","required"); |
|
| 129 | + if ($type==="empty") { |
|
| 130 | + $this->addToProperty("class", "required"); |
|
| 131 | 131 | } |
| 132 | - $this->_validation->addRule($type,$prompt,$value); |
|
| 132 | + $this->_validation->addRule($type, $prompt, $value); |
|
| 133 | 133 | } |
| 134 | 134 | return $this; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - public function addRules(array $rules){ |
|
| 138 | - foreach ($rules as $rule){ |
|
| 137 | + public function addRules(array $rules) { |
|
| 138 | + foreach ($rules as $rule) { |
|
| 139 | 139 | $this->addRule($rule); |
| 140 | 140 | } |
| 141 | 141 | return $this; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - public function addIcon($icon,$direction=Direction::LEFT){ |
|
| 144 | + public function addIcon($icon, $direction=Direction::LEFT) { |
|
| 145 | 145 | $field=$this->getField(); |
| 146 | - return $field->addIcon($icon,$direction); |
|
| 146 | + return $field->addIcon($icon, $direction); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | public function getValidation() { |
@@ -7,25 +7,25 @@ |
||
| 7 | 7 | |
| 8 | 8 | class HtmlFormDropdown extends HtmlFormField { |
| 9 | 9 | |
| 10 | - public function __construct($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false,$associative=true) { |
|
| 11 | - parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier,$value,$items,$associative))->asSelect($identifier,$multiple), $label); |
|
| 10 | + public function __construct($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false, $associative=true) { |
|
| 11 | + parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier, $value, $items, $associative))->asSelect($identifier, $multiple), $label); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - public function setItems($items){ |
|
| 14 | + public function setItems($items) { |
|
| 15 | 15 | return $this->getField()->setItems($items); |
| 16 | 16 | } |
| 17 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
| 18 | - return $this->getField()->addItem($item,$value,$image); |
|
| 17 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
| 18 | + return $this->getField()->addItem($item, $value, $image); |
|
| 19 | 19 | } |
| 20 | - public static function multipleDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$associative=true){ |
|
| 21 | - return new HtmlFormDropdown($identifier,$items,$label,$value,true,$associative); |
|
| 20 | + public static function multipleDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $associative=true) { |
|
| 21 | + return new HtmlFormDropdown($identifier, $items, $label, $value, true, $associative); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function getDataField(){ |
|
| 24 | + public function getDataField() { |
|
| 25 | 25 | return $this->getField()->getInput(); |
| 26 | 26 | } |
| 27 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
| 28 | - $this->getField()->asSelect($name,$multiple,$selection); |
|
| 27 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 28 | + $this->getField()->asSelect($name, $multiple, $selection); |
|
| 29 | 29 | return $this; |
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | \ No newline at end of file |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $this->startIndex=$startIndex; |
| 53 | 53 | $this->autoActive=$autoActive; |
| 54 | 54 | $this->_contentSeparator="<div class='divider'> / </div>"; |
| 55 | - $this->_hrefFunction=function ($e) { |
|
| 55 | + $this->_hrefFunction=function($e) { |
|
| 56 | 56 | return $e->getContent(); |
| 57 | 57 | }; |
| 58 | 58 | if (isset($hrefFunction)) { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @return HtmlBreadcrumbs |
| 69 | 69 | */ |
| 70 | 70 | public function autoGetOnClick($targetSelector) { |
| 71 | - return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr )); |
|
| 71 | + return $this->getOnClick($this->root, $targetSelector, array("attr" => $this->attr)); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function contentAsString() { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function setActive($index=null) { |
| 85 | 85 | if (!isset($index)) { |
| 86 | - $index=sizeof($this->content) - 1; |
|
| 86 | + $index=sizeof($this->content)-1; |
|
| 87 | 87 | } |
| 88 | 88 | $activeItem=$this->content[$index]; |
| 89 | 89 | $activeItem->addToProperty("class", "active"); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @param Dispatcher $dispatcher the request dispatcher |
| 97 | 97 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 98 | 98 | */ |
| 99 | - public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) { |
|
| 99 | + public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) { |
|
| 100 | 100 | return $this->addItems($js->fromDispatcher($dispatcher)); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | if (!isset($index)) { |
| 111 | 111 | $index=sizeof($this->content); |
| 112 | 112 | } |
| 113 | - if ($this->absolutePaths === true) { |
|
| 113 | + if ($this->absolutePaths===true) { |
|
| 114 | 114 | return $this->_hrefFunction($this->content[$index]); |
| 115 | 115 | } else { |
| 116 | - return $this->root . implode($separator, array_slice(array_map(function ($e) { |
|
| 116 | + return $this->root.implode($separator, array_slice(array_map(function($e) { |
|
| 117 | 117 | return $this->_hrefFunction($e); |
| 118 | - }, $this->content), $this->startIndex, $index + 1)); |
|
| 118 | + }, $this->content), $this->startIndex, $index+1)); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | $this->setActive(); |
| 150 | 150 | } |
| 151 | 151 | $count=$this->count(); |
| 152 | - for($i=1; $i < $count; $i++) { |
|
| 153 | - $this->content[$i]->wrap($this->getContentDivider($i - 1)); |
|
| 152 | + for ($i=1; $i<$count; $i++) { |
|
| 153 | + $this->content[$i]->wrap($this->getContentDivider($i-1)); |
|
| 154 | 154 | } |
| 155 | 155 | return parent::compile($js, $view); |
| 156 | 156 | } |
@@ -160,15 +160,15 @@ discard block |
||
| 160 | 160 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 161 | 161 | */ |
| 162 | 162 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 163 | - foreach ( $this->content as $element ) { |
|
| 163 | + foreach ($this->content as $element) { |
|
| 164 | 164 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
| 165 | 165 | } |
| 166 | 166 | return $this; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 170 | - foreach ( $this->content as $element ) { |
|
| 171 | - if ($element->getProperty($this->attr) != NULL){ |
|
| 170 | + foreach ($this->content as $element) { |
|
| 171 | + if ($element->getProperty($this->attr)!=NULL) { |
|
| 172 | 172 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | protected function createItem($value) { |
| 185 | 185 | $count=$this->count(); |
| 186 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section"); |
|
| 186 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section"); |
|
| 187 | 187 | if (\is_array($value)) |
| 188 | 188 | $itemO->fromArray($value); |
| 189 | 189 | else { |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | public function addIconAt($icon, $index) { |
| 196 | 196 | $item=$this->getItem($index); |
| 197 | 197 | if (isset($item)) { |
| 198 | - $icon=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 198 | + $icon=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 199 | 199 | $item->wrapContent($icon); |
| 200 | 200 | } |
| 201 | 201 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | public function addItem($item) { |
| 204 | 204 | $count=$this->count(); |
| 205 | 205 | $itemO=parent::addItem($item); |
| 206 | - $this->addToPropertyCtrl("class", "section", array ("section" )); |
|
| 206 | + $this->addToPropertyCtrl("class", "section", array("section")); |
|
| 207 | 207 | $itemO->setProperty($this->attr, $this->getHref($count)); |
| 208 | 208 | return $itemO; |
| 209 | 209 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | public function setAbsolutePaths($absolutePaths) { |
| 220 | 220 | $this->absolutePaths=$absolutePaths; |
| 221 | 221 | $size=\sizeof($this->content); |
| 222 | - for($i=0;$i<$size;$i++){ |
|
| 222 | + for ($i=0; $i<$size; $i++) { |
|
| 223 | 223 | $this->content[$i]->setProperty($this->attr, $this->getHref($i)); |
| 224 | 224 | } |
| 225 | 225 | return $this; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | class HtmlPopup extends HtmlSemDoubleElement { |
| 13 | 13 | private $_container; |
| 14 | - public function __construct(BaseHtml $container,$identifier, $content="") { |
|
| 14 | + public function __construct(BaseHtml $container, $identifier, $content="") { |
|
| 15 | 15 | parent::__construct($identifier, "div"); |
| 16 | 16 | $this->_container=$container; |
| 17 | 17 | $this->setClass("ui popup"); |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | $this->_params=array("on"=>"hover"); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public function addList($items=array(),$header=NULL){ |
|
| 23 | - if(!$this->content instanceof HtmlGrid){ |
|
| 24 | - $this->content=new HtmlGrid("Grid-".$this->identifier,0); |
|
| 22 | + public function addList($items=array(), $header=NULL) { |
|
| 23 | + if (!$this->content instanceof HtmlGrid) { |
|
| 24 | + $this->content=new HtmlGrid("Grid-".$this->identifier, 0); |
|
| 25 | 25 | } |
| 26 | 26 | $grid=$this->content; |
| 27 | 27 | |
@@ -29,12 +29,12 @@ discard block |
||
| 29 | 29 | $colCount++; |
| 30 | 30 | $grid->setColsCount($colCount); |
| 31 | 31 | |
| 32 | - $list=new HtmlList("",$items); |
|
| 32 | + $list=new HtmlList("", $items); |
|
| 33 | 33 | $list->asLink(); |
| 34 | - if(isset($header)){ |
|
| 35 | - $list->addHeader(4,$header); |
|
| 34 | + if (isset($header)) { |
|
| 35 | + $list->addHeader(4, $header); |
|
| 36 | 36 | } |
| 37 | - $grid->getCell(0,$colCount-1)->setContent($list); |
|
| 37 | + $grid->getCell(0, $colCount-1)->setContent($list); |
|
| 38 | 38 | $grid->setDivided()->setRelaxed(true); |
| 39 | 39 | return $list; |
| 40 | 40 | } |
@@ -42,14 +42,14 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * A popup can have no maximum width and continue to flow to fit its content |
| 44 | 44 | */ |
| 45 | - public function setFlowing(){ |
|
| 45 | + public function setFlowing() { |
|
| 46 | 46 | return $this->addToProperty("class", "flowing"); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * A popup can provide more basic formatting |
| 51 | 51 | */ |
| 52 | - public function setBasic(){ |
|
| 52 | + public function setBasic() { |
|
| 53 | 53 | return $this->addToProperty("class", "basic"); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -57,22 +57,22 @@ discard block |
||
| 57 | 57 | * {@inheritDoc} |
| 58 | 58 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
| 59 | 59 | */ |
| 60 | - public function run(JsUtils $js){ |
|
| 60 | + public function run(JsUtils $js) { |
|
| 61 | 61 | $this->_params["popup"]="#".$this->identifier; |
| 62 | - $js->semantic()->popup("#".$this->_container->getIdentifier(),$this->_params); |
|
| 62 | + $js->semantic()->popup("#".$this->_container->getIdentifier(), $this->_params); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public function setOn($event="click"){ |
|
| 65 | + public function setOn($event="click") { |
|
| 66 | 66 | $this->_params["on"]=$event; |
| 67 | 67 | return $this; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - public function setInline($value=true){ |
|
| 70 | + public function setInline($value=true) { |
|
| 71 | 71 | $this->_params["inline"]=$value; |
| 72 | 72 | return $this; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function setPosition($position){ |
|
| 75 | + public function setPosition($position) { |
|
| 76 | 76 | $this->_params["position"]=$position; |
| 77 | 77 | return $this; |
| 78 | 78 | } |
@@ -15,117 +15,117 @@ discard block |
||
| 15 | 15 | protected $_paramParts=array(); |
| 16 | 16 | |
| 17 | 17 | public function __construct($identifier, $header="", $content="", $actions=array()) { |
| 18 | - parent::__construct($identifier, "div","ui modal"); |
|
| 19 | - if(isset($header)){ |
|
| 18 | + parent::__construct($identifier, "div", "ui modal"); |
|
| 19 | + if (isset($header)) { |
|
| 20 | 20 | $this->setHeader($header); |
| 21 | 21 | } |
| 22 | - if(isset($content)){ |
|
| 22 | + if (isset($content)) { |
|
| 23 | 23 | $this->setContent($content); |
| 24 | 24 | } |
| 25 | - if(isset($actions)){ |
|
| 25 | + if (isset($actions)) { |
|
| 26 | 26 | $this->setActions($actions); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function setHeader($value) { |
| 31 | - $this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value); |
|
| 31 | + $this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value); |
|
| 32 | 32 | return $this; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function setContent($value) { |
| 36 | - $this->content["content"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", $value); |
|
| 36 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", $value); |
|
| 37 | 37 | return $this; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function setActions($actions) { |
| 41 | - $this->content["actions"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "actions"); |
|
| 42 | - if(\is_array($actions)){ |
|
| 43 | - foreach ($actions as $action){ |
|
| 41 | + $this->content["actions"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "actions"); |
|
| 42 | + if (\is_array($actions)) { |
|
| 43 | + foreach ($actions as $action) { |
|
| 44 | 44 | $this->addAction($action); |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | - else{ |
|
| 47 | + else { |
|
| 48 | 48 | $this->addAction($actions); |
| 49 | 49 | } |
| 50 | 50 | return $this; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function addAction($action){ |
|
| 54 | - if(!$action instanceof BaseHtml){ |
|
| 53 | + public function addAction($action) { |
|
| 54 | + if (!$action instanceof BaseHtml) { |
|
| 55 | 55 | $class=""; |
| 56 | - if(\array_search($action, ["Okay","Yes"])!==false){ |
|
| 56 | + if (\array_search($action, ["Okay", "Yes"])!==false) { |
|
| 57 | 57 | $class="approve"; |
| 58 | 58 | } |
| 59 | - if(\array_search($action, ["Cancel","No"])!==false){ |
|
| 59 | + if (\array_search($action, ["Cancel", "No"])!==false) { |
|
| 60 | 60 | $class="cancel"; |
| 61 | 61 | } |
| 62 | - $action=new HtmlButton("action-".$this->identifier,$action); |
|
| 63 | - if($class!=="") |
|
| 62 | + $action=new HtmlButton("action-".$this->identifier, $action); |
|
| 63 | + if ($class!=="") |
|
| 64 | 64 | $action->addToProperty("class", $class); |
| 65 | 65 | } |
| 66 | 66 | return $this->addElementInPart($action, "actions"); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function addContent($content,$before=false){ |
|
| 70 | - $this->content["content"]->addContent($content,$before); |
|
| 69 | + public function addContent($content, $before=false) { |
|
| 70 | + $this->content["content"]->addContent($content, $before); |
|
| 71 | 71 | return $this; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function addImageContent($image,$description=NULL){ |
|
| 74 | + public function addImageContent($image, $description=NULL) { |
|
| 75 | 75 | $content=$this->content["content"]; |
| 76 | - if(isset($description)){ |
|
| 77 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
| 78 | - $content->addContent($description,true); |
|
| 76 | + if (isset($description)) { |
|
| 77 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
| 78 | + $content->addContent($description, true); |
|
| 79 | 79 | } |
| 80 | - if($image!==""){ |
|
| 81 | - $img=new HtmlImage("image-".$this->identifier,$image,"","medium"); |
|
| 82 | - $content->addContent($img,true); |
|
| 83 | - $content->addToProperty("class","image"); |
|
| 80 | + if ($image!=="") { |
|
| 81 | + $img=new HtmlImage("image-".$this->identifier, $image, "", "medium"); |
|
| 82 | + $content->addContent($img, true); |
|
| 83 | + $content->addToProperty("class", "image"); |
|
| 84 | 84 | } |
| 85 | 85 | return $this; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - public function addIconContent($icon,$description=NULL){ |
|
| 88 | + public function addIconContent($icon, $description=NULL) { |
|
| 89 | 89 | $content=$this->content["content"]; |
| 90 | - if(isset($description)){ |
|
| 91 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
| 92 | - $content->addContent($description,true); |
|
| 90 | + if (isset($description)) { |
|
| 91 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
| 92 | + $content->addContent($description, true); |
|
| 93 | 93 | } |
| 94 | - if($icon!==""){ |
|
| 95 | - $img=new HtmlIcon("image-".$this->identifier,$icon); |
|
| 96 | - $content->addContent($img,true); |
|
| 97 | - $content->addToProperty("class","image"); |
|
| 94 | + if ($icon!=="") { |
|
| 95 | + $img=new HtmlIcon("image-".$this->identifier, $icon); |
|
| 96 | + $content->addContent($img, true); |
|
| 97 | + $content->addToProperty("class", "image"); |
|
| 98 | 98 | } |
| 99 | 99 | return $this; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - private function addContentInPart($content,$uiClass,$part) { |
|
| 103 | - return $this->addElementInPart(new HtmlSemDoubleElement($part."-" . $this->identifier, "div", $uiClass, $content), $part); |
|
| 102 | + private function addContentInPart($content, $uiClass, $part) { |
|
| 103 | + return $this->addElementInPart(new HtmlSemDoubleElement($part."-".$this->identifier, "div", $uiClass, $content), $part); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - private function addElementInPart($element,$part) { |
|
| 106 | + private function addElementInPart($element, $part) { |
|
| 107 | 107 | $this->content[$part]->addContent($element); |
| 108 | 108 | return $element; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - public function showDimmer($value){ |
|
| 112 | - $value=$value?"show":"hide"; |
|
| 111 | + public function showDimmer($value) { |
|
| 112 | + $value=$value ? "show" : "hide"; |
|
| 113 | 113 | $this->_paramParts[]=["'".$value." dimmer'"]; |
| 114 | 114 | return $this; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - public function setInverted(){ |
|
| 117 | + public function setInverted() { |
|
| 118 | 118 | $this->_params["inverted"]=true; |
| 119 | 119 | return $this; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - public function setBasic(){ |
|
| 122 | + public function setBasic() { |
|
| 123 | 123 | return $this->addToProperty("class", "basic"); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
| 127 | - public function setTransition($value){ |
|
| 128 | - $this->_paramParts[]=["'setting'","'transition'","'".$value."'"]; |
|
| 127 | + public function setTransition($value) { |
|
| 128 | + $this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"]; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | * @param string $viewName |
| 136 | 136 | * @param $params The parameters to pass to the view |
| 137 | 137 | */ |
| 138 | - public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) { |
|
| 139 | - return $this->setContent($js->renderContent($initialController, $viewName,$params)); |
|
| 138 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
| 139 | + return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | * @param string $actionName the action name |
| 148 | 148 | * @param array $params |
| 149 | 149 | */ |
| 150 | - public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
| 151 | - return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params)); |
|
| 150 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
| 151 | + return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | /** |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 159 | 159 | */ |
| 160 | 160 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 161 | - $this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]); |
|
| 161 | + $this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]); |
|
| 162 | 162 | return parent::compile($js, $view); |
| 163 | 163 | } |
| 164 | 164 | /* |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | * @see BaseHtml::run() |
| 167 | 167 | */ |
| 168 | 168 | public function run(JsUtils $js) { |
| 169 | - if(isset($this->_bsComponent)===false) |
|
| 170 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
| 169 | + if (isset($this->_bsComponent)===false) |
|
| 170 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts); |
|
| 171 | 171 | $this->addEventsOnRun($js); |
| 172 | 172 | return $this->_bsComponent; |
| 173 | 173 | } |