Beispiel #1
0
/**
 * Template tag: Boxed Style Paging
 *
 * @param array $args:
 *	'before': (string)
 *	'after': (string)
 *	'options': (string|array) Used to overwrite options set in WP-Admin -> Settings -> PageNavi
 *	'query': (object) A WP_Query instance
 */
function wp_pagenavi($args = array())
{
    if (!is_array($args)) {
        $argv = func_get_args();
        $args = array();
        foreach (array('before', 'after', 'options') as $i => $key) {
            $args[$key] = isset($argv[$i]) ? $argv[$i] : "";
        }
    }
    $args = wp_parse_args($args, array('before' => '', 'after' => '', 'options' => array(), 'query' => $GLOBALS['wp_query'], 'type' => 'posts', 'echo' => true));
    extract($args, EXTR_SKIP);
    $options = wp_parse_args($options, PageNavi_Core::$options->get());
    $instance = new PageNavi_Call($args);
    list($posts_per_page, $paged, $total_pages) = $instance->get_pagination_args();
    if (1 == $total_pages && !$options['always_show']) {
        return;
    }
    $pages_to_show = absint($options['num_pages']);
    $larger_page_to_show = absint($options['num_larger_page_numbers']);
    $larger_page_multiple = absint($options['larger_page_numbers_multiple']);
    $pages_to_show_minus_1 = $pages_to_show - 1;
    $half_page_start = floor($pages_to_show_minus_1 / 2);
    $half_page_end = ceil($pages_to_show_minus_1 / 2);
    $start_page = $paged - $half_page_start;
    if ($start_page <= 0) {
        $start_page = 1;
    }
    $end_page = $paged + $half_page_end;
    if ($end_page - $start_page != $pages_to_show_minus_1) {
        $end_page = $start_page + $pages_to_show_minus_1;
    }
    if ($end_page > $total_pages) {
        $start_page = $total_pages - $pages_to_show_minus_1;
        $end_page = $total_pages;
    }
    if ($start_page < 1) {
        $start_page = 1;
    }
    // Support for filters to change class names
    $class_names = array('pages' => apply_filters('wp_pagenavi_class_pages', 'pages'), 'first' => apply_filters('wp_pagenavi_class_first', 'first'), 'previouspostslink' => apply_filters('wp_pagenavi_class_previouspostslink', 'previouspostslink'), 'extend' => apply_filters('wp_pagenavi_class_extend', 'extend'), 'smaller' => apply_filters('wp_pagenavi_class_smaller', 'smaller'), 'page' => apply_filters('wp_pagenavi_class_page', 'page'), 'current' => apply_filters('wp_pagenavi_class_current', 'current'), 'larger' => apply_filters('wp_pagenavi_class_larger', 'larger'), 'nextpostslink' => apply_filters('wp_pagenavi_class_nextpostslink', 'nextpostslink'), 'last' => apply_filters('wp_pagenavi_class_last', 'last'));
    $out = '';
    switch (intval($options['style'])) {
        // Normal
        case 1:
            // Text
            if (!empty($options['pages_text'])) {
                $pages_text = str_replace(array("%CURRENT_PAGE%", "%TOTAL_PAGES%"), array(number_format_i18n($paged), number_format_i18n($total_pages)), __($options['pages_text'], 'wp-pagenavi'));
                $out .= "<span class='{$class_names['pages']}'>{$pages_text}</span>";
            }
            if ($start_page >= 2 && $pages_to_show < $total_pages) {
                // First
                $first_text = str_replace('%TOTAL_PAGES%', number_format_i18n($total_pages), __($options['first_text'], 'wp-pagenavi'));
                $out .= $instance->get_single(1, $first_text, array('class' => $class_names['first']), '%TOTAL_PAGES%');
            }
            // Previous
            if ($paged > 1 && !empty($options['prev_text'])) {
                $out .= $instance->get_single($paged - 1, $options['prev_text'], array('class' => $class_names['previouspostslink'], 'rel' => 'prev'));
            }
            if ($start_page >= 2 && $pages_to_show < $total_pages) {
                if (!empty($options['dotleft_text'])) {
                    $out .= "<span class='{$class_names['extend']}'>{$options['dotleft_text']}</span>";
                }
            }
            // Smaller pages
            $larger_pages_array = array();
            if ($larger_page_multiple) {
                for ($i = $larger_page_multiple; $i <= $total_pages; $i += $larger_page_multiple) {
                    $larger_pages_array[] = $i;
                }
            }
            $larger_page_start = 0;
            foreach ($larger_pages_array as $larger_page) {
                if ($larger_page < $start_page - $half_page_start && $larger_page_start < $larger_page_to_show) {
                    $out .= $instance->get_single($larger_page, $options['page_text'], array('class' => "{$class_names['smaller']} {$class_names['page']}"));
                    $larger_page_start++;
                }
            }
            if ($larger_page_start) {
                $out .= "<span class='{$class_names['extend']}'>{$options['dotleft_text']}</span>";
            }
            // Page numbers
            $timeline = 'smaller';
            foreach (range($start_page, $end_page) as $i) {
                if ($i == $paged && !empty($options['current_text'])) {
                    $current_page_text = str_replace('%PAGE_NUMBER%', number_format_i18n($i), $options['current_text']);
                    $out .= "<span class='{$class_names['current']}'>{$current_page_text}</span>";
                    $timeline = 'larger';
                } else {
                    $out .= $instance->get_single($i, $options['page_text'], array('class' => "{$class_names['page']} {$class_names[$timeline]}"));
                }
            }
            // Large pages
            $larger_page_end = 0;
            $larger_page_out = '';
            foreach ($larger_pages_array as $larger_page) {
                if ($larger_page > $end_page + $half_page_end && $larger_page_end < $larger_page_to_show) {
                    $larger_page_out .= $instance->get_single($larger_page, $options['page_text'], array('class' => "{$class_names['larger']} {$class_names['page']}"));
                    $larger_page_end++;
                }
            }
            if ($larger_page_out) {
                $out .= "<span class='{$class_names['extend']}'>{$options['dotright_text']}</span>";
            }
            $out .= $larger_page_out;
            if ($end_page < $total_pages) {
                if (!empty($options['dotright_text'])) {
                    $out .= "<span class='{$class_names['extend']}'>{$options['dotright_text']}</span>";
                }
            }
            // Next
            if ($paged < $total_pages && !empty($options['next_text'])) {
                $out .= $instance->get_single($paged + 1, $options['next_text'], array('class' => $class_names['nextpostslink'], 'rel' => 'next'));
            }
            if ($end_page < $total_pages) {
                // Last
                $out .= $instance->get_single($total_pages, __($options['last_text'], 'wp-pagenavi'), array('class' => $class_names['last']), '%TOTAL_PAGES%');
            }
            break;
            // Dropdown
        // Dropdown
        case 2:
            $out .= '<form action="" method="get">' . "\n";
            $out .= '<select size="1" onchange="document.location.href = this.options[this.selectedIndex].value;">' . "\n";
            foreach (range(1, $total_pages) as $i) {
                $page_num = $i;
                if ($page_num == 1) {
                    $page_num = 0;
                }
                if ($i == $paged) {
                    $current_page_text = str_replace('%PAGE_NUMBER%', number_format_i18n($i), $options['current_text']);
                    $out .= '<option value="' . esc_url($instance->get_url($page_num)) . '" selected="selected" class="' . $class_names['current'] . '">' . $current_page_text . "</option>\n";
                } else {
                    $page_text = str_replace('%PAGE_NUMBER%', number_format_i18n($i), $options['page_text']);
                    $out .= '<option value="' . esc_url($instance->get_url($page_num)) . '">' . $page_text . "</option>\n";
                }
            }
            $out .= "</select>\n";
            $out .= "</form>\n";
            break;
    }
    $out = $before . "<div class='wp-pagenavi'>\n{$out}\n</div>" . $after;
    $out = apply_filters('wp_pagenavi', $out);
    if (!$echo) {
        return $out;
    }
    echo $out;
}
    /**
     * Display navigation to next/previous pages when applicable
     */
    function ipt_kb_content_nav($nav_id)
    {
        global $wp_query, $post;
        // Give compatibility for wp-pagenavi
        if (function_exists('wp_pagenavi') && !is_single()) {
            $args = wp_parse_args(array(), array('before' => '', 'after' => '', 'options' => array(), 'query' => $GLOBALS['wp_query'], 'type' => 'posts', 'echo' => true));
            extract($args, EXTR_SKIP);
            $options = wp_parse_args($options, PageNavi_Core::$options->get());
            $instance = new PageNavi_Call($args);
            list($posts_per_page, $paged, $total_pages) = $instance->get_pagination_args();
            if (1 == $total_pages && !$options['always_show']) {
                return;
            }
            $pages_to_show = absint($options['num_pages']);
            $larger_page_to_show = absint($options['num_larger_page_numbers']);
            $larger_page_multiple = absint($options['larger_page_numbers_multiple']);
            $pages_to_show_minus_1 = $pages_to_show - 1;
            $half_page_start = floor($pages_to_show_minus_1 / 2);
            $half_page_end = ceil($pages_to_show_minus_1 / 2);
            $start_page = $paged - $half_page_start;
            if ($start_page <= 0) {
                $start_page = 1;
            }
            $end_page = $paged + $half_page_end;
            if ($end_page - $start_page != $pages_to_show_minus_1) {
                $end_page = $start_page + $pages_to_show_minus_1;
            }
            if ($end_page > $total_pages) {
                $start_page = $total_pages - $pages_to_show_minus_1;
                $end_page = $total_pages;
            }
            if ($start_page < 1) {
                $start_page = 1;
            }
            $out = '';
            // Text
            if (!empty($options['pages_text'])) {
                $pages_text = str_replace(array("%CURRENT_PAGE%", "%TOTAL_PAGES%"), array(number_format_i18n($paged), number_format_i18n($total_pages)), $options['pages_text']);
                $out .= "<li class='disabled'><span class='pages'>{$pages_text}</span></li>";
            }
            if ($start_page >= 2 && $pages_to_show < $total_pages) {
                // First
                $first_text = str_replace('%TOTAL_PAGES%', number_format_i18n($total_pages), $options['first_text']);
                $out .= '<li>' . $instance->get_single(1, '<i class="glyphicon glyphicon-fast-backward"></i>', array('class' => 'first bstooltip', 'title' => $first_text, 'data-container' => 'body'), '%TOTAL_PAGES%') . '</li>';
            }
            // Previous
            if ($paged > 1 && !empty($options['prev_text'])) {
                $out .= '<li>' . $instance->get_single($paged - 1, '<i class="glyphicon glyphicon-backward"></i>', array('class' => 'previouspostslink bstooltip', 'title' => $options['prev_text'], 'data-container' => 'body')) . '</li>';
            }
            if ($start_page >= 2 && $pages_to_show < $total_pages) {
                if (!empty($options['dotleft_text'])) {
                    $out .= "<li class='disabled'><span class='extend'>{$options['dotleft_text']}</span></li>";
                }
            }
            // Smaller pages
            $larger_pages_array = array();
            if ($larger_page_multiple) {
                for ($i = $larger_page_multiple; $i <= $total_pages; $i += $larger_page_multiple) {
                    $larger_pages_array[] = $i;
                }
            }
            $larger_page_start = 0;
            foreach ($larger_pages_array as $larger_page) {
                if ($larger_page < $start_page - $half_page_start && $larger_page_start < $larger_page_to_show) {
                    $out .= '<li>' . $instance->get_single($larger_page, $options['page_text'], array('class' => 'smaller page')) . '</li>';
                    $larger_page_start++;
                }
            }
            if ($larger_page_start) {
                $out .= "<li class='disabled'><span class='extend'>{$options['dotleft_text']}</span></li>";
            }
            // Page numbers
            $timeline = 'smaller';
            foreach (range($start_page, $end_page) as $i) {
                if ($i == $paged && !empty($options['current_text'])) {
                    $current_page_text = str_replace('%PAGE_NUMBER%', number_format_i18n($i), $options['current_text']);
                    $out .= "<li class='active'><span class='current'>{$current_page_text}</span></li>";
                    $timeline = 'larger';
                } else {
                    $out .= '<li>' . $instance->get_single($i, $options['page_text'], array('class' => "page {$timeline}")) . '</li>';
                }
            }
            // Large pages
            $larger_page_end = 0;
            $larger_page_out = '';
            foreach ($larger_pages_array as $larger_page) {
                if ($larger_page > $end_page + $half_page_end && $larger_page_end < $larger_page_to_show) {
                    $larger_page_out .= '<li>' . $instance->get_single($larger_page, $options['page_text'], array('class' => 'larger page')) . '</li>';
                    $larger_page_end++;
                }
            }
            if ($larger_page_out) {
                $out .= "<li class='disabled'><span class='extend'>{$options['dotright_text']}</span></li>";
            }
            $out .= $larger_page_out;
            if ($end_page < $total_pages) {
                if (!empty($options['dotright_text'])) {
                    $out .= "<li class='disabled'><span class='extend'>{$options['dotright_text']}</span></li>";
                }
            }
            // Next
            if ($paged < $total_pages && !empty($options['next_text'])) {
                $out .= '<li>' . $instance->get_single($paged + 1, '<i class="glyphicon glyphicon-forward"></i>', array('class' => 'nextpostslink bstooltip', 'title' => $options['next_text'], 'data-container' => 'body')) . '</li>';
            }
            if ($end_page < $total_pages) {
                // Last
                $out .= '<li>' . $instance->get_single($total_pages, '<i class="glyphicon glyphicon-fast-forward"></i>', array('class' => 'last bstooltip', 'title' => $options['last_text'], 'data-container' => 'body'), '%TOTAL_PAGES%') . '</li>';
            }
            $out = $before . "<ul class='pagination pagination-lg'>\n{$out}\n</ul>" . $after;
            $out = apply_filters('wp_pagenavi', $out);
            if (!$echo) {
                return $out;
            }
            echo $out;
            return;
        }
        // Don't print empty markup on single pages if there's nowhere to navigate.
        if (is_single()) {
            $previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(true, '', true);
            $next = get_adjacent_post(true, '', false);
            if (!$next && !$previous) {
                return;
            }
        }
        // Don't print empty markup in archives if there's only one page.
        if ($wp_query->max_num_pages < 2 && (is_home() || is_archive() || is_search())) {
            return;
        }
        $nav_class = is_single() ? 'post-navigation' : 'paging-navigation';
        // Add support with bootstrap pager
        $nav_class .= ' pager';
        ?>
	<ul role="navigation" id="<?php 
        echo esc_attr($nav_id);
        ?>
" class="<?php 
        echo $nav_class;
        ?>
">
		<li class="screen-reader-text"><?php 
        _e('Post navigation', 'ipt_kb');
        ?>
</li>
	<?php 
        if (is_single()) {
            // navigation links for single posts
            ?>

		<?php 
            previous_post_link('<li class="nav-previous previous">%link</li>', '<span class="meta-nav">' . _x('<span class="glyphicon glyphicon-arrow-left"></span>', 'Previous post link', 'ipt_kb') . '</span> %title', true);
            ?>
		<?php 
            next_post_link('<li class="nav-next next">%link</li>', '%title <span class="meta-nav">' . _x('<span class="glyphicon glyphicon-arrow-right"></span>', 'Next post link', 'ipt_kb') . '</span>', true);
            ?>

	<?php 
        } elseif ($wp_query->max_num_pages > 1 && (is_home() || is_archive() || is_search())) {
            // navigation links for home, archive, and search pages
            ?>

		<?php 
            if (get_next_posts_link()) {
                ?>
		<li class="nav-previous previous"><?php 
                next_posts_link(__('<span class="meta-nav"><span class="glyphicon glyphicon-arrow-left"></span></span> Older posts', 'ipt_kb'));
                ?>
</li>
		<?php 
            }
            ?>

		<?php 
            if (get_previous_posts_link()) {
                ?>
		<li class="nav-next next"><?php 
                previous_posts_link(__('Newer posts <span class="meta-nav"><span class="glyphicon glyphicon-arrow-right"></span></span>', 'ipt_kb'));
                ?>
</li>
		<?php 
            }
            ?>

	<?php 
        }
        ?>

	</ul><!-- #<?php 
        echo esc_html($nav_id);
        ?>
 -->
	<?php 
    }
