$pdf->SetTextColor(0); $total = 0; foreach ($panier as $a) { if ($a->getIdordinateur() != null) { $ordinateur = $ordinateurmanager->get($a->getIdordinateur()); $nom = $ordinateur->getNom(); $prix = $ordinateur->getPrix(); if (strlen($nom) > 50) { $nom = substr($nom, 0, 40) . '...'; } $pdf->Cell(80, 10, $nom, 1, 0, 'L', false); $pdf->Cell(80, 10, $prix . chr(128), 1, 0, 'L', false); $total += $prix; $pdf->Ln(); } else { $piece = $piecemanager->get($a->getIdpiece()); $nom = $piece->getNom(); $prix = $piece->getPrix(); if (strlen($nom) > 50) { $nom = substr($nom, 0, 40) . '...'; } $pdf->Cell(80, 10, $nom, 1, 0, 'L', false); $pdf->Cell(80, 10, $prix . chr(128), 1, 0, 'L', false); $total += $prix; $pdf->Ln(); } } $pdf->Cell(160, 10, 'Total: ' . $total . chr(128), 1, 0, 'L', 1); $pdf->Output(); } catch (Exception $e) { echo $e->getMessage();
echo '<h1>' . $title . '</h1>'; echo '<div class="container col-xs-12">'; foreach ($pieces as $a) { $piece = $piecemanager->get($a); echo '<h2>' . $piece->getNom() . '</h2>'; echo '<div>' . $piece->getDescriptif() . '</div>'; } echo ' <h1>' . $ordinateur->getPrix() . '€</h1>'; if (isset($_SESSION['utilisateur'])) { echo '<p><input class="btn btn-primary" href="?page=panier" attrordinateur="' . $ordinateur->getId() . '" attrpersonne="' . $_SESSION['utilisateur']->getId() . '" value="Ajouter au panier" id="validitemordinateur" role="button"></p>'; } } else { $piece = new PieceDB(); $piecemanager = new PieceManager($_SESSION['connexion']); $piece = $piecemanager->get($_GET['item']); $title = $piece->getNom(); echo '<h1>' . $title . '</h1>'; echo ' <div class="container col-xs-12"> <div>' . $piece->getDescriptif() . '</div> <h1>' . $piece->getPrix() . '</h1> <p><input class="btn btn-primary" href="?page=panier" attrpiece="' . $piece->getId() . '" attrpersonne="' . $_SESSION['utilisateur']->getId() . '" value="Ajouter au panier" id="validitempiece" role="button"></p> '; } echo '</div>'; ?> </div> </div> </div> </div>