public function savePaper(Paper $publication, $path) { $jsonResponse = new JsonResponse(); if ($publication->saveFile($path)) { $statement = "INSERT INTO paper (title, filename, theme, date, year, publication_type) \r\n VALUES (:title, :filename, :subarea, :date, :year, :publication_type)"; $query = $this->session->prepare($statement); $query->bindParam(":title", $publication->title()); $query->bindParam(":filename", $publication->getFilename()); $query->bindParam(":subarea", $publication->getSubareaId()); $query->bindParam(":date", $publication->date()); $query->bindParam(":year", $publication->getYear()); $query->bindParam(":publication_type", $publication->getTypeId()); try { $query->execute(); } catch (PDOException $err) { throw new PDOException($err->getMessage()); } } else { throw new Exception("Falha ao salvar cópia do arquivo no diretório: {$path}"); } }
public static function printPapers(Paper $publication) { $html = "<tr>"; $html .= "<td class='name-paper'>" . $publication->title() . "</td>"; $html .= "<td>"; $html .= "<a target='_blank' href='" . LinkController::getBaseURL() . "/publicacao/" . $publication->getSimpleFilename() . "'>"; $html .= "<img class='pdf' title='puclicação' alt='pdf' src='" . LinkController::getBaseURL() . "/images/pdf-icon.jpg'/>"; $html .= "</a>"; $html .= "</td>"; $html .= "</tr>"; echo $html; }