@@ -12,23 +12,23 @@ |
||
12 | 12 | * @param string $value |
13 | 13 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
14 | 14 | */ |
15 | - public function setTextAlignment($value=TextAlignment::LEFT){ |
|
16 | - return $this->addToPropertyCtrl("class", $value,TextAlignment::getConstants()); |
|
15 | + public function setTextAlignment($value=TextAlignment::LEFT) { |
|
16 | + return $this->addToPropertyCtrl("class", $value, TextAlignment::getConstants()); |
|
17 | 17 | } |
18 | 18 | |
19 | - public function textCenterAligned(){ |
|
19 | + public function textCenterAligned() { |
|
20 | 20 | return $this->setTextAlignment(TextAlignment::CENTER); |
21 | 21 | } |
22 | 22 | |
23 | - public function textJustified(){ |
|
23 | + public function textJustified() { |
|
24 | 24 | return $this->setTextAlignment(TextAlignment::JUSTIFIED); |
25 | 25 | } |
26 | 26 | |
27 | - public function textRightAligned(){ |
|
27 | + public function textRightAligned() { |
|
28 | 28 | return $this->setTextAlignment(TextAlignment::RIGHT); |
29 | 29 | } |
30 | 30 | |
31 | - public function textLeftAligned(){ |
|
31 | + public function textLeftAligned() { |
|
32 | 32 | return $this->setTextAlignment(); |
33 | 33 | } |
34 | 34 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | class HtmlCard extends HtmlViewItem { |
8 | 8 | |
9 | - public function __construct($identifier,$content=NULL) { |
|
9 | + public function __construct($identifier, $content=NULL) { |
|
10 | 10 | parent::__construct($identifier, "ui card", $content); |
11 | 11 | } |
12 | 12 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @param string $event |
22 | 22 | * @param boolean $multiple |
23 | 23 | */ |
24 | - public function __construct($table,$class="active",$event="click",$multiple=false){ |
|
24 | + public function __construct($table, $class="active", $event="click", $multiple=false) { |
|
25 | 25 | $this->table=$table; |
26 | 26 | $this->class=$class; |
27 | 27 | $this->event=$event; |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | return $this; |
56 | 56 | } |
57 | 57 | |
58 | - public function compile(){ |
|
58 | + public function compile() { |
|
59 | 59 | $multiple=""; |
60 | - if(!$this->multiple){ |
|
60 | + if (!$this->multiple) { |
|
61 | 61 | $multiple="$(this).closest('tbody').children('tr').removeClass('".$this->class."');"; |
62 | 62 | } |
63 | - $this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');",false,false); |
|
63 | + $this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');", false, false); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | } |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | * @author jc |
13 | 13 | * @version 1.001 |
14 | 14 | */ |
15 | -class HtmlLabeledIconMenu extends HtmlMenu{ |
|
15 | +class HtmlLabeledIconMenu extends HtmlMenu { |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @param string $identifier |
20 | 20 | * @param array $items icons |
21 | 21 | */ |
22 | - public function __construct( $identifier, $items=array()){ |
|
23 | - parent::__construct( $identifier, $items); |
|
22 | + public function __construct($identifier, $items=array()) { |
|
23 | + parent::__construct($identifier, $items); |
|
24 | 24 | $this->addToProperty("class", "labeled icon"); |
25 | 25 | } |
26 | 26 | |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | protected function createItem($value) { |
32 | 32 | $text=""; |
33 | 33 | $v=$value; |
34 | - if(\is_array($value)){ |
|
34 | + if (\is_array($value)) { |
|
35 | 35 | $v=@$value[0]; |
36 | 36 | $text=@$value[1]; |
37 | 37 | } |
38 | 38 | $count=\sizeof($this->content); |
39 | 39 | $value=new HtmlIcon("icon-".$count, $v); |
40 | - $value->wrap("",$text); |
|
41 | - $itemO=new HtmlLink("item-".$count,"",$value); |
|
40 | + $value->wrap("", $text); |
|
41 | + $itemO=new HtmlLink("item-".$count, "", $value); |
|
42 | 42 | return $itemO->setClass("item"); |
43 | 43 | } |
44 | 44 | } |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | * @author jc |
13 | 13 | * @version 1.001 |
14 | 14 | */ |
15 | -class HtmlIconMenu extends HtmlMenu{ |
|
15 | +class HtmlIconMenu extends HtmlMenu { |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @param string $identifier |
20 | 20 | * @param array $items icons |
21 | 21 | */ |
22 | - public function __construct( $identifier, $items=array()){ |
|
23 | - parent::__construct( $identifier, $items); |
|
22 | + public function __construct($identifier, $items=array()) { |
|
23 | + parent::__construct($identifier, $items); |
|
24 | 24 | $this->addToProperty("class", "icon"); |
25 | 25 | } |
26 | 26 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | protected function createItem($value) { |
33 | 33 | $count=\sizeof($this->content); |
34 | 34 | $value=new HtmlIcon("icon-".$count, $value); |
35 | - $itemO=new HtmlLink("item-".$count,"",$value); |
|
35 | + $itemO=new HtmlLink("item-".$count, "", $value); |
|
36 | 36 | return $itemO->setClass("item"); |
37 | 37 | } |
38 | 38 | } |
@@ -47,8 +47,9 @@ discard block |
||
47 | 47 | $actionO=$action; |
48 | 48 | if (\is_object($action) === false) { |
49 | 49 | $actionO=new HtmlButton("action-" . $this->identifier, $action); |
50 | - if (isset($icon)) |
|
51 | - $actionO->addIcon($icon, true, $labeled); |
|
50 | + if (isset($icon)) { |
|
51 | + $actionO->addIcon($icon, true, $labeled); |
|
52 | + } |
|
52 | 53 | } |
53 | 54 | $field->addToProperty("class", $direction . " action"); |
54 | 55 | $field->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
@@ -82,8 +83,9 @@ discard block |
||
82 | 83 | |
83 | 84 | public function setDisabled($disable=true) { |
84 | 85 | $field=$this->getField(); |
85 | - if($disable) |
|
86 | - $field->addToProperty("class", "disabled"); |
|
86 | + if($disable) { |
|
87 | + $field->addToProperty("class", "disabled"); |
|
88 | + } |
|
87 | 89 | return $this; |
88 | 90 | } |
89 | 91 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | abstract public function addToProperty($name, $value, $separator=" "); |
21 | 21 | abstract public function addLabel($caption, $style="label-default", $leftSeparator=" "); |
22 | - abstract public function addContent($content,$before=false); |
|
22 | + abstract public function addContent($content, $before=false); |
|
23 | 23 | abstract public function getField(); |
24 | 24 | abstract public function getDataField(); |
25 | 25 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | } |
29 | 29 | |
30 | 30 | public function addLoading() { |
31 | - if ($this->_hasIcon === false) { |
|
31 | + if ($this->_hasIcon===false) { |
|
32 | 32 | throw new \Exception("Input must have an icon for showing a loader, use addIcon before"); |
33 | 33 | } |
34 | 34 | return $this->addToProperty("class", State::LOADING); |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function labeled($label, $direction=Direction::LEFT, $icon=NULL) { |
44 | 44 | $field=$this->getField(); |
45 | - $labelO=$field->addLabel($label,$direction===Direction::LEFT,$icon); |
|
46 | - $field->addToProperty("class", $direction . " labeled"); |
|
45 | + $labelO=$field->addLabel($label, $direction===Direction::LEFT, $icon); |
|
46 | + $field->addToProperty("class", $direction." labeled"); |
|
47 | 47 | return $labelO; |
48 | 48 | } |
49 | 49 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * @param string $checkboxType |
55 | 55 | * @return HtmlLabel |
56 | 56 | */ |
57 | - public function labeledCheckbox($direction=Direction::LEFT,$caption="",$value=NULL,$checkboxType=NULL){ |
|
58 | - return $this->labeled(new HtmlCheckbox("lbl-ck-".$this->getField()->getIdentifier(),$caption,$value,$checkboxType),$direction); |
|
57 | + public function labeledCheckbox($direction=Direction::LEFT, $caption="", $value=NULL, $checkboxType=NULL) { |
|
58 | + return $this->labeled(new HtmlCheckbox("lbl-ck-".$this->getField()->getIdentifier(), $caption, $value, $checkboxType), $direction); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return HtmlLabel |
65 | 65 | */ |
66 | 66 | public function labeledToCorner($icon, $direction=Direction::LEFT) { |
67 | - return $this->labeled("", $direction . " corner", $icon)->toCorner($direction); |
|
67 | + return $this->labeled("", $direction." corner", $icon)->toCorner($direction); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) { |
78 | 78 | $field=$this->getField(); |
79 | 79 | $actionO=$action; |
80 | - if (\is_object($action) === false) { |
|
81 | - $actionO=new HtmlButton("action-" . $this->identifier, $action); |
|
80 | + if (\is_object($action)===false) { |
|
81 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
82 | 82 | if (isset($icon)) |
83 | 83 | $actionO->addIcon($icon, true, $labeled); |
84 | 84 | } |
85 | - $field->addToProperty("class", $direction . " action"); |
|
86 | - $field->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
|
85 | + $field->addToProperty("class", $direction." action"); |
|
86 | + $field->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
87 | 87 | return $actionO; |
88 | 88 | } |
89 | 89 | |
@@ -93,34 +93,34 @@ discard block |
||
93 | 93 | * @param string $direction |
94 | 94 | * @return HtmlLabel |
95 | 95 | */ |
96 | - public function addDropdown($label="", $items=array(),$direction=Direction::RIGHT){ |
|
97 | - $labelO=new HtmlDropdown("dd-".$this->identifier,$label,$items); |
|
98 | - $labelO->asSelect("select-".$this->identifier,false,true); |
|
99 | - return $this->labeled($labelO,$direction); |
|
96 | + public function addDropdown($label="", $items=array(), $direction=Direction::RIGHT) { |
|
97 | + $labelO=new HtmlDropdown("dd-".$this->identifier, $label, $items); |
|
98 | + $labelO->asSelect("select-".$this->identifier, false, true); |
|
99 | + return $this->labeled($labelO, $direction); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | public function setTransparent() { |
103 | 103 | return $this->getField()->addToProperty("class", "transparent"); |
104 | 104 | } |
105 | 105 | |
106 | - public function setReadonly(){ |
|
106 | + public function setReadonly() { |
|
107 | 107 | $this->getDataField()->setProperty("readonly", ""); |
108 | 108 | return $this; |
109 | 109 | } |
110 | 110 | |
111 | - public function setName($name){ |
|
112 | - $this->getDataField()->setProperty("name",$name); |
|
111 | + public function setName($name) { |
|
112 | + $this->getDataField()->setProperty("name", $name); |
|
113 | 113 | return $this; |
114 | 114 | } |
115 | 115 | |
116 | - public function setFluid(){ |
|
117 | - $this->getField()->addToProperty("class","fluid"); |
|
116 | + public function setFluid() { |
|
117 | + $this->getField()->addToProperty("class", "fluid"); |
|
118 | 118 | return $this; |
119 | 119 | } |
120 | 120 | |
121 | 121 | public function setDisabled($disable=true) { |
122 | 122 | $field=$this->getField(); |
123 | - if($disable) |
|
123 | + if ($disable) |
|
124 | 124 | $field->addToProperty("class", "disabled"); |
125 | 125 | return $this; |
126 | 126 | } |
@@ -3,5 +3,5 @@ |
||
3 | 3 | use Ajax\common\BaseEnum; |
4 | 4 | |
5 | 5 | abstract class PositionInTable extends BaseEnum { |
6 | - const BEFORETABLE="beforeTable",AFTERTABLE="afterTable",HEADER="thead",FOOTER="tfoot",BODY="tbody"; |
|
6 | + const BEFORETABLE="beforeTable", AFTERTABLE="afterTable", HEADER="thead", FOOTER="tfoot", BODY="tbody"; |
|
7 | 7 | } |
@@ -16,17 +16,17 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @see \Ajax\semantic\widgets\dataform\DataForm::__construct() |
18 | 18 | */ |
19 | - public function __construct($identifier,$modelInstance=null,$fieldsOrder,$fieldsDefinition,$fields=[],$captions=[],$separators=[]) { |
|
20 | - if(!isset($modelInstance)){ |
|
19 | + public function __construct($identifier, $modelInstance=null, $fieldsOrder, $fieldsDefinition, $fields=[], $captions=[], $separators=[]) { |
|
20 | + if (!isset($modelInstance)) { |
|
21 | 21 | $modelInstance=$this->getDefaultModelInstance(); |
22 | 22 | } |
23 | - parent::__construct($identifier,$modelInstance); |
|
24 | - $this->_initForm($fieldsOrder, $fieldsDefinition,$fields,$captions,$separators); |
|
23 | + parent::__construct($identifier, $modelInstance); |
|
24 | + $this->_initForm($fieldsOrder, $fieldsDefinition, $fields, $captions, $separators); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | abstract protected function getDefaultModelInstance(); |
28 | 28 | |
29 | - protected function _initForm($fieldsOrder,$fieldsDefinition,$fields=[],$captions=[],$separators=[]){ |
|
29 | + protected function _initForm($fieldsOrder, $fieldsDefinition, $fields=[], $captions=[], $separators=[]) { |
|
30 | 30 | $this->_fieldsOrder=$fieldsOrder; |
31 | 31 | $this->setFields($fields); |
32 | 32 | $this->setSeparators($separators); |
@@ -34,26 +34,26 @@ discard block |
||
34 | 34 | $this->setCaptions($captions); |
35 | 35 | } |
36 | 36 | |
37 | - protected function _getIndex($fieldName){ |
|
37 | + protected function _getIndex($fieldName) { |
|
38 | 38 | $index=$fieldName; |
39 | - if(\is_string($fieldName)){ |
|
39 | + if (\is_string($fieldName)) { |
|
40 | 40 | $index=\array_search($fieldName, $this->_fieldsOrder); |
41 | 41 | } |
42 | 42 | return $index; |
43 | 43 | } |
44 | - protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null){ |
|
44 | + protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) { |
|
45 | 45 | $index=$this->_getIndex($index); |
46 | - return parent::_fieldAs($elementCallback, $index,$attributes,$prefix); |
|
46 | + return parent::_fieldAs($elementCallback, $index, $attributes, $prefix); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | - public function removeField($fieldName){ |
|
50 | + public function removeField($fieldName) { |
|
51 | 51 | parent::removeField($fieldName); |
52 | - \array_splice($this->_fieldsOrder,$this->_getIndex($fieldName),1); |
|
52 | + \array_splice($this->_fieldsOrder, $this->_getIndex($fieldName), 1); |
|
53 | 53 | return $this; |
54 | 54 | } |
55 | 55 | |
56 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
57 | - return parent::compile($js,$view); |
|
56 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
57 | + return parent::compile($js, $view); |
|
58 | 58 | } |
59 | 59 | } |
@@ -10,50 +10,50 @@ |
||
10 | 10 | * @param string $identifier |
11 | 11 | * @param object $modelInstance |
12 | 12 | */ |
13 | - public function __construct($identifier,$modelInstance=null,$fieldsOrder=[],$fieldsDefinition=[],$fields=[],$captions=[],$separators=[]) { |
|
14 | - parent::__construct($identifier,$modelInstance,$fieldsOrder,$fieldsDefinition,$fields,$captions,$separators); |
|
13 | + public function __construct($identifier, $modelInstance=null, $fieldsOrder=[], $fieldsDefinition=[], $fields=[], $captions=[], $separators=[]) { |
|
14 | + parent::__construct($identifier, $modelInstance, $fieldsOrder, $fieldsDefinition, $fields, $captions, $separators); |
|
15 | 15 | } |
16 | 16 | |
17 | - protected function getDefaultModelInstance(){ |
|
17 | + protected function getDefaultModelInstance() { |
|
18 | 18 | return new UserModel(); |
19 | 19 | } |
20 | 20 | |
21 | - public static function regular($identifier,$modelInstance=null){ |
|
22 | - return new FormLogin($identifier,$modelInstance, |
|
23 | - ["message","login","password","remember","forget","submit","error"], |
|
24 | - ["message"=>[["icon"=>"sign in"]],"input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"checkbox","link","submit"=>["green fluid"],"message2"=>[["error"=>true]]], |
|
25 | - ["Connection","login","password","remember","forget","submit","error"], |
|
26 | - ["Please enter login and password to connect","Login","Password","Remember me.","Forgot your password?","Connection"], |
|
27 | - [0,2,4,5,6]); |
|
21 | + public static function regular($identifier, $modelInstance=null) { |
|
22 | + return new FormLogin($identifier, $modelInstance, |
|
23 | + ["message", "login", "password", "remember", "forget", "submit", "error"], |
|
24 | + ["message"=>[["icon"=>"sign in"]], "input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "checkbox", "link", "submit"=>["green fluid"], "message2"=>[["error"=>true]]], |
|
25 | + ["Connection", "login", "password", "remember", "forget", "submit", "error"], |
|
26 | + ["Please enter login and password to connect", "Login", "Password", "Remember me.", "Forgot your password?", "Connection"], |
|
27 | + [0, 2, 4, 5, 6]); |
|
28 | 28 | } |
29 | 29 | |
30 | - public static function smallInline($identifier,$modelInstance=null){ |
|
31 | - $result=new FormLogin($identifier,$modelInstance, |
|
32 | - ["login","password","submit"], |
|
33 | - ["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]], |
|
34 | - ["login","password","submit"], |
|
35 | - ["","","Connection"], |
|
30 | + public static function smallInline($identifier, $modelInstance=null) { |
|
31 | + $result=new FormLogin($identifier, $modelInstance, |
|
32 | + ["login", "password", "submit"], |
|
33 | + ["input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "submit"=>["green basic"]], |
|
34 | + ["login", "password", "submit"], |
|
35 | + ["", "", "Connection"], |
|
36 | 36 | [2]); |
37 | 37 | $result->addDividerBefore(0, "Connection"); |
38 | 38 | return $result; |
39 | 39 | } |
40 | 40 | |
41 | - public static function small($identifier,$modelInstance=null){ |
|
42 | - $result=new FormLogin($identifier,$modelInstance, |
|
43 | - ["login","password","submit"], |
|
44 | - ["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]], |
|
45 | - ["login","password","submit"], |
|
46 | - ["Login","Password","Connection"], |
|
47 | - [1,2]); |
|
41 | + public static function small($identifier, $modelInstance=null) { |
|
42 | + $result=new FormLogin($identifier, $modelInstance, |
|
43 | + ["login", "password", "submit"], |
|
44 | + ["input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "submit"=>["green basic"]], |
|
45 | + ["login", "password", "submit"], |
|
46 | + ["Login", "Password", "Connection"], |
|
47 | + [1, 2]); |
|
48 | 48 | $result->addDividerBefore(0, "Connection"); |
49 | 49 | return $result; |
50 | 50 | } |
51 | 51 | |
52 | - public static function attachedSegment($identifier,$modelInstance=null){ |
|
53 | - $result=self::regular($identifier,$modelInstance); |
|
54 | - $result->fieldAsMessage("message",["icon"=>"sign in","attached"=>true]); |
|
55 | - $result->addWrapper("message",null,"<div class='ui attached segment'>"); |
|
56 | - $result->addWrapper("error", null,"</div>"); |
|
52 | + public static function attachedSegment($identifier, $modelInstance=null) { |
|
53 | + $result=self::regular($identifier, $modelInstance); |
|
54 | + $result->fieldAsMessage("message", ["icon"=>"sign in", "attached"=>true]); |
|
55 | + $result->addWrapper("message", null, "<div class='ui attached segment'>"); |
|
56 | + $result->addWrapper("error", null, "</div>"); |
|
57 | 57 | return $result; |
58 | 58 | } |
59 | 59 | } |