<?php

require_once "TravelAdvisoryPDO.php";
require_once "TravelAdvisory.php";
$traveladvisoryid = $_GET["id"];
$traveladvisoryPDO = new TravelAdvisoryPDO();
$traveladvisory = $traveladvisoryPDO->getTravelAdvisory($traveladvisoryid);
// echo "UserId " .$user->getUserId();
$traveladvisoryPDO->deleteTravelAdvisory($traveladvisory);
echo "<html>";
echo "<head>";
echo "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' >";
echo "<link rel='stylesheet' type='text/css' href='menu.css'>";
echo "<title>News Portal - Delete Travel Advisory</title>";
echo "</head>";
echo "<body>";
include "menu.php";
echo "Deleted Travel Advisory </br>";
echo "<a href='Home.php'> Back to Home</a>";
echo "</body>";
echo "</html";
<!DOCTYPE html>
<html>
	<head>
		<meta content="noindex, nofollow" name="robots">
 <link rel="stylesheet" type="text/css" href="menu.css">

<title>News Portal - Update Travel Advisory Source</title>
	</head>
<body>
	<?php 
include "menu.php";
require_once "TravelAdvisoryPDO.php";
require_once "TravelAdvisory.php";
$traveladvisoryid = $_GET["id"];
$traveladvisoryPDO = new TravelAdvisoryPDO();
$traveladvisory = $traveladvisoryPDO->getTravelAdvisory($traveladvisoryid);
?>
<form action="EditTravelAdvisory.php" method="post">
<input type="hidden" name="traveladvisoryid" value="<?php 
echo $traveladvisoryid;
?>
">
<h1>Input Travel Advisory Source</h1>
<br>
<input type="text" name="traveladvisorysourcename" value="<?php 
echo $traveladvisory->getTravelAdvisorySourceName();
?>
">
<br>
<h1>Input Travel Advisory Source Link</h1>
<br>
<?php

require_once "TravelAdvisoryPDO.php";
require_once "TravelAdvisory.php";
$traveladvisoryPDO = new TravelAdvisoryPDO();
$traveladvisories = $traveladvisoryPDO->getTravelAdvisories();
echo "<html>";
echo "<head>";
echo "<meta http-equiv='Content-Type'' content='text/html; charset=UTF-8' >";
echo "<link rel='stylesheet'' type='text/css' href='menu.css'>";
echo "<title>News Portal Travel Advisory List</title>";
echo "</head>";
echo "<body>";
include "menu.php";
echo "<table border=1>";
echo "<tr border=1>";
echo "<th border=1><h4>Travel Advisory Id</h4></th>";
echo "<th border=1><h4>Travel Advisory Source Name</h4></th>";
echo "<th border=1><h4>Travel Advisory Source Link</h4></th>";
echo "<th border=1><h4>Travel Advisory Source Link Type</h4></th>";
echo "<th border=1><h4>Update Link</h4></th>";
echo "<th border=1><h4>Delete Link</h4></th>";
echo "</tr>";
foreach ($traveladvisories as $traveladvisory) {
    echo "<tr border=1>";
    echo "<td border=1>";
    echo "<h5>" . $traveladvisory->getTravelAdvisoryId() . "</h5>";
    echo "</td>";
    echo "<td border=1>";
    echo "<h5>" . $traveladvisory->getTravelAdvisorySourceName() . "</h5>";
    echo "</td>";
<?php

require_once "TravelAdvisoryPDO.php";
require_once "TravelAdvisory.php";
if (isset($_POST['submit'])) {
    $traveladvisoryid = $_POST["traveladvisoryid"];
    $traveladvisorysourcename = $_POST["traveladvisorysourcename"];
    // echo $username . "<br>\n";
    $traveladvisorysourcelink = $_POST["traveladvisorysourcelink"];
    //echo $password ."<br>\n";
    $traveladvisorysourcelinktype = $_POST["traveladvisorysourcelinktype"];
    if ($traveladvisorysourcename != '' && $traveladvisorysourcelink != '' && $traveladvisorysourcelinktype != '') {
        $traveladvisoryPDO = new TravelAdvisoryPDO();
        $travelAdvisory = new TravelAdvisory();
        $travelAdvisory->setTravelAdvisoryId($traveladvisoryid);
        $travelAdvisory->setTravelAdvisorySourceName($traveladvisorysourcename);
        $travelAdvisory->setTravelAdvisorySourceLink($traveladvisorysourcelink);
        $travelAdvisory->setTravelAdvisorySourceLinkType($traveladvisorysourcelinktype);
        $traveladvisoryPDO->updateTravelAdvisory($travelAdvisory);
        echo "<html>";
        echo "<head>";
        echo "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' >";
        echo "<link rel='stylesheet' type='text/css' href='menu.css'>";
        echo "<title>News Portal - Insert Travel Advisory</title>";
        echo "</head>";
        echo "<body>";
        include "menu.php";
        echo "Created a Travel Advisory </br>";
        echo "<a href='Home.php'> Back to Home</a>";
        echo "</body>";
        echo "</html";
<?php

require_once "TravelAdvisoryPDO.php";
require_once "TravelAdvisory.php";
if (isset($_POST['submit'])) {
    $traveladvisorysourcename = $_POST["traveladvisorysourcename"];
    // echo $username . "<br>\n";
    $traveladvisorysourcelink = $_POST["traveladvisorysourcelink"];
    //echo $password ."<br>\n";
    $traveladvisorysourcelinktype = $_POST["traveladvisorysourcelinktype"];
    if ($traveladvisorysourcename != '' && $traveladvisorysourcelink != '' && $traveladvisorysourcelinktype != '') {
        $traveladvisoryPDO = new TravelAdvisoryPDO();
        $travelAdvisory = new TravelAdvisory();
        $travelAdvisory->setTravelAdvisorySourceName($traveladvisorysourcename);
        $travelAdvisory->setTravelAdvisorySourceLink($traveladvisorysourcelink);
        $travelAdvisory->setTravelAdvisorySourceLinkType($traveladvisorysourcelinktype);
        $traveladvisoryPDO->insertTravelAdvisory($travelAdvisory);
        echo "<html>";
        echo "<head>";
        echo "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' >";
        echo "<link rel='stylesheet' type='text/css' href='menu.css'>";
        echo "<title>News Portal - Insert Travel Advisory</title>";
        echo "</head>";
        echo "<body>";
        include "menu.php";
        echo "Created a Travel Advisory </br>";
        echo "<a href='index.php'> Back to Home</a>";
        echo "</body>";
        echo "</html";
    } else {
        echo "Please fill all of the fields" . "<br>\n";