MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mindexedcontrol.class
Ir para a documentação deste ficheiro.
1<?php
2
4{
5 public $index;
6 public $container;
7
8 public function __construct( $name = '', $label = '', $controls = NULL )
9 {
10 $this->container = new MContainer( $name, $controls, 'vertical' );
11
12 parent::__construct( $name, '', $label );
13
14 $this->index = 0;
15 $controls = $this->container->getControls();
16
17 if ( $controls != NULL )
18 {
19 foreach ( $controls as $c )
20 {
21 $this->setIndex( $c, $this->index++ );
22 }
23 }
24 }
25
26
27 public function setIndex( $control, $index )
28 {
29 $control->setName( $this->name . '[' . $index . ']' );
30 }
31
32
33 public function addControl( $control, $index = NULL )
34 {
35 if ( $index == NULL )
36 {
37 $index = $this->index++;
38 }
39
40 if ( is_array( $control ) )
41 {
42 foreach ( $control as $c )
43 {
44 $this->addControl( $c, $index );
45 }
46 }
47 else
48 {
49 $this->container->_addControl( $control, $index );
50 $this->setIndex( $control, $index );
51 }
52 }
53
54
55 public function setValue( $value )
56 {
57 $controls = $this->container->getControls();
58
59 foreach ( $controls as $k => $c )
60 {
61 $c->setValue( $value[$k] );
62 }
63
64 $this->value = $value;
65 }
66
67
68 public function setDisposition( $disposition )
69 {
70 $this->container->setDisposition( $disposition );
71 }
72
73
74 public function generateInner()
75 {
76 $t = array();
77
78 $controls = $this->container->getControls();
79
80 foreach ( $controls as $c )
81 {
82 $label = ( $c->label != '' ) ? $c->label . ':&nbsp;' : '';
83 $c->generateInner();
84 $t[] = $label;
85 $t[] = $c->getInner();
86 $t[] = $this->container->separator;
87 }
88
89 $this->inner = $t;
90 }
91}
92
93?>
__construct( $name='', $label='', $controls=NULL)
addControl( $control, $index=NULL)
setIndex( $control, $index)
setDisposition( $disposition)