emails
2 years ago
form-fields
4 weeks ago
access-denied-browse-job_listings.php
4 years ago
access-denied-single-job_listing.php
3 years ago
account-signin.php
4 years ago
content-job_listing.php
2 months ago
content-no-jobs-found.php
7 years ago
content-single-job_listing-company.php
3 years ago
content-single-job_listing-meta.php
4 years ago
content-single-job_listing.php
4 years ago
content-summary-job_listing.php
2 months ago
content-widget-job_listing.php
2 months ago
content-widget-no-jobs-found.php
7 years ago
job-application-email.php
4 years ago
job-application-url.php
7 years ago
job-application.php
7 years ago
job-dashboard-login.php
7 years ago
job-dashboard-overlay.php
2 years ago
job-dashboard.php
2 years ago
job-filter-job-types.php
2 years ago
job-filters.php
2 years ago
job-listings-end.php
7 years ago
job-listings-start.php
7 years ago
job-pagination.php
7 years ago
job-preview.php
2 years ago
job-stats.php
2 months ago
job-submit.php
2 years ago
job-submitted.php
2 years ago
notice.php
2 years ago
pagination.php
6 years ago
job-stats.php
143 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Job stats |
| 4 | * |
| 5 | * @see https://wpjobmanager.com/document/template-overrides/ |
| 6 | * @author Automattic |
| 7 | * @package wp-job-manager |
| 8 | * @category Template |
| 9 | * @version 2.3.0 |
| 10 | * |
| 11 | * @var WP_Post $job Array of job post results. |
| 12 | * @var array $stats Total stats grouped by section. |
| 13 | * @var array $chart Total stats grouped by section. |
| 14 | */ |
| 15 | |
| 16 | use WP_Job_Manager\UI\UI_Elements; |
| 17 | |
| 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 19 | exit; // Exit if accessed directly. |
| 20 | } |
| 21 | |
| 22 | ?> |
| 23 | |
| 24 | <div class="jm-job-stats"> |
| 25 | <div class="jm-job-stats-chart"> |
| 26 | <div class="jm-section-header"> |
| 27 | <?php esc_html_e( 'Daily Views', 'wp-job-manager' ); ?> |
| 28 | </div> |
| 29 | <div class="jm-chart"> |
| 30 | <?php $values = $chart['values']; ?> |
| 31 | <div class="jm-chart-y-axis"> |
| 32 | <?php |
| 33 | foreach ( $chart['y-labels'] as $label ) { |
| 34 | $position = ( $label / $chart['max'] ) * 100; |
| 35 | echo '<div class="jm-chart-y-axis__label" style="bottom: ' . esc_attr( $position ) . '%;"><span>' . esc_html( number_format_i18n( $label ) ) . '</span></div>'; |
| 36 | } |
| 37 | ?> |
| 38 | </div> |
| 39 | <div class="jm-chart-bars"> |
| 40 | <?php |
| 41 | $i = 0; |
| 42 | $count = count( $values ); |
| 43 | foreach ( $values as $day ) : ?> |
| 44 | <?php |
| 45 | $class = $day['class'] ?? ''; |
| 46 | $percent = $i++ / $count * 100; |
| 47 | if ( $percent > 80 ) { |
| 48 | $class .= ' jm-chart-bar--right-edge'; |
| 49 | } |
| 50 | ?> |
| 51 | <div class="jm-chart-bar <?php echo esc_attr( $class ); ?>" |
| 52 | aria-describedby="jm-chart-bar-tooltip-<?php echo esc_attr( $day['date'] ); ?>"> |
| 53 | <div class="jm-chart-bar-tooltip jm-ui-tooltip" |
| 54 | id="jm-chart-bar-tooltip-<?php echo esc_attr( $day['date'] ); ?>"> |
| 55 | <div class="jm-ui-row"> |
| 56 | <strong><?php echo esc_html( $day['date'] ); ?></strong> |
| 57 | </div> |
| 58 | <div class="jm-ui-row"> |
| 59 | <?php esc_html_e( 'Search impressions', 'wp-job-manager' ); ?> |
| 60 | <strong><?php echo esc_html( number_format_i18n( $day['impressions'] ) ); ?></strong> |
| 61 | </div> |
| 62 | <div class="jm-ui-row"> |
| 63 | <?php esc_html_e( 'Page views', 'wp-job-manager' ); ?> |
| 64 | <strong><?php echo esc_html( number_format_i18n( $day['views'] ) ); ?></strong> |
| 65 | </div> |
| 66 | <div class="jm-ui-row"> |
| 67 | <?php esc_html_e( 'Unique visitors', 'wp-job-manager' ); ?> |
| 68 | <strong><?php echo esc_html( number_format_i18n( $day['uniques'] ) ); ?></strong> |
| 69 | </div> |
| 70 | |
| 71 | |
| 72 | </div> |
| 73 | <div class="jm-chart-bar-value" |
| 74 | style="height: <?php echo esc_attr( ( $day['views'] / $chart['max'] ) * 100 ); ?>%;"></div> |
| 75 | <div class="jm-chart-bar-inner-value" |
| 76 | style="height: <?php echo esc_attr( ( $day['uniques'] / $chart['max'] ) * 100 ); ?>%;"></div> |
| 77 | </div> |
| 78 | <?php endforeach; ?> |
| 79 | </div> |
| 80 | <div class="jm-chart-x-axis"> |
| 81 | <div class="jm-chart-x-axis__label"> |
| 82 | <?php echo esc_html( array_key_first( $values ) ); ?> |
| 83 | </div> |
| 84 | <div class="jm-chart-x-axis__label"> |
| 85 | <?php echo esc_html( array_key_last( $values ) ); ?> |
| 86 | </div> |
| 87 | </div> |
| 88 | </div> |
| 89 | </div> |
| 90 | <p class="jm-job-stats__footnote"> |
| 91 | <small><em><?php esc_html_e( 'Statistics reflect visitor activity on public pages and may include approximate counts.', 'wp-job-manager' ); ?></em></small> |
| 92 | </p> |
| 93 | <div class="jm-job-stat-details jm-ui-row"> |
| 94 | <?php foreach ( $stats as $column_name => $column ) : ?> |
| 95 | <div class="jm-ui-col"> |
| 96 | <?php foreach ( $column as $i => $section ) : |
| 97 | $help_text = $section['help'] ?? ''; |
| 98 | $tooltip_id = $help_text ? 'jm-stat-section-tooltip-' . $column_name . '-' . $i : ''; |
| 99 | ?> |
| 100 | <div class="jm-stat-section"> |
| 101 | <div class="jm-section-header" aria-describedby="<?php echo esc_attr( $tooltip_id ); ?>"> |
| 102 | <span><?php echo esc_html( $section['title'] ); ?></span> |
| 103 | <?php if ( ! empty( $help_text ) ): ?> |
| 104 | <span class="jm-section-header__help jm-ui-has-tooltip" tabindex="0"> |
| 105 | <?php echo UI_Elements::icon( 'help' ); ?> |
| 106 | <div role="tooltip" class="jm-ui-tooltip" id="<?php echo esc_attr( $tooltip_id ); ?>"> |
| 107 | <?php echo esc_html( $help_text ); ?> |
| 108 | </div> |
| 109 | </span> |
| 110 | <?php endif; ?> |
| 111 | </div> |
| 112 | <?php foreach ( $section['stats'] as $stat ) : ?> |
| 113 | <div class="jm-stat-row jm-ui-row"> |
| 114 | <?php if ( isset( $stat['icon'] ) ) { |
| 115 | echo UI_Elements::icon( $stat['icon'], $stat['label'] ); |
| 116 | } ?> |
| 117 | <div class="jm-stat-label"> |
| 118 | <?php echo esc_html( $stat['label'] ); ?> |
| 119 | </div> |
| 120 | <div class="jm-stat-value"> |
| 121 | <?php if ( isset( $stat['value'] ) ) : ?> |
| 122 | <?php echo esc_html( number_format_i18n( $stat['value'] ) ); ?> |
| 123 | <?php endif; ?> |
| 124 | <?php if ( isset( $stat['percent'] ) ) : ?> |
| 125 | <span |
| 126 | class="jm-stat-value-percent"><?php echo esc_html( number_format_i18n( $stat['percent'], 2 ) ); ?>%</span> |
| 127 | <?php endif; ?> |
| 128 | </div> |
| 129 | <?php if ( isset( $stat['background'] ) ) : ?> |
| 130 | <span |
| 131 | class="jm-stat-background" |
| 132 | style="width: <?php echo esc_attr( $stat['background'] . '%' ); ?>;"></span> |
| 133 | <?php endif; ?> |
| 134 | </div> |
| 135 | <?php endforeach; ?> |
| 136 | </div> |
| 137 | <?php endforeach; ?> |
| 138 | </div> |
| 139 | <?php endforeach; ?> |
| 140 | |
| 141 | </div> |
| 142 | </div> |
| 143 |