public function testPagination()
 {
     $pagination = new Pagination();
     $pagination->setCurrent(10);
     $pagination->setTotal(95);
     $pagination->setRPP(10);
     $this->assertEquals(10, $pagination->getNumberOfPages());
     $this->assertEquals(5, $pagination->countCurrentItems());
     $this->assertEquals(91, $pagination->firstItem());
     $this->assertEquals(95, $pagination->lastItem());
     //change to another page
     $pagination->setCurrent(5);
     $this->assertEquals(10, $pagination->countCurrentItems());
     $this->assertEquals(41, $pagination->firstItem());
     $this->assertEquals(50, $pagination->lastItem());
 }
Example #2
0
 static function paginate($total, $limit = 10, $link = "", $current = -1, $range = 5)
 {
     $pages = new Pagination($total, $limit);
     $pages->setTemplate('parter/pagination.html');
     if (!empty($link)) {
         $pages->setLinkPath($link);
     }
     if ($current != -1) {
         $pages->setCurrent($current);
     }
     $pages->setRange($range);
     return $pages->serve();
 }
Example #3
0
 /**
  * 
  * @param string $tag Default is NULL
  * @param int $page Default is NULL
  * @return void
  */
 public function index($tag = NULL, $page = NULL)
 {
     $getData = array('query' => $tag ? $tag : Input::get('query'), 'type' => Input::get('type'), 'country' => Input::get('country'), 'make' => Input::get('make'), 'model' => Input::get('model'), 'year_min' => Input::get('year_min'), 'year_max' => Input::get('year_max'), 'price_min' => Input::get('price_min'), 'price_max' => Input::get('price_max'), 'currency' => Input::get('currency'), 'condition' => Input::get('condition'), 'color' => Input::get('color'), 'mileage_min' => Input::get('mileage_min'), 'mileage_max' => Input::get('mileage_max'), 'vehicle' => Input::get('vehicle'), 'vin' => Input::get('vin'), 'state' => Input::get('state'), 'city' => Input::get('city'), 'location' => Input::get('location'), 'order' => Input::get('order'), 'page' => $page ? $page : Input::get('page'));
     $getData = $this->mSearch->fixDashes($getData);
     $getData = $this->mSearch->fixLower($getData);
     $data = $this->mSearch->apiResults($getData);
     $data['params'] = $getData;
     $data['yearMin'] = $getData['year_min'] ? $getData['year_min'] : 1980;
     $data['yearMax'] = $getData['year_max'] ? $getData['year_max'] : (int) date('Y');
     $data['priceMin'] = $getData['price_min'] ? $getData['price_min'] : 0;
     $data['priceMax'] = $getData['price_max'] ? $getData['price_max'] : 50000;
     $data['mileageMin'] = $getData['mileage_min'] ? $getData['mileage_min'] : 0;
     $data['mileageMax'] = $getData['mileage_max'] ? $getData['mileage_max'] : 200000;
     $this->mSearch->saveTags($getData['query'], $data['total']);
     $data['latestTags'] = $this->mSearch->getTags('latest');
     $data['randomTags'] = $this->mSearch->getTags('random');
     if ($tag !== NULL) {
         Pagination::setQueryString(FALSE);
         Pagination::setURL(tagLink($getData['query']));
         $seoData = $this->mSearch->setSeo('tags', $getData, $data['total']);
         Layout::title(getSeo($seoData, 'tagsTitle'));
         Layout::desc(getSeo($seoData, 'tagsDesc'));
         Layout::heading(getSeo($seoData, 'tagsHeading'));
     } else {
         Pagination::setQueryString(TRUE);
         Pagination::setURL(searchLink($getData, FALSE));
         $seoData = $this->mSearch->setSeo('search', $getData, $data['total']);
         Layout::title(getSeo($seoData, 'searchTitle'));
         Layout::desc(getSeo($seoData, 'searchDesc'));
         Layout::heading(getSeo($seoData, 'searchHeading'));
     }
     Pagination::setTotal($data['total'], Config::get('searchResultsLimit', 'limit'), Config::get('searchPaginaLimit', 'limit'));
     Pagination::setCurrent($getData['page']);
     Pagination::setNumLinks(3);
     Pagination::run();
     $data['pagination'] = Pagination::getPagina();
     Layout::view('vSearch', $data);
 }
