예제 #1
0
 public static function convert($row)
 {
     $trabalho = new Trabalho();
     $trabalho->id = $row['id'];
     $trabalho->titulo = $row['titulo'];
     $trabalho->resumo = $row['resumo'];
     $trabalho->palavras_chave = $row['palavras_chave'];
     $trabalho->subarea = Subarea::find($row['subarea_id']);
     $trabalho->tipo = TipoTrabalho::find($row['tipo_id']);
     $trabalho->extensao = $row['extensao'];
     $trabalho->autor_principal = Participante::find($row['autor_principal_id']);
     return $trabalho;
 }
예제 #2
0
}
session_start();
if (!isset($_SESSION['participante'])) {
    header("location: /" . $config['PATH'] . "/trabalhos/form_login.php?syserror=INSCRICAO_SUBMISSAO");
    exit;
}
if (!in_array(get_file_extension($_FILES['arquivo']['name']), $config['PAPER_TYPES'])) {
    header("location: /" . $config['PATH'] . "/trabalhos/form_submissao.php?syserror=FORMATO_SUBMISSAO_INVALIDO");
    exit;
}
$trabalho = new Trabalho();
$trabalho->titulo = $_POST['titulo'];
$trabalho->resumo = $_POST['resumo'];
$trabalho->palavras_chave = $_POST['palavras_chave'];
$trabalho->subarea = Subarea::find($_POST['subarea_id']);
$trabalho->tipo = TipoTrabalho::find($_POST['tipo_id']);
$trabalho->extensao = get_file_extension($_FILES['arquivo']['name']);
$trabalho->autor_principal = $_SESSION['participante'];
$trabalho->save();
if (is_uploaded_file($_FILES['arquivo']['tmp_name'])) {
    $result = move_uploaded_file($_FILES['arquivo']['tmp_name'], dirname(__FILE__) . '/uploads/' . $trabalho->id . '.' . get_file_extension($_FILES['arquivo']['name']));
    if (!$result) {
        echo "Falha ao mover o arquivo!";
    }
} else {
    echo "Operação não permitida!";
}
if (isset($_POST['nomes_coautores'])) {
    $quantidade_coautores = count($_POST['nomes_coautores']);
    for ($i = 0; $i < $quantidade_coautores; $i++) {
        $coautor = new Coautor();