Пример #1
0
<?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;
Пример #2
0
<?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;
Пример #3
0
<?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;
Пример #4
0
<?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;
Пример #5
0
<?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;