<?php require_once __DIR__ . "/../vendor/autoload.php"; require_once __DIR__ . "/../src/JobOpening.php"; require_once __DIR__ . "/../src/Contact.php"; $app = new Silex\Application(); // Home Page $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>Post a Job</title>\n </head>\n\n <body>\n <div class='container'>\n <div class='row'>\n <div class='col-sm-6'>\n <h1>Post a Job</h1>\n <form action='/results'>\n <div class='form-group'>\n <label for='title'>Enter the 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 job 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='phone'>Enter your phone number:</label>\n <input id='phone' name='phone' class='form-control' type='number'>\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'>Submit</button>\n </form>\n </div>\n </div>\n </div>\n </body>\n </html>"; }); // Results Page $app->get("/results", function () { $contact = new Contact($_GET['name'], $_GET['phone'], $_GET['email']); $newJob = new JobOpening($_GET['title'], $_GET['description'], $contact); $output = "<h3>Job: " . $newJob->getTitle() . "</h3>\n <h4>Description: " . $newJob->getDescription() . "</h4>\n <p>Name: " . $contact->getName() . "</p>\n <p>Phone: " . $contact->getPhone() . "</p>\n <p>email: " . $contact->getEmail() . "</p><hr>"; 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>Posted Job</title>\n </head>\n\n <body>\n <div class='container'>\n <div class='row'>\n <div class='col-sm-8'>" . $output . "</div>\n </div>\n </div>\n </body>\n </html>"; }); 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;
// </div> // <div class='form-group'> // <label for='phone'>Enter the phone numba:</label> // <input id='phone' name='phone' class='form-control' type='number'> // </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 () {
<?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 <meta charset='utf-8'>\n <title>Job Posting</title>\n </head>\n <body>\n <h1>Submit Job Posting</h1>\n <form class='' action='/job_postings' method='get'>\n <label for='title'>Job Post Title</label>\n <input type='text' name='title' id='title'>\n <label for='desc'>Job Description</label>\n <input type='text' name='desc' id='desc'>\n <label for='name'>Your Name</label>\n <input type='text' name='name' id='name'>\n <label for='email'>Your Email</label>\n <input type='email' name='email' id='email'>\n <label for='phone'>Your Phone</label>\n <input type='number' name='phone' id='phone'>\n <button type='submit'>Post Job</button>\n </form>\n </body>\n </html>"; }); $app->get("/job_postings", function () { $output = ""; $this_posting = new JobOpening($_GET['title'], $_GET['desc']); $contact_info = new Contact($_GET['name'], $_GET['email'], $_GET['phone']); $contactoutput = $contact_info->getWholeContact(); $postattempt = $this_posting->getWholeTitle(); $output = $output . "\n <h1>" . $postattempt . "</h1>\n <h2>" . $contactoutput . "</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;
<?php require_once __DIR__ . "/../vendor/autoload.php"; require_once __DIR__ . "/../src/JobOpening.php"; require_once __DIR__ . "/../src/Contact.php"; session_start(); if (empty($_SESSION['list_of_jobs'])) { $_SESSION['list_of_jobs'] = array(); } $app = new Silex\Application(); $app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views')); $app->get("/", function () use($app) { return $app['twig']->render('form.html.twig'); }); $app->get("/result", function () use($app) { // $title = $_GET['title']; // $description = $_GET['description']; // $name = $_GET['name']; // $phone = $_GET['phone']; // $email = $_GET['email']; // refactored $contact = new Contact($_GET['name'], $_GET['phone'], $_GET['email']); $job = new JobOpening($_GET['title'], $_GET['description'], $contact); $job->save(); return $app['twig']->render('result.html.twig', array('jobs' => $_SESSION['list_of_jobs'])); }); return $app;
<input type="text" name="phone" id="phone"> <label for="email">Email Address:</label> <input type="text" name="email" id="email"> <label for="address">Address:</label> <input type="text" name="address" id="address"> <button type='submit' class='btn-success'>Submit</button> </form> <?php return ""; }); $app->get("/posting", function () { $job_opening = new JobOpening($_GET["title"], $_GET["des"]); $contact = new Contact($_GET["phone"], $_GET["email"], $_GET["address"]); ?> <p><?php echo $job_opening->getTitle(); ?> </p> <p><?php echo $job_opening->getDes(); ?> </p> <p><?php echo $contact->getPhone(); ?> </p> <p><?php
<?php require_once __DIR__ . "/../vendor/autoload.php"; require_once __DIR__ . "/../src/JobOpening.php"; require_once __DIR__ . "/../src/ContactInfo.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.6/css/bootstrap.min.css' integrity='sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7' crossorigin='anonymous'>\n <title>Post a Job Opening</title>\n </head>\n <body>\n <div class='container'>\n <h1>Post a New Job Opening</h1>\n <form action='/view_jobs'>\n <div class='form-group'>\n <label for='jobTitle'> Job Title</label>\n <input id='jobTitle' name='jobTitle' class='form-control' type='text' required>\n <label for='jobDescription'> Job Description</label>\n <input id='jobDescription' name='jobDescription' class='form-control' type='text' required>\n <label for='contactName'> Contact Name</label>\n <input id='contactName' name='contactName' class='form-control' type='text' required>\n <label for='contactEmail'> Contact Email</label>\n <input id='contactEmail' name='contactEmail' class='form-control' type='email' required>\n <label for='phoneNumber'> Contact Phone Number</label>\n <input id='phoneNumber' name='phoneNumber' class='form-control' type='tel' required>\n </div>\n <button type='submit' class='btn-success'>Submit</button>\n </form>\n </div>\n </body>\n </html>\n "; }); $app->get("/view_jobs", function () { $newOpening = new JobOpening($_GET['jobTitle'], $_GET['jobDescription'], new ContactInfo($_GET['contactName'], $_GET['contactEmail'], $_GET['phoneNumber'])); $title = $newOpening->getTitle(); $description = $newOpening->getDescription(); $currentContact = $newOpening->getContactInfo(); return "\n <!DOCTYPE html>\n <html>\n <head>\n <link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css' integrity='sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7' crossorigin='anonymous'>\n <title>A Job Opening!</title>\n </head>\n <body>\n <div class='container'>\n <h1>" . $title . "</h1>\n <p>" . $description . "</p>\n <p> Contact: </p>\n <ul>\n <li>Email Contact: <a href='mailto:" . $currentContact->getContactEmail() . "'>" . $currentContact->getContactName() . "</a></li>\n <li>Phone Contact: " . $currentContact->getPhoneNumber() . "</li>\n </div>\n </body>\n </html>\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 "\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 <link rel='stylesheet' href='css/styles.css'>\n <title>Job Board</title>\n </head>\n <body>\n <div class='container'>\n <h1>Job Board</h1>\n <form action='/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 job 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='phone_number'>Enter phone number: </label>\n <input id='phone_number' name='phone_number' 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-primary'>Submit</button>\n </form>\n </div>\n </body>\n </html>\n "; }); $app->get("/job", function () { $new_job = new JobOpening($_GET["title"], $_GET["description"]); $new_contact = new Contact($_GET["name"], $_GET["phone_number"], $_GET["email"]); $output = ""; $output = $output . "<div class='box'><p>Title: " . $new_job->getTitle() . "</p>\n <p> Description: " . $new_job->getDescription() . "</p>\n <p> Name: " . $new_contact->getName() . "</p>\n <p> Phone Number: " . $new_contact->getPhoneNumber() . "</p>\n <p> Email: " . $new_contact->getEmail() . "</div></p>"; 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 <link rel='stylesheet' href='css/styles.css'>\n <title>Job Posted!</title>\n </head>\n <body>\n <div class='container'>\n <h1>Your job has been posted!</h1>\n <h3>The job details are:</h3>\n <p>{$output}</p>\n </div>\n </body>\n </html>\n "; }); return $app;