Ejemplo n.º 1
0
<?php

include "config.php";
include "banco.php";
include "ajudantes.php";
include "classes/Tarefas.php";
$tarefas = new Tarefas($mysqli);
$exibir_tabela = false;
$tem_erros = false;
$erros_validacao = array();
if (tem_post()) {
    $tarefa = array();
    $tarefa['id'] = $_POST['id'];
    if (isset($_POST['nome']) && strlen($_POST['nome']) > 0) {
        $tarefa['nome'] = $_POST['nome'];
    } else {
        $tem_erros = true;
        $erros_validacao['nome'] = 'O nome da tarefa é obrigatório!';
    }
    if (isset($_POST['descricao'])) {
        $tarefa['descricao'] = $_POST['descricao'];
    } else {
        $tarefa['descricao'] = '';
    }
    if (isset($_POST['prazo']) && strlen($_POST['prazo']) > 0) {
        if (validar_data($_POST['prazo'])) {
            $tarefa['prazo'] = traduz_data_para_banco($_POST['prazo']);
        } else {
            $tem_erros = true;
            $erros_validacao['prazo'] = 'O prazo não é uma data válida!';
        }
Ejemplo n.º 2
0
<?php

include "config.php";
include "banco.php";
include "ajudantes.php";
include "classes/Tarefas.php";
$tarefas = new Tarefas($mysqli);
$tem_erros = false;
$erros_validacao = array();
if (tem_post()) {
    // upload dos anexos
    $tarefa_id = $_POST['tarefa_id'];
    if (!isset($_FILES['anexo'])) {
        $tem_erros = true;
        $erros_validacao['anexo'] = 'Você deve selecionar um arquivo para anexar';
    } else {
        if (tratar_anexo($_FILES['anexo'])) {
            $anexo = array();
            $anexo['tarefa_id'] = $tarefa_id;
            $anexo['nome'] = $_FILES['anexo']['name'];
            $anexo['arquivo'] = $_FILES['anexo']['name'];
        } else {
            $tem_erros = true;
            $erros_validacao['anexo'] = 'Envie apenas anexos nos formatos zip ou pdf';
        }
    }
    if (!$tem_erros) {
        gravar_anexo($mysqli, $anexo);
    }
}
$tarefas->buscar_tarefa($_GET['id']);
Ejemplo n.º 3
0
<?php

include "config.php";
include "banco.php";
include "ajudantes.php";
include "classes/Tarefas.php";
$tarefas = new Tarefas($mysqli);
$exibir_tabela = true;
$tem_erros = false;
$erros_validacao = array();
if (tem_post()) {
    $tarefa = array();
    if (isset($_POST['nome']) && strlen($_POST['nome']) > 0) {
        $tarefa['nome'] = $_POST['nome'];
    } else {
        $tem_erros = true;
        $erros_validacao['nome'] = 'O nome da tarefa é obrigatório!';
    }
    if (isset($_POST['descricao'])) {
        $tarefa['descricao'] = $_POST['descricao'];
    } else {
        $tarefa['descricao'] = '';
    }
    if (isset($_POST['prazo']) && strlen($_POST['prazo']) > 0) {
        if (validar_data($_POST['prazo'])) {
            $tarefa['prazo'] = traduz_data_para_banco($_POST['prazo']);
        } else {
            $tem_erros = true;
            $erros_validacao['prazo'] = 'O prazo não é uma data válida!';
        }
    } else {