Beispiel #3
0
function projectTheme_orders()
{
    global $menu_admin_project_theme_bull;
    echo '<div class="wrap">';
    echo '<div class="icon32" id="icon-options-general-orders"><br/></div>';
    echo '<h2 class="my_title_class_sitemile">ProjectTheme Orders</h2>';
    if (isset($_GET['mark_delivered'])) {
        $tm = current_time('timestamp', 0);
        $pid = $_GET['mark_delivered'];
        update_post_meta($pid, 'mark_coder_delivered', "1");
        update_post_meta($pid, 'mark_coder_delivered_date', $tm);
        $winner_bd = projectTheme_get_winner_bid($pid);
        //------------------------------------------------------------------------------
        ProjectTheme_send_email_on_delivered_project_to_bidder($pid, $winner_bd->uid);
        ProjectTheme_send_email_on_delivered_project_to_owner($pid);
        echo '<div class="saved_thing">Marked Delivered!</div>';
    }
    if (isset($_GET['mark_completed'])) {
        $tm = current_time('timestamp', 0);
        $pid = $_GET['mark_completed'];
        $pstpst = get_post($pid);
        update_post_meta($pid, 'mark_seller_accepted', "1");
        update_post_meta($pid, 'mark_seller_accepted_date', $tm);
        update_post_meta($pid, 'outstanding', "0");
        update_post_meta($pid, 'delivered', "1");
        //update_post_meta($pid, 'paid_user',		"1");
        //------------------------------------------------------------------------------
        ProjectTheme_send_email_on_completed_project_to_bidder($pid, $pstpst->post_author);
        ProjectTheme_send_email_on_completed_project_to_owner($pid);
        echo '<div class="saved_thing">Marked Completed!</div>';
    }
    if (isset($_GET['mark_paid'])) {
        $tm = current_time('timestamp', 0);
        $pid = $_GET['mark_paid'];
        update_post_meta($pid, 'paid_user_date', $tm);
        update_post_meta($pid, 'paid_user', "1");
        echo '<div class="saved_thing">Marked Paid!</div>';
    }
    ?>
    
        <div id="usual2" class="usual"> 
  <ul> 
    <li><a href="#tabs1">Open Orders</a></li> 
    <li><a href="#tabs2">Delivered Orders</a></li>
    <li><a href="#tabs3">Completed Orders</a></li>
    <li><a href="#tabs4">Paid Orders</a></li>
    <!-- <li><a href="#tabs4">Failed &amp; Disputed Orders</a></li> -->
    <?php 
    do_action('ProjectTheme_main_menu_orders_tabs');
    ?>
  </ul> 
  <div id="tabs1" style="display: none; ">
    	<?php 
    global $current_user;
    get_currentuserinfo();
    $uid = $current_user->ID;
    global $wp_query;
    $query_vars = $wp_query->query_vars;
    $post_per_page = 25;
    $outstanding = array('key' => 'outstanding', 'value' => "1", 'compare' => '=');
    $winner = array('key' => 'winner', 'value' => 0, 'compare' => '!=');
    $delivered2 = array('key' => 'delivered', 'value' => "1", 'compare' => '!=');
    $mark_coder_delivered = array('key' => 'mark_coder_delivered', 'value' => "1", 'compare' => '!=');
    $pj = $_GET['pj1'];
    if (empty($_GET['pj1'])) {
        $pj = 1;
    }
    $args = array('post_type' => 'project', 'order' => 'DESC', 'posts_per_page' => $post_per_page, 'paged' => $pj, 'meta_query' => array($outstanding, $winner, $delivered2, $mark_coder_delivered));
    add_filter('posts_join', 'projectTheme_posts_join_0');
    add_filter('posts_orderby', 'projectTheme_posts_orderby_0');
    query_posts($args);
    if (have_posts()) {
        echo '<table class="widefat post fixed">';
        echo '<thead>';
        echo '<th>Project Title</th>';
        echo '<th>Project Creator</th>';
        echo '<th>Bidder</th>';
        echo '<th>Winning Bid</th>';
        echo '<th>Date Ordered</th>';
        echo '<th>Expected Delivery</th>';
        echo '<th>Options</th>';
        echo '</thead>';
        while (have_posts()) {
            the_post();
            $bid = projectTheme_get_winner_bid(get_the_ID());
            $bidsa = $bid;
            $bid = ProjectTheme_get_show_price($bid->bid);
            $post = get_post(get_the_ID());
            $creator = get_userdata($post->post_author);
            $winner = get_post_meta(get_the_ID(), 'winner', true);
            $winner = get_userdata($winner);
            $winner = '<a href="' . ProjectTheme_get_user_profile_link($winner->ID) . '">' . $winner->user_login . '</a>';
            $creator = '<a href="' . ProjectTheme_get_user_profile_link($post->post_author) . '">' . $creator->user_login . '</a>';
            $tm_d = get_post_meta(get_the_ID(), 'expected_delivery', true);
            $tm_d = date_i18n('d-M-Y H:i:s', $tm_d);
            $closed_date = get_post_meta(get_the_ID(), 'closed_date', true);
            $winner_date = date_i18n('d-M-Y H:i:s', $closed_date);
            echo '</tr>';
            echo '<th><a href="' . get_permalink(get_the_ID()) . '">' . get_the_title() . '</a></th>';
            echo '<th>' . $creator . '</th>';
            echo '<th>' . $winner . '</th>';
            echo '<th>' . $bid . '</th>';
            echo '<th>' . $winner_date . '</th>';
            echo '<th>' . $tm_d . '</th>';
            echo '<th><a href="' . get_admin_url() . 'admin.php?page=orders&pj1=' . $pj . '&mark_delivered=' . get_the_ID() . '">Mark Delivered</a></th>';
            echo '</tr>';
        }
        echo '</table>';
        //-------------------------------------------------------
        if (function_exists('wp_pagenavi')) {
            if (!is_array($args)) {
                $argv = func_get_args();
                $args = array();
                foreach (array('before', 'after', 'options') as $i => $key) {
                    $args[$key] = $argv[$i];
                }
            }
            $args = wp_parse_args($args, array('before' => '', 'after' => '', 'options' => array(), 'query' => $GLOBALS['wp_query'], 'type' => 'posts', 'echo' => true));
            $instance = new PageNavi_Call($args);
            list($posts_per_page, $paged, $total_pages) = $instance->get_pagination_args();
            for ($i = 1; $i <= $total_pages; $i++) {
                if ($pj == $i) {
                    echo $i . ' | ';
                } else {
                    echo '<a href="' . get_admin_url() . 'admin.php?page=orders&pj1=' . $i . '">' . $i . '</a> | ';
                }
            }
        }
        //------------ end pagination ------------------
    } else {
        _e("There are no outstanding projects yet.", 'ProjectTheme');
    }
    wp_reset_query();
    ?>
        
          </div> 
        
        
        <div id="tabs2" style="display: none; ">
        
        <?php 
    global $current_user;
    get_currentuserinfo();
    $uid = $current_user->ID;
    global $wp_query;
    $query_vars = $wp_query->query_vars;
    $post_per_page = 25;
    $delivered = array('key' => 'mark_coder_delivered', 'value' => "1", 'compare' => '=');
    $mark_seller_accepted = array('key' => 'mark_seller_accepted', 'value' => "1", 'compare' => '!=');
    $paid = array('key' => 'paid_user', 'value' => "0", 'compare' => '=');
    $pj = $_GET['pj2'];
    if (empty($_GET['pj2'])) {
        $pj = 1;
    }
    $args = array('post_type' => 'project', 'posts_per_page' => $post_per_page, 'paged' => $pj, 'meta_query' => array($delivered, $paid, $mark_seller_accepted));
    add_filter('posts_join', 'projectTheme_posts_join_0');
    add_filter('posts_orderby', 'projectTheme_posts_orderby_0');
    query_posts($args);
    if (have_posts()) {
        echo '<table class="widefat post fixed">';
        echo '<thead>';
        echo '<th>Project Title</th>';
        echo '<th>Project Creator</th>';
        echo '<th>Bidder</th>';
        echo '<th>Winning Bid</th>';
        echo '<th>Date Ordered</th>';
        echo '<th>Delivered On</th>';
        echo '<th>Options</th>';
        echo '</thead>';
        while (have_posts()) {
            the_post();
            $bid = projectTheme_get_winner_bid(get_the_ID());
            $bid = ProjectTheme_get_show_price($bid->bid);
            $post = get_post(get_the_ID());
            $creator = get_userdata($post->post_author);
            $winner = get_post_meta(get_the_ID(), 'winner', true);
            $winner = get_userdata($winner);
            $winner = '<a href="' . ProjectTheme_get_user_profile_link($winner->ID) . '">' . $winner->user_login . '</a>';
            $creator = '<a href="' . ProjectTheme_get_user_profile_link($post->post_author) . '">' . $creator->user_login . '</a>';
            $tm_d = get_post_meta(get_the_ID(), 'mark_coder_delivered_date', true);
            $tm_d = date_i18n('d-M-Y H:i:s', $tm_d);
            $closed_date = get_post_meta(get_the_ID(), 'closed_date', true);
            $winner_date = date_i18n('d-M-Y H:i:s', $closed_date);
            echo '</tr>';
            echo '<th><a href="' . get_permalink(get_the_ID()) . '">' . get_the_title() . '</a></th>';
            echo '<th>' . $creator . '</th>';
            echo '<th>' . $winner . '</th>';
            echo '<th>' . $bid . '</th>';
            echo '<th>' . $winner_date . '</th>';
            echo '<th>' . $tm_d . '</th>';
            echo '<th><a href="' . get_admin_url() . 'admin.php?page=orders&pj2=' . $pj . '&active_tab=tabs2&mark_completed=' . get_the_ID() . '">Mark Completed</a></th>';
            echo '</tr>';
        }
        echo '</table>';
        //-------------------------------------------------------
        if (function_exists('wp_pagenavi')) {
            if (!is_array($args)) {
                $argv = func_get_args();
                $args = array();
                foreach (array('before', 'after', 'options') as $i => $key) {
                    $args[$key] = $argv[$i];
                }
            }
            $args = wp_parse_args($args, array('before' => '', 'after' => '', 'options' => array(), 'query' => $GLOBALS['wp_query'], 'type' => 'posts', 'echo' => true));
            $instance = new PageNavi_Call($args);
            list($posts_per_page, $paged, $total_pages) = $instance->get_pagination_args();
            for ($i = 1; $i <= $total_pages; $i++) {
                if ($pj == $i) {
                    echo $i . ' | ';
                } else {
                    echo '<a href="' . get_admin_url() . 'admin.php?page=orders&pj2=' . $i . '&active_tab=tabs2">' . $i . '</a> | ';
                }
            }
        }
        //------------ end pagination ------------------
    } else {
        _e("There are no delivered projects yet.", 'ProjectTheme');
    }
    wp_reset_query();
    ?>
        
        </div> 
       
       
        
        
         <div id="tabs3" style="display: none; ">
         
         
         <?php 
    global $current_user;
    get_currentuserinfo();
    $uid = $current_user->ID;
    global $wp_query;
    $query_vars = $wp_query->query_vars;
    $post_per_page = 25;
    $delivered = array('key' => 'mark_seller_accepted', 'value' => "1", 'compare' => '=');
    $delivered2 = array('key' => 'delivered', 'value' => "1", 'compare' => '=');
    $paid = array('key' => 'paid_user', 'value' => "0", 'compare' => '=');
    $pj = $_GET['pj3'];
    if (empty($_GET['pj3'])) {
        $pj = 1;
    }
    $args = array('post_type' => 'project', 'posts_per_page' => $post_per_page, 'paged' => $pj, 'meta_query' => array($delivered, $delivered2, $paid));
    add_filter('posts_join', 'projectTheme_posts_join_0');
    add_filter('posts_orderby', 'projectTheme_posts_orderby_0');
    query_posts($args);
    if (have_posts()) {
        echo '<table class="widefat post fixed">';
        echo '<thead>';
        echo '<th>Project Title</th>';
        echo '<th>Project Creator</th>';
        echo '<th>Bidder</th>';
        echo '<th>Winning Bid</th>';
        echo '<th>Date Ordered</th>';
        echo '<th>Completed On</th>';
        echo '<th>Options</th>';
        echo '</thead>';
        while (have_posts()) {
            the_post();
            $bid = projectTheme_get_winner_bid(get_the_ID());
            $bid = ProjectTheme_get_show_price($bid->bid);
            $post = get_post(get_the_ID());
            $creator = get_userdata($post->post_author);
            $winner = get_post_meta(get_the_ID(), 'winner', true);
            $winner = get_userdata($winner);
            $winner = '<a href="' . ProjectTheme_get_user_profile_link($winner->ID) . '">' . $winner->user_login . '</a>';
            $tm_d = get_post_meta(get_the_ID(), 'mark_seller_accepted_date', true);
            $tm_d = date_i18n('d-M-Y H:i:s', $tm_d);
            $closed_date = get_post_meta(get_the_ID(), 'closed_date', true);
            $winner_date = date_i18n('d-M-Y H:i:s', $closed_date);
            $creator = '<a href="' . ProjectTheme_get_user_profile_link($post->post_author) . '">' . $creator->user_login . '</a>';
            $paid_user = get_post_meta(get_the_ID(), 'paid_user', true);
            echo '</tr>';
            echo '<th><a href="' . get_permalink(get_the_ID()) . '">' . get_the_title() . '</a></th>';
            echo '<th>' . $creator . '</th>';
            echo '<th>' . $winner . '</th>';
            echo '<th>' . $bid . '</th>';
            echo '<th>' . $winner_date . '</th>';
            echo '<th>' . $tm_d . '</th>';
            echo '<th>' . '<a href="' . get_admin_url() . 'admin.php?active_tab=tabs3&page=orders&pj3=' . $pj . '&mark_paid=' . get_the_ID() . '">Mark Paid</a>' . '</th>';
            echo '</tr>';
        }
        echo '</table>';
        //-------------------------------------------------------
        if (function_exists('wp_pagenavi')) {
            if (!is_array($args)) {
                $argv = func_get_args();
                $args = array();
                foreach (array('before', 'after', 'options') as $i => $key) {
                    $args[$key] = $argv[$i];
                }
            }
            $args = wp_parse_args($args, array('before' => '', 'after' => '', 'options' => array(), 'query' => $GLOBALS['wp_query'], 'type' => 'posts', 'echo' => true));
            $instance = new PageNavi_Call($args);
            list($posts_per_page, $paged, $total_pages) = $instance->get_pagination_args();
            for ($i = 1; $i <= $total_pages; $i++) {
                if ($pj == $i) {
                    echo $i . ' | ';
                } else {
                    echo '<a href="' . get_admin_url() . 'admin.php?page=orders&pj3=' . $i . '&active_tab=tabs3">' . $i . '</a> | ';
                }
            }
        }
        //------------ end pagination ------------------
    } else {
        _e("There are no completed projects yet.", 'ProjectTheme');
    }
    wp_reset_query();
    ?>
         
         
         </div> 
         
         
         
         
         <div id="tabs4" style="display: none; ">
         
         
         <?php 
    global $current_user;
    get_currentuserinfo();
    $uid = $current_user->ID;
    global $wp_query;
    $query_vars = $wp_query->query_vars;
    $post_per_page = 25;
    $delivered = array('key' => 'mark_seller_accepted', 'value' => "1", 'compare' => '=');
    $delivered2 = array('key' => 'delivered', 'value' => "1", 'compare' => '=');
    $paid = array('key' => 'paid_user', 'value' => "1", 'compare' => '=');
    $pj = $_GET['pj4'];
    if (empty($_GET['pj4'])) {
        $pj = 1;
    }
    $args = array('post_type' => 'project', 'posts_per_page' => $post_per_page, 'paged' => $pj, 'meta_query' => array($delivered, $delivered2, $paid));
    add_filter('posts_join', 'projectTheme_posts_join_0');
    add_filter('posts_orderby', 'projectTheme_posts_orderby_0');
    query_posts($args);
    if (have_posts()) {
        echo '<table class="widefat post fixed">';
        echo '<thead>';
        echo '<th>Project Title</th>';
        echo '<th>Project Creator</th>';
        echo '<th>Bidder</th>';
        echo '<th>Winning Bid</th>';
        echo '<th>Date Ordered</th>';
        echo '<th>Completed On</th>';
        echo '<th>Paid On</th>';
        echo '</thead>';
        while (have_posts()) {
            the_post();
            $bid = projectTheme_get_winner_bid(get_the_ID());
            $bid = ProjectTheme_get_show_price($bid->bid);
            $post = get_post(get_the_ID());
            $creator = get_userdata($post->post_author);
            $winner = get_post_meta(get_the_ID(), 'winner', true);
            $winner = get_userdata($winner);
            $winner = '<a href="' . ProjectTheme_get_user_profile_link($winner->ID) . '">' . $winner->user_login . '</a>';
            $tm_d = get_post_meta(get_the_ID(), 'mark_seller_accepted_date', true);
            $tm_d = date_i18n('d-M-Y H:i:s', $tm_d);
            $closed_date = get_post_meta(get_the_ID(), 'closed_date', true);
            $winner_date = date_i18n('d-M-Y H:i:s', $closed_date);
            $creator = '<a href="' . ProjectTheme_get_user_profile_link($post->post_author) . '">' . $creator->user_login . '</a>';
            $paid_user = get_post_meta(get_the_ID(), 'paid_user', true);
            $paid_user_date = get_post_meta(get_the_ID(), 'paid_user_date', true);
            if (!empty($paid_user_date)) {
                $paid_user_date = date_i18n('d-M-Y H:i:s', $paid_user_date);
            }
            echo '</tr>';
            echo '<th><a href="' . get_permalink(get_the_ID()) . '">' . get_the_title() . '</a></th>';
            echo '<th>' . $creator . '</th>';
            echo '<th>' . $winner . '</th>';
            echo '<th>' . $bid . '</th>';
            echo '<th>' . $winner_date . '</th>';
            echo '<th>' . $tm_d . '</th>';
            echo '<th>' . $paid_user_date . '</th>';
            echo '</tr>';
        }
        echo '</table>';
        //-------------------------------------------------------
        if (function_exists('wp_pagenavi')) {
            if (!is_array($args)) {
                $argv = func_get_args();
                $args = array();
                foreach (array('before', 'after', 'options') as $i => $key) {
                    $args[$key] = $argv[$i];
                }
            }
            $args = wp_parse_args($args, array('before' => '', 'after' => '', 'options' => array(), 'query' => $GLOBALS['wp_query'], 'type' => 'posts', 'echo' => true));
            $instance = new PageNavi_Call($args);
            list($posts_per_page, $paged, $total_pages) = $instance->get_pagination_args();
            for ($i = 1; $i <= $total_pages; $i++) {
                if ($pj == $i) {
                    echo $i . ' | ';
                } else {
                    echo '<a href="' . get_admin_url() . 'admin.php?page=orders&pj4=' . $i . '&active_tab=tabs4">' . $i . '</a> | ';
                }
            }
        }
        //------------ end pagination ------------------
    } else {
        _e("There are no paid projects yet.", 'ProjectTheme');
    }
    wp_reset_query();
    ?>
         
         
         </div> 
         
         
         
         
         </div> 
         

    	
        <?php 
    do_action('ProjectTheme_main_menu_orders_content');
    ?>
    
    <?php 
    echo '</div>';
}
Beispiel #4
0
/**
 * Template tag: Boxed Style Paging
 * @version 2.83
 */
