Exemple #1
0
 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($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();
 }
Exemple #3
0
 public function __construct($array = '')
 {
     // Get header
     echo parent::getHeader('Home');
     if (!empty($array)) {
         $content = parent::htmlAlertDiv('warning', Heading::newHeading('h5', 'Cars Stored in Session'));
         echo parent::htmlDiv($content, 8);
         $content = Table::generateTable($array);
         echo parent::htmlDiv($content, 6);
     } else {
         $content = parent::htmlAlertDiv('danger', Heading::newHeading('h5', 'No cars stored in session to be
       displayed.'));
         $content .= parent::htmlAlertDiv('info', Heading::newHeading('h5', 'Add a new car
       by clicking the <strong>"Add New Car"</strong> link above.'));
         echo parent::htmlDiv($content, 8);
     }
     // Get footer
     echo parent::getFooter();
 }
Exemple #4
0
 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();
 }