예제 #1
0
 case 'alterar-visibilidade':
     try {
         $out = Tramite::alterarVisibilidadeTramite($_REQUEST['id_unidade'], $_REQUEST['id_referencia'], $_REQUEST['status']);
     } catch (Exception $e) {
         $out = array('success' => 'false', 'error' => $e->getMessage());
     }
     break;
 case 'cadastrar':
     $unidade = new Unidade($_REQUEST);
     $out = DaoUnidade::inserirUnidade($unidade)->toArray();
     break;
 case 'alterar':
     $unidade = new Unidade($_REQUEST);
     $out = DaoUnidade::alterarUnidade($unidade)->toArray();
     if ($_REQUEST['tipo'] != $_REQUEST['clear']) {
         DaoTramite::clearAllTramitesByIdUnidade($_REQUEST['id']);
     }
     break;
 case 'pesquisar':
     try {
         unset($_SESSION['PESQUISAR_UNIDADES']);
         foreach ($_REQUEST as $key => $value) {
             if ($key != 'acao' && $value && strtolower($value) != 'null') {
                 $_SESSION['PESQUISAR_UNIDADES'][$key] = $value;
             }
         }
         $out = array('success' => 'true');
     } catch (Exception $e) {
         $out = array('success' => 'false', 'error' => $e->getMessage());
     }
     break;