|
|
@@ -42,18 +42,21 @@ if(core::ifGet("add") AND access::ifAccesss("add-user")) {
|
|
|
<header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light row">
|
|
|
<div class="col-11">
|
|
|
<h2 class="bd-title" id="content">
|
|
|
- <span><?php echo $titre; if(isset($user["last_connect"])){ echo '<span style="margin-left: 15px; font-size: .875rem;">Dernière connexion : ' . $user["last_connect"] ."</span>"; } ?></span>
|
|
|
+ <span><?= $titre ?></span>
|
|
|
</h2>
|
|
|
- <?php if(isset($user["id"]) AND session::getId() != $user["id"] AND $protect != 2){ ?>
|
|
|
+ <?php if (isset($user["id"]) && session::getId() != $user["id"] && $protect != 2): ?>
|
|
|
<div class="fix-container-button-nav">
|
|
|
- <a href="/submit.php?from=user-delete&id=<?php echo $user["id"] ?>" onclick="return confirm('Voulez-vous supprimer le compte de <?php echo $user["prenom"] . " " . $user["nom"]; ?> ?')"><button type="submit" class="btn btn-outline-danger btn-sm"><?php icon::getFont(["icon" => "bi-trash-fill"]) ?></i> Supprimer</button></a>
|
|
|
+ <a href="/submit.php?from=user-delete&id=<?= $user['id']; ?>" onclick="return confirm('Voulez-vous supprimer le compte de <?= $user["prenom"] . " " . $user["nom"]; ?> ?')">
|
|
|
+ <button type="submit" class="btn btn-outline-danger btn-sm"><?= icon::getFont(["icon" => "bi-trash-fill"]); ?> Supprimer</button>
|
|
|
+ </a>
|
|
|
</div>
|
|
|
- <?php } elseif($protect == 2){ ?>
|
|
|
+ <?php elseif ($protect == 2): ?>
|
|
|
<div class="fix-container-button-nav">
|
|
|
- <a href="/submit.php?from=user-restore&id=<?php echo $user["id"] ?>" onclick="return confirm('Voulez-vous restaurer le compte de <?php echo $user["prenom"] . " " . $user["nom"]; ?> ?')"><button type="submit" class="btn btn-outline-danger btn-sm"><?php echo icon::getFont(["icon" => "bi bi-box2-fill"]) ?> Restaurer</button></a>
|
|
|
+ <a href="/submit.php?from=user-restore&id=<?= $user['id']; ?>" onclick="return confirm('Voulez-vous restaurer le compte de <?= $user["prenom"] . " " . $user["nom"]; ?> ?')">
|
|
|
+ <button type="submit" class="btn btn-outline-danger btn-sm"><?= icon::getFont(["icon" => "bi bi-box2-fill"]); ?> Restaurer</button>
|
|
|
+ </a>
|
|
|
</div>
|
|
|
- <?php } ?>
|
|
|
-
|
|
|
+ <?php endif; ?>
|
|
|
</div>
|
|
|
</header>
|
|
|
<?php
|
|
|
@@ -67,6 +70,14 @@ if(core::ifGet("add") AND access::ifAccesss("add-user")) {
|
|
|
));
|
|
|
}
|
|
|
?>
|
|
|
+ <?php if (isset($user["last_connect"])): ?>
|
|
|
+ <?php callout::print([
|
|
|
+ "type" => "info",
|
|
|
+ "size" => "tiny",
|
|
|
+ "style" => "margin:-5px 0;",
|
|
|
+ "p" => "Dernière connexion le " . core::convertDate($user["last_connect"]),
|
|
|
+ ]); ?>
|
|
|
+ <?php endif; ?>
|
|
|
<br />
|
|
|
<?php if($protect != 2): ?>
|
|
|
|
|
|
@@ -81,27 +92,27 @@ if(core::ifGet("add") AND access::ifAccesss("add-user")) {
|
|
|
|
|
|
<div class="form-group">
|
|
|
<label>Type de compte</label>
|
|
|
+ <?php
|
|
|
+ $id_type = [
|
|
|
+ 2 => "Contrôleur QRCode (émargement)",
|
|
|
+ 3 => "Assistance sociale",
|
|
|
+ 4 => "Modérateur du CMS",
|
|
|
+ 5 => "Membre du Bureau du CSE",
|
|
|
+ 6 => "Elu du CSE",
|
|
|
+ 7 => "Comptable",
|
|
|
+ 1 => "Administrateur"
|
|
|
+ ];
|
|
|
+ ?>
|
|
|
<?php if($protect == 0): ?>
|
|
|
- <select name="id_type" class="form-select">
|
|
|
- <option value="2"<?php if(isset($user["id_type"]) AND $user["id_type"] == 2){ echo " selected"; } ?>>Contrôleur QRCode (émargement)</option>
|
|
|
- <option value="3"<?php if(isset($user["id_type"]) AND $user["id_type"] == 3){ echo " selected"; } ?>>Assistance sociale</option>
|
|
|
- <option value="4"<?php if(isset($user["id_type"]) AND $user["id_type"] == 4){ echo " selected"; } ?>>Modérateur du CMS</option>
|
|
|
- <option value="5"<?php if(isset($user["id_type"]) AND $user["id_type"] == 5){ echo " selected"; } ?>>Membre du Bureau du CSE</option>
|
|
|
- <option value="6"<?php if(isset($user["id_type"]) AND $user["id_type"] == 6){ echo " selected"; } ?>>Elu du CSE</option>
|
|
|
- <option value="7"<?php if(isset($user["id_type"]) AND $user["id_type"] == 7){ echo " selected"; } ?>>Comptable</option>
|
|
|
- <option value="1"<?php if(isset($user["id_type"]) AND $user["id_type"] == 1){ echo " selected"; } ?>>Administrateur</option>
|
|
|
- </select>
|
|
|
+ <?php
|
|
|
+ html::printSelect('name="id_type" class="form-select"', $id_type, $user["id_type"]);
|
|
|
+ ?>
|
|
|
<?php endif; ?>
|
|
|
<?php if($protect == 1 OR $protect == 2): ?>
|
|
|
- <input type="text" class="form-control" value="<?php
|
|
|
- if($user["id_type"] == 1){ echo "Administrateur"; }
|
|
|
- elseif($user["id_type"] == 2){ echo "Contrôleur QRCode (émargement)"; }
|
|
|
- elseif($user["id_type"] == 3){ echo "Assistance sociale"; }
|
|
|
- elseif($user["id_type"] == 4){ echo "Modérateur du CMS"; }
|
|
|
- elseif($user["id_type"] == 5){ echo "Membre du Bureau du CSE"; }
|
|
|
- elseif($user["id_type"] == 6){ echo "Elu du CSE"; }
|
|
|
- ?>" readonly="readonly" />
|
|
|
- <input type="hidden" name="id_type" value="<?php echo $user["id_type"] ?>">
|
|
|
+ <?php
|
|
|
+ html::printSelect('class="form-control" disabled', $id_type, $user["id_type"]);
|
|
|
+ html::printInput('type="hidden" name="id_type"', $user["id_type"]);
|
|
|
+ ?>
|
|
|
<?php endif; ?>
|
|
|
</div>
|
|
|
<br />
|
|
|
@@ -110,53 +121,49 @@ if(core::ifGet("add") AND access::ifAccesss("add-user")) {
|
|
|
if(access::ifAccesss("add-user") AND core::ifGet("id")) { ?>
|
|
|
<div class="form-group">
|
|
|
<label>Rôles aditionnels</label>
|
|
|
- <input type="text" value="<?php
|
|
|
- if (isset($user["tags"])) {
|
|
|
- echo $user["tags"];
|
|
|
- }
|
|
|
- ?>" id="tags" name="tags" />
|
|
|
+ <?= html::printInput('type="text" name="tags" id="tags"', $user["tags"]) ?>
|
|
|
</div>
|
|
|
<br />
|
|
|
<?php
|
|
|
} elseif(isset($user["tags"])) { ?>
|
|
|
<div class="form-group">
|
|
|
- <label>Rôles aditionnels</label>
|
|
|
- <input type="text" class="form-control" name="tags" value="<?php echo $user["tags"] ?>" readonly="readonly" />
|
|
|
+ <label>Rôles aditionnels</label>
|
|
|
+ <?= html::printInput('type="text" class="form-control" name="tags" readonly="readonly"', $user["tags"]) ?>
|
|
|
</div>
|
|
|
<br />
|
|
|
<?php
|
|
|
} else {
|
|
|
- echo '<input type="hidden" name="tags" value="" />';
|
|
|
+ html::printInput('type="hidden" name="tags"');
|
|
|
}
|
|
|
?>
|
|
|
|
|
|
<div class="form-group">
|
|
|
<label>Prénom</label>
|
|
|
- <input type="text" class="form-control" value="<?php
|
|
|
- if (isset($user["prenom"])) {
|
|
|
- echo $user["prenom"];
|
|
|
- }
|
|
|
- ?>" name="prenom" placeholder="" <?php if($protect == 2){ echo 'readonly="readonly"'; } else { echo 'required'; } ?>>
|
|
|
+ <?php
|
|
|
+ $confPrenom = 'type="text" name="prenom" class="form-control" ';
|
|
|
+ $confPrenom .= $protect == 2 ? 'readonly="readonly"' : 'required';
|
|
|
+ html::printInput($confPrenom, $user["prenom"]);
|
|
|
+ ?>
|
|
|
</div>
|
|
|
<br />
|
|
|
|
|
|
<div class="form-group">
|
|
|
<label>nom</label>
|
|
|
- <input type="text" class="form-control" value="<?php
|
|
|
- if (isset($user["nom"])) {
|
|
|
- echo $user["nom"];
|
|
|
- }
|
|
|
- ?>" name="nom" placeholder="" <?php if($protect == 2){ echo 'readonly="readonly"'; } else { echo 'required'; } ?>>
|
|
|
+ <?php
|
|
|
+ $confNom = 'type="text" name="nom" class="form-control" ';
|
|
|
+ $confNom .= $protect == 2 ? 'readonly="readonly"' : 'required';
|
|
|
+ html::printInput($confNom, $user["nom"]);
|
|
|
+ ?>
|
|
|
</div>
|
|
|
<br />
|
|
|
|
|
|
<div class="form-group">
|
|
|
<label>Email</label>
|
|
|
- <input type="email" class="form-control" value="<?php
|
|
|
- if (isset($user["email"])) {
|
|
|
- echo $user["email"];
|
|
|
- }
|
|
|
- ?>" name="email" placeholder="" <?php if($protect == 2){ echo 'readonly="readonly"'; } else { echo 'required'; } ?>>
|
|
|
+ <?php
|
|
|
+ $confEmail = 'type="text" name="email" class="form-control" ';
|
|
|
+ $confEmail .= $protect == 2 ? 'readonly="readonly"' : 'required';
|
|
|
+ html::printInput($confEmail, $user["email"]);
|
|
|
+ ?>
|
|
|
</div>
|
|
|
<br />
|
|
|
|
|
|
@@ -164,22 +171,33 @@ if(core::ifGet("add") AND access::ifAccesss("add-user")) {
|
|
|
|
|
|
<div class="form-group">
|
|
|
<label>Mot de passe</label>
|
|
|
- <input type="password" class="form-control" minlength="8" maxlength="25" value="" name="password" placeholder="" <?php if(core::ifGet("add")){ echo "required"; } ?>>
|
|
|
+ <?php
|
|
|
+ $confPassword = 'type="password" class="form-control" minlength="8" maxlength="25" name="password" ';
|
|
|
+ $confPassword .= core::ifGet("add") ? 'required"' : NULL;
|
|
|
+ html::printInput($confPassword);
|
|
|
+ ?>
|
|
|
</div>
|
|
|
<br />
|
|
|
|
|
|
<div class="form-group">
|
|
|
<label>Confirmation du mot de passe</label>
|
|
|
- <input type="password" class="form-control" value="" name="password2" placeholder="" <?php if(core::ifGet("add")){ echo "required"; } ?>>
|
|
|
+ <?php
|
|
|
+ $confPassword2 = 'type="password" class="form-control" minlength="8" maxlength="25" name="password2" ';
|
|
|
+ $confPassword2 .= core::ifGet("add") ? 'required"' : NULL;
|
|
|
+ html::printInput($confPassword2);
|
|
|
+ ?>
|
|
|
</div>
|
|
|
<br />
|
|
|
|
|
|
<div class="form-group">
|
|
|
<label>Google Authenticator</label>
|
|
|
- <select name="googleAuthenticator" class="form-select">
|
|
|
- <option value="0"<?php if(isset($user["googleAuthenticator"]) AND $user["googleAuthenticator"] == 0){ echo " selected"; } ?>>Désactivée</option>
|
|
|
- <option value="1"<?php if(isset($user["googleAuthenticator"]) AND $user["googleAuthenticator"] == 1){ echo " selected"; } ?>>Activée</option>
|
|
|
- </select>
|
|
|
+ <?php
|
|
|
+ $googleAuthenticator = [
|
|
|
+ 0 => "Désactivé",
|
|
|
+ 1 => "Activé",
|
|
|
+ ];
|
|
|
+ html::printSelect('name="googleAuthenticator" class="form-select"', $googleAuthenticator, $user["googleAuthenticator"]);
|
|
|
+ ?>
|
|
|
</div>
|
|
|
<br />
|
|
|
|
|
|
@@ -202,16 +220,19 @@ if(core::ifGet("add") AND access::ifAccesss("add-user")) {
|
|
|
<?php if($protect == 0): ?>
|
|
|
<div class="form-group">
|
|
|
<label>Etat du compte</label>
|
|
|
- <select name="actif" class="form-select">
|
|
|
- <option value="0"<?php if(isset($user["actif"]) AND $user["actif"] == 0){ echo " selected"; } ?>>Compte désactivé</option>
|
|
|
- <option value="1"<?php if(isset($user["actif"]) AND $user["actif"] == 1){ echo " selected"; } ?>>Compte activé</option>
|
|
|
- </select>
|
|
|
+ <?php
|
|
|
+ $actif = [
|
|
|
+ 0 => "Compte désactivé",
|
|
|
+ 1 => "Compte activé",
|
|
|
+ ];
|
|
|
+ html::printSelect('name="actif" class="form-select"', $actif, $user["actif"]);
|
|
|
+ ?>
|
|
|
</div>
|
|
|
<br />
|
|
|
<?php endif; ?>
|
|
|
|
|
|
<?php if($protect == 1): ?>
|
|
|
- <input type="hidden" name="actif" value="<?php echo $user["actif"] ?>">
|
|
|
+ <?= html::printInput('type="hidden" name="actif"', $user["actif"]); ?>
|
|
|
<?php endif; ?>
|
|
|
|
|
|
<input class="btn btn-primary btn-lg" style="width: 100%; margin-bottom:20px;" type="submit" value="<?php echo $submit ?>">
|