public function __construct($basicInfo, $detailedInfo, $salesman = false) { echo parent::htmlHeader('Car Details'); $heading = Heading::newHeading('h4', 'Car details'); $content = parent::htmlAlertDiv('info', $heading); echo parent::htmlDiv($content, 8); $detailsList = Heading::newHeading('h4', 'Basic information:'); $detailsList .= ListHTML::carDetailsList($basicInfo); echo parent::htmlDiv($detailsList, 6); $detailedList = Heading::newHeading('h4', 'Detailed information:'); $detailedList .= ListHTML::carDetailedList($detailedInfo); echo parent::htmlDiv($detailedList, 6); // Display the form to edit a car if the user is logged in and the car belongs to the user if ($_SESSION['user_session'] && $salesman) { $cInfo = $basicInfo[0]; $hp = InputField::hiddenInputField('text', 'form'); $img_url = InputField::hiddenImageField($cInfo['Image']); $vin_number = InputField::newInputFieldEdit('text', 'vin', 'Vin Number', $cInfo['Vin'], true); $price = InputField::newInputFieldEdit('text', 'price', 'Price', $cInfo['Price'], false); $condition = InputField::newInputFieldEdit('text', 'condition', 'Condition', $cInfo['Condition'], false); $picture = InputField::newInputFieldEdit('file', 'file', 'File Input', 'Value', false); $edit = Button::newButtonEdit('submit', 'edit', 'btn-success', 'Edit'); $delete = Button::newButtonEdit('submit', 'delete', 'btn-danger', 'Delete'); $form = new Form('index.php?page=editcar', 'POST', false); $form->addNewInput($hp); $form->addNewInput($img_url); $form->addNewInput($vin_number); $form->addNewInput($price); $form->addNewInput($condition); $form->addNewInput($picture); $form->addNewInput($edit); $form->addNewInput($delete); $content = $form->getForm(); $collapsible = parent::collapsibleDiv('Edit or Delete', $content); $collapsible .= '<br /><br /><br /><br /><br /><br /><br /><br />'; echo parent::htmlDiv($collapsible, 6); } echo parent::htmlFooter(); }
public function __construct($loginAttempts = '', $userInformation = '', $usersCars = '') { echo parent::htmlHeader('Profile Information'); $heading = Heading::newHeading('h4', 'Profile information'); $content = parent::htmlAlertDiv('info', $heading); echo parent::htmlDiv($content, 8); // Display users cars if he/she has added any if (!empty($usersCars)) { $content = Heading::newHeading('h4', 'Cars added by this user:'******'h4', 'Basic user information:'); $content .= ListHTML::databaseList($userInformation); $well = parent::htmlWell($content); echo parent::htmlDiv($well, 6); // Display the login attemps if user is logged in if (isset($_SESSION['user_session']) && !empty($_SESSION['user_session']) && !empty($loginAttempts)) { $content = Heading::newHeading('h4', 'Login attempts:'); $content .= Table::userLoginHistory($loginAttempts); echo parent::htmlDiv($content, 6); } echo parent::htmlFooter(); }