1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | class IconSelect extends Control{ |
7: | private $label = ""; |
8: | |
9: | public function oncompcreate($param) { |
10: | $this->setHTMLID(""); |
11: | $this->setHTMLName(""); |
12: | } |
13: | public function setLabel($label) { |
14: | $this->label = $label; |
15: | } |
16: | public function onjsrender() { |
17: | addHeaderJSCode("$this->name", " function {$this->name}_setvalue(obj){ " |
18: | . "$('#$this->name').val($(obj).data('cls')); " |
19: | . "$('#{$this->name}spn').removeClass(); " |
20: | . "$('#{$this->name}spn').addClass($(obj).data('cls')); " |
21: | |
22: | . "}"); |
23: | } |
24: | public function onrender(){ |
25: | global $ctrl; |
26: | |
27: | $this->tagName = 'div'; |
28: | $this->setPreTag('<span id="'. $this->name .'spn" class="'.$this->value.'"></span><input id="'.$this->name.'" name="'.$this->name.'" value="'.$this->value.'" type="hidden" /><br /> |
29: | '); |
30: | $this->class = "iconselectbody col-md-12 " . $this->class ; |
31: | $stra = explode(",", $this->innerHTML); |
32: | $this->innerHTML = ""; |
33: | $str = ""; |
34: | foreach($stra as $key=>$value){ |
35: | $value = trim($value); |
36: | $str .= '<a href="#" onclick="'.$this->name.'_setvalue(this); return false;" data-cls="'. $value .'"><span class="'.$value.'"></span></a> '; |
37: | } |
38: | $this->innerHTML = $str; |
39: | } |
40: | |
41: | } |
42: |