feat: Add theme templates and Job Management UI (Steps 8 & 9)

This commit is contained in:
Ruben Ramirez 2025-04-03 21:11:53 -05:00
parent db7905e957
commit 6a1319784d
10 changed files with 803 additions and 0 deletions

102
content-single.php Normal file
View file

@ -0,0 +1,102 @@
<?php
/**
* The template for displaying single posts.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> <?php generate_do_microdata( 'article' ); ?>>
<div class="inside-article">
<?php
/**
* generate_before_content hook.
*
* @since 0.1
*
* @hooked generate_featured_page_header_inside_single - 10
*/
do_action( 'generate_before_content' );
if ( generate_show_entry_header() ) :
?>
<header <?php generate_do_attr( 'entry-header' ); ?>>
<?php
/**
* generate_before_entry_title hook.
*
* @since 0.1
*/
do_action( 'generate_before_entry_title' );
if ( generate_show_title() ) {
$params = generate_get_the_title_parameters();
the_title( $params['before'], $params['after'] );
}
/**
* generate_after_entry_title hook.
*
* @since 0.1
*
* @hooked generate_post_meta - 10
*/
do_action( 'generate_after_entry_title' );
?>
</header>
<?php
endif;
/**
* generate_after_entry_header hook.
*
* @since 0.1
*
* @hooked generate_post_image - 10
*/
do_action( 'generate_after_entry_header' );
$itemprop = '';
if ( 'microdata' === generate_get_schema_type() ) {
$itemprop = ' itemprop="text"';
}
?>
<div class="entry-content"<?php echo $itemprop; // phpcs:ignore -- No escaping needed. ?>>
<?php
the_content();
wp_link_pages(
array(
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
'after' => '</div>',
)
);
?>
</div>
<?php
/**
* generate_after_entry_content hook.
*
* @since 0.1
*
* @hooked generate_footer_meta - 10
*/
do_action( 'generate_after_entry_content' );
/**
* generate_after_content hook.
*
* @since 0.1
*/
do_action( 'generate_after_content' );
?>
</div>
</article>

View file

