1: <?php
2:
3: class HLabel extends Sphp\tools\Component{
4: private $label = "";
5: private $labelfor = "";
6: private $lblsize = "col-md-4";
7: private $compsize = "col-md-8";
8: private $blnReq = false;
9:
10: public function fu_setLabel($label,$labelfor) {
11: $this->label = $label;
12: $this->labelfor = $labelfor;
13: }
14: public function fu_setSize($lblsize,$compsize) {
15: $this->lblsize = $lblsize;
16: $this->compsize = $compsize;
17: }
18: public function fu_setRequired() {
19: $this->blnReq = true;
20: }
21: protected function onprerender(){
22: $this->class = "controls";
23: }
24: protected function onrender(){
25: $this->tagName = 'div';
26: $this->fu_setHTMLID("");
27: $this->fu_setHTMLName("");
28: // $this->fu_unsetRenderTag();
29: $req = "";
30: if($this->blnReq){
31: $req = "<span class='text-danger'>*</span>";
32: }
33: $this->setPreTag('<div class="control-group">
34: <div class="row"><div class="'.$this->lblsize.' align-right">
35: <label class="control-label" for="'.$this->labelfor.'">'. $req . $this->label.'</label>
36: </div><div class="'.$this->compsize.'">
37: ');
38:
39: $this->setPostTag('
40: </div></div>
41: </div>
42: ');
43: $this->blnReq = false;
44: }
45:
46: }
47: