} else {
                                CFModelUsuarioUnidade::factory()->createUserAssociationWithUnit($idUsuario, $idUnidade);
                            }
                        }
                    }
                    CFModelUsuario::factory()->commit();
                    Controlador::getInstance()->cache->remove("acl_{$idUsuario}");
                    Controlador::getInstance()->cache->clean('matchingAnyTag', array("acl_usuario_{$idUsuario}"));
                    $out = array('success' => 'true', 'message' => 'Operação realizada com sucesso!');
                } catch (Exception $e) {
                    CFModelUsuario::factory()->rollback();
                    $error = 'Ocorreu um erro ao tentar salvar as informações do usuário!';
                    if (strpos($e->getMessage(), 'already exists')) {
                        $error = 'Verifique o se o USUÁRIO DO SISTEMA ou CPF já não estão cadastrados!';
                    }
                    $out = array('success' => 'false', 'error' => $error);
                }
                break;
            case 'alterar-status':
                $usuario = DaoUsuario::getUsuario((int) $_REQUEST['id'], '*', true);
                $usuario->status = $_REQUEST['status'];
                $out = DaoUsuario::alterarStatus($usuario)->toArray();
                break;
            default:
                $out = array('success' => 'false', 'error' => 'Ocorreu um erro na operação desejada!');
                break;
        }
        print json_encode($out);
    } catch (Exception $e) {
    }
}
$pdf->Cell(5, 5, "", 0, 1, 'L');
$pdf->Cell(5, 5, "", 0, 0, 'C');
$pdf->SetFont("Arial", "B", 7);
$pdf->Cell(180, 5, '', 0, 0, 'C');
$pdf->Cell(5, 5, "", 0, 1, 'L');
$pdf->Ln(10);
$pdf->Cell(5, 5, "", 0, 0, 'C');
$pdf->SetFont("Arial", "B", 6);
$pdf->Cell(180, 5, utf8_decode("INFORMAÇÕES DO TRAMITE"), 0, 0, 'C');
$pdf->Cell(5, 5, "", 0, 1, 'L');
$pdf->Ln(5);
$pdf->Cell(5, 5, "", 0, 0, 'C');
$pdf->SetFont("Arial", "B", 7);
$pdf->Cell(23, 5, "TRAMITADO POR: ", 0, 0, 'L');
$pdf->SetFont("Arial", "", 7);
$pdf->Cell(172, 5, utf8_decode(DaoUsuario::getUsuario(null, 'nome')), 0, 0, 'L');
$pdf->Cell(5, 5, "", 0, 1, 'L');
$pdf->Cell(5, 5, "", 0, 0, 'C');
$pdf->SetFont("Arial", "B", 7);
$pdf->Cell(18, 5, "DATA - HORA: ", 0, 0, 'L');
$pdf->SetFont("Arial", "", 7);
$pdf->Cell(178, 5, date("d/m/Y " . " - " . "H:i:s"), 0, 0, 'L');
$pdf->Cell(5, 5, "", 0, 1, 'L');
$pdf->Cell(5, 5, "", 0, 0, 'C');
$pdf->SetFont("Arial", "B", 7);
$pdf->Cell(28, 5, "ORIGEM DO TRAMITE:", 0, 0, 'L');
$pdf->SetFont("Arial", "", 7);
$pdf->Cell(152, 5, utf8_decode(DaoUnidade::getUnidade(null, 'nome')), 0, 0, 'L');
$pdf->Cell(5, 5, "", 0, 1, 'L');
$pdf->Cell(5, 5, "", 0, 0, 'C');
$pdf->SetFont("Arial", "B", 7);
Beispiel #3
0
 /**
  * @return Output
  */
 public function comment()
 {
     $out = array();
     $unidade = DaoUnidade::getUnidade($this->post['setor'], 'nome');
     $usuario = DaoUsuario::getUsuario((int) $this->post['usuario']);
     $mensagem = "O volume {$this->post['volume']} deste processo está aos cuidados de {$usuario['nome']} - {$unidade}.";
     Controlador::getInstance()->getConnection()->connection->beginTransaction();
     $id_usuario = Zend_Auth::getInstance()->getIdentity()->ID;
     $nome_usuario = Zend_Auth::getInstance()->getIdentity()->NOME;
     $id_unidade_historico = Zend_Auth::getInstance()->getIdentity()->ID_UNIDADE_ORIGINAL;
     $diretoria = DaoUnidade::getUnidade($id_unidade_historico, 'nome');
     try {
         $stmt = Controlador::getInstance()->getConnection()->connection->prepare("\n                INSERT INTO TB_COMENTARIOS_PROCESSOS \n                    (NUMERO_PROCESSO, ID_USUARIO, USUARIO, DT_CADASTRO, TEXTO_COMENTARIO, ID_UNIDADE, DIRETORIA)\n                VALUES\n                    (?,?,?,CLOCK_TIMESTAMP(),?,?,?)\n            ");
         $stmt->bindValue(1, $this->getProcesso());
         $stmt->bindParam(2, $id_usuario, PDO::PARAM_INT);
         $stmt->bindParam(3, $nome_usuario, PDO::PARAM_STR);
         $stmt->bindParam(4, $mensagem);
         $stmt->bindParam(5, $id_unidade_historico, PDO::PARAM_INT);
         $stmt->bindParam(6, $diretoria, PDO::PARAM_STR);
         $stmt->execute();
         $last_id = Controlador::getInstance()->getConnection()->connection->lastInsertId('TB_COMENTARIOS_PROCESSOS_ID_SEQ');
         $stmt = Controlador::getInstance()->getConnection()->connection->prepare('UPDATE TB_PROCESSOS_VOLUME SET ID_COMENTARIO = ? WHERE ID = ?');
         $stmt->bindParam(1, $last_id);
         $stmt->bindParam(2, $this->post['idvolume']);
         $stmt->execute();
         Controlador::getInstance()->getConnection()->connection->commit();
         $out = array('success' => 'true');
         $this->print = $out;
     } catch (Exception $e) {
         Controlador::getInstance()->getConnection()->connection->rollback();
         $out = array('success' => 'false', 'message' => 'Não foi possível registrar o comentário deste volume!');
     }
     return new Output($out);
 }