@ -4,4 +4,158 @@
*
* Add your custom PHP in this file.
* Only edit this file if you have direct access to it on your server (to fix errors if they happen).
function quiztech_theme_enqueue_scripts() {
// List of Quiztech custom page templates
$quiztech_templates = [
'template-quiztech-dashboard.php',
'template-manage-jobs.php',
'template-manage-assessments.php',
'template-manage-questions.php',
'template-manage-credits.php',
'template-view-results.php',
];
// Check if the current page is using one of our templates
$is_quiztech_template = false;
foreach ( $quiztech_templates as $template ) {
if ( is_page_template( $template ) ) {
$is_quiztech_template = true;
break;
}
}
// Only enqueue the script on our specific template pages
if ( $is_quiztech_template ) {
$script_path = get_stylesheet_directory() . '/js/quiztech-theme.js';
$script_url = get_stylesheet_directory_uri() . '/js/quiztech-theme.js';
$version = file_exists( $script_path ) ? filemtime( $script_path ) : '1.0';
wp_enqueue_script(
'quiztech-theme-script',
$script_url,
array( 'jquery' ), // Depends on jQuery
$version,
true // Load in footer
);
// Localize script with necessary data for AJAX calls
wp_localize_script( 'quiztech-theme-script', 'quiztechThemeData', [
'ajax_url' => admin_url( 'admin-ajax.php' ),
'add_job_nonce' => wp_create_nonce( 'quiztech_add_new_job_action' ),
'send_invite_nonce' => wp_create_nonce( 'quiztech_send_job_invite_action' ),
'error_generic' => esc_html__( 'An error occurred. Please try again.', 'quiztech' ),
'error_permissions' => esc_html__( 'You do not have permission to perform this action.', 'quiztech' ),
'error_missing_assessment' => esc_html__( 'Error: No assessment is linked to this job.', 'quiztech' ),
'invite_sent_success' => esc_html__( 'Invite sent successfully!', 'quiztech' ),
'job_added_success' => esc_html__( 'Job added successfully!', 'quiztech' ),
]);
}
}
add_action( 'wp_enqueue_scripts', 'quiztech_theme_enqueue_scripts' );
/**
* AJAX handler for adding a new job post from the frontend.
*/
function quiztech_ajax_add_new_job() {
// 1. Verify Nonce
check_ajax_referer( 'quiztech_add_new_job_action', 'nonce' );
// 2. Check Capabilities (adjust capability if needed)
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( [ 'message' => esc_html__( 'Insufficient permissions.', 'quiztech' ) ], 403 );
}
// 3. Sanitize Input
$job_title = isset( $_POST['job_title'] ) ? sanitize_text_field( wp_unslash( $_POST['job_title'] ) ) : '';
$job_description = isset( $_POST['job_description'] ) ? sanitize_textarea_field( wp_unslash( $_POST['job_description'] ) ) : '';
if ( empty( $job_title ) ) {
wp_send_json_error( [ 'message' => esc_html__( 'Job title cannot be empty.', 'quiztech' ) ], 400 );
}
// 4. Create Post
$post_data = [
'post_title' => $job_title,
'post_content' => $job_description,
'post_status' => 'publish', // Or 'draft' if preferred
'post_author' => get_current_user_id(),
'post_type' => 'job',
];
$post_id = wp_insert_post( $post_data, true ); // Pass true to return WP_Error on failure
// 5. Send Response
if ( is_wp_error( $post_id ) ) {
wp_send_json_error( [ 'message' => $post_id->get_error_message() ], 500 );
} else {
// Optionally return HTML for the new row, or just success and let JS handle refresh/update
wp_send_json_success( [
'message' => esc_html__( 'Job created successfully.', 'quiztech' ),
'post_id' => $post_id
] );
}
}
add_action( 'wp_ajax_add_new_job', 'quiztech_ajax_add_new_job' );
/**
* AJAX handler for sending a job invite from the frontend.
*/
function quiztech_ajax_send_job_invite() {
// 1. Verify Nonce
check_ajax_referer( 'quiztech_send_job_invite_action', 'nonce' );
// 2. Check Capabilities (adjust capability if needed)
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( [ 'message' => esc_html__( 'Insufficient permissions.', 'quiztech' ) ], 403 );
}
// 3. Sanitize Input
$job_id = isset( $_POST['job_id'] ) ? absint( $_POST['job_id'] ) : 0;
$applicant_email = isset( $_POST['applicant_email'] ) ? sanitize_email( wp_unslash( $_POST['applicant_email'] ) ) : '';
if ( ! $job_id || ! is_email( $applicant_email ) ) {
wp_send_json_error( [ 'message' => esc_html__( 'Invalid job ID or email address.', 'quiztech' ) ], 400 );
}
// 4. Check if Job exists and belongs to user (optional extra check)
$job_post = get_post( $job_id );
if ( ! $job_post || $job_post->post_type !== 'job' || $job_post->post_author != get_current_user_id() ) {
wp_send_json_error( [ 'message' => esc_html__( 'Invalid job specified.', 'quiztech' ) ], 404 );
}
// 5. Get Linked Assessment ID
$assessment_id = get_post_meta( $job_id, '_quiztech_linked_assessment_id', true );
if ( empty( $assessment_id ) ) {
wp_send_json_error( [ 'message' => esc_html__( 'No assessment is linked to this job. Please edit the job and link an assessment.', 'quiztech' ) ], 400 );
}
$assessment_id = absint( $assessment_id );
// 6. Use the Invitation Class (ensure plugin is active and class exists)
if ( ! class_exists( 'Quiztech\\AssessmentPlatform\\Includes\\Invitations' ) ) {
wp_send_json_error( [ 'message' => esc_html__( 'Invitation system is unavailable.', 'quiztech' ) ], 500 );
}
try {
$invitations = new \Quiztech\AssessmentPlatform\Includes\Invitations();
$result = $invitations->create_invitation( $job_id, $assessment_id, $applicant_email );
if ( is_wp_error( $result ) ) {
wp_send_json_error( [ 'message' => $result->get_error_message() ], 500 );
} elseif ( $result === false ) {
// Generic failure from create_invitation if no WP_Error
wp_send_json_error( [ 'message' => esc_html__( 'Failed to create invitation.', 'quiztech' ) ], 500 );
} else {
// Success! $result might contain the token or true
wp_send_json_success( [ 'message' => esc_html__( 'Invitation sent successfully.', 'quiztech' ) ] );
}
} catch ( \Exception $e ) {
// Catch any unexpected exceptions
error_log( 'Quiztech Send Invite Error: ' . $e->getMessage() );
wp_send_json_error( [ 'message' => esc_html__( 'An unexpected error occurred while sending the invitation.', 'quiztech' ) ], 500 );
}
}
add_action( 'wp_ajax_send_job_invite', 'quiztech_ajax_send_job_invite' );

