public function visualizar($id)
 {
     $unidade = Unidade::get($id);
     if ($unidade) {
         $usuarios = Viewusuariounidade::getAllByIdUnidade($id);
         $this->_set('unidade', $unidade);
         $this->_set('usuarios', $usuarios);
     } else {
         $this->_flash('erro', 'Unidade não encontrada!');
     }
     return $this->_view();
 }
    foreach ($emp->getEmpresas() as $empresa) {
        $tpl->EMPID = $empresa['id'];
        $tpl->EMPNOME = $empresa['nome'];
        $tpl->CNPJ = $emp->transformCnpj($empresa['cnpj']);
        $tpl->block('EACH_EMP');
    }
    $i = 0;
    foreach ($emp->getServicos() as $servi) {
        $tpl->SERVVAL = $i;
        $tpl->SERVNOME = $servi->children();
        $tpl->SERVDESC = $servi->children()[1];
        $tpl->block('EACH_SERV');
        $i++;
    }
    $ano = date('Y');
    for ($i = $ano - 7; $i <= $ano + 7; $i++) {
        $tpl->ANOVAL = $i;
        $tpl->block("EACH_ANO1");
        $tpl->block("EACH_ANO2");
    }
    $sqlUdd = "SELECT id FROM daee_udds ORDER BY id";
    $queryUdd = mysql_query($sqlUdd);
    while ($res = mysql_fetch_array($queryUdd)) {
        $unid = new Unidade($res['id']);
        $tpl->UDDSIGLA = $unid->getSigla();
        $tpl->UDDNOME = $unid->getNome();
        $tpl->UDDID = $unid->get('id');
        $tpl->block('EACH_UDD');
    }
}
$tpl->show();