Exemplo n.º 1
0
/**
 * Get the info header for a list of docs
 *
 * Contains things like tag filters
 *
 * @package BuddyPress Docs
 * @since 1.0-beta
 *
 * @param int $doc_id optional The post_id of the doc
 * @return str Permalink for the group doc
 */
function bp_docs_get_info_header()
{
    $filters = bp_docs_get_current_filters();
    // Set the message based on the current filters
    if (empty($filters)) {
        $message = __('You are viewing <strong>all</strong> docs.', 'bp-docs');
    } else {
        $message = array();
        $message = apply_filters('bp_docs_info_header_message', $message, $filters);
        $message = implode("\n", $message);
        // We are viewing a subset of docs, so we'll add a link to clear filters
        $message .= ' - ' . sprintf(__('<strong><a href="%s" title="View All Docs">View All Docs</a></strong>', 'bp_docs'), bp_docs_get_item_docs_link());
    }
    ?>
		
		<p class="currently-viewing"><?php 
    echo $message;
    ?>
</p>
		
		<form action="<?php 
    bp_docs_item_docs_link();
    ?>
" method="post">
				
			<div class="docs-filters">
				<?php 
    do_action('bp_docs_filter_markup');
    ?>
			</div>

			<div class="clear"> </div>
			
			<?php 
    /*
    <input class="button" id="docs-filter-submit" name="docs-filter-submit" value="<?php _e( 'Submit', 'bp-docs' ) ?>" type="submit" />
    */
    ?>

		</form>
		
		
		<?php 
}
/**
 * Get the info header for a list of docs
 *
 * Contains things like tag filters
 *
 * @package BuddyPress Docs
 * @since 1.0-beta
 *
 * @param int $doc_id optional The post_id of the doc
 * @return str Permalink for the group doc
 */
function bp_docs_get_info_header()
{
    $filters = bp_docs_get_current_filters();
    // Set the message based on the current filters
    if (empty($filters)) {
        $message = __('You are viewing <strong>all</strong> docs.', 'bp-docs');
    } else {
        $message = array();
        $message = apply_filters('bp_docs_info_header_message', $message, $filters);
        $message = implode("\n", $message);
        // We are viewing a subset of docs, so we'll add a link to clear filters
        // Figure out what the possible filter query args are.
        $filter_args = apply_filters('bp_docs_filter_types', array());
        $filter_args = wp_list_pluck($filter_args, 'query_arg');
        $filter_args = array_merge($filter_args, array('search_submit', 'folder'));
        $message .= ' - ' . sprintf(__('<strong><a href="%s" title="View All Docs">View All Docs</a></strong>', 'bp-docs'), remove_query_arg($filter_args));
    }
    ?>

		<p class="currently-viewing"><?php 
    echo $message;
    ?>
</p>

		<?php 
    if ($filter_titles = bp_docs_filter_titles()) {
        ?>
			<div class="docs-filters">
				<p id="docs-filter-meta">
					<?php 
        printf(__('Filter by: %s', 'bp-docs'), $filter_titles);
        ?>
				</p>

				<div id="docs-filter-sections">
					<?php 
        do_action('bp_docs_filter_sections');
        ?>
				</div>
			</div>

			<div class="clear"> </div>
		<?php 
    }
    ?>

		<?php 
}
/**
 * Get the info header for a list of docs
 *
 * Contains things like tag filters
 *
 * @since 1.0-beta
 *
 * @param int $doc_id optional The post_id of the doc
 * @return str Permalink for the group doc
 */
function bp_docs_get_info_header()
{
    do_action('bp_docs_before_info_header');
    $filters = bp_docs_get_current_filters();
    // Set the message based on the current filters
    if (empty($filters)) {
        $message = __('You are viewing <strong>all</strong> docs.', 'bp-docs');
    } else {
        $message = array();
        $message = apply_filters('bp_docs_info_header_message', $message, $filters);
        $message = implode("<br />", $message);
        // We are viewing a subset of docs, so we'll add a link to clear filters
        // Figure out what the possible filter query args are.
        $filter_args = apply_filters('bp_docs_filter_types', array());
        $filter_args = wp_list_pluck($filter_args, 'query_arg');
        $filter_args = array_merge($filter_args, array('search_submit', 'folder'));
        // XTEC ************ AFEGIT - Added support for multitag
        // 2016.04.27 @sarjona
        // 2016.10.10 @xaviernietosanchez
        if (!empty($_REQUEST['bool']) && $_REQUEST['bool'] === 'and') {
            // AND operator is enabled so show "OR" link
            $message .= ' - ' . sprintf(__('<strong><a href="%s" title="View Docs with some of the selected tags">Viewing docs with some of these tags</a></strong>', 'bp-docs'), add_query_arg('bool', 'or'));
        } else {
            // OR operator is enabled so show "AND" link
            $message .= ' - ' . sprintf(__('<strong><a href="%s" title="View Docs with all selected tags">Viewing docs with each of these tags</a></strong>', 'bp-docs'), add_query_arg('bool', 'and'));
        }
        //************ FI
        $message .= ' - ' . sprintf(__('<strong><a href="%s" title="View All Docs">View All Docs</a></strong>', 'bp-docs'), remove_query_arg($filter_args));
    }
    ?>

		<p class="currently-viewing"><?php 
    echo $message;
    ?>
</p>

		<?php 
    if ($filter_titles = bp_docs_filter_titles()) {
        ?>
			<div class="docs-filters">
				<p id="docs-filter-meta">
					<?php 
        printf(__('Filter by: %s', 'bp-docs'), $filter_titles);
        ?>
				</p>

				<div id="docs-filter-sections">
					<?php 
        do_action('bp_docs_filter_sections');
        ?>
				</div>
			</div>

			<div class="clear"> </div>
		<?php 
    }
    ?>
		<?php 
}