145
js/quiztech-theme.js Normal file
View file

@ -0,0 +1,145 @@
jQuery(document).ready(function($) {
// --- Add New Job Form ---
// Show the "Add New Job" form when the button is clicked
$('.add-new-job-button').on('click', function(e) {
e.preventDefault();
$('#add-new-job-form').slideDown();
$(this).hide(); // Hide the "Add New Job" button itself
});
// Hide the "Add New Job" form when the cancel button is clicked
$('#add-new-job-form .cancel-add-job').on('click', function(e) {
e.preventDefault();
$('#add-new-job-form').slideUp(function() {
// Optional: Clear form fields on cancel
// $('#new-job-form')[0].reset();
// $('.add-job-status').empty();
});
$('.add-new-job-button').show(); // Show the "Add New Job" button again
});
// --- Send Invite Form ---
// Show the specific "Send Invite" form row when the link is clicked
$('.send-job-invite').on('click', function(e) {
e.preventDefault();
var jobId = $(this).data('job-id');
var inviteRow = $('#send-invite-row-' + jobId);
// Hide any other open invite forms first
$('.send-invite-form-row').not(inviteRow).slideUp();
// Toggle the clicked one
inviteRow.slideToggle();
});
// Hide the "Send Invite" form row when its cancel button is clicked
$('.send-invite-form-row .cancel-invite').on('click', function(e) {
e.preventDefault();
$(this).closest('.send-invite-form-row').slideUp();
});
// --- AJAX Form Submissions ---
// Add New Job AJAX
$('#new-job-form').on('submit', function(e) {
e.preventDefault();
var $form = $(this);
var $submitButton = $form.find('input[type="submit"]');
var $spinner = $form.find('.spinner');
var $statusDiv = $form.find('.add-job-status');
$statusDiv.empty().removeClass('error success');
$spinner.css('visibility', 'visible');
$submitButton.prop('disabled', true);
var formData = {
action: 'add_new_job',
nonce: quiztechThemeData.add_job_nonce,
job_title: $form.find('#job_title').val(),
job_description: $form.find('#job_description').val()
};
$.post(quiztechThemeData.ajax_url, formData)
.done(function(response) {
if (response.success) {
$statusDiv.text(quiztechThemeData.job_added_success).addClass('success');
// Optionally: Clear form, hide it, refresh job list via another AJAX call or page reload
$form[0].reset();
$('#add-new-job-form').slideUp();
$('.add-new-job-button').show();
// Consider adding the new job row dynamically instead of full reload
location.reload(); // Simple reload for now
} else {
$statusDiv.text(response.data.message || quiztechThemeData.error_generic).addClass('error');
}
})
.fail(function() {
$statusDiv.text(quiztechThemeData.error_generic).addClass('error');
})
.always(function() {
$spinner.css('visibility', 'hidden');
$submitButton.prop('disabled', false);
});
});
// Send Invite AJAX
$('.send-invite-submit').on('click', function(e) {
e.preventDefault();
var $button = $(this);
var jobId = $button.data('job-id');
var $wrapper = $button.closest('.send-invite-form-wrapper');
var $emailInput = $wrapper.find('input[name="applicant_email"]');
var $spinner = $wrapper.find('.spinner');
var $statusDiv = $wrapper.find('.invite-status');
var applicantEmail = $emailInput.val();
if (!applicantEmail) {
$emailInput.focus();
// Maybe add a small visual cue that email is required
return;
}
$statusDiv.empty().removeClass('error success');
$spinner.css('visibility', 'visible');
$button.prop('disabled', true).siblings('.cancel-invite').prop('disabled', true);
var formData = {
action: 'send_job_invite',
nonce: quiztechThemeData.send_invite_nonce,
job_id: jobId,
applicant_email: applicantEmail
};
$.post(quiztechThemeData.ajax_url, formData)
.done(function(response) {
if (response.success) {
$statusDiv.text(quiztechThemeData.invite_sent_success).addClass('success');
$emailInput.val(''); // Clear email field on success
// Optionally hide the form row after a delay
setTimeout(function() {
$button.closest('.send-invite-form-row').slideUp();
}, 2000);
} else {
var errorMessage = quiztechThemeData.error_generic;
if (response.data && response.data.message) {
errorMessage = response.data.message;
} else if (response.data && response.data === 'error_missing_assessment') {
// Example of handling specific error code if needed
errorMessage = quiztechThemeData.error_missing_assessment;
}
$statusDiv.text(errorMessage).addClass('error');
}
})
.fail(function() {
$statusDiv.text(quiztechThemeData.error_generic).addClass('error');
})
.always(function() {
$spinner.css('visibility', 'hidden');
$button.prop('disabled', false).siblings('.cancel-invite').prop('disabled', false);
});
});
});

