public function __construct() { echo parent::htmlHeader('Home'); $heading = parent::htmlAlertDiv('info', Heading::newHeading('h4', 'Sign up below')); echo parent::htmlDiv($heading, 8); $hp_uniq = InputField::hiddenInputField('text', 'form'); $hp = InputField::hpInputField(); $firstname = InputField::newInputField('text', 'fname', 'First name'); $lastname = InputField::newInputField('text', 'lname', 'Last name'); $email = InputField::newInputField('text', 'email', 'Email'); $password = InputField::newInputField('password', 'pass', 'Password'); $password2 = InputField::newInputField('password', 'pass2', 'Re-enter password'); $captcha = InputField::captchaInputField(); $submit = Button::newButton('submit', 'btn-primary', 'Register'); $form = new Form('index.php?page=signup', 'POST'); $form->addNewInput($hp_uniq); $form->addNewInput($hp); $form->addNewInput($firstname); $form->addNewInput($lastname); $form->addNewInput($email); $form->addNewInput($password); $form->addNewInput($password2); $form->addNewInput($captcha); $form->addNewInput($submit); $content = $form->getForm(); $content .= Link::newLink('Go Back', 'index.php', '_self'); echo parent::htmlDiv($content, 4); echo parent::htmlFooter(); }
public function __construct() { echo parent::htmlHeader('Login'); $heading = Heading::newHeading('h4', '<b>Welcome!</b> Sing in or sing up below.'); $content = parent::htmlAlertDiv('info', $heading); echo parent::htmlDiv($content, 8); // Form $hp_uniq = InputField::hiddenInputField('text', 'form'); $hp = InputField::hpInputField(); $username = InputField::newInputField('text', 'email', 'Email'); $password = InputField::newInputField('password', 'password', 'Password'); $captcha = InputField::captchaInputField(); $submit = Button::newButton('submit', 'btn-primary', 'Sing in'); $form = new Form('index.php?page=login', 'POST'); $form->addNewInput($hp_uniq); $form->addNewInput($hp); $form->addNewInput($username); $form->addNewInput($password); $form->addNewInput($captcha); $form->addNewInput($submit); $content = $form->getForm(); $content .= Paragraph::newParagraph('Not a member yet? Please sing up below!'); $content .= Link::newLink('Sing up', 'index.php?page=signup', '_self'); echo parent::htmlDiv($content, 4); echo parent::htmlFooter(); }
public function __construct($session_array = '', $car_id = '') { // Header echo parent::getHeader('Car Details'); // Get the proper car from the session array $car = $session_array[$car_id['id']]; $heading = Heading::newHeading('h5', 'Car Details'); $content = parent::htmlAlertDiv('warning', $heading); echo parent::htmlDiv($content, 8); // Display information about the car foreach ($car as $attribute => $value) { $clean = HTML::cleanAttribute($attribute); if ($clean == 'Image') { $image = Heading::newHeading('h2', 'Image'); if (!empty($value)) { $image .= '<img src="' . $value . '" alt="image" class="img-thumbnail">'; } else { $image .= Heading::newHeading('h4', 'Not Available'); } } else { if ($clean == 'Guid') { continue; } else { $ctn .= '<b>' . $clean . '</b>: ' . $value . '<br />'; } } } $ctn .= Link::newLink('<br />Go Back', 'index.php', '_self'); $well = parent::htmlWell('lg', $ctn); echo parent::htmlDiv($image, 6); echo parent::htmlDiv($well, 6); // Footer echo parent::getFooter(); }
public function getHeader($title) { $pageHTML = '<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UI-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>' . $title . '</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> </head> <body> <nav class="navbar navbar-inverse"> <div class="container-fluid"> <a class="navbar-brand" href="index.php">IS-218</a> <ul class="nav navbar-nav"> <li>' . Link::newLink('Home', 'index.php', '_self') . '</li> <li>' . Link::newLink('Add New Car', 'index.php?page=addcar', '_self') . '</li> <li>' . Link::newLink('Import CSV File', 'index.php?page=importcsv', '_self') . '</li> </ul> </div> </nav> <div class="container">'; return $pageHTML; }
public function __construct($array = '', $carID = '') { // Get header echo parent::getHeader('Edit Car'); // Get the proper car in the array $car = $array[$carID['id']]; $content = parent::htmlAlertDiv('warning', Heading::newHeading('h5', 'Edit or delete the car below')); echo parent::htmlDiv($content, 8); //echo $form = new Form('index.php', 'POST'); foreach ($car as $attribute => $value) { $clean = HTML::cleanAttribute($attribute, 'false'); if ($clean == 'guid') { // Disable the GUID input field so it cannot be edited ${$clean} = InputField::newInputField('text', $clean, $value, 'readonly'); $form->addNewInput(${$clean}); } else { // If not a GUID input field, allow for editing ${$clean} = InputField::newInputField('text', $clean, $value); $form->addNewInput(${$clean}); } } $save = Button::newButton('submit', 'save', 'btn-success', 'Save'); $delete = Button::newButton('submit', 'delete', 'btn-danger', 'Delete'); $form->addNewInput($save); $form->addNewInput($delete); $content = $form->getForm(); $content .= Link::newLink('Go Back', 'index.php', '_self') . '</li></ul>'; echo parent::htmlDiv($content, 4); // Get footer echo parent::getFooter(); }
public function __construct() { // Header echo parent::getHeader('New Car'); $heading = Heading::newHeading('h5', 'Add a New Car'); $content = parent::htmlAlertDiv('warning', $heading); echo parent::htmlDiv($content, 8); // newInputField($type, $name, $value, $readonly, $placeholder) // I need: type, name, placeholder // newButton($type, $name, $class, $text) // I need: type, class, text $make = InputField::newInputField('text', 'make', '', '', 'Make'); $model = InputField::newInputField('text', 'model', '', '', 'Model'); $year = InputField::newInputField('text', 'year', '', '', 'Year'); $carPic = InputField::newInputField('file', 'file', '', '', 'File Input'); $submit = Button::newButton('submit', '', 'primary', 'Submit'); $form = new Form('index.php?page=addcar', 'POST'); $form->addNewInput($make); $form->addNewInput($model); $form->addNewInput($year); $form->addNewInput($carPic); $form->addNewInput($submit); $content = $form->getForm(); $content .= Link::newLink('Go Back', 'index.php', '_self'); echo parent::htmlDiv($content, 4); // Get footer echo parent::getFooter(); }
public function __construct($session_array = '', $car_id = '') { // Get header echo parent::getHeader('Edit Car'); // Get the proper car in the array $car = $session_array[$car_id['id']]; $content = parent::htmlAlertDiv('warning', Heading::newHeading('h5', 'Edit or delete the car below')); echo parent::htmlDiv($content, 8); // newInputField($type, $name, $value, $readonly, $placeholder) // newButton($type, $name, $class, $text) $form = new Form('index.php?page=editcar', 'POST'); foreach ($car as $attribute => $value) { $clean = HTML::cleanAttribute($attribute, 'false'); if ($clean == 'guid') { // Disable the GUID input field so it cannot be edited ${$clean} = InputField::newInputField('text', $clean, $value, 'readonly', 'ID'); $form->addNewInput(${$clean}); } else { if ($clean == 'image') { $img = Heading::newHeading('h2', 'Image'); if (!empty($value)) { $img = '<div class="thumbnail">'; $img .= '<img src="' . $value . '" alt="image">'; $img .= '</div>'; ${$clean} = InputField::newInputField('text', $clean, $value, 'readonly', 'Image Path'); $form->addNewInput(${$clean}); } else { $img .= Heading::newHeading('h4', 'Not available'); } } else { // If not a GUID input field, allow for editing ${$clean} = InputField::newInputField('text', $clean, $value); $form->addNewInput(${$clean}); } } } $carPic = InputField::newInputField('file', 'file', '', '', 'New Picture'); $save = Button::newButton('submit', 'save', 'success', 'Save'); $delete = Button::newButton('submit', 'delete', 'danger', 'Delete'); $form->addNewInput($carPic); $form->addNewInput($save); $form->addNewInput($delete); $content = $form->getForm(); $content .= Link::newLink('Go Back<br /><br />', 'index.php', '_self') . '</li></ul>'; echo parent::htmlDiv($img, 6); echo parent::htmlDiv($content, 4); // Get footer echo parent::getFooter(); }
public function __construct($array = '', $carID = '') { // Get header echo parent::getHeader('Car Details'); // Get the proper car in the array $car = $array[$carID['id']]; $content = parent::htmlAlertDiv('warning', Heading::newHeading('h5', 'Car Details')); echo parent::htmlDiv($content, 8); // Display information about the car foreach ($car as $attribute => $value) { $clean = HTML::cleanAttribute($attribute); $ctn .= '<b>' . $clean . '</b>: ' . $value . '<br />'; } $ctn .= Link::newLink('Go Back', 'index.php', '_self'); echo parent::htmlDiv($ctn, 6); // Get footer echo parent::getFooter(); }
public function htmlHeader($pageTitle) { $pageHTML = ' <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UI-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>' . $pageTitle . '</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> <link rel="stylesheet" href="css/main.css"> </head> <body> <nav class="navbar navbar-inverse"> <div class="container"> <a class="navbar-brand" href="index.php">IS-218</a> <ul class="nav navbar-nav">'; if (isset($_SESSION['user_session']) && ($_SESSION['HTTP_USER_AGENT'] = md5($_SERVER['HTTP_USER_AGENT']))) { $pageHTML .= ' <li>' . Link::newLink('Home', 'index.php', '_self') . '</li> <li>' . Link::newLink('Profile', 'index.php?page=profile&id=' . $_SESSION['user_session'], '_self') . '</li> <li>' . Link::newLink('Add New Car', 'index.php?page=addcar', '_self') . '</li> </ul> <a href="index.php?logout=true"><button type="button" class="btn btn-default navbar-btn navbar-right"> Logout</button></a> <p class="navbar-text navbar-right">Signed in as <a href="index.php?page=profile&id=' . $_SESSION['user_session'] . '"><b>' . $_SESSION['user_fname'] . ' ' . $_SESSION['user_lname'] . '</b></a>         </p>'; } else { $pageHTML .= '<li>' . Link::newLink('Home', 'index.php', '_self') . '</li></ul>'; $pageHTML .= '<a href="index.php?page=login"><button type="button" class="btn btn-default navbar-btn navbar-right">Login</button></a>'; } $pageHTML .= ' </div> </nav> <div class="container">'; return $pageHTML; }
public function __construct() { // Get header echo parent::getHeader('New Car'); $content = parent::htmlAlertDiv('warning', Heading::newHeading('h5', 'Add a New Car')); echo parent::htmlDiv($content, 8); $make = InputField::newInputField('text', 'make', 'Make', '', 'Make'); $model = InputField::newInputField('text', 'model', 'Model', '', 'Model'); $year = InputField::newInputField('text', 'year', 'Year', '', 'Year'); $submit = InputField::newInputField('submit', '', 'Submit'); $form = new Form('index.php', 'POST'); $form->addNewInput($make); $form->addNewInput($model); $form->addNewInput($year); $form->addNewInput($submit); $content = $form->getForm(); $content .= Link::newLink('Go Back', 'index.php', '_self'); echo parent::htmlDiv($content, 4); // Get footer echo parent::getFooter(); }