@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | class JArray { |
| 6 | 6 | |
| 7 | 7 | public static function isAssociative($array) { |
| 8 | - return (array_values($array) !== $array); |
|
| 8 | + return (array_values($array)!==$array); |
|
| 9 | 9 | //return (array_keys($array)!==range(0, count($array)-1)); |
| 10 | 10 | } |
| 11 | 11 | |
@@ -21,21 +21,21 @@ discard block |
||
| 21 | 21 | public static function getDefaultValue($array, $key, $default) { |
| 22 | 22 | if (array_key_exists($key, $array)) { |
| 23 | 23 | return $array [$key]; |
| 24 | - } else |
|
| 24 | + }else |
|
| 25 | 25 | return $default; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public static function implode($glue,$pieces){ |
|
| 28 | + public static function implode($glue, $pieces) { |
|
| 29 | 29 | $result=""; |
| 30 | - if(\is_array($glue)){ |
|
| 30 | + if (\is_array($glue)) { |
|
| 31 | 31 | $size=\sizeof($pieces); |
| 32 | - if($size>0){ |
|
| 33 | - for($i=0;$i<$size-1;$i++){ |
|
| 32 | + if ($size>0) { |
|
| 33 | + for ($i=0; $i<$size-1; $i++) { |
|
| 34 | 34 | $result.=$pieces[$i].@$glue[$i]; |
| 35 | 35 | } |
| 36 | 36 | $result.=$pieces[$size-1]; |
| 37 | 37 | } |
| 38 | - }else{ |
|
| 38 | + }else { |
|
| 39 | 39 | $result=\implode($glue, $pieces); |
| 40 | 40 | } |
| 41 | 41 | return $result; |
@@ -8,26 +8,26 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class HtmlFormField extends HtmlSemDoubleElement { |
| 10 | 10 | protected $_container; |
| 11 | - public function __construct($identifier, $field,$label=NULL) { |
|
| 12 | - parent::__construct($identifier, "div","field"); |
|
| 11 | + public function __construct($identifier, $field, $label=NULL) { |
|
| 12 | + parent::__construct($identifier, "div", "field"); |
|
| 13 | 13 | $this->content=array(); |
| 14 | - $this->_states=[State::ERROR,State::DISABLED]; |
|
| 15 | - if(isset($label)) |
|
| 14 | + $this->_states=[State::ERROR, State::DISABLED]; |
|
| 15 | + if (isset($label)) |
|
| 16 | 16 | $this->setLabel($label); |
| 17 | 17 | $this->setField($field); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function setLabel($label){ |
|
| 20 | + public function setLabel($label) { |
|
| 21 | 21 | $labelO=$label; |
| 22 | - if(\is_string($label)){ |
|
| 23 | - $labelO=new HtmlSemDoubleElement("","label",""); |
|
| 22 | + if (\is_string($label)) { |
|
| 23 | + $labelO=new HtmlSemDoubleElement("", "label", ""); |
|
| 24 | 24 | $labelO->setContent($label); |
| 25 | - $labelO->setProperty("for", \str_replace("field-", "",$this->identifier)); |
|
| 25 | + $labelO->setProperty("for", \str_replace("field-", "", $this->identifier)); |
|
| 26 | 26 | } |
| 27 | 27 | $this->content["label"]=$labelO; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function setField($field){ |
|
| 30 | + public function setField($field) { |
|
| 31 | 31 | $this->content["field"]=$field; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | * Returns the label or null |
| 36 | 36 | * @return mixed |
| 37 | 37 | */ |
| 38 | - public function getLabel(){ |
|
| 39 | - if(\array_key_exists("label", $this->content)) |
|
| 38 | + public function getLabel() { |
|
| 39 | + if (\array_key_exists("label", $this->content)) |
|
| 40 | 40 | return $this->content["label"]; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -44,14 +44,14 @@ discard block |
||
| 44 | 44 | * Return the field |
| 45 | 45 | * @return mixed |
| 46 | 46 | */ |
| 47 | - public function getField(){ |
|
| 47 | + public function getField() { |
|
| 48 | 48 | return $this->content["field"]; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * puts the label before or behind |
| 53 | 53 | */ |
| 54 | - public function swapLabel(){ |
|
| 54 | + public function swapLabel() { |
|
| 55 | 55 | $label=$this->getLabel(); |
| 56 | 56 | unset($this->content["label"]); |
| 57 | 57 | $this->content["label"]=$label; |
@@ -62,27 +62,27 @@ discard block |
||
| 62 | 62 | * @param int $width |
| 63 | 63 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
| 64 | 64 | */ |
| 65 | - public function setWidth($width){ |
|
| 66 | - if(\is_int($width)){ |
|
| 65 | + public function setWidth($width) { |
|
| 66 | + if (\is_int($width)) { |
|
| 67 | 67 | $width=Wide::getConstants()["W".$width]; |
| 68 | 68 | } |
| 69 | 69 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 70 | - if(isset($this->_container)){ |
|
| 70 | + if (isset($this->_container)) { |
|
| 71 | 71 | $this->_container->setEqualWidth(false); |
| 72 | 72 | } |
| 73 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
| 73 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * Field displays an error state |
| 78 | 78 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
| 79 | 79 | */ |
| 80 | - public function setError(){ |
|
| 80 | + public function setError() { |
|
| 81 | 81 | return $this->addToProperty("class", "error"); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public function jsState($state){ |
|
| 85 | - return $this->jsDoJquery("addClass",$state); |
|
| 84 | + public function jsState($state) { |
|
| 85 | + return $this->jsDoJquery("addClass", $state); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public function setContainer($_container) { |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | return $this; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - public function setReadonly(){ |
|
| 93 | + public function setReadonly() { |
|
| 94 | 94 | $this->getField()->setProperty("readonly", ""); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -10,13 +10,13 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class HtmlFormRadio extends AbstractHtmlFormRadioCheckbox { |
| 12 | 12 | |
| 13 | - public function __construct($identifier, $name=NULL,$label=NULL,$value=NULL,$type=NULL) { |
|
| 14 | - parent::__construct($identifier, $name,$label,$value,$type); |
|
| 13 | + public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL, $type=NULL) { |
|
| 14 | + parent::__construct($identifier, $name, $label, $value, $type); |
|
| 15 | 15 | $this->_input->getField()->setProperty("type", "radio"); |
| 16 | 16 | $this->_input->setClass("ui radio checkbox"); |
| 17 | - if(isset($name)) |
|
| 17 | + if (isset($name)) |
|
| 18 | 18 | $this->_input->getField()->setProperty("name", $name); |
| 19 | - if(isset($type)) |
|
| 19 | + if (isset($type)) |
|
| 20 | 20 | $this->setType($type); |
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | \ No newline at end of file |
@@ -14,9 +14,11 @@ |
||
| 14 | 14 | parent::__construct($identifier, $name,$label,$value,$type); |
| 15 | 15 | $this->_input->getField()->setProperty("type", "radio"); |
| 16 | 16 | $this->_input->setClass("ui radio checkbox"); |
| 17 | - if(isset($name)) |
|
| 18 | - $this->_input->getField()->setProperty("name", $name); |
|
| 19 | - if(isset($type)) |
|
| 20 | - $this->setType($type); |
|
| 17 | + if(isset($name)) { |
|
| 18 | + $this->_input->getField()->setProperty("name", $name); |
|
| 19 | + } |
|
| 20 | + if(isset($type)) { |
|
| 21 | + $this->setType($type); |
|
| 22 | + } |
|
| 21 | 23 | } |
| 22 | 24 | } |
| 23 | 25 | \ No newline at end of file |
@@ -15,26 +15,26 @@ discard block |
||
| 15 | 15 | protected $_equalWidth; |
| 16 | 16 | protected $_name; |
| 17 | 17 | |
| 18 | - public function __construct($identifier, $fields=array(),$equalWidth=true) { |
|
| 18 | + public function __construct($identifier, $fields=array(), $equalWidth=true) { |
|
| 19 | 19 | parent::__construct($identifier, "div"); |
| 20 | 20 | $this->_equalWidth=$equalWidth; |
| 21 | 21 | $this->addItems($fields); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function addFields($fields=NULL,$label=NULL){ |
|
| 25 | - if(!$fields instanceof HtmlFormFields){ |
|
| 26 | - if(\is_array($fields)===false){ |
|
| 27 | - $fields = \func_get_args(); |
|
| 24 | + public function addFields($fields=NULL, $label=NULL) { |
|
| 25 | + if (!$fields instanceof HtmlFormFields) { |
|
| 26 | + if (\is_array($fields)===false) { |
|
| 27 | + $fields=\func_get_args(); |
|
| 28 | 28 | $end=\end($fields); |
| 29 | - if(\is_string($end)){ |
|
| 29 | + if (\is_string($end)) { |
|
| 30 | 30 | $label=$end; |
| 31 | 31 | \array_pop($fields); |
| 32 | 32 | }else $label=NULL; |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | - if(isset($label)) |
|
| 35 | + if (isset($label)) |
|
| 36 | 36 | $this->setLabel($label); |
| 37 | - foreach ($fields as $field){ |
|
| 37 | + foreach ($fields as $field) { |
|
| 38 | 38 | $this->addItem($field); |
| 39 | 39 | } |
| 40 | 40 | return $this; |
@@ -44,40 +44,40 @@ discard block |
||
| 44 | 44 | * @param string|HtmlSemDoubleElement $label |
| 45 | 45 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
| 46 | 46 | */ |
| 47 | - public function setLabel($label){ |
|
| 47 | + public function setLabel($label) { |
|
| 48 | 48 | $labelO=$label; |
| 49 | - if(\is_string($label)){ |
|
| 50 | - $labelO=new HtmlSemDoubleElement("","label","",$label); |
|
| 49 | + if (\is_string($label)) { |
|
| 50 | + $labelO=new HtmlSemDoubleElement("", "label", "", $label); |
|
| 51 | 51 | } |
| 52 | - $this->insertItem($labelO,0); |
|
| 52 | + $this->insertItem($labelO, 0); |
|
| 53 | 53 | return $labelO; |
| 54 | 54 | } |
| 55 | - public function addItem($item){ |
|
| 55 | + public function addItem($item) { |
|
| 56 | 56 | $item=parent::addItem($item); |
| 57 | 57 | $item->setContainer($this); |
| 58 | 58 | return $item; |
| 59 | 59 | } |
| 60 | - public function compile(JsUtils $js=NULL,View $view=NULL){ |
|
| 61 | - if($this->_equalWidth){ |
|
| 60 | + public function compile(JsUtils $js=NULL, View $view=NULL) { |
|
| 61 | + if ($this->_equalWidth) { |
|
| 62 | 62 | $count=$this->count(); |
| 63 | 63 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
| 64 | 64 | }else |
| 65 | - $this->addToProperty("class","fields"); |
|
| 66 | - return parent::compile($js,$view); |
|
| 65 | + $this->addToProperty("class", "fields"); |
|
| 66 | + return parent::compile($js, $view); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function setWidth($index,$width){ |
|
| 69 | + public function setWidth($index, $width) { |
|
| 70 | 70 | $this->_equalWidth=false; |
| 71 | 71 | return $this->getItem($index)->setWidth($width); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function setInline(){ |
|
| 74 | + public function setInline() { |
|
| 75 | 75 | $this->_equalWidth=false; |
| 76 | 76 | $this->addToProperty("class", "inline"); |
| 77 | 77 | return $this; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function setGrouped(){ |
|
| 80 | + public function setGrouped() { |
|
| 81 | 81 | $this->_equalWidth=false; |
| 82 | 82 | $this->addToProperty("class", "grouped"); |
| 83 | 83 | } |
@@ -91,18 +91,18 @@ discard block |
||
| 91 | 91 | return $this; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - public static function radios($name,$items=array(),$label=NULL,$value=null,$type=NULL){ |
|
| 94 | + public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) { |
|
| 95 | 95 | $fields=array(); |
| 96 | 96 | $i=0; |
| 97 | - foreach ($items as $val=>$caption){ |
|
| 98 | - $itemO=new HtmlFormRadio($name."-".$i++,$name,$caption,$val,$type); |
|
| 99 | - if($val===$value){ |
|
| 97 | + foreach ($items as $val=>$caption) { |
|
| 98 | + $itemO=new HtmlFormRadio($name."-".$i++, $name, $caption, $val, $type); |
|
| 99 | + if ($val===$value) { |
|
| 100 | 100 | $itemO->getInput()->getField()->setProperty("checked", ""); |
| 101 | 101 | } |
| 102 | 102 | $fields[]=$itemO; |
| 103 | 103 | } |
| 104 | - $radios=new HtmlFormFields("fields-".$name,$fields); |
|
| 105 | - if(isset($label)) |
|
| 104 | + $radios=new HtmlFormFields("fields-".$name, $fields); |
|
| 105 | + if (isset($label)) |
|
| 106 | 106 | $radios->setLabel($label)->setProperty("for", $name); |
| 107 | 107 | return $radios; |
| 108 | 108 | } |
@@ -9,10 +9,10 @@ |
||
| 9 | 9 | * @version 1.001 |
| 10 | 10 | */ |
| 11 | 11 | class HtmlFormCheckbox extends AbstractHtmlFormRadioCheckbox { |
| 12 | - public function __construct($identifier, $label=NULL,$value=NULL,$type=NULL) { |
|
| 13 | - parent::__construct($identifier, NULL,$label,$value,$type); |
|
| 12 | + public function __construct($identifier, $label=NULL, $value=NULL, $type=NULL) { |
|
| 13 | + parent::__construct($identifier, NULL, $label, $value, $type); |
|
| 14 | 14 | $this->_input->setClass("ui checkbox"); |
| 15 | - if(isset($type)) |
|
| 15 | + if (isset($type)) |
|
| 16 | 16 | $this->setType($type); |
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | \ No newline at end of file |
@@ -12,7 +12,8 @@ |
||
| 12 | 12 | public function __construct($identifier, $label=NULL,$value=NULL,$type=NULL) { |
| 13 | 13 | parent::__construct($identifier, NULL,$label,$value,$type); |
| 14 | 14 | $this->_input->setClass("ui checkbox"); |
| 15 | - if(isset($type)) |
|
| 16 | - $this->setType($type); |
|
| 15 | + if(isset($type)) { |
|
| 16 | + $this->setType($type); |
|
| 17 | + } |
|
| 17 | 18 | } |
| 18 | 19 | } |
| 19 | 20 | \ No newline at end of file |
@@ -8,13 +8,13 @@ |
||
| 8 | 8 | class HtmlFormInput extends HtmlFormField { |
| 9 | 9 | use TextFieldsTrait; |
| 10 | 10 | |
| 11 | - public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
|
| 12 | - if(!isset($placeholder) && $type==="text") |
|
| 11 | + public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
| 12 | + if (!isset($placeholder) && $type==="text") |
|
| 13 | 13 | $placeholder=$label; |
| 14 | - parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
|
| 14 | + parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - public function setReadonly(){ |
|
| 17 | + public function setReadonly() { |
|
| 18 | 18 | $this->getField()->setProperty("readonly", ""); |
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 | \ No newline at end of file |
@@ -9,8 +9,9 @@ |
||
| 9 | 9 | use TextFieldsTrait; |
| 10 | 10 | |
| 11 | 11 | public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
| 12 | - if(!isset($placeholder) && $type==="text") |
|
| 13 | - $placeholder=$label; |
|
| 12 | + if(!isset($placeholder) && $type==="text") { |
|
| 13 | + $placeholder=$label; |
|
| 14 | + } |
|
| 14 | 15 | parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
| 15 | 16 | } |
| 16 | 17 | |
@@ -12,20 +12,20 @@ discard block |
||
| 12 | 12 | abstract class AbstractHtmlFormRadioCheckbox extends HtmlFormField { |
| 13 | 13 | protected $_input; |
| 14 | 14 | |
| 15 | - public function __construct($identifier, $name=NULL,$label=NULL,$value=NULL,$type=NULL) { |
|
| 16 | - $input=new HtmlFormInput($identifier,$label,"checkbox",$value); |
|
| 15 | + public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL, $type=NULL) { |
|
| 16 | + $input=new HtmlFormInput($identifier, $label, "checkbox", $value); |
|
| 17 | 17 | parent::__construct("rField-".$identifier, $input); |
| 18 | - if(isset($label)){ |
|
| 18 | + if (isset($label)) { |
|
| 19 | 19 | $input->swapLabel(); |
| 20 | 20 | $label=$input->getLabel(); |
| 21 | 21 | $label->setClass="hidden"; |
| 22 | - $label->setProperty("tabindex",0); |
|
| 22 | + $label->setProperty("tabindex", 0); |
|
| 23 | 23 | } |
| 24 | 24 | $this->_input=$input; |
| 25 | - $input->getField()->addToProperty("class","hidden"); |
|
| 25 | + $input->getField()->addToProperty("class", "hidden"); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function setType($checkboxType){ |
|
| 28 | + public function setType($checkboxType) { |
|
| 29 | 29 | return $this->_input->addToPropertyCtrl("class", $checkboxType, CheckboxType::getConstants()); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | return $this; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function setReadonly(){ |
|
| 42 | - $this->_input->getField()->setProperty("disabled","disabled"); |
|
| 43 | - return $this->_input->addToProperty("class","read-only"); |
|
| 41 | + public function setReadonly() { |
|
| 42 | + $this->_input->getField()->setProperty("disabled", "disabled"); |
|
| 43 | + return $this->_input->addToProperty("class", "read-only"); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | } |
| 47 | 47 | \ No newline at end of file |
@@ -16,33 +16,33 @@ discard block |
||
| 16 | 16 | * @author jc |
| 17 | 17 | * @version 1.001 |
| 18 | 18 | */ |
| 19 | -class HtmlGrid extends HtmlSemCollection{ |
|
| 19 | +class HtmlGrid extends HtmlSemCollection { |
|
| 20 | 20 | use TextAlignmentTrait; |
| 21 | 21 | private $_createCols; |
| 22 | 22 | private $_colSizing=true; |
| 23 | 23 | private $_implicitRows=false; |
| 24 | 24 | |
| 25 | - public function __construct( $identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
|
| 26 | - parent::__construct( $identifier, "div","ui grid"); |
|
| 25 | + public function __construct($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
|
| 26 | + parent::__construct($identifier, "div", "ui grid"); |
|
| 27 | 27 | $this->_implicitRows=$implicitRows; |
| 28 | 28 | $this->_createCols=$createCols; |
| 29 | - if(isset($numCols)){ |
|
| 29 | + if (isset($numCols)) { |
|
| 30 | 30 | //if($this->_createCols){ |
| 31 | 31 | $this->_colSizing=false; |
| 32 | 32 | //} |
| 33 | 33 | $this->setWide($numCols); |
| 34 | 34 | } |
| 35 | - $this->setRowsCount($numRows,$numCols); |
|
| 35 | + $this->setRowsCount($numRows, $numCols); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Defines the grid width (alias for setWidth) |
| 40 | 40 | * @param int $wide |
| 41 | 41 | */ |
| 42 | - public function setWide($wide){ |
|
| 42 | + public function setWide($wide) { |
|
| 43 | 43 | $wide=Wide::getConstants()["W".$wide]; |
| 44 | 44 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
| 45 | - return $this->addToPropertyCtrl("class","column",array("column")); |
|
| 45 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @param int $width |
| 51 | 51 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 52 | 52 | */ |
| 53 | - public function setWidth($width){ |
|
| 53 | + public function setWidth($width) { |
|
| 54 | 54 | return $this->setWide($width); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | * @param int $colsCount number of columns to create |
| 60 | 60 | * @return mixed |
| 61 | 61 | */ |
| 62 | - public function addRow($colsCount=NULL){ |
|
| 62 | + public function addRow($colsCount=NULL) { |
|
| 63 | 63 | $rowCount=$this->rowCount()+1; |
| 64 | - $this->setRowsCount($rowCount,$colsCount,true); |
|
| 64 | + $this->setRowsCount($rowCount, $colsCount, true); |
|
| 65 | 65 | return $this->content[$rowCount-1]; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -70,10 +70,10 @@ discard block |
||
| 70 | 70 | * @param int $width with of the column to add |
| 71 | 71 | * @return mixed|\Ajax\semantic\html\collections\HtmlGrid |
| 72 | 72 | */ |
| 73 | - public function addCol($width=NULL){ |
|
| 73 | + public function addCol($width=NULL) { |
|
| 74 | 74 | $colCount=$this->colCount()+1; |
| 75 | - $this->setColsCount($colCount,true,$width); |
|
| 76 | - if($this->hasOnlyCols($this->count())) |
|
| 75 | + $this->setColsCount($colCount, true, $width); |
|
| 76 | + if ($this->hasOnlyCols($this->count())) |
|
| 77 | 77 | return $this->content[$colCount-1]; |
| 78 | 78 | return $this; |
| 79 | 79 | } |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | * @param array $sizes array of width of the columns to create |
| 83 | 83 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 84 | 84 | */ |
| 85 | - public function addCols($sizes=array()){ |
|
| 86 | - foreach ($sizes as $size){ |
|
| 85 | + public function addCols($sizes=array()) { |
|
| 86 | + foreach ($sizes as $size) { |
|
| 87 | 87 | $this->addCol($size); |
| 88 | 88 | } |
| 89 | 89 | return $this; |
@@ -95,28 +95,28 @@ discard block |
||
| 95 | 95 | * @param int $colsCount |
| 96 | 96 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 97 | 97 | */ |
| 98 | - public function setRowsCount($rowsCount,$colsCount=NULL,$force=false){ |
|
| 98 | + public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) { |
|
| 99 | 99 | $count=$this->count(); |
| 100 | - if($rowsCount<2 && $force===false){ |
|
| 101 | - for($i=$count;$i<$colsCount;$i++){ |
|
| 100 | + if ($rowsCount<2 && $force===false) { |
|
| 101 | + for ($i=$count; $i<$colsCount; $i++) { |
|
| 102 | 102 | $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
| 103 | 103 | } |
| 104 | - }else{ |
|
| 105 | - if($this->hasOnlyCols($count)){ |
|
| 104 | + }else { |
|
| 105 | + if ($this->hasOnlyCols($count)) { |
|
| 106 | 106 | $tmpContent=$this->content; |
| 107 | 107 | $item=$this->addItem($colsCount); |
| 108 | 108 | $item->setContent($tmpContent); |
| 109 | 109 | $this->content=array(); |
| 110 | 110 | $count=1; |
| 111 | 111 | } |
| 112 | - for($i=$count;$i<$rowsCount;$i++){ |
|
| 112 | + for ($i=$count; $i<$rowsCount; $i++) { |
|
| 113 | 113 | $this->addItem($colsCount); |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | return $this; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - protected function hasOnlyCols($count){ |
|
| 119 | + protected function hasOnlyCols($count) { |
|
| 120 | 120 | return $count>0 && $this->content[0] instanceof HtmlGridCol; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -127,17 +127,17 @@ discard block |
||
| 127 | 127 | * @param int $width |
| 128 | 128 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 129 | 129 | */ |
| 130 | - public function setColsCount($numCols,$toCreate=true,$width=NULL){ |
|
| 131 | - if(isset($width)===false) |
|
| 130 | + public function setColsCount($numCols, $toCreate=true, $width=NULL) { |
|
| 131 | + if (isset($width)===false) |
|
| 132 | 132 | $this->setWide($numCols); |
| 133 | - if($toCreate==true){ |
|
| 133 | + if ($toCreate==true) { |
|
| 134 | 134 | $count=$this->count(); |
| 135 | - if($count==0 || $this->hasOnlyCols($count)){ |
|
| 136 | - for($i=$count;$i<$numCols;$i++){ |
|
| 137 | - $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i,$width)); |
|
| 135 | + if ($count==0 || $this->hasOnlyCols($count)) { |
|
| 136 | + for ($i=$count; $i<$numCols; $i++) { |
|
| 137 | + $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width)); |
|
| 138 | 138 | } |
| 139 | - }else{ |
|
| 140 | - for($i=0;$i<$count;$i++){ |
|
| 139 | + }else { |
|
| 140 | + for ($i=0; $i<$count; $i++) { |
|
| 141 | 141 | $this->getItem($i)->setColsCount($numCols); |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | * @param int $index |
| 151 | 151 | * @return \Ajax\semantic\html\collections\HtmlGridRow |
| 152 | 152 | */ |
| 153 | - public function getRow($index){ |
|
| 153 | + public function getRow($index) { |
|
| 154 | 154 | return $this->getItem($index); |
| 155 | 155 | } |
| 156 | 156 | |
@@ -158,9 +158,9 @@ discard block |
||
| 158 | 158 | * Returns the row count |
| 159 | 159 | * @return int |
| 160 | 160 | */ |
| 161 | - public function rowCount(){ |
|
| 161 | + public function rowCount() { |
|
| 162 | 162 | $count=$this->count(); |
| 163 | - if($this->hasOnlyCols($count)) |
|
| 163 | + if ($this->hasOnlyCols($count)) |
|
| 164 | 164 | return 0; |
| 165 | 165 | return $count; |
| 166 | 166 | } |
@@ -169,11 +169,11 @@ discard block |
||
| 169 | 169 | * Returns the column count |
| 170 | 170 | * @return int |
| 171 | 171 | */ |
| 172 | - public function colCount(){ |
|
| 172 | + public function colCount() { |
|
| 173 | 173 | $count=$this->count(); |
| 174 | - if($this->hasOnlyCols($count)) |
|
| 174 | + if ($this->hasOnlyCols($count)) |
|
| 175 | 175 | return $count; |
| 176 | - if($count>0) |
|
| 176 | + if ($count>0) |
|
| 177 | 177 | return $this->getItem(0)->count(); |
| 178 | 178 | return 0; |
| 179 | 179 | } |
@@ -184,11 +184,11 @@ discard block |
||
| 184 | 184 | * @param int $col |
| 185 | 185 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 186 | 186 | */ |
| 187 | - public function getCell($row,$col){ |
|
| 188 | - if($row<2 && $this->hasOnlyCols($this->count())) |
|
| 187 | + public function getCell($row, $col) { |
|
| 188 | + if ($row<2 && $this->hasOnlyCols($this->count())) |
|
| 189 | 189 | return $this->getItem($col); |
| 190 | 190 | $row=$this->getItem($row); |
| 191 | - if(isset($row)){ |
|
| 191 | + if (isset($row)) { |
|
| 192 | 192 | $col=$row->getItem($col); |
| 193 | 193 | } |
| 194 | 194 | return $col; |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | * @param boolean $vertically |
| 200 | 200 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 201 | 201 | */ |
| 202 | - public function setDivided($vertically=false){ |
|
| 203 | - $value=($vertically===true)?"vertically divided":"divided"; |
|
| 204 | - return $this->addToPropertyCtrl("class", $value,array("divided")); |
|
| 202 | + public function setDivided($vertically=false) { |
|
| 203 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
| 204 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -209,23 +209,23 @@ discard block |
||
| 209 | 209 | * @param boolean $internally true for internal cells |
| 210 | 210 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 211 | 211 | */ |
| 212 | - public function setCelled($internally=false){ |
|
| 213 | - $value=($internally===true)?"internally celled":"celled"; |
|
| 214 | - return $this->addToPropertyCtrl("class", $value,array("celled","internally celled")); |
|
| 212 | + public function setCelled($internally=false) { |
|
| 213 | + $value=($internally===true) ? "internally celled" : "celled"; |
|
| 214 | + return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled")); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
| 218 | 218 | * A grid can have its columns centered |
| 219 | 219 | */ |
| 220 | - public function setCentered(){ |
|
| 221 | - return $this->addToPropertyCtrl("class", "centered",array("centered")); |
|
| 220 | + public function setCentered() { |
|
| 221 | + return $this->addToPropertyCtrl("class", "centered", array("centered")); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /** |
| 225 | 225 | * automatically resize all elements to split the available width evenly |
| 226 | 226 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 227 | 227 | */ |
| 228 | - public function setEqualWidth(){ |
|
| 228 | + public function setEqualWidth() { |
|
| 229 | 229 | return $this->addToProperty("class", "equal width"); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -234,9 +234,9 @@ discard block |
||
| 234 | 234 | * @param string $value |
| 235 | 235 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 236 | 236 | */ |
| 237 | - public function setPadded($value=NULL){ |
|
| 238 | - if(isset($value)) |
|
| 239 | - $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
| 237 | + public function setPadded($value=NULL) { |
|
| 238 | + if (isset($value)) |
|
| 239 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
| 240 | 240 | return $this->addToProperty("class", "padded"); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -244,23 +244,23 @@ discard block |
||
| 244 | 244 | * @param boolean $very |
| 245 | 245 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 246 | 246 | */ |
| 247 | - public function setRelaxed($very=false){ |
|
| 248 | - $value=($very===true)?"very relaxed":"relaxed"; |
|
| 249 | - return $this->addToPropertyCtrl("class", $value,array("relaxed","very relaxed")); |
|
| 247 | + public function setRelaxed($very=false) { |
|
| 248 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
| 249 | + return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed")); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - public function setVerticalAlignment($value=VerticalAlignment::MIDDLE){ |
|
| 253 | - return $this->addToPropertyCtrl("class", $value." aligned",VerticalAlignment::getConstantValues("aligned")); |
|
| 252 | + public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
|
| 253 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
| 257 | 257 | * {@inheritDoc} |
| 258 | 258 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 259 | 259 | */ |
| 260 | - protected function createItem($value){ |
|
| 261 | - if($this->_createCols===false) |
|
| 260 | + protected function createItem($value) { |
|
| 261 | + if ($this->_createCols===false) |
|
| 262 | 262 | $value=null; |
| 263 | - $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing,$this->_implicitRows); |
|
| 263 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
| 264 | 264 | return $item; |
| 265 | 265 | } |
| 266 | 266 | |
@@ -268,17 +268,17 @@ discard block |
||
| 268 | 268 | * Sets $values to the grid |
| 269 | 269 | * @param array $values |
| 270 | 270 | */ |
| 271 | - public function setValues($values){ |
|
| 271 | + public function setValues($values) { |
|
| 272 | 272 | $count=$this->count(); |
| 273 | - if($this->_createCols===false){ |
|
| 274 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
| 273 | + if ($this->_createCols===false) { |
|
| 274 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
| 275 | 275 | $colSize=\sizeof($values[$i]); |
| 276 | - $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1),$colSize,$this->_colSizing,$this->_implicitRows)); |
|
| 276 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | - $count=\min(array($this->count(),\sizeof($values))); |
|
| 280 | - for($i=0;$i<$count;$i++){ |
|
| 281 | - $this->content[$i]->setValues($values[$i],$this->_createCols===false); |
|
| 279 | + $count=\min(array($this->count(), \sizeof($values))); |
|
| 280 | + for ($i=0; $i<$count; $i++) { |
|
| 281 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | * stretch the row contents to take up the entire column height |
| 287 | 287 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 288 | 288 | */ |
| 289 | - public function setStretched(){ |
|
| 289 | + public function setStretched() { |
|
| 290 | 290 | return $this->addToProperty("class", "stretched"); |
| 291 | 291 | } |
| 292 | 292 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | class HtmlPopup extends HtmlSemDoubleElement { |
| 13 | 13 | private $_params; |
| 14 | 14 | private $_container; |
| 15 | - public function __construct(BaseHtml $container,$identifier, $content="") { |
|
| 15 | + public function __construct(BaseHtml $container, $identifier, $content="") { |
|
| 16 | 16 | parent::__construct($identifier, "div"); |
| 17 | 17 | $this->_container=$container; |
| 18 | 18 | $this->setClass("ui popup"); |
@@ -20,21 +20,21 @@ discard block |
||
| 20 | 20 | $this->_params=array("on"=>"hover"); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function addList($items=array(),$header=NULL){ |
|
| 24 | - if(!$this->content instanceof HtmlGrid){ |
|
| 25 | - $this->content=new HtmlGrid("Grid-".$this->identifier,0); |
|
| 23 | + public function addList($items=array(), $header=NULL) { |
|
| 24 | + if (!$this->content instanceof HtmlGrid) { |
|
| 25 | + $this->content=new HtmlGrid("Grid-".$this->identifier, 0); |
|
| 26 | 26 | } |
| 27 | 27 | $grid=$this->content; |
| 28 | 28 | |
| 29 | 29 | $colCount=$grid->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 | } |