| 1 |
<?php |
| 2 |
/** |
| 3 |
* Ranks template |
| 4 |
* |
| 5 |
* This template can be overridden by copying it to yourtheme/gamipress/ranks.php |
| 6 |
* To override a specific rank type just copy it as yourtheme/gamipress/ranks-{rank-type}.php |
| 7 |
*/ |
| 8 |
global $gamipress_template_args; |
| 9 |
|
| 10 |
// Shorthand |
| 11 |
$a = $gamipress_template_args; |
| 12 |
|
| 13 |
$rank_types = gamipress_get_rank_types(); |
| 14 |
|
| 15 |
$user_id = isset( $a['user_id'] ) ? absint( $a['user_id'] ) : get_current_user_id(); ?> |
| 16 |
|
| 17 |
<div id="gamipress-ranks-list" class="gamipress-ranks-list <?php echo ( $a['is_user_ranks'] ? 'gamipress-user-ranks' : '' ); ?>"> |
| 18 |
|
| 19 |
<?php |
| 20 |
/** |
| 21 |
* Before render rank types list |
| 22 |
* |
| 23 |
* @since 1.0.0 |
| 24 |
* |
| 25 |
* @param array $rank_types Array of rank types to be rendered |
| 26 |
* @param array $template_args Template received arguments |
| 27 |
*/ |
| 28 |
do_action( 'gamipress_before_render_rank_types_list', $a['rank-types'], $a ); ?> |
| 29 |
|
| 30 |
<?php foreach( $a['rank-types'] as $rank_type => $rank_ids ) : |
| 31 |
if( ! isset( $rank_types[$rank_type] ) ) : |
| 32 |
continue; |
| 33 |
endif; ?> |
| 34 |
|
| 35 |
|
| 36 |
<div id="gamipress-rank-type-<?php echo esc_attr( $rank_type ); ?>" class="gamipress-rank-type gamipress-rank-type-<?php echo esc_attr( $rank_type ); ?>"> |
| 37 |
|
| 38 |
<?php |
| 39 |
/** |
| 40 |
* Before render rank type |
| 41 |
* |
| 42 |
* @since 1.0.0 |
| 43 |
* |
| 44 |
* @param string $rank_type Rank type slug |
| 45 |
* @param array $rank_types Array of rank types to be rendered |
| 46 |
* @param array $template_args Template received arguments |
| 47 |
*/ |
| 48 |
do_action( 'gamipress_before_render_rank_type', $rank_type, $a['rank-types'], $a ); ?> |
| 49 |
|
| 50 |
<h2 class="gamipress-rank-type-title"><?php echo $rank_types[$rank_type]['plural_name']; ?></h2> |
| 51 |
|
| 52 |
<?php |
| 53 |
/** |
| 54 |
* After rank type title |
| 55 |
* |
| 56 |
* @since 1.0.0 |
| 57 |
* |
| 58 |
* @param string $rank_type Rank type slug |
| 59 |
* @param array $rank_types Array of rank types to be rendered |
| 60 |
* @param array $template_args Template received arguments |
| 61 |
*/ |
| 62 |
do_action( 'gamipress_after_rank_type_title', $rank_type, $a['rank-types'], $a ); ?> |
| 63 |
|
| 64 |
<div class="gamipress-ranks-container gamipress-columns-<?php echo esc_attr( $a['columns'] ); ?> gamipress-columns-small-<?php echo esc_attr( $a['columns_small'] ); ?>"> |
| 65 |
|
| 66 |
<?php foreach( $rank_ids as $rank_id ) : ?> |
| 67 |
|
| 68 |
<?php echo gamipress_render_rank( $rank_id, $a['template_args'] ) ;?> |
| 69 |
|
| 70 |
<?php endforeach; ?> |
| 71 |
|
| 72 |
</div><!-- .gamipress-ranks-container --> |
| 73 |
|
| 74 |
<?php |
| 75 |
/** |
| 76 |
* After render rank type |
| 77 |
* |
| 78 |
* @since 1.0.0 |
| 79 |
* |
| 80 |
* @param string $rank_type Rank type slug |
| 81 |
* @param array $rank_types Array of rank types to be rendered |
| 82 |
* @param array $template_args Template received arguments |
| 83 |
*/ |
| 84 |
do_action( 'gamipress_after_render_rank_type', $rank_type, $a['rank-types'], $a ); ?> |
| 85 |
|
| 86 |
</div> |
| 87 |
|
| 88 |
<?php endforeach; ?> |
| 89 |
|
| 90 |
<?php |
| 91 |
/** |
| 92 |
* After render rank types list |
| 93 |
* |
| 94 |
* @since 1.0.0 |
| 95 |
* |
| 96 |
* @param array $rank_types Array of rank types to be rendered |
| 97 |
* @param array $template_args Template received arguments |
| 98 |
*/ |
| 99 |
do_action( 'gamipress_after_render_rank_types_list', $a['rank-types'], $a ); ?> |
| 100 |
|
| 101 |
</div><!-- .gamipress-ranks-list --> |
| 102 |
|