Grunion_Contact_Form_Plugin::export_form PHP Метод

export_form() публичный Метод

Prints the menu
public export_form ( )
    function export_form()
    {
        if (get_current_screen()->id != 'edit-feedback') {
            return;
        }
        if (!current_user_can('export')) {
            return;
        }
        // if there aren't any feedbacks, bail out
        if (!(int) wp_count_posts('feedback')->publish) {
            return;
        }
        ?>

		<div id="feedback-export" style="display:none">
			<h2><?php 
        _e('Export feedback as CSV', 'jetpack');
        ?>
</h2>
			<div class="clear"></div>
			<form action="<?php 
        echo admin_url('admin-post.php');
        ?>
" method="post" class="form">
				<?php 
        wp_nonce_field('feedback_export', 'feedback_export_nonce');
        ?>

				<input name="action" value="feedback_export" type="hidden">
				<label for="post"><?php 
        _e('Select feedback to download', 'jetpack');
        ?>
</label>
				<select name="post">
					<option value="all"><?php 
        esc_html_e('All posts', 'jetpack');
        ?>
</option>
					<?php 
        echo $this->get_feedbacks_as_options();
        ?>
				</select>

				<br><br>
				<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php 
        esc_html_e('Download', 'jetpack');
        ?>
">
			</form>
		</div>

		<?php 
        // There aren't any usable actions in core to output the "export feedback" form in the correct place,
        // so this inline JS moves it from the top of the page to the bottom.
        ?>
		<script type='text/javascript'>
		var menu = document.getElementById( 'feedback-export' ),
		wrapper = document.getElementsByClassName( 'wrap' )[0];
		wrapper.appendChild(menu);
		menu.style.display = 'block';
		</script>
		<?php 
    }