Rev 65 | Rev 71 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
// Include Session Handling
require_once ('includes/session.php');
global $mediaTypeTextArr;
global $mediaTypeIconArr;
// Include config & login validate file
require_once 'includes/validateUser.php';
if (isset($_SESSION['sessData']['field_error'])) {
// Get form field error from session
$fieldError = $_SESSION['sessData']['field_error'];
// Remove field error data from session
unset($_SESSION['field_error']['sessData']);
}
?>
<!DOCTYPE html>
<html lang="en-US">
<head>
<!--head-->
<?php include_once 'elements/head.php'; ?>
<!--//head-->
</head>
<body>
<div class="main">
<!--header-->
<?php include_once 'elements/header.php'; ?>
<!--//header-->
<!--main-->
<div class="main-content">
<div class="wrapper-frm bg-light text-dark border shadow">
<div class="head-menu bg-primary menu-tle">
<h2>Edit Account</h2>
</div>
<form action="<?php echo BASE_URL; ?>userAccount.php" method="post" enctype="multipart/form-data">
<div class="ucontent">
<div class="left-pnl">
<img class="img-fluid upicture" src="<?php echo $userPicture; ?>" alt="<?php echo $userName; ?>">
<h2><?php echo $userName; ?></h2>
</div>
<div class="right-pnl">
<?php echo !empty($statusMsg) ? '<p class="status-msg ' . $statusMsgType . '">' . $statusMsg . '</p>' : ''; ?>
<input type="hidden" name="sessionTab" value="<?php if (isset($_POST['sessionTab'])) echo $_POST['sessionTab']; ?>">
<input type="hidden" name="searchTerm" value="<?php if (isset($_POST['searchTerm'])) echo $_POST['searchTerm']; ?>">
<input type="hidden" name="buyerZip" value="<?php if (isset($_POST['buyerZip'])) echo $_POST['buyerZip']; ?>">
<div class="custom-file frm-input">
<input type="file" class="custom-file-input file-in border" id="customFile" name="picture">
<label class="custom-file-label" for="customFile"><img src="assets/images/uimg.png" alt="Default User Image"> Optional user image</label>
</div>
<div class="frm-input <?php echo !empty($fieldError['first_name']) ? 'error' : ''; ?>">
<input type="text" name="first_name" class="user-in" placeholder="First name" value="<?php echo !empty($userData['first_name']) ? $userData['first_name'] : ''; ?>" required="">
<?php echo !empty($fieldError['first_name']) ? '<p>' . $fieldError['first_name'] . '</p>' : ''; ?>
</div>
<div class="frm-input <?php echo !empty($fieldError['last_name']) ? 'error' : ''; ?>">
<input type="text" name="last_name" class="user-in" placeholder="Last name" value="<?php echo !empty($userData['last_name']) ? $userData['last_name'] : ''; ?>">
<?php echo !empty($fieldError['last_name']) ? '<p>' . $fieldError['last_name'] . '</p>' : ''; ?>
</div>
<div class="frm-input <?php echo !empty($sessData['field_error']['email']) ? 'error' : ''; ?>">
<input type="email" name="email" class="email-in" placeholder="Email" value="<?php echo !empty($userData['email']) ? $userData['email'] : ''; ?>" required="">
<?php echo !empty($fieldError['email']) ? '<p>' . $fieldError['email'] . '</p>' : ''; ?>
</div>
<div class="frm-input">
<input type="text" name="zip" class="addr-in" placeholder="Zip" value="<?php echo !empty($userData['zip']) ? $userData['zip'] : ''; ?>">
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="bg-dark text-light menu-tle my-3">
<h5>Layout</h5>
</div>
<div class="text-center m-2">
<label>Color Theme:</label>
<select class="form-control" id="theme" name="theme">
<?php
$themes = scandir("../css");
foreach ($themes as $themeLong) {
$themeLong = strtolower($themeLong);
if (strpos($themeLong, "theme-") === 0) {
$theme = substr($themeLong, 6, strlen($themeLong) - 10);
echo "<option";
if (!empty($userData['theme']) && $userData['theme'] == $theme) {
echo " selected";
}
echo ">";
echo ucwords($theme);
echo "</option>";
}
}
?>
</select>
<p>Result View:</p>
<div class="form-check-inline">
<label class="form-check-label">
<input type="radio" class="form-check-input" name="cardView" value="0" <?php echo $userData['cardView'] ? "" : "checked"; ?>>Table
</label>
</div>
<div class="form-check-inline">
<label class="form-check-label">
<input type="radio" class="form-check-input" name="cardView" value="1" <?php echo $userData['cardView'] ? "checked" : ""; ?>>Cards
</label>
</div>
</div>
<div class="bg-dark text-light menu-tle my-3">
<h5>Search Filter Preferences</h5>
</div>
<div class="card-group">
<div class="card m-2">
<div class="card-header font-weight-bold">Condition</div>
<div class="card-body ac-info">
<div class="form-check">
<label class="form-check-label">
<input name="filterConditionNew" type="checkbox" class="form-check-input" value="New" <?php echo ($userData["conditionNew"] ? "checked" : ""); ?>>New
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input name="filterConditionUsed" type="checkbox" class="form-check-input" value="Used" <?php echo ($userData["conditionUsed"] ? "checked" : ""); ?>>Used
</label>
</div>
</div>
</div>
<div class="card m-2">
<div class="card-header font-weight-bold">Media Type</div>
<div class="card-body ac-info">
<div class="form-check">
<label class="form-check-label">
<input name="filterMediaTypeCD" type="checkbox" class="form-check-input" value="CD" <?php echo ($userData["mediaCD"] ? "checked" : ""); ?>><i class="<?php echo $mediaTypeIconArr["CD"]; ?>"></i> <?php echo $mediaTypeTextArr["CD"]; ?>
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input name="filterMediaTypeRecord" type="checkbox" class="form-check-input" value="Record" <?php echo ($userData["mediaRecord"] ? "checked" : ""); ?>><i class="<?php echo $mediaTypeIconArr["Record"]; ?>"></i> <?php echo $mediaTypeTextArr["Record"]; ?>
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input name="filterMediaTypeDigital" type="checkbox" class="form-check-input" value="Digital" <?php echo ($userData["mediaDigital"] ? "checked" : ""); ?>><i class="<?php echo $mediaTypeIconArr["Digital"]; ?>"></i> <?php echo $mediaTypeTextArr["Digital"]; ?>
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input name="filterMediaTypeBook" type="checkbox" class="form-check-input" value="Books" <?php echo ($userData["mediaBook"] ? "checked" : ""); ?>><i class="<?php echo $mediaTypeIconArr["Book"]; ?>"></i> <?php echo $mediaTypeTextArr["Book"]; ?>
</label>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="frm-btn text-center">
<button type="submit" class="btn btn-success" name="updateProfile" value="Update">Update</button>
</div>
</form>
</div>
</div>
<!--//main-->
<!--footer-->
<?php include_once 'elements/footer.php'; ?>
<!--//footer-->
</div>
<script>
$(".custom-file-input").on("change", function() {
var fileName = $(this).val().split("\\").pop();
$(this).siblings(".custom-file-label").addClass("selected").html(fileName);
});
</script>
</body>
</html>