| @@ -141,8 +141,64 @@ | ||
| 141 | 141 | ); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | + * Renders chart advanced settings group. | |
| 146 | + * | |
| 147 | + * @access protected | |
| 148 | + */ | |
| 149 | + protected function _renderAdvancedSettings() { | |
| 150 | + self::_renderGroupStart( esc_html__( 'Frontend Actions', 'visualizer' ) ); | |
| 151 | + self::_renderSectionStart(); | |
| 152 | + self::_renderSectionDescription( esc_html__( 'Configure frontend actions here.', 'visualizer' ) ); | |
| 153 | + self::_renderSectionEnd(); | |
| 154 | + | |
| 155 | + $this->_renderActionSettings(); | |
| 156 | + self::_renderGroupEnd(); | |
| 157 | + } | |
| 158 | + | |
| 159 | + /** | |
| 160 | + * Renders chart action buttons group. | |
| 161 | + * | |
| 162 | + * @access protected | |
| 163 | + */ | |
| 164 | + protected function _renderActionSettings() { | |
| 165 | + self::_renderSectionStart( esc_html__( 'Actions', 'visualizer' ), false ); | |
| 166 | + self::_renderCheckboxItem( | |
| 167 | + esc_html__( 'Print', 'visualizer' ), | |
| 168 | + 'actions[]', | |
| 169 | + isset( $this->actions ) && in_array( 'print', $this->actions ) ? true : false, | |
| 170 | + 'print', | |
| 171 | + esc_html__( 'To enable printing the data.', 'visualizer' ) | |
| 172 | + ); | |
| 173 | + self::_renderCheckboxItem( | |
| 174 | + esc_html__( 'CSV', 'visualizer' ), | |
| 175 | + 'actions[]', | |
| 176 | + isset( $this->actions ) && in_array( 'csv;application/csv', $this->actions ) ? true : false, | |
| 177 | + 'csv;application/csv', | |
| 178 | + esc_html__( 'To enable downloading the data as a CSV.', 'visualizer' ) | |
| 179 | + ); | |
| 180 | + | |
| 181 | + $disabled = ! ( extension_loaded( 'zip' ) && extension_loaded( 'xml' ) && version_compare( PHP_VERSION, '5.2.0', '>' ) ); | |
| 182 | + self::_renderCheckboxItem( | |
| 183 | + esc_html__( 'Excel', 'visualizer' ), | |
| 184 | + 'actions[]', | |
| 185 | + isset( $this->actions ) && in_array( 'xls;application/vnd.ms-excel', $this->actions ) ? true : false, | |
| 186 | + 'xls;application/vnd.ms-excel', | |
| 187 | + $disabled ? '<span class="section-error">' . esc_html__( 'Enable the ZIP and XML extensions to use this setting.', 'visualizer' ) . '</span>' : esc_html__( 'To enable downloading the data as an Excel spreadsheet.', 'visualizer' ), | |
| 188 | + $disabled | |
| 189 | + ); | |
| 190 | + self::_renderCheckboxItem( | |
| 191 | + esc_html__( 'Copy', 'visualizer' ), | |
| 192 | + 'actions[]', | |
| 193 | + isset( $this->actions ) && in_array( 'copy', $this->actions ) ? true : false, | |
| 194 | + 'copy', | |
| 195 | + esc_html__( 'To enable copying the data to the clipboard.', 'visualizer' ) | |
| 196 | + ); | |
| 197 | + self::_renderSectionEnd(); | |
| 198 | + } | |
| 199 | + | |
| 200 | + /** | |
| 145 | 201 | * Renders chart general settings group. |
| 146 | 202 | * |
| 147 | 203 | * @since 1.0.0 |
| 148 | 204 | * |
| @@ -549,13 +605,13 @@ | ||
| 549 | 605 | |
| 550 | 606 | /** |
| 551 | 607 | * Render a checkbox item |
| 552 | 608 | */ |
| 553 | - protected static function _renderCheckboxItem( $title, $name, $value, $default, $desc ) { | |
| 609 | + protected static function _renderCheckboxItem( $title, $name, $value, $default, $desc, $disabled = false ) { | |
| 554 | 610 | echo '<div class="section-item">'; |
| 555 | 611 | echo '<a class="more-info" href="javascript:;">[?]</a>'; |
| 556 | 612 | echo '<b>', $title, '</b>'; |
| 557 | - echo '<input type="checkbox" class="control-check" value="', $default, '" name="', $name, '" ', ($value == $default ? 'checked' : ''), '>'; | |
| 613 | + echo '<input type="checkbox" class="control-check" value="', $default, '" name="', $name, '" ', ($value == $default ? 'checked' : ''), ' ', ($disabled ? 'disabled=disabled' : ''), '>'; | |
| 558 | 614 | echo '<p class="section-description">', $desc, '</p>'; |
| 559 | 615 | echo '</div>'; |
| 560 | 616 | } |
| 561 | 617 | |