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();
 }
Exemple #2
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();
 }
Exemple #3
0
 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();
 }