Example #4
0
         $label = $queries->getWhere('forums_topic_labels', array('id', '=', $sticky->label));
         $label = '<span class="label label-' . htmlspecialchars($label[0]->label) . '">' . htmlspecialchars($label[0]->name) . '</span>';
     } else {
         // no
         $label = '';
     }
     // Add to array
     $sticky_array[] = array('topic_title' => htmlspecialchars($sticky->topic_title), 'topic_id' => $sticky->id, 'topic_created_rough' => $timeago->inWords(date('d M Y, H:i', $sticky->topic_date), $time_language), 'topic_created' => date('d M Y, H:i', $sticky->topic_date), 'topic_created_username' => htmlspecialchars($user->IdToName($sticky->topic_last_user)), 'topic_created_mcname' => htmlspecialchars($user->IdToMCName($sticky->topic_last_user)), 'views' => $sticky->topic_views, 'locked' => $sticky->locked, 'posts' => $replies, 'last_reply_avatar' => $last_reply_avatar, 'last_reply_rough' => $timeago->inWords(date('d M Y, H:i', $sticky->topic_reply_date), $time_language), 'last_reply' => date('d M Y, H:i', $sticky->topic_reply_date), 'last_reply_username' => htmlspecialchars($user->IdToName($sticky->topic_last_user)), 'last_reply_mcname' => htmlspecialchars($user->IdToMCName($sticky->topic_last_user)), 'label' => $label);
 }
 // Clear out variables
 $stickies = null;
 $sticky = null;
 // Latest discussions
 // PAGINATION
 // Set current page and number of records
 $pagination->setCurrent($p);
 $pagination->setTotal(count($topics));
 $pagination->alwaysShowPagination();
 // Get number of topics we should display on the page
 $paginate = PaginateArray($p);
 $n = $paginate[0];
 $f = $paginate[1];
 // Get the number we need to finish on ($d)
 if (count($topics) > $f) {
     $d = $p * 10;
 } else {
     $d = count($topics) - $n;
     $d = $d + $n;
 }
 $template_array = array();
 // Get a list of all topics from the forum, and paginate
Example #5
0
function formatPagination($current_page, $result_count)
{
    global $search_results_per_page;
    $pagination = new Pagination();
    $pagination->setCurrent($current_page);
    $pagination->setTotal($result_count);
    $pagination->setRPP($search_results_per_page);
    $pagination->setClasses(array("pagination", "pagination-right"));
    return $pagination->parse();
}
Example #6
0
?>
                        <a href="<?php 
echo $websiteUrl . 'movies/mv' . sprintf("%07s", $actormovie->movie_id) . '/';
?>
">Go To Movie</a>
                    </div>
                </div>
                <hr>
                <?php 
$num_rec_per_page = 10;
$page = isset($get['page']) ? $get['page'] : 1;
$start_from = ($page - 1) * $num_rec_per_page;
$query = "SELECT rt.*,mv.title,mv.release_date FROM " . $db_prefix . "ratings rt JOIN " . $db_prefix . "movies mv ON rt.movie_id=mv.movie_id WHERE rt.actor_id='{$actorid}' AND mv.movie_id='{$movieid}'";
$all = $db->sql_query($query);
$pagi = new Pagination();
$pagi->setCurrent($page);
$pagi->setTotal($all->num_rows);
$pagi->setRPP($num_rec_per_page);
$comments = $db->sql_query("{$query} ORDER BY rate_date DESC LIMIT {$start_from}, {$num_rec_per_page}");
?>
                <section class="comment-list">
                    <h2>Ratings and Comments</h2>
                    <?php 
