summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/tickets/protected/pages/DActiveDropDownList2.php
blob: 532b17b013d6b76e3fc185d1b0950588db9e4d68 (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
<?php
Prado::using('System.Web.UI.ActiveControls.*');
class DActiveDropDownList2 extends TActiveDropDownList
{
    public function setOpcoes($val)
    {
        $this->setViewState('Opcoes', $val);
    }

    public function loadOptions()
    {
        $opcao =  $this->getViewState('Opcoes');

        switch ($opcao) {
            case "turnos":
                $this->DataTextField="descricao";
                $this->DataValueField="id_turno";
                $opts = array(
                    array('id_turno' => 'M', 'descricao' => 'Manhã'),
                    array('id_turno' => 'T', 'descricao' => 'Tarde'),
                    array('id_turno' => 'N', 'descricao' => 'Noite')
                );
                break;

            default:
                throw new TConfigurationException('Falta argumento OPCOES no DActiveDropDownList');
                break;
        }
        $this->setDataSource($opts);
        $this->dataBind();
    }
}

?>