Example #1
0
/**
 * Print distributor meta box for distributor
 *
 * @since 0.0.1
 */
function pmp_distributor_options_meta_box_for_distributor()
{
    global $post;
    wp_nonce_field('pmp_dist_meta_box', 'pmp_dist_meta_box_nonce');
    ?>
	<div id="pmp-dist-options" class="async-menu-container">
		<p>Set a Series and Property for this post.</p>
		<?php 
    foreach (array('series', 'property') as $type) {
        ?>
		<div
			id="pmp-<?php 
        echo $type;
        ?>
-for-post"
			class="async-menu-option pmp-dist-option-for-post"
			data-pmp-dist-option-type="<?php 
        echo $type;
        ?>
">
			<span class="spinner"></span>
		</div>
		<?php 
    }
    ?>
	</div>
	<div id="pmp-publish-actions">
		<?php 
    submit_button('Update dist. options', 'primary', 'pmp_save_dist_options', false, $attrs);
    ?>
	</div>
	<?php 
    /*
     * Javascript required for the async select menus for Groups, Series, Property
     */
    ?>
	<script type="text/javascript">
		var PMP = <?php 
    echo json_encode(pmp_json_obj(array('post_id' => $post->ID)));
    ?>
;
	</script><?php 
    pmp_async_select_template();
}
/**
 * The PMP meta box to end all PMP meta boxes.
 *
 * @since 0.3
 */
function pmp_mega_meta_box($post)
{
    wp_nonce_field('pmp_mega_meta_box', 'pmp_mega_meta_box_nonce');
    $pmp_guid = get_post_meta($post->ID, 'pmp_guid', true);
    pmp_last_modified_meta($post);
    if (!empty($pmp_guid) && !pmp_post_is_mine($post->ID)) {
        pmp_subscribe_to_updates_markup($post);
    } else {
        /*
         * Container elements for async select menus for Groups, Series and Property for the post
         */
        if ($post->post_status == 'publish') {
            ?>
		 <div id="pmp-override-defaults">
			<p>Modify the Group, Series and Property settings for this post.</p>
			<?php 
            foreach (array('group', 'series', 'property') as $type) {
                ?>
			<div id="pmp-<?php 
                echo $type;
                ?>
-select-for-post" class="pmp-select-for-post">
				<span class="spinner"></span>
			</div>
			<?php 
            }
            ?>
		</div><?php 
        }
        pmp_publish_and_push_to_pmp_button($post);
        /*
         * Javascript required for the async select menus for Groups, Series, Property
         */
        ?>
		<script type="text/javascript">
			var PMP = <?php 
        echo json_encode(pmp_json_obj(array('post_id' => $post->ID)));
        ?>
;
		</script><?php 
        pmp_async_select_template();
    }
}