| 1 |
<?php |
| 2 |
$parse_option_names = array( |
| 3 |
'columns' => esc_html__( 'Columns', 'm-chart' ), |
| 4 |
'rows' => esc_html__( 'Rows', 'm-chart' ), |
| 5 |
); |
| 6 |
|
| 7 |
$y_min_disabled = $post_meta['y_min'] ? '' : 'disabled="disabled" '; |
| 8 |
?> |
| 9 |
<div class="settings"> |
| 10 |
<div class="row one"> |
| 11 |
<p> |
| 12 |
<label for="<?php echo esc_attr( $this->get_field_id( 'type' ) ); ?>"><?php esc_html_e( 'Type', 'm-chart' ); ?></label><br /> |
| 13 |
<select name='<?php echo esc_attr( $this->get_field_name( 'type' ) ); ?>' class='select' id="<?php echo esc_attr( $this->get_field_id( 'type' ) ); ?>"> |
| 14 |
<?php |
| 15 |
foreach ( m_chart()->library( 'chartjs' )->type_options as $type ) { |
| 16 |
?> |
| 17 |
<option value="<?php echo esc_attr( $type ); ?>"<?php selected( $type, $post_meta['type'] ); ?>> |
| 18 |
<?php echo esc_html( m_chart()->library( 'chartjs' )->type_option_names[ $type ] ); ?> |
| 19 |
</option> |
| 20 |
<?php |
| 21 |
} |
| 22 |
?> |
| 23 |
</select> |
| 24 |
</p> |
| 25 |
<p> |
| 26 |
<label for="<?php echo esc_attr( $this->get_field_id( 'theme' ) ); ?>"><?php esc_html_e( 'Theme', 'm-chart' ); ?></label><br /> |
| 27 |
<select name="<?php echo esc_attr( $this->get_field_name( 'theme' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'theme' ) ); ?>"> |
| 28 |
<?php |
| 29 |
foreach ( m_chart()->library( 'chartjs' )->get_themes() as $theme ) { |
| 30 |
?> |
| 31 |
<option value="<?php echo esc_attr( $theme->slug ); ?>"<?php selected( $theme->slug, $post_meta['theme'] ); ?>> |
| 32 |
<?php esc_html_e( $theme->name, 'm-chart' ); ?> |
| 33 |
</option> |
| 34 |
<?php |
| 35 |
} |
| 36 |
?> |
| 37 |
</select> |
| 38 |
</p> |
| 39 |
<p> |
| 40 |
<label for="<?php echo esc_attr( $this->get_field_id( 'height' ) ); ?>"><?php esc_html_e( 'Height', 'm-chart' ); ?></label><br /> |
| 41 |
<input type="number" name="<?php echo esc_attr( $this->get_field_name( 'height' ) ); ?>" value="<?php echo absint( $post_meta['height'] ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'height' ) ); ?>" min="300" max="1500" /> |
| 42 |
</p> |
| 43 |
</div> |
| 44 |
<div class="row two"> |
| 45 |
<p> |
| 46 |
<label for="<?php echo esc_attr( $this->get_field_id( 'parse_in' ) ); ?>"><?php esc_html_e( 'Parse data in', 'm-chart' ); ?></label><br /> |
| 47 |
<select name='<?php echo esc_attr( $this->get_field_name( 'parse_in' ) ); ?>' class='select' id="<?php echo esc_attr( $this->get_field_id( 'parse_in' ) ); ?>"> |
| 48 |
<?php |
| 49 |
foreach ( m_chart()->parse_options as $parse_in ) { |
| 50 |
?> |
| 51 |
<option value="<?php echo esc_attr( $parse_in ); ?>"<?php selected( $parse_in, $post_meta['parse_in'] ); ?>> |
| 52 |
<?php echo esc_html( $parse_option_names[ $parse_in ] ); ?> |
| 53 |
</option> |
| 54 |
<?php |
| 55 |
} |
| 56 |
?> |
| 57 |
</select> |
| 58 |
</p> |
| 59 |
<p class="labels"> |
| 60 |
<br /> |
| 61 |
<label for="<?php echo esc_attr( $this->get_field_id( 'labels' ) ); ?>"> |
| 62 |
<input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'labels' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'labels' ) ); ?>" value="1"<?php checked( $post_meta['labels'], true ); ?>/> |
| 63 |
<?php esc_html_e( 'Show labels', 'm-chart' ); ?> |
| 64 |
</label> |
| 65 |
</p> |
| 66 |
<p class="legend"> |
| 67 |
<br /> |
| 68 |
<label for="<?php echo esc_attr( $this->get_field_id( 'legend' ) ); ?>"> |
| 69 |
<input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'legend' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'legend' ) ); ?>" value="1"<?php checked( $post_meta['legend'], true ); ?>/> |
| 70 |
<?php esc_html_e( 'Show legend', 'm-chart' ); ?> |
| 71 |
</label> |
| 72 |
</p> |
| 73 |
<p class="shared"> <br /> |
| 74 |
<label for="<?php echo esc_attr( $this->get_field_id( 'shared' ) ); ?>"> |
| 75 |
<input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'shared' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'shared' ) ); ?>" value="1"<?php checked( $post_meta['shared'], true ); ?>/> |
| 76 |
<?php esc_html_e( 'Shared tooltip', 'm-chart' ); ?> |
| 77 |
</label> |
| 78 |
</p> |
| 79 |
</div> |
| 80 |
<div class="row three vertical-axis"> |
| 81 |
<p> |
| 82 |
<label for="<?php echo esc_attr( $this->get_field_id( 'y-title' ) ); ?>"><?php esc_html_e( 'Vertical axis title', 'm-chart' ); ?></label><br /> |
| 83 |
<input class="input" type="text" name="<?php echo esc_attr( $this->get_field_name( 'y_title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'y-title' ) ); ?>" value="<?php echo esc_attr( $post_meta['y_title'] ); ?>" style="width: 100%;" /> |
| 84 |
</p> |
| 85 |
<p class="units"> |
| 86 |
<label for="<?php echo esc_attr( $this->get_field_id( 'y-units' ) ); ?>"><?php esc_html_e( 'Units', 'm-chart' ); ?></label><br /> |
| 87 |
<select name='<?php echo esc_attr( $this->get_field_name( 'y_units' ) ); ?>' id="<?php echo esc_attr( $this->get_field_id( 'y-units' ) ); ?>" class='select'> |
| 88 |
<option value=""><?php esc_html_e( 'N/A', 'm-chart' ); ?></option> |
| 89 |
<?php |
| 90 |
foreach ( m_chart()->get_unit_terms() as $parent => $units ) { |
| 91 |
?> |
| 92 |
<option value="" disabled="disabled"> |
| 93 |
<?php echo esc_html( $parent ); ?> |
| 94 |
</option> |
| 95 |
<?php |
| 96 |
|
| 97 |
foreach ( $units as $unit ) { |
| 98 |
?> |
| 99 |
<option value="<?php echo esc_attr( $unit->name ); ?>"<?php selected( $unit->name, $post_meta['y_units'] ); ?>> |
| 100 |
<?php echo esc_html( $unit->name ); ?> |
| 101 |
</option> |
| 102 |
<?php |
| 103 |
} |
| 104 |
} |
| 105 |
?> |
| 106 |
</select> |
| 107 |
</p> |
| 108 |
</div> |
| 109 |
<div class="row four y-min"> |
| 110 |
<p> |
| 111 |
<label for="<?php echo esc_attr( $this->get_field_id( 'y-min' ) ); ?>"> |
| 112 |
<input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'y_min' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'y-min' ) ); ?>" value="1"<?php checked( $post_meta['y_min'], true ); ?>/> |
| 113 |
<?php esc_html_e( 'Force vertical axis minimum: ', 'm-chart' ) ?> |
| 114 |
</label> |
| 115 |
<input type="text" name="<?php echo esc_attr( $this->get_field_name( 'y_min_value' ) ); ?>" value="<?php echo floatval( $post_meta['y_min_value'] ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'y-min-value' ) ); ?>" size="7" <?php echo esc_html( $y_min_disabled ); ?>/> |
| 116 |
</p> |
| 117 |
</div> |
| 118 |
<div class="row five horizontal-axis"> |
| 119 |
<p> |
| 120 |
<label for="<?php echo esc_attr( $this->get_field_id( 'x-title' ) ); ?>"><?php esc_html_e( 'Horizontal axis title', 'm-chart' ); ?></label><br /> |
| 121 |
<input class="input" type="text" name="<?php echo esc_attr( $this->get_field_name( 'x_title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'x-title' ) ); ?>" value="<?php echo esc_attr( $post_meta['x_title'] ); ?>" style="width: 100%;" /> |
| 122 |
</p> |
| 123 |
<p class="units"> |
| 124 |
<label for="<?php echo esc_attr( $this->get_field_id( 'x-units' ) ); ?>"><?php esc_html_e( 'Units', 'm-chart' ); ?></label><br /> |
| 125 |
<select name='<?php echo esc_attr( $this->get_field_name( 'x_units' ) ); ?>' id="<?php echo esc_attr( $this->get_field_id( 'x-units' ) ); ?>" class='select'> |
| 126 |
<option value=""><?php esc_html_e( 'N/A', 'm-chart' ) ?></option> |
| 127 |
<?php |
| 128 |
foreach ( m_chart()->get_unit_terms() as $parent => $units ) { |
| 129 |
?> |
| 130 |
<option value="" disabled="disabled"> |
| 131 |
<?php echo esc_html( $parent ); ?> |
| 132 |
</option> |
| 133 |
<?php |
| 134 |
|
| 135 |
foreach ( $units as $unit ) { |
| 136 |
?> |
| 137 |
<option value="<?php echo esc_attr( $unit->name ); ?>"<?php selected( $unit->name, $post_meta['x_units'] ); ?>> |
| 138 |
<?php echo esc_html( $unit->name ); ?> |
| 139 |
</option> |
| 140 |
<?php |
| 141 |
} |
| 142 |
} |
| 143 |
?> |
| 144 |
</select> |
| 145 |
</p> |
| 146 |
</div> |
| 147 |
</div> |
| 148 |
<div class="row seven"> |
| 149 |
<p> |
| 150 |
<label for="<?php echo esc_attr( $this->get_field_id( 'shortcode' ) ); ?>"><?php esc_html_e( 'Shortcode', 'm-chart' ); ?></label><br /> |
| 151 |
<input class="input" type="text" name="<?php echo esc_attr( $this->get_field_name( 'shortcode' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'shortcode' ) ); ?>" value='[chart id="<?php echo absint( $post->ID ); ?>"]' style="width: 100%;" readonly="readonly" /> |
| 152 |
</p> |
| 153 |
<p class="image"> |
| 154 |
<label for="<?php echo esc_attr( $this->get_field_id( 'image' ) ); ?>"><?php esc_html_e( 'Image', 'm-chart' ); ?></label><br /> |
| 155 |
<?php |
| 156 |
if ( $image ) { |
| 157 |
?> |
| 158 |
<input class="input" type="text" name="<?php echo esc_attr( $this->get_field_name( 'image' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'image' ) ); ?>" value="<?php echo esc_url( $image['url'] ); ?>" style="width: 100%;" readonly="readonly" /> |
| 159 |
<a href="<?php echo esc_url( $image['url'] ); ?>" class="button" target="_blank"><?php esc_html_e( 'View', 'm-chart' ); ?></a> |
| 160 |
<?php |
| 161 |
} elseif ( 'default' != $settings['performance'] ) { |
| 162 |
?><em><?php esc_html_e( 'Image generation is disabled', 'm-chart' ); ?></em><?php |
| 163 |
} else { |
| 164 |
?><em><?php esc_html_e( 'Save/Update this post to generate the image version', 'm-chart' ); ?></em><?php |
| 165 |
} |
| 166 |
?> |
| 167 |
</p> |
| 168 |
</div> |
| 169 |
<input type="hidden" name="<?php echo esc_attr( $this->get_field_name( 'library' ) ); ?>" value="<?php echo esc_attr( $post_meta['library'] ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'library' ) ); ?>"> |