Jump to content

Alfredo Chitela

Members
  • Content count

    3
  • Joined

  • Last visited

Community Reputation

0 Comum

About Alfredo Chitela

  1. <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <?php session_start(); define("DIR", dirname(__FILE__)); define("DS", DIRECTORY_SEPARATOR); include_once DIR . DS . 'App' . DS . 'Loader.php'; $loader = new App\Loader(); $loader->register(); $pdo = new \PDO("mysql:host=localhost;dbname=shop", "root", ""); $productRepository = new App\Model\Product\ProductRepositoryPDO($pdo); $page = isset($_GET['page']) ? $_GET['page'] : ''; $action = isset($_GET['action']) ? $_GET['action'] : 'index'; switch ($page) { case 'cart': $sessionCart = new App\Model\Shopping\CartSession(); $cart = new App\Controller\Cart($productRepository, $sessionCart); call_user_func_array(array($cart, $action), array()); break; default: $home = new App\Controller\Home($productRepository); call_user_func_array(array($home, $action), array()); } ?> </body> </HTML>
  2. Alfredo Chitela

    Gerar PDF

    Agradeço a vossa ajuda pretendo Gerar este codigo em PDF e nao gostaria refazer todo ele no Body do mpdf. por favor ver codigo abaixo: <!DOCTYPE html> <html lang="pt"> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta charset="UTF-8"/> <html> <head> <meta charset="UTF-8"> <title>Consulta pelo Nome do Passageiro</title> <h4>Chegadas</h4> </head> <style> table { width: 100%; border: 1px solid black; } td { border: 1px solid black; height: 15px; } th { border: 1px solid black; height: 15px; text-align: center; } table.TableRows { table-layout: auto; } table.TableRows2 { table-layout: auto; } </style> <body> <?php echo "<table style='border: solid 1px black;'>"; echo "<tr><th>ID</th><th>Nome</th><th>Apelido</th><th>Hora</th><th>Voo</th><th>Proveniencia</th><th>Data</th><th>Destino</th><th>Descricao</th><th>Motorista</th></tr>"; class TableRows extends RecursiveIteratorIterator { function __construct($it) { parent::__construct($it, self::LEAVES_ONLY); } function current() { return "<td style='width:95px;border:1px solid black;'>" . parent::current(). "</td>"; } function beginChildren() { echo "<tr>"; } function endChildren() { echo "</tr>" . "\n"; } } if($_SERVER["REQUEST_METHOD"]=="POST"){ //collect value of input field $name = $_POST["Primeiro"]; //fim da recolha do front in $servername = "localhost"; $username = "root"; $password = ""; $dbname = "operacoes"; try { $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare("SELECT ID, Nome, Apelido, Hora_Chegada, Voo_Chegada, Proveniencia_Chegada, Data_Chegada, Destino_Chegada, Descricao_Chegada, Motorista_Chegada FROM asschegadas WHERE Nome = '$name'"); $stmt->execute(); // set the resulting array to associative $result = $stmt->setFetchMode(PDO::FETCH_ASSOC); foreach(new TableRows(new RecursiveArrayIterator($stmt->fetchAll())) as $k=>$v) { echo $v; } } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } $conn = null; echo "</table>"; } ?> <h4>Partidas</h4> <?php echo "<table style='border: solid 1px black;'>"; echo "<tr><th>ID</th><th>Nome</th><th>Apelido</th><th>Hora</th><th>Voo</th><th>Proveniencia</th><th>Data</th><th>Destino</th><th>Descricao</th><th>Motorista</th></tr>"; class TableRows2 extends RecursiveIteratorIterator { function __construct($it) { parent::__construct($it, self::LEAVES_ONLY); } function current() { return "<td style='width:95px;border:1px solid black;'>" . parent::current(). "</td>"; } function beginChildren() { echo "<tr>"; } function endChildren() { echo "</tr>" . "\n"; } } if($_SERVER["REQUEST_METHOD"]=="POST"){ //collect value of input field $name = $_POST["Primeiro"]; //fim da recolha do front in $servername = "localhost"; $username = "root"; $password = ""; $dbname = "operacoes"; try { $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare("SELECT ID, Nome, Apelido, Hora_Partida, Voo_Partida, Proveniencia_Partida, Data_Partida, Destino_Partida, Descricao_Partida, Motorista_Partida FROM asspartidas WHERE Nome = '$name'"); $stmt->execute(); // set the resulting array to associative $result = $stmt->setFetchMode(PDO::FETCH_ASSOC); foreach(new TableRows2(new RecursiveArrayIterator($stmt->fetchAll())) as $k=>$v) { /* $block_rep='0000-00-00'; $stmt = $conn->prepare('SELECT FROM assistencia WHERE Data_Partida= :rep'); $bind = $stmt ->bindValue(':rep', $block_rep, PDO::PARAM_INT); $stmt -> execute(); $assistencia=$stmt->fetchAll(); foreach($stmt as $dados){} if($dados['Data_Partida'] == $block_rep){ }else{ echo $v; } */ echo $v; } } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } $conn = null; echo "</table>"; } ?> <br><br> <form method="post"> <input type="button" value="inprimir" onclick="window.print()"/> </form> </body> </html>
  3. Alfredo Chitela

    Gerar PDF

    <!DOCTYPE html> <html lang="pt"> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta charset="UTF-8"/> <html> <head> <meta charset="UTF-8"> <title>Consulta pelo Nome do Passageiro</title> <h4>Chegadas</h4> </head> <style> table { width: 100%; border: 1px solid black; } td { border: 1px solid black; height: 15px; } th { border: 1px solid black; height: 15px; text-align: center; } table.TableRows { table-layout: auto; } table.TableRows2 { table-layout: auto; } </style> <body> <?php echo "<table style='border: solid 1px black;'>"; echo "<tr><th>ID</th><th>Nome</th><th>Apelido</th><th>Hora</th><th>Voo</th><th>Proveniencia</th><th>Data</th><th>Destino</th><th>Descricao</th><th>Motorista</th></tr>"; class TableRows extends RecursiveIteratorIterator { function __construct($it) { parent::__construct($it, self::LEAVES_ONLY); } function current() { return "<td style='width:95px;border:1px solid black;'>" . parent::current(). "</td>"; } function beginChildren() { echo "<tr>"; } function endChildren() { echo "</tr>" . "\n"; } } if($_SERVER["REQUEST_METHOD"]=="POST"){ //collect value of input field $name = $_POST["Primeiro"]; //fim da recolha do front in $servername = "localhost"; $username = "root"; $password = ""; $dbname = "operacoes"; try { $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare("SELECT ID, Nome, Apelido, Hora_Chegada, Voo_Chegada, Proveniencia_Chegada, Data_Chegada, Destino_Chegada, Descricao_Chegada, Motorista_Chegada FROM asschegadas WHERE Nome = '$name'"); $stmt->execute(); // set the resulting array to associative $result = $stmt->setFetchMode(PDO::FETCH_ASSOC); foreach(new TableRows(new RecursiveArrayIterator($stmt->fetchAll())) as $k=>$v) { echo $v; } } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } $conn = null; echo "</table>"; } ?> <h4>Partidas</h4> <?php echo "<table style='border: solid 1px black;'>"; echo "<tr><th>ID</th><th>Nome</th><th>Apelido</th><th>Hora</th><th>Voo</th><th>Proveniencia</th><th>Data</th><th>Destino</th><th>Descricao</th><th>Motorista</th></tr>"; class TableRows2 extends RecursiveIteratorIterator { function __construct($it) { parent::__construct($it, self::LEAVES_ONLY); } function current() { return "<td style='width:95px;border:1px solid black;'>" . parent::current(). "</td>"; } function beginChildren() { echo "<tr>"; } function endChildren() { echo "</tr>" . "\n"; } } if($_SERVER["REQUEST_METHOD"]=="POST"){ //collect value of input field $name = $_POST["Primeiro"]; //fim da recolha do front in $servername = "localhost"; $username = "root"; $password = ""; $dbname = "operacoes"; try { $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $conn->prepare("SELECT ID, Nome, Apelido, Hora_Partida, Voo_Partida, Proveniencia_Partida, Data_Partida, Destino_Partida, Descricao_Partida, Motorista_Partida FROM asspartidas WHERE Nome = '$name'"); $stmt->execute(); // set the resulting array to associative $result = $stmt->setFetchMode(PDO::FETCH_ASSOC); foreach(new TableRows2(new RecursiveArrayIterator($stmt->fetchAll())) as $k=>$v) { /* $block_rep='0000-00-00'; $stmt = $conn->prepare('SELECT FROM assistencia WHERE Data_Partida= :rep'); $bind = $stmt ->bindValue(':rep', $block_rep, PDO::PARAM_INT); $stmt -> execute(); $assistencia=$stmt->fetchAll(); foreach($stmt as $dados){} if($dados['Data_Partida'] == $block_rep){ }else{ echo $v; } */ echo $v; } } catch(PDOException $e) { echo "Error: " . $e->getMessage(); } $conn = null; echo "</table>"; } ?> <br><br> <form method="post"> <input type="button" value="inprimir" onclick="window.print()"/> </form> </body> </html>
×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.