MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
optionscontrol.class
Ir para a documentação deste ficheiro.
1<?php
2
3class MOption extends MFormControl
4{
5 public $checked;
6 public $showValues;
7 public $type = 'circle';
8 public $control; // owner control of this Option
9
10
11 public function __construct( $name = '', $value = null, $label = '', $checked = false, $id = false )
12 {
13 parent::__construct( $name, $value, $label );
14
15 $this->checked = $checked;
16 }
17
18
19 public function setChecked( $checked )
20 {
21 if ( ! is_bool( $checked ) )
22 {
23 throw new Exception( _M('MOption::setChecked expects an boolean as parameter!') );
24 }
25
26 $this->checked = $checked;
27 }
28
29
30 public function setControl( $control, $pos = 0 )
31 {
32 $this->control = $control;
33 }
34
35
36 public function generate()
37 {
38 if ( is_array( $this->control->value ) )
39 {
40 $found = array_search( $this->value, $this->control->value );
41 $checked = ( ! is_null($found) ) && ( $found !== false );
42 }
43 else
44 {
45 $checked = ( $this->value == $this->control->value );
46 }
47
48 $this->checked = $this->checked || $checked;
49 $this->showValues = $this->control->showValues;
50
51 return $this->getRender( 'option' );
52 }
53}
54
55
57{
58 public $label;
59 public $name;
60 public $options; // array of option objects
61 public $content;
62
63
64 public function __construct( $name, $label = '', $options = NULL )
65 {
66 parent::__construct();
67
68 $this->label = $label;
69 $this->name = $name;
70 $this->options = $options;
71 }
72
73
74 public function generate()
75 {
76 foreach ( $this->options as $o )
77 {
78 $this->content .= $o->generate();
79 }
80
81 $this->setClass( 'm-combo' );
82
83 return $this->getRender( 'optiongroup' );
84 }
85}
86
87?>
setClass( $cssClass, $add=true)
Definição mcontrol.class:398
getRender( $method)
Definição mcontrol.class:833
__construct( $name, $label='', $options=NULL)
setControl( $control, $pos=0)
__construct( $name='', $value=null, $label='', $checked=false, $id=false)
setChecked( $checked)