54
single.php Normal file
View file

@ -0,0 +1,54 @@
<?php
/**
* The Template for displaying all single posts.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
get_header(); ?>
<div <?php generate_do_attr( 'content' ); ?>>
<main <?php generate_do_attr( 'main' ); ?>>
<?php
/**
* generate_before_main_content hook.
*
* @since 0.1
*/
do_action( 'generate_before_main_content' );
if ( generate_has_default_loop() ) {
while ( have_posts() ) :
the_post();
generate_do_template_part( 'single' );
endwhile;
}
/**
* generate_after_main_content hook.
*
* @since 0.1
*/
do_action( 'generate_after_main_content' );
?>
</main>
</div>
<?php
/**
* generate_after_primary_content_area hook.
*
* @since 2.0
*/
do_action( 'generate_after_primary_content_area' );
generate_construct_sidebars();
get_footer();

View file

@ -0,0 +1,42 @@
<?php
/**
* Template Name: Manage Assessments
*
* This template is used for the page where Quiz Managers can manage Assessments.
*
* @package Quiztech
*/
// Ensure the user is logged in and has the appropriate capability.
// Using 'manage_options' as a placeholder capability for Quiz Managers.
// Replace with a more specific capability like 'manage_quiztech_assessments' if defined.
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
// Redirect to login page or show an error message.
wp_safe_redirect( wp_login_url( get_permalink() ) );
exit;
// Alternatively, display an error message:
// wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'quiztech' ), 403 );
}
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<p><?php esc_html_e( 'Placeholder for Assessment Management interface (list, add, edit - likely the Assessment Builder).', 'quiztech' ); ?></p>
<!-- Add Assessment listing table, 'Create New Assessment' button/link to builder here -->
</div><!-- .entry-content -->
</article><!-- #post-<?php the_ID(); ?> -->
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer();

View file

@ -0,0 +1,42 @@
<?php
/**
* Template Name: Manage Credits
*
* This template is used for the page where Quiz Managers can view their credit balance and purchase more.
*
* @package Quiztech
*/
// Ensure the user is logged in and has the appropriate capability.
// Using 'manage_options' as a placeholder capability for Quiz Managers.
// Replace with a more specific capability like 'manage_quiztech_credits' or similar if defined.
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
// Redirect to login page or show an error message.
wp_safe_redirect( wp_login_url( get_permalink() ) );
exit;
// Alternatively, display an error message:
// wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'quiztech' ), 403 );
}
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<p><?php esc_html_e( 'Placeholder for Credit Management interface (view balance, purchase options).', 'quiztech' ); ?></p>
<!-- Add current balance display, credit package options, purchase button here -->
</div><!-- .entry-content -->
</article><!-- #post-<?php the_ID(); ?> -->
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer();

138
template-manage-jobs.php Normal file
View file

