summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/active-controls/protected/pages/GerTurno2.php
blob: d31c10f6f54a197bc91f2578d3ae9feaca95902e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php

class GerTurno2 extends TPage {
    
    private $_turnos = null;


    public function onLoad($param) {
        parent::onLoad($param);
        
        $this->loadTurnoOptions();
        
        if (!$this->IsPostBack) {
            $this->ativaModoEdicao();
        }
    }
    
    
    protected function loadTurnoOptions()
    {
    	$this->DDropTurno->DataTextField="descricao";
        $this->DDropTurno->DataValueField="id";
        $this->_turnos = array(
							array('id' => 1, 'codigo'=>'test 1', 'descricao' => 'hello 1'),
							array('id' => 2, 'codigo'=>'test 2', 'descricao' => 'hello 2')
						);
        $this->DDropTurno->setDataSource($this->_turnos);
        $this->DDropTurno->dataBind();
    }


    protected function ativaModoEdicao() {
        $this->loadDadosTurno($this->DDropTurno->getSelectedValue());
    }

    
    protected function loadDadosTurno($id) {
        foreach ($this->_turnos as $key => $tur) {
        	if ($tur['id'] == $id) {
        	    $this->Codigo->setText($tur['codigo']);
                $this->Descricao->setText($tur['descricao']);
        	}
        }
    }

    
    public function trocaTurno($sender,$param) {
        $this->loadDadosTurno($sender->getSelectedValue());
    }
    
}

?>