v1.0 Initial commit of project
This commit is contained in:
108
pub/bin/pages/pageUserProfile_edit.php
Normal file
108
pub/bin/pages/pageUserProfile_edit.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
use bin\php\Classes\formBuilder;
|
||||
use bin\php\Classes\pageNavbar;
|
||||
|
||||
if (!defined('APP_INIT')) {
|
||||
exit;
|
||||
}
|
||||
# IDE Section
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/formBuilder.php');
|
||||
# Page functions
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['Generatepassword'] = true;
|
||||
$jsScriptLoadData['passwordShowHide'] = true;
|
||||
$jsScriptLoadData['passwordRegen'] = true;
|
||||
$jsScriptLoadData['enableButtonOnImageUpload'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
$formBuilder = new formBuilder('Edit profile', '<i class="fas fa-plus"></i>', '/userprofile/');
|
||||
|
||||
# Retrieve Information for the page
|
||||
$user_groups_data = $GLOBALS['conn']->query("SELECT * FROM vc_user_groups WHERE user_group_type = 'admin' ORDER BY user_group_weight DESC");
|
||||
$user_groups = array();
|
||||
$user_data = false;
|
||||
while ($user_group = $user_groups_data->fetch_assoc()) {
|
||||
array_push($user_groups, $user_group);
|
||||
$last_weight = $user_group['user_group_weight'];
|
||||
}
|
||||
|
||||
$user_uuid = $_SESSION['user']['user_uuid'];
|
||||
$stmt = $GLOBALS['conn']->prepare("SELECT * FROM vc_users INNER JOIN vc_user_groups ON vc_users.user_group_uuid = vc_user_groups.user_group_uuid WHERE user_uuid = ?");
|
||||
$stmt->bind_param("s", $user_uuid);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
if ($result->num_rows == 1) {
|
||||
$user_data = $result->fetch_assoc();
|
||||
}
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('user_profile'), 'href' => '/userprofile/'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('edit'), 'href' => ''));
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
|
||||
if ($user_data) {
|
||||
$formBuilder->startForm(); ?>
|
||||
<form id="FormValidation" enctype="multipart/form-data" method="post" action="/api/v1/users/">
|
||||
<input type="hidden" name="user_uuid" value="<?php echo $user_uuid; ?>"/>
|
||||
<div class="card-body">
|
||||
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="user_email" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('user_email') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<input type="email" class="form-control" id="user_email" name="user_email" value="<?php echo $user_data['user_email'] ?>" placeholder="user@example.xxx" required autofill="off" autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="user_first_name" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('first_name') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<input type="text" class="form-control" id="user_first_name" name="user_first_name" value="<?php echo $user_data['user_first_name'] ?>" required/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Last Name -->
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="user_last_name" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('last_name') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<input type="text" class="form-control" id="user_last_name" name="user_last_name" value="<?php echo $user_data['user_last_name'] ?>" required/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Phone Number -->
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="user_phone_number" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('phone_number') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<input type="text" class="form-control" id="user_phone_number" name="user_phone_number" placeholder="+1234542069" value="<?php echo $user_data['user_phone_number'] ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Preferred Language -->
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="user_pref_language" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('preferred_language') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<select id="user_pref_language" name="user_pref_language" class="form-control">
|
||||
<?php foreach (scandir($_SERVER['DOCUMENT_ROOT'] . '/bin/locales/') as $file) {
|
||||
if (pathinfo($file, PATHINFO_EXTENSION) === 'php') {
|
||||
$language = str_replace('.php', '', $file); ?>
|
||||
<option <?php echo(($user_data['user_pref_language'] == $language) ? 'selected' : '') ?> value="<?php echo $language ?>"><?php echo __($language) ?></option>
|
||||
<?php }
|
||||
} ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $formBuilder->formFooter(); ?>
|
||||
</form>
|
||||
<?php $formBuilder->endForm(); ?><?php } else { ?>
|
||||
<p>no admin with this uuid found.</p>
|
||||
<?php } ?>
|
||||
Reference in New Issue
Block a user