// </div> // <button type='submit' class='btn-success'>Create</button> // </form> // </div> // </body> // </html> // "; // }); $app->post("/view_job", function () { $output = ""; $new_contact = new Contact($_POST["name"], $_POST["email"], $_POST["phone"]); $new_job = new JobOpening($_POST["title"], $_POST["description"], $new_contact); $new_job->save(); $title = $new_job->getTitle(); $description = $new_job->getDescript(); $job_contact = $new_job->getContact(); $name = $job_contact->getName(); $email = $job_contact->getEmail(); $number = $job_contact->getPhoneNumba(); // $available_jobs = array(); // // array_push($available_jobs, $new_job); // // var_dump($available_jobs); return "\n <h1>Here is your new job listing:</h1>\n <h3>{$title}</h3>\n <h4>{$description}</h4>\n <ul>\n <li>{$name}</li>\n <li>{$email}</li>\n <li>{$number}</li>\n </ul>\n \n "; }); $app->post("/delete_jobs", function () { JobOpening::deleteAll(); return "\n <h1>List cleared!</h1>\n <p><a href='/'>Home</a></p>\n "; }); return $app;
<?php require_once __DIR__ . "/../vendor/autoload.php"; require_once __DIR__ . "/../src/JobOpening.php"; require_once __DIR__ . "/../src/Contact.php"; $app = new Silex\Application(); $app->get("/", function () { return "<h1><a href='/Jobs-for-sale'>Want to exploit the underclass? Click here!</a></h1>"; }); $app->get("/Jobs-for-sale", function () { return "\n <DOCTYPE>\n <html>\n <head>\n <link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css'>\n <title>Jobs for sale</title>\n <body>\n <div class='container'>\n <h1>Employ Someone Today!</h1>\n <form action='/job-results' method='get'>\n <div class='form-group'>\n <label for='title'>Title</label>\n <input type='string' name='title' id='title' class='form-control'>\n </div>\n <div class='form-group'>\n <label for='discript'>Job Description</label>\n <input type='string' name='descript' id='descript' class='form-control'>\n </div>\n <div class='form-group'>\n <label for='pay'>Pay</label>\n <input type='number' name='pay' id='pay' class='form-control'>\n </div>\n\n\n <div class='form-group'>\n <label for='phone'>Phone Number</label>\n <input type='number' name='phone' id='phone' class='form-control'>\n </div>\n <div class='form-group'>\n <label for='address'>Home Address</label>\n <input type='string' name='address' id='address' class='form-control'>\n </div>\n <div class='form-group'>\n <label for='hair_color'>Hair Color (dirty blond is not a color)</label>\n <input type='string' name='hair_color' id='hair_color' class='form-control'>\n </div>\n <div class='form-group'>\n <label for='email'>E-mail Address</label>\n <input type='string' name='email' id='email' class='form-control'>\n </div>\n <div class='form-group'>\n <label for='ssn'>Social Security Number :-)</label>\n <input type='number' name='ssn' id='ssn' class='form-control'>\n </div>\n <div class='form-group'>\n <label for='bday_month'>Birth Month</label>\n <input type='number' name='bday_month' id='bday_month' class='form-control'>\n </div>\n <div class='form-group'>\n <label for='bday_day'>Birth Day</label>\n <input type='number' name='bday_day' id='bday_day' class='form-control'>\n </div>\n <div class='form-group'>\n <label for='bday_year'>Birth Year</label>\n <input type='number' name='bday_year' id='bday_year' class='form-control'>\n </div>\n <button name='submit' class='btn-success'>Submit</button>\n </form>\n </div>\n </body>\n </html>"; }); $app->get("/job-results", function () { if ($_GET['hair_color'] != "dirty blond" && $_GET['hair_color'] != "dirty blonde") { $yourcontact = new Contact($_GET['phone'], $_GET['address'], $_GET['hair_color'], $_GET['email'], $_GET['ssn'], $_GET['bday_month'], $_GET['bday_day'], $_GET['bday_year']); $yourjob = new JobOpening($_GET['title'], $_GET['descript'], $_GET['pay'], $yourcontact); $output = ""; $output = $output . "<h3>GOTCHA! Your SSN is " . $yourjob->getContact()->getSSN() . ".</h3>"; $output = $output . "<h1>Also your birthday is " . $yourjob->getContact()->getBdayMonth() . "/" . $yourjob->getContact()->getBdayDay() . "/" . $yourjob->getContact()->getBdayYear() . ".</h1>"; $output = $output . "<h5>Thanks for using Jobs4Sale! Have a nice day.</h5>"; return $output; } else { return "Dirty blond/e is not a hair color. Sorry."; } }); return $app;
<?php require_once __DIR__ . "/../vendor/autoload.php"; require_once __DIR__ . "/../src/JobOpening.php"; require_once __DIR__ . "/../src/Contact.php"; $app = new Silex\Application(); $app->get("/", function () { return "\n <!DOCTYPE html>\n <html>\n <head>\n <link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css'>\n <title></title>\n </head>\n <body>\n <div class='container'>\n <h1>Enter information about Job Opening</h1>\n <form action='/view_job_post'>\n <div class='form-group'>\n <label for='job_title'>Job Title:</label>\n <input id='job_title' name='job_title' class='form-control' type='text'>\n </div>\n <div class='form-group'>\n <label for='job_description'>Job Description:</label>\n <input id='job_description' name='job_description' class='form-control' type='text'>\n </div>\n <h2>Contact Information</h2>\n <div class='form-group'>\n <label for='contact_name'>Name:</label>\n <input id='contact_name' name='contact_name' class='form-control' type='text'>\n </div>\n <div class='form-group'>\n <label for='contact_email'>Email:</label>\n <input id='contact_email' name='contact_email' class='form-control' type='text'>\n </div>\n <div class='form-group'>\n <label for='contact_phone'>Phone Number:</label>\n <input id='contact_phone' name='contact_phone' class='form-control' type='text'>\n </div>\n <button type='submit' class='btn'>Go!</button>\n </form>\n </div>\n </body>\n </html>\n "; }); $app->get("/view_job_post", function () { $contact_info = new Contact($_GET["contact_name"], $_GET["contact_email"], $_GET["contact_phone"]); $job_post = new JobOpening($_GET["job_title"], $_GET["job_description"], $contact_info); $output = ''; if ($contact_info->checkNumber()) { $output .= "<h1>" . $job_post->getTitle() . "</h1> \n"; $output .= "<h2>" . $job_post->getDescription() . "</h2> \n"; $output .= "\n <h2>Contact Information</h2> \n"; $output .= "<h3>" . $job_post->getContact()->getName() . "</h3> \n"; $output .= "<h3>" . $job_post->getContact()->getEmail() . "</h3> \n"; $output .= "<h3>" . $job_post->getContact()->getPhone() . "</h3> \n"; } else { $output .= "<h1>Invalid Phone Number, Try Again!</h1>"; } return $output; }); return $app;
<?php require_once __DIR__ . "/../vendor/autoload.php"; require_once __DIR__ . "/../src/Job-Opening.php"; require_once __DIR__ . "/../src/Contact.php"; $app = new Silex\Application(); $app->get("/new_posting", function () { return "<!DOCTYPE html>\n <html>\n <head>\n <meta charset='utf-8'>\n <title>Post a new job</title>\n <link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css'>\n </head>\n <body>\n <form action='/view_job'>\n <div class='form-group'>\n <label for='title'>Enter Job Title:</label>\n <input id='title' name='title' class='form-control' type='text'>\n </div>\n <div class='form-group'>\n <label for='description'>Enter the description:</label>\n <input id='description' name='description' class='form-control' type='text'>\n </div>\n <div class='form-group'>\n <label for='name'>Enter your Name:</label>\n <input id='name' name='name' class='form-control' type='text'>\n </div>\n <div class='form-group'>\n <label for='email'>Enter your Email:</label>\n <input id='email' name='email' class='form-control' type='text'>\n </div>\n <button type='submit' class='btn-success'>Create</button>\n </form>\n </body>\n </html>"; }); $app->get("/view_job", function () { $new_contact = new Contact($_GET["name"], $_GET["email"]); $new_post = new JobOpening($_GET["title"], $_GET["description"], $new_contact); $new_title = $new_post->getTitle(); $new_description = $new_post->getDescription(); $current_contact = $new_post->getContact(); $new_name = $current_contact->getName(); $new_email = $current_contact->getEmail(); // return "$new_name"; return "<ul>\n <li>{$new_title}</li>\n <li>{$new_description}</li>\n <ul>\n <li>{$new_name}</li>\n <li>{$new_email}</li>\n </ul>\n </ul>\n "; }); return $app;