Пример #1
0
if (!in_array(12, listarAcesso())) {
    // echo '<script language= "JavaScript">location.href="index.php";</script>';
}
$checkList = new CheckList();
$DAO_CK = new CheckListDAO();
$DAOMsg = new MensagemDAO();
$mensagem = new Mensagem();
$DAO = new DocumentoDAO();
$checkList->setId(limpaTexto($_GET['id']));
// Verifica se a acao de salvar foi iniciada
if (!empty($_POST['cmd']) && $_POST['cmd'] == 'aprovar') {
    connectSQL();
    /* Verifica se nao foi aprovado */
    $query = mysql_query("SELECT id FROM " . MYSQL_BASE_CHECK_LISTS . " \r\n\t\t\t\t\t\t\tWHERE aprovado IS NULL\r\n\t\t\t\t\t\t\tAND id=" . $checkList->getId());
    if (mysql_num_rows($query) > 0) {
        $checkList->setConsideracoes($_POST['consideracoes']);
        $checkList->setAprovadoSupervisor(userId());
        $checkList->setDespacha($_POST['despacha']);
        $post = array("item1", "item2", "item3", "item4", "item5", "item6", "item7", "item8", "item9", "item10", "item11", "item12", "item13", "item14", "item15", "item16", "item17");
        $lista = array();
        foreach ($post as $item) {
            // Verifica se um item foi deixado de ser selecionado
            if (!empty($_POST[$item])) {
                $lista[] = $_POST[$item];
            } else {
                $lista[] = "";
            }
        }
        $resultado = $DAO_CK->Listar("SELECT nome FROM " . MYSQL_BASE_OBRAS . " WHERE id=" . $_POST['obra']);
        foreach ($resultado as $item) {
            $obra = $item['nome'];