Example #1
0
	"http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head><title>Listagem de Editoras</title></head>
	<body>
	
		
	
		<table border ='1'>
		
		
		
		
		
		
			<?php 
$editoraBDR = new ColecaoDeEditorasEmBDR($pdo);
$colecao = $editoraBDR->todos();
echo "<tr>" . "<td colspan='3' >Tamano da Lista: " . $editoraBDR->tamanho() . "</td>" . "</tr>";
?>
			
			
			
			
			
		
			<tr>
				<th>ID</th>
				<th>Nome</th>
			</tr>
			
			
Example #2
0
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Cadastro de Editora</title>
	</head>
	<body>
		
	
		<h1>Cadastro de Editora</h1>
		
		<?php 
$editora = new Editora();
$editoras = new ColecaoDeEditorasEmBDR($pdo);
if (isset($_GET['id'])) {
    $id = htmlspecialchars(trim($_GET['id']));
    try {
        $editora = $editoras->comId($id);
    } catch (ColecaoException $e) {
        echo 'Erro ao obter os dados: ' . $e->getMessage();
    }
} else {
    if (isset($_POST['enviar'])) {
        if (isset($_POST['nome']) and isset($_POST['id'])) {
            $nome = htmlspecialchars(trim($_POST['nome']));
            $id = htmlspecialchars(trim($_POST['id']));
            $editora = new Editora($id, $nome);
            if ($id > 0) {
                try {
Example #3
0
<?php

header('Content-Type: text/html; charset=UTF-8');
require_once 'editora.php';
require_once 'colecaodeeditorasembdr.php';
$pdo = null;
try {
    $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8");
    $pdo = new PDO('mysql:dbname=magazine;hostname=localhost', 'root', 'jony1723', $options);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
    echo 'Falha ao conectar: ' . $e->getMessage();
}
$editoras = new ColecaoDeEditorasEmBDR($pdo);
if (isset($_GET['id'])) {
    $id = htmlspecialchars(trim($_GET['id']));
    try {
        $editoras->removerPeloId($id);
    } catch (ColecaoException $e) {
        echo 'Erro ao remover os dados' . $e->getMessage();
    }
    header('Location: editora-lista.php');
}
Example #4
0
		
		
		
		
	
		<?php 
header('Content-Type: text/html; charset=UTF-8');
require_once 'editora.php';
require_once 'revista.php';
require_once 'colecaoderevistasembdr.php';
require_once 'colecaodeeditorasembdr.php';
require_once 'pdoinstance.php';
$pdoi = new PDOInstance();
$pdo = $pdoi->getPDO();
$revista = new Revista();
$editoraBDR = new ColecaoDeEditorasEmBDR($pdo);
$revistaBDR = new ColecaoDeRevistasEmBDR($pdo, $editoraBDR);
if (isset($_GET['id'])) {
    $id = htmlspecialchars(trim($_GET['id']));
    try {
        $revista = $revistaBDR->comId($id);
        echo $revista->nome();
    } catch (ColecaoException $e) {
        echo 'Erro ao obter os dados: ' . $e->getMessage();
    }
} else {
    if (isset($_POST['enviar'])) {
        if (isset($_POST['id']) and isset($_POST['nome']) and isset($_POST['mes']) and isset($_POST['ano']) and isset($_POST['editora'])) {
            $id = htmlspecialchars(trim($_POST['id']));
            $nome = htmlspecialchars(trim($_POST['nome']));
            $mes = htmlspecialchars(trim($_POST['mes']));