@ -0,0 +1,138 @@
<?php
/**
* Template Name: Manage Jobs
*
* This template is used for the page where Quiz Managers can manage Job postings.
*
* @package Quiztech
*/
// Ensure the user is logged in and has the appropriate capability.
// Using 'manage_options' as a placeholder capability for Quiz Managers.
// Replace with a more specific capability like 'manage_quiztech_jobs' if defined.
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
// Redirect to login page or show an error message.
wp_safe_redirect( wp_login_url( get_permalink() ) );
exit;
// Alternatively, display an error message:
// wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'quiztech' ), 403 );
}
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<h2><?php esc_html_e( 'Your Job Postings', 'quiztech' ); ?></h2>
<?php
// Query args to get jobs for the current user
$current_user_id = get_current_user_id();
$args = array(
'post_type' => 'job',
'posts_per_page' => -1, // Get all jobs
'author' => $current_user_id,
'post_status' => 'any', // Include drafts, pending, etc.
'orderby' => 'date',
'order' => 'DESC',
);
$user_jobs_query = new WP_Query( $args );
if ( $user_jobs_query->have_posts() ) :
?>
<table class="quiztech-manage-table wp-list-table widefat fixed striped">
<thead>
<tr>
<th scope="col"><?php esc_html_e( 'Title', 'quiztech' ); ?></th>
<th scope="col"><?php esc_html_e( 'Status', 'quiztech' ); ?></th>
<th scope="col"><?php esc_html_e( 'Actions', 'quiztech' ); ?></th>
</tr>
</thead>
<tbody>
<?php while ( $user_jobs_query->have_posts() ) : $user_jobs_query->the_post(); ?>
<tr>
<td>
<strong><a href="<?php echo esc_url( get_edit_post_link( get_the_ID() ) ); ?>" title="<?php esc_attr_e( 'Edit this job in WP Admin', 'quiztech' ); ?>"><?php the_title(); ?></a></strong>
<?php // Add quick edit later if needed ?>
</td>
<td><?php echo esc_html( get_post_status( get_the_ID() ) ); ?></td>
<td>
<?php
// Placeholder links - replace with actual frontend edit/view results page URLs when created
$edit_url = '#edit-job-' . get_the_ID(); // Placeholder
$results_url = '#view-results-' . get_the_ID(); // Placeholder
?>
<a href="<?php echo esc_url( $edit_url ); ?>"><?php esc_html_e( 'Edit', 'quiztech' ); ?></a> |
<a href="<?php echo esc_url( $results_url ); ?>"><?php esc_html_e( 'View Results', 'quiztech' ); ?></a> |
<a href="#send-invite" class="send-job-invite" data-job-id="<?php echo esc_attr( get_the_ID() ); ?>"><?php esc_html_e( 'Send Invite', 'quiztech' ); ?></a>
</td>
</tr>
<tr class="send-invite-form-row" id="send-invite-row-<?php echo esc_attr( get_the_ID() ); ?>" style="display: none;">
<td colspan="3">
<div class="send-invite-form-wrapper" style="padding: 10px; background-color: #f9f9f9;">
<label for="applicant_email_<?php echo esc_attr( get_the_ID() ); ?>"><?php esc_html_e( 'Applicant Email:', 'quiztech' ); ?></label>
<input type="email" id="applicant_email_<?php echo esc_attr( get_the_ID() ); ?>" name="applicant_email" size="40" />
<button class="button button-primary send-invite-submit" data-job-id="<?php echo esc_attr( get_the_ID() ); ?>"><?php esc_html_e( 'Send', 'quiztech' ); ?></button>
<button class="button cancel-invite"><?php esc_html_e( 'Cancel', 'quiztech' ); ?></button>
<span class="spinner" style="float: none; vertical-align: middle;"></span>
<div class="invite-status" style="display: inline-block; margin-left: 10px;"></div>
</div>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
<?php
else :
echo '<p>' . esc_html__( 'You have not created any jobs yet.', 'quiztech' ) . '</p>';
endif;
// Restore original Post Data
wp_reset_postdata();
?>
<p style="margin-top: 20px;"><a href="#add-new-job-form" class="button add-new-job-button"><?php esc_html_e( 'Add New Job', 'quiztech' ); ?></a></p>
<div id="add-new-job-form" style="margin-top: 20px; padding-top: 20px; border-top: 1px solid #ccc; display: none;"> <!-- Initially hidden -->
<h2><?php esc_html_e( 'Add New Job Details', 'quiztech' ); ?></h2>
<form id="new-job-form" method="post" action="">
<?php wp_nonce_field( 'quiztech_add_new_job_action', 'quiztech_add_new_job_nonce' ); ?>
<p>
<label for="job_title"><?php esc_html_e( 'Job Title:', 'quiztech' ); ?></label><br />
<input type="text" id="job_title" name="job_title" value="" required style="width: 100%;" />
</p>
<p>
<label for="job_description"><?php esc_html_e( 'Job Description:', 'quiztech' ); ?></label><br />
<?php
// Basic textarea for now. Replace with wp_editor in a later refinement step if needed.
// wp_editor( '', 'job_description', array('textarea_rows' => 10) );
?>
<textarea id="job_description" name="job_description" rows="10" style="width: 100%;"></textarea>
</p>
<p>
<input type="submit" name="submit_new_job" class="button button-primary" value="<?php esc_attr_e( 'Save Job', 'quiztech' ); ?>" />
<button type="button" class="button cancel-add-job"><?php esc_html_e( 'Cancel', 'quiztech' ); ?></button>
<span class="spinner" style="float: none; vertical-align: middle;"></span>
<div class="add-job-status" style="display: inline-block; margin-left: 10px;"></div>
</p>
</form>
</div>
</div><!-- .entry-content -->
</article><!-- #post-<?php the_ID(); ?> -->
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer();