if ($comments->num_rows > 0) {
    while ($comment = $comments->fetch_object()) {
        $user = fetchUserDetailsByID($comment->user_id);
        ?>
                    <article>
                        <div class="panel panel-default arrow left">
                            <div class="panel-body">
                                <header class="text-left">
    $fundRaising = isset($_GET['fundRaising']) ? $_GET['fundRaising'] : null;
    $number = isset($_GET['number']) ? (int) $_GET['number'] : 0;
    $number2 = isset($_GET['number2']) ? (int) $_GET['number2'] : 0;
    if ($fundRaising != null) {
        $startups = $Startup->searchByFundraisingDetails($fundRaising, $number, $number2, array('filter' => 'raising'));
    } else {
        $startups = $Startup->startupsWithRaising(array('query' => $query, 'type' => 'Startup', 'filter' => 'raising', 'page' => $page, 'per_page' => '3'));
    }
} else {
    $startups = $Startup->raising($page)['startups'];
}
$pagination_markup = "";
if ($raising['total'] > 3) {
    require 'libs/Pagination.class';
    $pagination = new Pagination();
    $pagination->setCurrent($page);
    $pagination->setTotal($raising['total']);
    $pagination_markup = $pagination->parse();
}
if (isset($_GET['vd'])) {
    vd($startups);
}
?>

<?php 
include 'header.php';
?>

<div class="container">

Example #8
0
    public function displayMerchant($data = '')
    {
        $ccCon = ccController();
        $total_records = 0;
        $path_to_upload = Yii::getPathOfAlias('webroot') . "/upload";
        if (is_array($data) && count($data) >= 1) {
            $total_records = (int) $data['0']['total_records'];
            foreach ($data as $val) {
                //$address=$val['street']." ".$val['city']." ".$val['state']." ".$val['post_code'] ." ".$val['country_code'];
                //$address=$val['street']." ".$val['city']." ".$val['state']." ".$val['country_code'];
                $address = $val['street'] . " " . $val['city'] . " " . $val['state'];
                $is_merchant_open = Yii::app()->functions->isMerchantOpen($val['merchant_id']);
                $merchant_preorder = Yii::app()->functions->getOption("merchant_preorder", $val['merchant_id']);
                $ratings = Yii::app()->functions->getRatings($val['merchant_id']);
                $rating_meanings = '';
                if ($ratings['ratings'] >= 1) {
                    $rating_meaning = Yii::app()->functions->getRatingsMeaning($ratings['ratings']);
                    $rating_meanings = ucwords($rating_meaning['meaning']);
                }
                $tag_open = '';
                if ($is_merchant_open == TRUE) {
                    $tag_open = '<div class="uk-badge uk-badge-success">' . t("Open") . '</div>';
                } else {
                    if ($merchant_preorder) {
                        $tag_open = '<div class="uk-badge uk-badge-success">' . t("Pre-Order") . '</div>';
                    } else {
                        $tag_open = '<div class="uk-badge uk-badge-danger">' . t("Closed") . '</div>';
                    }
                }
                $rating = "<div class=\"rate-wrap\">\n\t\t\t<h6 class=\"rounded2\" data-uk-tooltip=\"{pos:'bottom-left'}\" title=\"{$rating_meanings}\" >" . number_format($ratings['ratings'], 1) . "</h6>\n\t\t\t<span>" . $ratings['votes'] . " " . Yii::t("default", "Votes") . "</span>\t\t\t\n\t\t\t</div>";
                $merchant_id = $val['merchant_id'];
                $lat = Yii::app()->functions->getOption("merchant_latitude", $merchant_id);
                $long = Yii::app()->functions->getOption("merchant_longtitude", $merchant_id);
                ?>
		   <div class="links" data-id="<?php 
                echo $address;
                ?>
" >
		   <div class="uk-grid" id="restaurant-mini-list">
		     <div class="uk-width-3-10">		     
		      <a href="<?php 
                echo baseUrl() . "{$ccCon}/menu/merchant/" . $val['restaurant_slug'];
                ?>
">
		      <?php 
                if (!empty($val['merchant_logo'])) {
                    ?>
		      <img class="uk-thumbnail uk-thumbnail-mini" src="<?php 
                    echo Yii::app()->request->baseUrl . "/upload/" . $val['merchant_logo'];
                    ?>
">
		      <?php 
                } else {
                    ?>
		      <img class="uk-thumbnail uk-thumbnail-mini" src="<?php 
                    echo Yii::app()->request->baseUrl . "/assets/images/thumbnail-medium.png";
                    ?>
">
		      <?php 
                }
                ?>
		      </a>
		     </div>
		     <div class="uk-width-7-10">
		        <h5><a href="<?php 
                echo baseUrl() . "{$ccCon}/menu/merchant/" . $val['restaurant_slug'];
                ?>
">
		        <?php 
                echo $val['restaurant_name'];
                ?>
</a>
		       </h5>
		        <p class="uk-text-muted"><?php 
                echo $address;
                ?>
</p>
		        <a class="view-map" href="javascript:;" data-id="<?php 
                echo $address;
                ?>
" data-lat="<?php 
                echo $lat;
                ?>
" data-long="<?php 
                echo $long;
                ?>
" data-merchantname="<?php 
                echo ucwords($val['restaurant_name']);
                ?>
" >
		        <i class="fa fa-map-marker"></i>
 <?php 
                echo Yii::t("default", "View Map");
                ?>
</a>
                <?php 
                echo $tag_open;
                ?>
		        <?php 
                echo $rating;
                ?>
		        		       
		     </div>
		   </div>
		   </div>
		   <?php 
            }
            $path = Yii::getPathOfAlias('webroot') . "/protected/vendor";
            require_once $path . "/Pagination/Pagination.class.php";
            $page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
            $pagination = new Pagination();
            $pagination->setCurrent($page);
            $pagination->setRPP(10);
            $pagination->setTotal($total_records);
            echo $pagination->parse();
        } else {
            ?>
<p class="uk-text-muted"><?php 
            echo Yii::t("default", "No data available");
            ?>
</p><?php 
        }
    }
Example #9
0
    function display_properties_payments()
    {
        ?>
        <table id="payments-table" cellpadding="10px">
            <tr>
                <th><?php 
        _e('Transaction ID', 'framework');
        ?>
</th>
                <th><?php 
        _e('Payment Date', 'framework');
        ?>
</th>
                <th><?php 
        _e('First Name', 'framework');
        ?>
</th>
                <th><?php 
        _e('Last Name', 'framework');
        ?>
</th>
                <th><?php 
        _e('Payer Email', 'framework');
        ?>
</th>
                <th><?php 
        _e('Payment Status', 'framework');
        ?>
</th>
                <th><?php 
        _e('Amount', 'framework');
        ?>
</th>
                <th><?php 
        _e('Currency', 'framework');
        ?>
</th>
                <th><?php 
        _e('Property ID', 'framework');
        ?>
</th>
                <th><?php 
        _e('Property Status', 'framework');
        ?>
</th>
                <th><?php 
        _e('Action', 'framework');
        ?>
</th>
            </tr>
            <?php 
        // determine page (based on <_GET>)
        $page_number = isset($_GET['page_number']) ? (int) $_GET['page_number'] : 1;
        $number_of_properties = 20;
        $paid_props_args = array('post_type' => 'property', 'posts_per_page' => $number_of_properties, 'paged' => $page_number, 'meta_query' => array(array('key' => 'payment_status', 'value' => 'Completed')));
        $paid_props_query = new WP_Query($paid_props_args);
        if ($paid_props_query->have_posts()) {
            $total_found_posts = $paid_props_query->found_posts;
            while ($paid_props_query->have_posts()) {
                $paid_props_query->the_post();
                global $post;
                $values = get_post_custom($post->ID);
                $not_available = __('Not Available', 'framework');
                $txn_id = isset($values['txn_id']) ? esc_attr($values['txn_id'][0]) : $not_available;
                $payment_date = isset($values['payment_date']) ? esc_attr($values['payment_date'][0]) : $not_available;
                $payer_email = isset($values['payer_email']) ? esc_attr($values['payer_email'][0]) : $not_available;
                $first_name = isset($values['first_name']) ? esc_attr($values['first_name'][0]) : $not_available;
                $last_name = isset($values['last_name']) ? esc_attr($values['last_name'][0]) : $not_available;
                $payment_status = isset($values['payment_status']) ? esc_attr($values['payment_status'][0]) : $not_available;
                $payment_gross = isset($values['payment_gross']) ? esc_attr($values['payment_gross'][0]) : $not_available;
                $payment_currency = isset($values['mc_currency']) ? esc_attr($values['mc_currency'][0]) : $not_available;
                ?>
                    <tr>
                        <td><?php 
                echo $txn_id;
                ?>
</td>
                        <td><?php 
                echo $payment_date;
                ?>
</td>
                        <td><?php 
                echo $first_name;
                ?>
</td>
                        <td><?php 
                echo $last_name;
                ?>
</td>
                        <td><?php 
                echo $payer_email;
                ?>
</td>
                        <td><?php 
                echo $payment_status;
                ?>
</td>
                        <td><?php 
                echo $payment_gross;
                ?>
</td>
                        <td><?php 
                echo $payment_currency;
                ?>
</td>
                        <td><?php 
                echo $post->ID;
                ?>
</td>
                        <td><?php 
                echo $post->post_status;
                ?>
</td>
                        <td><a href="<?php 
                echo get_edit_post_link($post->ID);
                ?>
"><?php 
                _e('Edit Property', 'framework');
                ?>
</a></td>
                    </tr>
                    <?php 
            }
            if ($total_found_posts > $number_of_properties) {
                ?>
                    <tr>
                        <td colspan="11">
                            <?php 
                require_once get_template_directory() . '/framework/functions/Pagination.class.php';
                // instantiate; set current page; set number of records
                $pagination = new Pagination();
                $pagination->setCurrent($page_number);
                $pagination->setTotal($total_found_posts);
                // grab rendered/parsed pagination markup
                echo $pagination->parse();
                ?>
                        </td>
                    </tr>
                    <?php 
            }
            wp_reset_query();
        } else {
            ?>
                <tr>
                    <td colspan="11"><?php 
            _e('No Completed Payment Found!', 'framework');
            ?>
</td>
                </tr>
                <?php 
        }
        ?>
        </table>
        <?php 
    }