Skip to content

Commit db94293

Browse files
author
hikki
committed
模板助手
1 parent 1d34f4a commit db94293

File tree

1 file changed

+42
-13
lines changed

1 file changed

+42
-13
lines changed

src/Tool/FormPanel.php

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,64 @@ class FormPanel
1111
{
1212
private $html = '';
1313

14-
public function input($column,$label,$value='')
14+
/**
15+
* @param string $column
16+
* @param string $label
17+
* @param string $value
18+
*/
19+
public function input(string $column, string $label, string $value = '')
1520
{
1621
$content = <<<EOF
1722
<div class="input-group">
1823
<span class="input-group-addon"><i class="fa fa-pencil fa-fw"></i></span>
1924
<input required="1" type="text" id="{$column}" name="{$column}" value="{$value}" class="form-control {$column}" placeholder="输入 {$label}" />
2025
</div>
2126
EOF;
22-
$this->html .= $this->rowpanel($column,$label,$content);
27+
$this->html .= $this->rowpanel($column, $label, $content);
2328
}
2429

25-
public function hidden($column,$value)
30+
/**
31+
* @param string $column
32+
* @param string $value
33+
*/
34+
public function hidden(string $column, string $value)
2635
{
2736
$this->html .= <<<EOF
2837
<input type="hidden" id="{$column}" name="{$column}" value="{$value}" />
2938
EOF;
3039
}
3140

32-
public function textarea($column,$label,$value='')
41+
/**
42+
* @param string $column
43+
* @param string $label
44+
* @param string $value
45+
*/
46+
public function textarea(string $column, string $label, string $value = '')
3347
{
3448
$content = <<<EOF
3549
<textarea name="{$column}" class="form-control {$column}" rows="3" placeholder="输入 {$label}">{$value}</textarea>
3650
EOF;
37-
$this->html .= $this->rowpanel($column,$label,$content);
51+
$this->html .= $this->rowpanel($column, $label, $content);
3852
}
3953

40-
public function select($column,$options,$selected)
54+
public function select(string $column, array $options, int $selected)
4155
{
4256

4357
}
4458

45-
public function datepicker($column,$label,$value='')
59+
public function multiSelect(string $column, array $options, array $selected)
4660
{
47-
if(!$value){
61+
62+
}
63+
64+
/**
65+
* @param string $column
66+
* @param string $label
67+
* @param string $value
68+
*/
69+
public function datepicker(string $column, string $label, string $value = '')
70+
{
71+
if (!$value) {
4872
$value = date('Y-m-d H:i:s');
4973
}
5074
$content = <<<EOF
@@ -62,13 +86,18 @@ function(e) {
6286
"background-color", "#3c3e43");
6387
});
6488
EOF
65-
);
66-
$this->html .= $this->rowpanel($column,$label,$content);
89+
);
90+
$this->html .= $this->rowpanel($column, $label, $content);
6791
}
6892

69-
public function html()
93+
/**
94+
* @param string $column
95+
* @param string $label
96+
* @param string $content
97+
*/
98+
public function html(string $column, string $label, string $content)
7099
{
71-
100+
$this->html .= $this->rowpanel($column, $label, $content);
72101
}
73102

74103
public function compile()
@@ -80,7 +109,7 @@ public function compile()
80109
EOF;
81110
}
82111

83-
private function rowpanel($column,$label,$content)
112+
private function rowpanel($column, $label, $content)
84113
{
85114
return <<<EOF
86115
<div class="form-group">

0 commit comments

Comments
 (0)