当前位置: 首页>>代码示例>>PHP>>正文


PHP pagination::calculate方法代码示例

本文整理汇总了PHP中pagination::calculate方法的典型用法代码示例。如果您正苦于以下问题:PHP pagination::calculate方法的具体用法?PHP pagination::calculate怎么用?PHP pagination::calculate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pagination的用法示例。


在下文中一共展示了pagination::calculate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

    $p->items($items);
    $p->limit(30);
    // Limit entries per page
    $p->currentPage($_GET[$p->paging]);
    // Gets and validates the current page
    // Calculates what to show
    $p->parameterName('paging');
    $p->adjacents(1);
    //No. of page away from the current page
    $p->target("tools.php?page=" . plugin_basename(dirname(__FILE__)) . "/modulo-vendas.php" . $ordenar_query . $filtrar_query);
    if (!isset($_GET['paging'])) {
        $p->page = 1;
    } else {
        $p->page = $_GET['paging'];
    }
    $p->calculate();
    //Query for limit paging
    $limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
    if ($ordenar_por) {
        $obter_vendas = "SELECT * from {$table_name} order by {$ordenar_por} asc {$limit}";
    } else {
        $obter_vendas = "SELECT * from {$table_name} order by id asc {$limit}";
    }
    if ($filtrar_por) {
        $obter_vendas = "SELECT * from {$table_name} where status='{$filtrar_por}' order by id asc {$limit}";
    }
    $vendas = $wpdb->get_results($obter_vendas);
    $colunas = $wpdb->get_col_info('name');
} else {
    echo "No Record Found";
}
开发者ID:alexanmtz,项目名称:M-dulo-de-pagamento-para-wordpress,代码行数:31,代码来源:modulo-vendas.php

示例2: WassUp


//.........这里部分代码省略.........
			if ($wassup_options->wassup_spamcheck == 1) { ?>
			<li><span><a href="#TB_inline?height=180&width=300&inlineId=hiddenspam" class="thickbox"><?php echo $spamtot; ?></a></span> <span>(<?php echo @number_format(($spamtot*100/$pagestot), 2); ?>%)</span> <small><?php _e('Spams','wassup'); ?></small></li>
			<?php } ?>
                        </ul>
                <?php
                // Print the Google chart!
                if ($pagestot > 20) {
                        echo $Tot->TheChart($last, $res, "125", $search, $wassup_options->wassup_chart_type, "bg,s,ffffff")."";
                } else {
                        echo '<div id="placeholder" align="center"><p style="padding-top:50px;">'.__('Too few records to print chart','wassup').'...</p></div>';
                } ?>
                </div>
        </div>
        <?php   } //end if wassup_chart == 1
	
		if (!isset($_GET['limit']) OR $_GET['limit'] == 10 OR $_GET['limit'] == 20) { 
		
			$expcol = '
		<table width="100%"><tr>
		<td align="left" class="legend"><a href="#" class="toggle-all">'.__('Expand All','wassup').'</a></td>
		<td align="right" class="legend"><a href="#" class="toggle-allcrono">'.__('Collapse Chronology','wassup').'</a></td>
		</tr></table><br />';
		}
		
		// MAIN QUERY
		$main = $Tot->calc_tot("main", $search);

		if ($itemstot > 0) {
		$p=new pagination();
		$p->items($itemstot);
		$p->limit($items);
		$p->currentPage($pages);
		$p->target("admin.php?page=".WASSUPFOLDER."&limit=$items&type=$type&last=$last&search=$search");
		$p->calculate();
		$p->adjacents(5);
		}

		// hidden spam options
                ?>
                <div id="hiddenspam" style="display:none;">
        <h2><?php _e('Spam Options','wassup'); ?></h2>
        <form action="" method="post">
	<p><input type="checkbox" name="wassup_spamcheck" value="1" <?php if($wassup_options->wassup_spamcheck == 1 ) print "CHECKED"; ?> /> <strong><?php _e('Enable/Disable Spam Check on Records','wassup'); ?></strong></p>
        <p style="padding-left:30px;"><input type="checkbox" name="wassup_spam" value="1" <?php if($wassup_options->wassup_spam == 1) print "CHECKED"; ?> /> <?php _e('Record Akismet comment spam attempts','wassup'); ?></p>
        <p style="padding-left:30px;"><input type="checkbox" name="wassup_refspam" value="1" <?php if($wassup_options->wassup_refspam == 1) print "CHECKED"; ?> /> <?php _e('Record referrer spam attempts','wassup'); ?></p>
        <p style="padding-left:0;"><input type="submit" name="submit-spam" value="<?php _e('Save Settings','wassup'); ?>" /></p>
        </form>
                </div>
                <table width="100%">
                <tr>
                <td align="left" class="legend">
                <?php
		// Marked items - Refresh
                if ($wassup_options->wmark == 1) echo '<a href="?'.$_SERVER['QUERY_STRING'].'&search='.$wassup_options->wip.'" title="'.__('Filter by marked IP','wassup').'"><strong>'.$markedtot.'</strong> '.__('show marked items','wassup').'</a> - ';
                if (!empty($search)) print "<strong>$searchtot</strong> ".__('Searched for','wassup').": <strong>$search</strong> - ";
                echo __('Auto refresh in','wassup').' <span id="CountDownPanel"></span> '.__('seconds','wassup'); ?>
		</td>
		<td align="right" class="legend"><a href="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/lib/action.php?action=topten&whash='.$whash.'&from_date='.$from_date.'&to_date='.$to_date.'&width='.$res.'&height=400'; ?>" class="thickbox" title="Wassup <?php _e('Top Ten','wassup'); ?>"><?php _e('Show Top Ten','wassup'); ?></a> - <a href="#" class='show-search'><?php _e('Search','wassup'); ?></a></td>
                </tr>
                </table>
<div class="search-ip" style="display: none;">
	<table border=0 width="100%">
		<tr valign="top">
		<td align="right">
        	<form action="" method="get">
		<input type="hidden" name="page" value="<?php echo WASSUPFOLDER; ?>" />
开发者ID:alx,项目名称:alexgirard.com-blog,代码行数:67,代码来源:wassup.php

示例3: Iscritti

function Iscritti()
{
    require 'pagination.class.php';
    global $_POST;
    global $wpdb;
    $table_email = $wpdb->prefix . "nl_email";
    //cancellazione provamoce
    if ($_POST['delete'] && $_POST['id_email']) {
        $delete = $wpdb->query("delete from {$table_email} where id_email = '{$_POST['id_email']}'");
        echo '<div id="message" class="updated fade"><p><strong>' . __("Email deleted succesfully!", "sendit") . '</strong></p></div>';
        //print_r($_POST);
    }
    //modifica provamoce
    if ($_POST['update']) {
        //$code = md5(uniqid(rand(), true));
        $update = $wpdb->query("update {$table_email} set email = '{$_POST['email']}', magic_string='{$_POST['code']}', accepted = '{$_POST['status']}' where id_email = '{$_POST['id_email']}'");
        echo '<div id="message" class="updated fade"><p><strong>' . sprintf(__('email %s edited succesfully', 'sendit'), $_POST[email]) . '</p></div>';
        //print_r($_POST);
    }
    //aggiunta indirizzo o indirizzi email dalla textarea
    if ($_POST['emails_add'] != "") {
        //ver 1.1 multiaddress support
        $email_add = explode("\n", $_POST['emails_add']);
        foreach ($email_add as $key => $value) {
            //echo $value."<br />";
            //validation fix 1.5.6 (also there!) {2,4}
            if (!ereg("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,4})\$", trim($value))) {
                echo '<div id="message" class="error"><p><strong>indirizzo email ' . $value . ' non valido!</strong></p></div>';
            } else {
                $user_count = $wpdb->get_var("SELECT COUNT(*) FROM {$table_email} where email ='{$value}' and id_lista = '{$_GET['lista']}' order by email;");
                if ($user_count > 0) {
                    echo "<div class=\"error\"><p><strong>" . sprintf(__('email %s already present', 'sendit'), $value) . "</strong></p></div>";
                } else {
                    //genero stringa univoca x conferme e cancellazioni sicure
                    $code = md5(uniqid(rand(), true));
                    $wpdb->query("INSERT INTO {$table_email} (email,id_lista, magic_string, accepted) VALUES ('{$value}', '{$_POST['id_lista']}', '{$code}', 'y')");
                    echo '<div class="updated fade"><p><strong>' . sprintf(__('email %s added succesfully!', 'sendit'), $value) . '</strong></p></div>';
                }
            }
        }
        //fine ciclo for
    }
    $email_items = $wpdb->get_var("SELECT count(*) FROM {$table_email} where id_lista= '{$_GET['lista']}'");
    // number of total rows in the database
    if ($email_items > 0) {
        $p = new pagination();
        $p->items($email_items);
        $p->limit(20);
        // Limit entries per page
        $p->target("admin.php?page=lista-iscritti&lista=" . $_GET['lista']);
        $p->currentPage($_GET[$p->paging]);
        // Gets and validates the current page
        $p->calculate();
        // Calculates what to show
        $p->parameterName('paging');
        $p->adjacents(1);
        //No. of page away from the current page
        if (!isset($_GET['paging'])) {
            $p->page = 1;
        } else {
            $p->page = $_GET['paging'];
        }
        //Query for limit paging
        $limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
    } else {
        //echo "No Record Found";
    }
    $emails = $wpdb->get_results("SELECT id_email, id_lista, email, subscriber_info, magic_string, accepted FROM {$table_email} where id_lista= '{$_GET['lista']}' order by email {$limit}");
    //email confermat
    $emails_confirmed = $wpdb->get_results("SELECT id_email, id_lista, email, subscriber_info, magic_string, accepted FROM {$table_email} where id_lista= '{$_GET['lista']}' and accepted='y'");
    echo "<div class=\"wrap\"><h2>" . __('Subscribers', 'sendit') . "</h2>";
    //estraggo le liste
    $table_liste = $wpdb->prefix . "nl_liste";
    $liste = $wpdb->get_results("SELECT id_lista, nomelista FROM {$table_liste} ");
    // print_r($_POST);
    echo "<div class=\"table\">\n\t\t\t<table class=\"widefat  fixed\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>" . __('id', 'sendit') . "</th>\n\t\t\t\t\t\t<th class=" . $css_list . ">" . __('mailing list', 'sendit') . "</th>\n\t\t\t\t\t\t<th>" . __('actions', 'sendit') . "</th>\n\n\t\t\t\t\t</tr>\n\t\t\t\t</thead><tbody>";
    foreach ($liste as $lista) {
        if ($_GET['lista'] == $lista->id_lista) {
            $selected = " class=\"updated fade\"";
        } else {
            $selected = "";
        }
        echo "<tr >\n                \t\t<td>" . $lista->id_lista . "</td>\n                \t\t<td " . $selected . "><a class=\"\" href=\"admin.php?page=lista-iscritti&lista=" . $lista->id_lista . "\">" . $lista->nomelista . "</a></td>\n                \t\t<td></td><tr>";
    }
    echo "</tbody></table>\n        </div><br clear=\"all\\ />";
    /*miglioro facendo comparire la form x aggiungere solo se selezionata una lista*/
    if ($_GET['lista']) {
        echo "<h3>" . __('Manual Subscribe mailing list ', 'sendit') . " " . $_POST['lista'] . "</h3>\n\n                <label for=\"email_add\">" . __('email address (one or more: default separator= line break)', 'sendit') . "<br />\n               <div id=\"dashboard-widgets\" class=\"metabox-holder\">\n               <div class='postbox-container' style='width:49%;'>\n\t\t\t\t<div id=\"normal-sortables\" class=\"meta-box-sortables\">\n\t\t\t\t<div id=\"dashboard_right_now\" class=\"postbox \" >\n\t\t\t\t\t<div class=\"handlediv\" title=\"Fare clic per cambiare.\"><br /></div>\n\t\t\t\t<h3 class='hndle'><span>" . __('Subscription', 'sendit') . "</span></h3>\n\t\t\t\t<div class=\"inside\">\n\t\t\t\t        <p>" . __('Copy here one or more email address', 'sendit') . "</p>\n\n\t\t\t\t\t           <form id=\"add\" name=\"add\" method=\"post\" action=\"admin.php?page=lista-iscritti&lista=" . $_GET[lista] . "\">\n\n                \n                <textarea id=\"emails_add\" type=\"text\" value=\"\" name=\"emails_add\" rows=\"10\" cols=\"50\"/></textarea></label>\n                 <input type=\"hidden\" name=\"id_lista\" value=\"" . $_GET[lista] . "\" /> \n\n                <input class=\"button\" type=\"submit\" value=\"" . __('Add', 'sendit') . "\"/>\n                </p>\n                            </form>\n                </div>\n               </div>\n               </div>\n               </div>\n               </div>\n               <br clear=\"all\" />";
        //posiziono la paginazione
        echo "<h3>" . __('Subscribers', 'sendit') . " n." . $email_items . " (" . __('Subscriptions confirmed', 'sendit') . ": " . count($emails_confirmed) . ")</h3>";
        if ($p) {
            echo $p->show();
        }
        echo "\n        <br clear=\"all\" />\n\t\t\t<table class=\"widefat post fixed\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>";
        if (get_option('sendit_gravatar') == 'yes') {
            echo "<th style=\"width:30px !important;\"></th>";
        }
        echo "<th>" . __('email', 'sendit') . "</th>\n\t\t\t\t\t\t<th>" . __('status', 'sendit') . "</th>\n\t\t\t\t\t\t<th>" . __('Additional info', 'sendit') . "</th>\n\t\t\t\t\t\t<th>" . __('actions', 'sendit') . "</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n    \t\n        ";
        foreach ($emails as $email) {
            //coloro le input per distinguere tra chi ha confermato e chi no
//.........这里部分代码省略.........
开发者ID:tammia,项目名称:sendit,代码行数:101,代码来源:admin.php

示例4: url


//.........这里部分代码省略.........
                    esc_attr_e('Save Changes', 'woocommerce-ac');
                    ?>
" />
							  </p>
						    </form>
						  </div>
						<?php 
                } elseif ($action == 'listcart' || $action == '') {
                    ?>
						
			<p> <?php 
                    _e('The list below shows all Abandoned Carts which have remained in cart for a time higher than the "Cart abandoned cut-off time" setting.', 'woocommerce-ac');
                    ?>
 </p>
			
			<?php 
                    //echo plugins_url();
                    include_once "pagination.class.php";
                    /* Find the number of rows returned from a query; Note: Do NOT use a LIMIT clause in this query */
                    $wpdb->get_results("SELECT wpac . * , wpu.user_login, wpu.user_email \n\t\t\t\t\t  FROM `" . $wpdb->prefix . "ac_abandoned_cart_history` AS wpac \n\t\t\t\t\t  LEFT JOIN " . $wpdb->prefix . "users AS wpu ON wpac.user_id = wpu.id\n\t\t\t\t\t  WHERE recovered_cart='0' AND unsubscribe_link='0' ");
                    $count = $wpdb->num_rows;
                    if ($count > 0) {
                        $p = new pagination();
                        $p->items($count);
                        $p->limit(10);
                        // Limit entries per page
                        $p->target("admin.php?page=woocommerce_ac_page&action=listcart");
                        if (isset($p->paging)) {
                            if (isset($_GET[$p->paging])) {
                                $p->currentPage($_GET[$p->paging]);
                            }
                            // Gets and validates the current page
                        }
                        $p->calculate();
                        // Calculates what to show
                        $p->parameterName('paging');
                        $p->adjacents(1);
                        //No. of page away from the current page
                        $p->showCounter(true);
                        if (!isset($_GET['paging'])) {
                            $p->page = 1;
                        } else {
                            $p->page = $_GET['paging'];
                        }
                        //Query for limit paging
                        $limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
                    } else {
                        $limit = "";
                    }
                    ?>
			  
			<div class="tablenav">
			    <div class='tablenav-pages'>
			    	<?php 
                    if ($count > 0) {
                        echo $p->show();
                    }
                    // Echo out the list of paging.
                    ?>
			    </div>
			</div>
			
			<?php 
                    $order = "";
                    if (isset($_GET['order'])) {
                        $order = $_GET['order'];
开发者ID:shahadat014,项目名称:geleyi,代码行数:67,代码来源:woocommerce-ac.php

示例5: wp_ulike_bbpress_likes_logs

/**
 * Create WP ULike bbPress Logs page with separate pagination
 *
 * @author       	Alimir	 	
 * @since           2.2
 * @return			String
 */
function wp_ulike_bbpress_likes_logs()
{
    global $wpdb;
    $alternate = true;
    $items = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "ulike_forums");
    if ($items > 0) {
        $p = new pagination();
        $p->items($items);
        $p->limit(wp_ulike_logs_return_per_page());
        // Limit entries per page
        $p->target("admin.php?page=wp-ulike-bbpress-logs");
        $p->calculate();
        // Calculates what to show
        $p->parameterName('page_number');
        $p->adjacents(1);
        //No. of page away from the current page
        if (!isset($_GET['page_number'])) {
            $p->page = 1;
        } else {
            $p->page = $_GET['page_number'];
        }
        //Query for limit page_number
        $limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
        $get_ulike_logs = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "ulike_forums ORDER BY id DESC " . $limit . "");
        ?>
	<div class="wrap">
		<h2><?php 
        _e('WP ULike Logs', 'alimir');
        ?>
</h2>
		<h3><?php 
        _e('Topics Likes Logs', 'alimir');
        ?>
</h3>
		<div class="tablenav">
			<div class='tablenav-pages'>
				<span class="displaying-num"><?php 
        echo $items . ' ' . __('Logs', 'alimir');
        ?>
</span>
				<?php 
        echo $p->show();
        // Echo out the list of paging.
        ?>
			</div>
		</div>
		<table class="widefat">
			<thead>
				<tr>
					<th width="2%"><?php 
        _e('ID', 'alimir');
        ?>
</th>
					<th width="10%"><?php 
        _e('Username', 'alimir');
        ?>
</th>
					<th><?php 
        _e('Status', 'alimir');
        ?>
</th>
					<th width="6%"><?php 
        _e('Topic ID', 'alimir');
        ?>
</th>
					<th><?php 
        _e('Topic Title', 'alimir');
        ?>
</th>
					<th width="20%"><?php 
        _e('Date / Time', 'alimir');
        ?>
</th>
					<th><?php 
        _e('IP', 'alimir');
        ?>
</th>
					<th><?php 
        _e('Actions', 'alimir');
        ?>
</th>
				</tr>
			</thead>
			<tbody class="wp_ulike_logs">
				<?php 
        foreach ($get_ulike_logs as $get_ulike_log) {
            ?>
				<tr <?php 
            if ($alternate == true) {
                echo 'class="alternate"';
            }
            ?>
>
//.........这里部分代码省略.........
开发者ID:hyperweb2,项目名称:wp-ulike,代码行数:101,代码来源:logs.php

示例6: show_easy_gallery

function show_easy_gallery($atts, $content = null)
{
    $order = 'desc';
    $pagesql = '';
    $limit = '';
    $count = 8;
    $page = true;
    $page_st = true;
    $theme = 'fancybox';
    $view = 'album';
    $album = '';
    global $wpdb;
    //echo "select * from easy_photos order  by $order limit $limit offset $offset";
    if (isset($atts['order'])) {
        $order = $atts['order'];
    }
    if (isset($atts['theme'])) {
        $theme = trim($atts['theme']);
        if ($theme != 'fancybox' && $theme != 'swipebox') {
            $theme = 'fancybox';
        }
    }
    if (isset($atts['view'])) {
        $view = trim($atts['view']);
        if ($view != 'album' && $view != 'image') {
            $view = 'album';
        }
    }
    if (isset($atts['album'])) {
        $album = trim($atts['album']);
    }
    if (isset($atts['limit'])) {
        $count = trim($atts['limit']);
        if ($count < 1) {
            $count = 2;
        }
    }
    $order = strtolower($order);
    if ($order != 'asc' && $order != 'desc') {
        $order = 'desc';
    }
    if (isset($atts['pagination'])) {
        $page_st = trim($atts['pagination']);
        if ($page_st != 'true' && $page_st != 'false') {
            $page_st = 'true';
        }
    }
    if ($page_st == 'true') {
        $page = true;
        $sql = "  SELECT DISTINCT(a.album_id) FROM easy_album a,easy_photos b WHERE a.album_id=b.album_id AND a.disabled=0 AND b.disabled=0";
        if ($album != '') {
            $sql = $sql . " and a.album_id = {$album}";
        }
        if ($view == 'image') {
            $sql = "select * from easy_photos  where album_id not in(select album_id from easy_album b where b.disabled=1) and disabled=0";
            if ($album != '') {
                $sql = $sql . " and album_id = {$album}";
            }
        }
        $rows = $wpdb->get_results($sql);
        $items = count($rows);
        if ($items > 0) {
            $p = new pagination();
            $p->items($items);
            $p->limit($count);
            // Limit entries per page
            if ($album != '') {
                $p->target(get_permalink() . '?album=' . $album);
            } else {
                $p->target(get_permalink());
            }
            //$p->urlFriendly();
            if (isset($p->paging)) {
                $p->currentPage($_GET[$p->paging]);
            }
            // Gets and validates the current page
            $p->calculate();
            // Calculates what to show
            $p->parameterName('paging');
            $p->nextLabel('');
            //removing next text
            $p->prevLabel('');
            //removing previous text
            $p->nextIcon('&#9658;');
            //Changing the next icon
            $p->prevIcon('&#9668;');
            //Changing the previous icon
            $p->adjacents(1);
            //No. of page away from the current page
            if (!isset($_GET['paging'])) {
                $p->page = 1;
            } else {
                $p->page = $_GET['paging'];
            }
            //Query for limit paging
            $limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
        } else {
            echo "No Images";
        }
    } else {
//.........这里部分代码省略.........
开发者ID:shankpaul,项目名称:easygallery,代码行数:101,代码来源:easy-front-end.php

示例7: create_paginator

function create_paginator($currentpage, $nb_items, $path)
{
    require_once ROOT_DIR . '/' . INC_DIR . '/paginator-digg/pagination.php';
    $p = new pagination();
    $p->items($nb_items);
    $p->currentPage($currentpage);
    $p->limit(1);
    $p->urlFriendly();
    $p->target(URL . "/{$path}/page/%");
    if ("" === $path) {
        $p->target(URL . "/page/%");
    }
    $p->adjacents(1);
    if (!$p->calculate) {
        if ($p->calculate()) {
            return "<div class=\"{$p->className}\">{$p->pagination}</div>";
        }
    }
}
开发者ID:holdensmagicalunicorn,项目名称:Volatile,代码行数:19,代码来源:functions.php

示例8: list_voucher_display_settings

function list_voucher_display_settings()
{
    global $wpdb;
    $sql = 'SELECT COUNT(*) FROM wp_voucher_post';
    $items = $wpdb->get_var($sql);
    //  $items = mysql_num_rows(mysql_query("SELECT * FROM wp_voucher_post")); // number of total rows in the database
    if ($items > 0) {
        $p = new pagination();
        $p->items($items);
        $p->limit(500);
        // Limit entries per page
        $p->target("admin.php?page=list_voucher_settings");
        $p->currentPage($_GET[$p->paging]);
        // Gets and validates the current page
        $p->calculate();
        // Calculates what to show
        $p->parameterName('paging');
        $p->adjacents(1);
        //No. of page away from the current page
        if (!isset($_GET['paging'])) {
            $p->page = 1;
        } else {
            $p->page = $_GET['paging'];
        }
        //Query for limit paging
        $limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
    } else {
        echo "No Record Found";
    }
    echo '<div class="wrap">
	<h2>List of Records</h2>
 
	<div class="tablenav">
		<div class="tablenav-pages">';
    echo $p->show();
    echo '</div>
	</div>
 
	<table class="widefat">
		<thead>
			 <tr>
				 <th><strong>ID</strong></th>
				 <th><strong>Người nhận</strong></th>
				 <th><strong>Email</strong></th>
                 <th><strong>Điện thoại</strong></th>
                 <th><strong>Tên voucher</strong></th>
                 <th><strong>Số lượng</strong></th>
			 </tr>
		</thead>
		<tbody>';
    $sql = "SELECT * FROM wp_voucher_post, wp_posts where wp_voucher_post.post_id = wp_posts.id ORDER BY wp_voucher_post.id DESC {$limit}";
    $result = $wpdb->get_results($sql) or die('Error, query failed');
    foreach ($result as $value) {
        echo '<tr>
				<td>' . $value->post_id . '</td>
				<td>' . $value->fullname . '</td>
				<td>' . $value->email . '</td>
                <td>' . $value->phone . '</td>
                <td>' . $value->post_title . '</td>
                <td>' . $value->total . '</td>
			</tr>';
    }
    echo '</tbody>
	</table>
</div>';
}
开发者ID:vanlong200880,项目名称:tmdt,代码行数:66,代码来源:voucher.php

示例9: sc_render_manager_page


//.........这里部分代码省略.........
            }
            break;
        case 'upload':
            ?>
	
			<form action="" enctype="multipart/form-data" method="post" id ="add_track">
				<table class="form-table">
					<tr valign="top">
					  <th scope="row"><label for="track_title">Track title:</label></th>
					  <td><input type="text" name="track_title" size="30" class="regular-text code"></td>
					</tr>
					<tr valign="top">
					  <th scope="row"><label for="track_file">Please specify a track:</label></th>
					  <td><input type="file" name="track_file" id="track_file" size="40" accept="audio/*" class="regular-text code"></td>
					</tr>
					<tr valign="top">
					  <th scope="row"><label for="track_art">Please specify track artwork:</label></th>
					  <td><input type="file" name="track_art" id="track_art" size="40" accept="image/*" class="regular-text code"></td>
					</tr>
					<tr valign="top">
					  <th scope="row"><label for="tag">Track tags:</label></th>
					  <td><input type="text" name="tag" id="tag" size="30"><input type="button" id="add_tag" name="add_tag" class="button" value="Add Tag" />
						<br><ul id="tags"></ul></td>
					</tr>
					<tr valign="top">
					  <th scope="row"><label for="sharing">Track privacy:</label></th>
					  <td><select name="sharing">
						<option value="public">Public</option>
						<option value="private">Private</option>
					  </select></td>
					</tr>
					</table>
			<p class="submit"><input type="submit" value="Upload" class="button-primary"></p>
			</form>					
			<?php 
            try {
                $tmp_file = '/tmp/' . stripslashes($_FILES['track_file']['name']);
                $tmp_art_file = '/tmp/' . stripslashes($_FILES['track_art']['name']);
                if (move_uploaded_file($_FILES['track_file']['tmp_name'], $tmp_file) && move_uploaded_file($_FILES['track_art']['tmp_name'], $tmp_art_file)) {
                    // upload audio file
                    $track = json_decode($client->post('tracks', array('track[title]' => $_POST['track_title'], 'track[asset_data]' => '@' . $tmp_file, 'track[artwork_data]' => '@' . $tmp_art_file, 'track[tags]' => strlen($_POST['tags']) ? $_POST['tags'] : null, 'track[sharing]' => $_POST['sharing'])));
                    unlink(realpath($tmp_file));
                    unlink(realpath($tmp_art_file));
                }
            } catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
                var_dump($e->getMessage());
                exit;
            }
            break;
        case 'tracks':
            try {
                echo '</br>';
                $page_size = 5;
                // Pagination code
                $p = new pagination();
                $p->items($me['track_count']);
                $p->limit($page_size);
                // Limit entries per page
                $p->target("admin.php?page=soundcloud-manager&tab=tracks");
                $p->currentPage($_GET[$p->paging]);
                // Gets and validates the current page
                $p->calculate();
                // Calculates what to show
                $p->parameterName('paging');
                $p->adjacents(1);
                //No. of page away from the current page
                if (!isset($_GET['paging'])) {
                    $p->page = 1;
                } else {
                    $p->page = $_GET['paging'];
                }
                if ($p->page == 1) {
                    // get first page of tracks
                    $tracks = json_decode($client->get('users/' . $me['id'] . '/tracks', array('order' => 'created_at', 'limit' => $page_size)));
                } else {
                    // get additional pages of tracks
                    $tracks = json_decode($client->get('users/' . $me['id'] . '/tracks', array('order' => 'created_at', 'limit' => $page_size, 'offset' => $page_size * $page)));
                }
                ?>
				<div class="tablenav">
					<div class='tablenav-pages'>
						<?php 
                echo $p->show();
                ?>
					</div>
				</div>
				<?php 
                foreach ($tracks as $track) {
                    $client->setCurlOptions(array(CURLOPT_FOLLOWLOCATION => 1));
                    $embed_info = json_decode($client->get('oembed', array('url' => $track->permalink_url)));
                    // render the html for the player widget
                    echo $embed_info->html . '</br></br>';
                }
            } catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
                var_dump($e->getMessage());
                exit;
            }
            break;
    }
}
开发者ID:rdetwiler,项目名称:wp-soundcloud,代码行数:101,代码来源:soundcloud.php

示例10: pagination

<?php

// Make sure no one attempts to run this script "directly"
if (!defined('JURPO')) {
    exit;
}
$result = fn_query($conn_id, $query);
$total_data = fn_num_rows($result);
//$total_data = hitung_data($query);
if ($total_data > $row_count) {
    require_once "class_pagination.php";
    $path = $thisfile;
    if ($page_parameter) {
        $path .= "?{$page_parameter}";
    }
    $paging = new pagination($class_path);
    if (!empty($common_image_dir)) {
        $paging->image_dir = $common_image_dir;
    }
    $paging->pg = $page_id;
    //get value from script before this file called
    $paging->category = $category;
    //get value from script before this file called
    $paging->q = $HTTP_GET_VARS[q];
    $paging->paging_class = "lightBlue";
    $paging->set_target($path);
    $paging->calculate($total_data, $row_count, $page_count);
    $query .= " LIMIT {$row_count} OFFSET " . $paging->min;
    $no = $paging->min;
    $page_view = $paging->pagination;
}
开发者ID:JulieNielsen,项目名称:jurpopage-diku-edition,代码行数:31,代码来源:paging_script.php


注:本文中的pagination::calculate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。