View file

@ -0,0 +1,42 @@
<?php
/**
* Template Name: Manage Questions
*
* This template is used for the page where Quiz Managers can manage Questions in the library.
*
* @package Quiztech
*/
// Ensure the user is logged in and has the appropriate capability.
// Using 'manage_options' as a placeholder capability for Quiz Managers.
// Replace with a more specific capability like 'manage_quiztech_questions' if defined.
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
// Redirect to login page or show an error message.
wp_safe_redirect( wp_login_url( get_permalink() ) );
exit;
// Alternatively, display an error message:
// wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'quiztech' ), 403 );
}
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<p><?php esc_html_e( 'Placeholder for Question Management interface (list, add, edit).', 'quiztech' ); ?></p>
<!-- Add Question listing table, 'Add New Question' button/form here -->
</div><!-- .entry-content -->
</article><!-- #post-<?php the_ID(); ?> -->
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer();

View file

@ -0,0 +1,42 @@
<?php
/**
* Template Name: Quiztech Dashboard
*
* This template is used for the main dashboard page for Quiz Managers.
*
* @package Quiztech
*/
// Ensure the user is logged in and has the appropriate capability.
// Using 'manage_options' as a placeholder capability for Quiz Managers.
// Replace with a more specific capability like 'manage_quiztech_options' if defined.
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
// Redirect to login page or show an error message.
wp_safe_redirect( wp_login_url( get_permalink() ) );
exit;
// Alternatively, display an error message:
// wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'quiztech' ), 403 );
}
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<p><?php esc_html_e( 'Welcome to the Quiztech Dashboard. Placeholder content.', 'quiztech' ); ?></p>
<!-- Add dashboard widgets, summaries, links here -->
</div><!-- .entry-content -->
</article><!-- #post-<?php the_ID(); ?> -->
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer();

42
template-view-results.php Normal file
View file

@ -0,0 +1,42 @@
<?php
/**
* Template Name: View Results
*
* This template is used for the page where Quiz Managers can view assessment results.
*
* @package Quiztech
*/
// Ensure the user is logged in and has the appropriate capability.
// Using 'manage_options' as a placeholder capability for Quiz Managers.
// Replace with a more specific capability like 'view_quiztech_results' or similar if defined.
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
// Redirect to login page or show an error message.
wp_safe_redirect( wp_login_url( get_permalink() ) );
exit;
// Alternatively, display an error message:
// wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'quiztech' ), 403 );
}
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<p><?php esc_html_e( 'Placeholder for Assessment Results interface (list results, view details).', 'quiztech' ); ?></p>
<!-- Add results listing (likely filterable by Job), link to view individual user_evaluation details here -->
</div><!-- .entry-content -->
</article><!-- #post-<?php the_ID(); ?> -->
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer();