1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| public function extra_tablenav( $which ) {
if ( $which != 'top' ) {
return;
}
$sections = wpsam_get_all_section();
$srole = wpsam_get_user_section_by_role();
if ( !($srole == 'XX')) {
$sid = wpsam_get_section_value_by_code_fede($srole,'id');
$sectionsingle = wpsam_array_filter_by_value($sections, 'id', $sid);
$sections = $sectionsingle;
};
$years = wpsam_get_all_financial_year();
$selected_section = ( isset( $_POST['filter_section'] ) ) ? sanitize_text_field( wp_unslash( $_POST['filter_section'] ) ) : '';
$selected_year = ( isset( $_POST['filter_year'] ) ) ? sanitize_text_field( wp_unslash( $_POST['filter_year'] ) ) : '';
?>
<div class="alignleft actions">
<label class="screen-reader-text" for="filter_section"><?php esc_html_e( 'Filter by Section', 'wpsam' ); ?></label>
<select name ="filter_section" id="filter_section">
<option value=""><?php esc_html_e( '— Toutes les sections —', 'wpsam' ); ?></option>
<option <?php echo ( $selected_section == '' ) ? ' selected="selected" ' : ''; ?> value=""><?php esc_html_e( '— Toutes les sections —', 'wpsam' ); ?></option>
<?php foreach ($sections as $section) : ?>
<option value="<?php echo $section->sct_fede; ?>" <?php selected( $selected_section, $section->sct_fede ); ?> name="<?php echo $section->sct_fede ;?>"><?php echo $section->sct_name ;?></option>
<?php endforeach; ?>
</select>
<label class="screen-reader-text" for="filter_year"><?php esc_html_e( 'Filter by Year', 'wpsam' ); ?></label>
<select name ="filter_year" id="filter_year">
<option value=""><?php esc_html_e( '— Toutes les années —', 'wpsam' ); ?></option>
<?php foreach ($years as $year) : ?>
<option value="<?php echo $year->fy_code; ?>" <?php selected( $selected_year, $year->fy_code ); ?> name="<?php echo $year->fy_code ;?>"><?php echo $year->fy_code ;?></option>
<?php endforeach; ?>
</select>
<?php submit_button( __( 'Filter', 'wpsam' ), 'button', 'filter_general_ledger', false ); ?>
</div>
<?php
} |
Partager