function wp_pagenavi($args = array())
{
    $defaults = array('before' => '', 'after' => '', 'class_active' => 'current', 'container' => 'div', 'container_class' => 'pagination-container', 'menu_class' => 'pagination-menu', 'style' => 'list', 'options' => array('pages_text' => get_setting('pagination_pages_text', __('Page %CURRENT_PAGE% of %TOTAL_PAGES%', 'spyropress')), 'current_text' => get_setting('pagination_current_text', '%PAGE_NUMBER%'), 'page_text' => get_setting('pagination_page_text', '%PAGE_NUMBER%'), 'first_text' => get_setting('pagination_first_text', __('&laquo; First', 'spyropress')), 'last_text' => get_setting('pagination_last_text', __('Last &raquo;', 'spyropress')), 'prev_text' => get_setting('pagination_prev_text', __('&laquo;', 'spyropress')), 'next_text' => get_setting('pagination_next_text', __('&raquo;', 'spyropress')), 'dotleft_text' => get_setting('pagination_dotleft_text', __('&hellip;', 'spyropress')), 'dotright_text' => get_setting('pagination_dotright_text', __('&hellip;', 'spyropress')), 'num_pages' => get_setting('pagination_num_pages', 5), 'num_larger_page_numbers' => get_setting('pagination_num_larger_page_numbers', 3), 'larger_page_numbers_multiple' => get_setting('pagination_larger_page_numbers_multiple', 10), 'always_show' => get_setting('pagination_always_show', false)), 'query' => $GLOBALS['wp_query'], 'type' => 'posts', 'echo' => true);
    $args = wp_parse_args($args, apply_filters('spyropress_pagination_defaults', $defaults));
    extract($args, EXTR_SKIP);
    $instance = new PageNavi_Call($args);
    list($posts_per_page, $paged, $total_pages) = $instance->get_pagination_args();
    if (1 == $total_pages && !$options['always_show']) {
        return;
    }
    $pages_to_show = absint($options['num_pages']);
    $larger_page_to_show = absint($options['num_larger_page_numbers']);
    $larger_page_multiple = absint($options['larger_page_numbers_multiple']);
    $pages_to_show_minus_1 = $pages_to_show - 1;
    $half_page_start = floor($pages_to_show_minus_1 / 2);
    $half_page_end = ceil($pages_to_show_minus_1 / 2);
    $start_page = $paged - $half_page_start;
    if ($start_page <= 0) {
        $start_page = 1;
    }
    $end_page = $paged + $half_page_end;
    if ($end_page - $start_page != $pages_to_show_minus_1) {
        $end_page = $start_page + $pages_to_show_minus_1;
    }
    if ($end_page > $total_pages) {
        $start_page = $total_pages - $pages_to_show_minus_1;
        $end_page = $total_pages;
    }
    if ($start_page < 1) {
        $start_page = 1;
    }
    $out = '';
    switch ($style) {
        // Normal
        case 'list':
            // Text
            if (!empty($options['pages_text'])) {
                $pages_text = str_replace(array("%CURRENT_PAGE%", "%TOTAL_PAGES%"), array(number_format_i18n($paged), number_format_i18n($total_pages)), $options['pages_text']);
                $out .= "<li><span class='pages'>{$pages_text}</span></li>";
            }
            if ($start_page >= 2 && $pages_to_show < $total_pages) {
                // First
                $first_text = str_replace('%TOTAL_PAGES%', number_format_i18n($total_pages), $options['first_text']);
                $out .= '<li class="first">' . $instance->get_single(1, 'first', $first_text, '%TOTAL_PAGES%') . '</li>';
            }
            // Previous
            if ($paged > 1 && !empty($options['prev_text'])) {
                $out .= '<li class="previouspostslink">' . $instance->get_single($paged - 1, 'previouspostslink', $options['prev_text']) . '</li>';
            }
            if ($start_page >= 2 && $pages_to_show < $total_pages) {
                if (!empty($options['dotleft_text'])) {
                    $out .= "<li><span class='extend'>{$options['dotleft_text']}</span></li>";
                }
            }
            // Smaller pages
            $larger_pages_array = array();
            if ($larger_page_multiple) {
                for ($i = $larger_page_multiple; $i <= $total_pages; $i += $larger_page_multiple) {
                    $larger_pages_array[] = $i;
                }
            }
            $larger_page_start = 0;
            foreach ($larger_pages_array as $larger_page) {
                if ($larger_page < $start_page - $half_page_start && $larger_page_start < $larger_page_to_show) {
                    $out .= '<li class="smaller page">' . $instance->get_single($larger_page, 'smaller page', $options['page_text']) . '</li>';
                    $larger_page_start++;
                }
            }
            if ($larger_page_start) {
                $out .= "<li><span class='extend'>{$options['dotleft_text']}</span></li>";
            }
            // Page numbers
            $timeline = 'smaller';
            foreach (range($start_page, $end_page) as $i) {
                if ($i == $paged && !empty($options['current_text'])) {
                    $current_page_text = str_replace('%PAGE_NUMBER%', number_format_i18n($i), $options['current_text']);
                    $out .= "<li class='{$class_active}'><span>{$current_page_text}</span></li>";
                    $timeline = 'larger';
                } else {
                    $out .= '<li class="page ' . $timeline . '">' . $instance->get_single($i, "page {$timeline}", $options['page_text']) . '</li>';
                }
            }
            // Large pages
            $larger_page_end = 0;
            $larger_page_out = '';
            foreach ($larger_pages_array as $larger_page) {
                if ($larger_page > $end_page + $half_page_end && $larger_page_end < $larger_page_to_show) {
                    $larger_page_out .= '<li class="larger page">' . $instance->get_single($larger_page, 'larger page', $options['page_text']) . '</li>';
                    $larger_page_end++;
                }
            }
            if ($larger_page_out) {
                $out .= "<li><span class='extend'>{$options['dotright_text']}</span></li>";
            }
            $out .= $larger_page_out;
            if ($end_page < $total_pages) {
                if (!empty($options['dotright_text'])) {
                    $out .= "<li><span class='extend'>{$options['dotright_text']}</span></li>";
                }
            }
            // Next
            if ($paged < $total_pages && !empty($options['next_text'])) {
                $out .= '<li class="nextpostslink">' . $instance->get_single($paged + 1, 'nextpostslink', $options['next_text']) . '</li>';
            }
            if ($end_page < $total_pages) {
                // Last
                $out .= '<li class="last">' . $instance->get_single($total_pages, 'last', $options['last_text'], '%TOTAL_PAGES%') . '</li>';
            }
            break;
            // Normal
        // Normal
        case 'simple':
            // Text
            if (!empty($options['pages_text'])) {
                $pages_text = str_replace(array("%CURRENT_PAGE%", "%TOTAL_PAGES%"), array(number_format_i18n($paged), number_format_i18n($total_pages)), $options['pages_text']);
                $out .= "<span class='pages'>{$pages_text}</span>";
            }
            if ($start_page >= 2 && $pages_to_show < $total_pages) {
                // First
                $first_text = str_replace('%TOTAL_PAGES%', number_format_i18n($total_pages), $options['first_text']);
                $out .= $instance->get_single(1, 'first', $first_text, '%TOTAL_PAGES%');
            }
            // Previous
            if ($paged > 1 && !empty($options['prev_text'])) {
                $out .= $instance->get_single($paged - 1, 'previouspostslink', $options['prev_text']);
            }
            if ($start_page >= 2 && $pages_to_show < $total_pages) {
                if (!empty($options['dotleft_text'])) {
                    $out .= "<span class='extend'>{$options['dotleft_text']}</span>";
                }
            }
            // Smaller pages
            $larger_pages_array = array();
            if ($larger_page_multiple) {
                for ($i = $larger_page_multiple; $i <= $total_pages; $i += $larger_page_multiple) {
                    $larger_pages_array[] = $i;
                }
            }
            $larger_page_start = 0;
            foreach ($larger_pages_array as $larger_page) {
                if ($larger_page < $start_page - $half_page_start && $larger_page_start < $larger_page_to_show) {
                    $out .= $instance->get_single($larger_page, 'smaller page', $options['page_text']);
                    $larger_page_start++;
                }
            }
            if ($larger_page_start) {
                $out .= "<span class='extend'>{$options['dotleft_text']}</span>";
            }
            // Page numbers
            $timeline = 'smaller';
            foreach (range($start_page, $end_page) as $i) {
                if ($i == $paged && !empty($options['current_text'])) {
                    $current_page_text = str_replace('%PAGE_NUMBER%', number_format_i18n($i), $options['current_text']);
                    $out .= "<span class='{$class_active}'>{$current_page_text}</span>";
                    $timeline = 'larger';
                } else {
                    $out .= $instance->get_single($i, "page {$timeline}", $options['page_text']);
                }
            }
            // Large pages
            $larger_page_end = 0;
            $larger_page_out = '';
            foreach ($larger_pages_array as $larger_page) {
                if ($larger_page > $end_page + $half_page_end && $larger_page_end < $larger_page_to_show) {
                    $larger_page_out .= $instance->get_single($larger_page, 'larger page', $options['page_text']);
                    $larger_page_end++;
                }
            }
            if ($larger_page_out) {
                $out .= "<span class='extend'>{$options['dotright_text']}</span>";
            }
            $out .= $larger_page_out;
            if ($end_page < $total_pages) {
                if (!empty($options['dotright_text'])) {
                    $out .= "<span class='extend'>{$options['dotright_text']}</span>";
                }
            }
            // Next
            if ($paged < $total_pages && !empty($options['next_text'])) {
                $out .= $instance->get_single($paged + 1, 'nextpostslink', $options['next_text']);
            }
            if ($end_page < $total_pages) {
                // Last
                $out .= $instance->get_single($total_pages, 'last', $options['last_text'], '%TOTAL_PAGES%');
            }
            break;
            // Dropdown
        // Dropdown
        case 'dropdown':
            $out .= '<form action="" method="get">' . "\n";
            $out .= '<select size="1" onchange="document.location.href = this.options[this.selectedIndex].value;">' . "\n";
            foreach (range(1, $total_pages) as $i) {
                $page_num = $i;
                if ($page_num == 1) {
                    $page_num = 0;
                }
                if ($i == $paged) {
                    $current_page_text = str_replace('%PAGE_NUMBER%', number_format_i18n($i), $options['current_text']);
                    $out .= '<option value="' . esc_url($instance->get_url($page_num)) . '" selected="selected" class="current">' . $current_page_text . "</option>\n";
                } else {
                    $page_text = str_replace('%PAGE_NUMBER%', number_format_i18n($i), $options['page_text']);
                    $out .= '<option value="' . esc_url($instance->get_url($page_num)) . '">' . $page_text . "</option>\n";
                }
            }
            $out .= "</select>\n";
            $out .= "</form>\n";
            break;
    }
    if ('list' == $style) {
        $out = $before . "<{$container} class='{$container_class}'>\n<ul class='{$menu_class}'>\n{$out}\n</ul>\n</{$container}>" . $after;
    } else {
        $out = $before . "<{$container} class='{$container_class}'>\n{$out}\n</{$container}>" . $after;
    }
    $out = apply_filters('wp_pagenavi', $out);
    if (!$echo) {
        return $out;
    }
    echo $out;
}