| 1 |
<?php |
| 2 |
/** |
| 3 |
* The Template for displaying a report parameters |
| 4 |
* |
| 5 |
* This template can be overridden by copying it to yourtheme/upstream/report-parameters.php. |
| 6 |
* |
| 7 |
* @package UpStream |
| 8 |
*/ |
| 9 |
|
| 10 |
if ( ! defined( 'ABSPATH' ) ) { |
| 11 |
exit; |
| 12 |
} |
| 13 |
|
| 14 |
require_once dirname( __FILE__ ) . '/../includes/admin/metaboxes/metabox-functions.php'; |
| 15 |
|
| 16 |
if ( function_exists( 'set_time_limit' ) ) { |
| 17 |
set_time_limit( 120 ); |
| 18 |
} |
| 19 |
|
| 20 |
$exception = null; |
| 21 |
$get_data = isset( $_GET ) ? wp_unslash( $_GET ) : array(); |
| 22 |
$server_data = isset( $_SERVER ) ? wp_unslash( $_SERVER ) : array(); |
| 23 |
|
| 24 |
try { |
| 25 |
if ( ! session_id() ) { |
| 26 |
session_start(); |
| 27 |
} |
| 28 |
} catch ( \Exception $e ) { |
| 29 |
$exception = $e; |
| 30 |
} |
| 31 |
|
| 32 |
add_action( |
| 33 |
'init', |
| 34 |
function() { |
| 35 |
try { |
| 36 |
if ( ! session_id() ) { |
| 37 |
session_start(); |
| 38 |
} |
| 39 |
} catch ( \Exception $e ) { |
| 40 |
$exception = $e; |
| 41 |
} |
| 42 |
}, |
| 43 |
9 |
| 44 |
); |
| 45 |
|
| 46 |
|
| 47 |
if ( ! apply_filters( 'upstream_theme_override_header', false ) ) { |
| 48 |
upstream_get_template_part( 'global/header.php' ); |
| 49 |
} |
| 50 |
|
| 51 |
if ( ! apply_filters( 'upstream_theme_override_sidebar', false ) ) { |
| 52 |
upstream_get_template_part( 'global/sidebar.php' ); |
| 53 |
} |
| 54 |
|
| 55 |
if ( ! apply_filters( 'upstream_theme_override_topnav', false ) ) { |
| 56 |
upstream_get_template_part( 'global/top-nav.php' ); |
| 57 |
} |
| 58 |
|
| 59 |
$report = UpStream_Report_Generator::get_instance()->get_report( sanitize_text_field( $get_data['report'] ) ); |
| 60 |
if ( ! $report ) { |
| 61 |
return; |
| 62 |
} |
| 63 |
|
| 64 |
$display_fields = array(); |
| 65 |
|
| 66 |
?> |
| 67 |
|
| 68 |
<div class="right_col" role="main"> |
| 69 |
|
| 70 |
<form action="<?php esc_url( $server_data['REQUEST_URI'] ); ?>" method="post"> |
| 71 |
<?php wp_nonce_field( 'upstream_report_form', 'upstream_report_form_nonce' ); ?> |
| 72 |
|
| 73 |
<?php foreach ( $report->getAllFieldOptions() as $section_id => $option_info ) : ?> |
| 74 |
<div id="report-parameters-<?php echo esc_attr( $option_info['type'] ); ?>>"> |
| 75 |
<?php include 'report-parameters/section.php'; ?> |
| 76 |
</div> |
| 77 |
<?php endforeach; ?> |
| 78 |
|
| 79 |
<?php require 'report-parameters/display-fields.php'; ?> |
| 80 |
|
| 81 |
<div class="col-md-12 mt-2"> |
| 82 |
<input type="submit" name="submit" value="<?php esc_html_e( 'Submit Filters', 'upstream' ); ?>" class="btn btn-primary"> |
| 83 |
</div> |
| 84 |
</form> |
| 85 |
</div> |
| 86 |
|
| 87 |
<?php |
| 88 |
|
| 89 |
|
| 90 |
if ( ! apply_filters( 'upstream_theme_override_footer', false ) ) { |
| 91 |
upstream_get_template_part( 'global/footer.php' ); |
| 92 |
} |
| 93 |
?> |
| 94 |
|