refactoring template name

This commit is contained in:
Antoine M 2025-02-26 10:12:17 +01:00
parent 477cef823c
commit 8d3aebb0d1

View File

@ -1,18 +1,27 @@
<?php <?php
$current_user = wp_get_current_user(); $current_user = wp_get_current_user();
$user_name = $current_user->display_name; $user_name = $current_user->display_name;
$use_current_user = isset($_GET['use-current-user']) ? $_GET['use-current-user'] : true;
?> ?>
<div class="wrap gestion-artisans"> <div class="wrap gestion-artisans">
<h1>Gestion</h1>
<div class="filter-artisans">
<input type="radio" name="choice" id="current-user" value="current-user"> <?php if ($use_current_user) : ?>
<label for="current-user">Artisans de <?php echo $user_name ?></label> <h1 class="page-title">Artisans de <?php echo $user_name ?></h1>
<input type="radio" name="choice" id="all-users" value="all-users"> <?php else : ?>
<label for="all-users">Tous les artisans</label> <h1 class="page-title">Tous les Artisans</h1>
<?php endif; ?>
<div class="filters">
<a href="<?php echo add_query_arg('use-current-user', '1', $_SERVER['REQUEST_URI']); ?>" class="button <?php echo $use_current_user ? 'filter-active' : ''; ?>">
Artisans de <?php echo $user_name ?>
</a>
<a href="<?php echo add_query_arg('use-current-user', '0', $_SERVER['REQUEST_URI']); ?>" class="button <?php echo !$use_current_user ? 'filter-active' : ''; ?> ">
Tous les artisans
</a>
</div> </div>
<h2>Artisans de <?php echo $user_name ?></h2>
<?php <?php
//===== SECTION : ACTION REQUISE =====// //===== SECTION : ACTION REQUISE =====//
@ -20,7 +29,7 @@ $user_name = $current_user->display_name;
'type' => 'action-required', 'type' => 'action-required',
'status_class' => 'action-required ', 'status_class' => 'action-required ',
'title' => 'Action requise', 'title' => 'Action requise',
'use_current_user' => true, 'use_current_user' => $use_current_user,
'current_user_id' => $current_user->ID, 'current_user_id' => $current_user->ID,
'not_found_message' => 'Aucun artisan avec une action requise', 'not_found_message' => 'Aucun artisan avec une action requise',
)); ));
@ -30,7 +39,7 @@ $user_name = $current_user->display_name;
'status' => 'to_actualize', 'status' => 'to_actualize',
'status_class' => 'to-actualize', 'status_class' => 'to-actualize',
'title' => 'À actualiser', 'title' => 'À actualiser',
'use_current_user' => true, 'use_current_user' => $use_current_user,
'current_user_id' => $current_user->ID, 'current_user_id' => $current_user->ID,
'not_found_message' => 'Aucun artisan à actualiser', 'not_found_message' => 'Aucun artisan à actualiser',
)); ));
@ -40,7 +49,7 @@ $user_name = $current_user->display_name;
'status' => 'to_contact', 'status' => 'to_contact',
'status_class' => 'to-contact', 'status_class' => 'to-contact',
'title' => 'À contacter', 'title' => 'À contacter',
'use_current_user' => true, 'use_current_user' => $use_current_user,
'current_user_id' => $current_user->ID, 'current_user_id' => $current_user->ID,
'not_found_message' => 'Aucun artisan à contacter', 'not_found_message' => 'Aucun artisan à contacter',
)); ));
@ -50,7 +59,7 @@ $user_name = $current_user->display_name;
'status' => 'waiting_feedback', 'status' => 'waiting_feedback',
'status_class' => 'waiting-feedback', 'status_class' => 'waiting-feedback',
'title' => 'En attente de retour', 'title' => 'En attente de retour',
'use_current_user' => true, 'use_current_user' => $use_current_user,
'current_user_id' => $current_user->ID, 'current_user_id' => $current_user->ID,
'not_found_message' => 'Aucun artisan en attente de retour', 'not_found_message' => 'Aucun artisan en attente de retour',
)); ));
@ -60,7 +69,7 @@ $user_name = $current_user->display_name;
'status' => 'ongoing', 'status' => 'ongoing',
'status_class' => 'ongoing', 'status_class' => 'ongoing',
'title' => 'En cours', 'title' => 'En cours',
'use_current_user' => true, 'use_current_user' => $use_current_user,
'current_user_id' => $current_user->ID, 'current_user_id' => $current_user->ID,
'not_found_message' => 'Aucun artisan en cours', 'not_found_message' => 'Aucun artisan en cours',
)); ));
@ -70,7 +79,7 @@ $user_name = $current_user->display_name;
'status' => 'ok', 'status' => 'ok',
'status_class' => 'ok', 'status_class' => 'ok',
'title' => 'OK', 'title' => 'OK',
'use_current_user' => true, 'use_current_user' => $use_current_user,
'current_user_id' => $current_user->ID, 'current_user_id' => $current_user->ID,
'not_found_message' => 'Aucun artisan OK', 'not_found_message' => 'Aucun artisan OK',
)); ));