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


PHP Paginator::findStart方法代码示例

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


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

示例1: adminPage

        /**
         * Handles displaying of the DatabaseBrowser admin page
         * 
         * @since 1.0
         */
        function adminPage()
        {
            echo '
			<div class="wrap" id="databasebrowser">
				<h2>' . __("Database browser", "databasebrowser") . '</h2>
			';
            // if no query is being run
            if ($this->querytype == "") {
                // show the navigation and return
                include_once "views/navigation.php";
                return;
            }
            // if a table has been chosen
            if (wp_verify_nonce(@$_GET["_wpnonce"], "query") && $this->querytype == "table") {
                // get the limit
                if (@$_POST["limit"] != "") {
                    $_SESSION["limit"] = (int) $_POST["limit"];
                    $this->limit = (int) $_POST["limit"];
                }
                // create the new paginator
                $paginator = new Paginator($this->limit);
                // load the table
                $this->loadTable($paginator->findStart(), $this->limit);
                // include the title view
                $title = sprintf(__("Table: %s", "databasebrowser"), $this->table);
                include_once "views/title.php";
                // include the filters view
                include_once "views/filters.php";
                // include the results view
                include_once "views/results.php";
                return;
            }
            // if a custom query is being run
            if (wp_verify_nonce(@$_GET["_wpnonce"], "query") && $this->querytype == "customquery") {
                // see if this query is being saved
                $queryname = trim(@$_POST["queryname"]);
                if ($queryname != "") {
                    $this->saveQuery($queryname, $this->query, true);
                }
                // run the query
                $this->runQuery($this->query);
                // include the title view
                $title = __("Custom query", "databasebrowser");
                include_once "views/title.php";
                // include the query view
                include_once "views/query.php";
                // include the results view
                include_once "views/results.php";
                return;
            }
            // if a stored query is being run
            if (wp_verify_nonce(@$_GET["_wpnonce"], "query") && $this->querytype == "storedquery") {
                // save this query
                $this->saveQuery($this->queryname, $this->query, false);
                // run the query
                $this->runQuery($this->query);
                // include the title view
                $title = sprintf(__("Stored query: %s", "databasebrowser"), $this->queryname);
                include_once "views/title.php";
                // include the query view
                include_once "views/query.php";
                // include the results view
                include_once "views/results.php";
                return;
            }
            // if we get here something has gone wrong, so show the navigation
            include_once "views/navigation.php";
        }
开发者ID:2030449c,项目名称:farkol,代码行数:73,代码来源:database-browser.php

示例2: adminPage

        function adminPage()
        {
            echo '
			<div class="wrap" id="databasebrowser">
				<h1>' . __("Database browser", "databasebrowser") . '</h1>
			';
            // if a table has been chosen, load the data
            if (wp_verify_nonce(@$_GET["_wpnonce"], "table") && $this->table != "") {
                $limit = 100;
                $paginator = new Paginator($limit);
                $custom = false;
                // if a query has been given
                if (isset($_POST["query"]) || isset($_SESSION["custom_query"])) {
                    $custom = true;
                    $tablename = "Custom query";
                    $query = @$_POST["query"];
                    if ($query == "") {
                        $query = $_SESSION["custom_query"];
                    }
                    $this->runQuery($query);
                } else {
                    // load the table
                    $this->loadTable($paginator->findStart(), $limit);
                    $tablename = $this->table;
                }
                echo '
				<h2>' . sprintf(__("Table: %s", "databasebrowser"), $tablename) . '</h2>
				';
                if ($this->error != null && $this->error != "") {
                    echo '
					<div id="message" class="updated">
						<p><strong>' . __("Database error", "databasebrowser") . '</strong></p>
						<p>' . $this->error . '</p>
					</div>
					';
                }
                // if a query has not been given
                if (!$custom) {
                    echo '
				<form action="' . $this->formURL . '" method="post">
				<p><label id="wherelabel" for="where">' . __("Where (click to toggle):", "databasebrowser") . '</label>
					<textarea name="where" cols="30" rows="6" style="width:100%;height:4em" class="hider" id="where">' . @stripslashes($_POST["where"]) . '</textarea>
				</p>
				<p><label id="orderbylabel" for="orderby">' . __("Order by (click to toggle):", "databasebrowser") . '</label>
					<textarea name="orderby" cols="30" rows="6" style="width:100%;height:4em" class="hider" id="orderby">' . @stripslashes($_POST["orderby"]) . '</textarea>
				</p>
				<p><button type="submit" class="button">' . __("Run where and order by clauses", "databasebrowser") . '</button>
				' . wp_nonce_field("query") . '</p>
				</form>
				';
                }
                // no data found
                if ($this->rowcount == 0) {
                    echo '
					<div id="message" class="updated">
						<p><strong>' . __("No data was found in this table.", "databasebrowser") . '</strong></p>
					</div>';
                } else {
                    $paginator->findPages($this->rowcount);
                    // write the export links
                    $this->exportLinks();
                    // write the data table with pagination (if not running a custom query)
                    if (!$custom) {
                        echo $paginator->links;
                    }
                    echo '<div class="tablewrapper">';
                    echo $this->toHTML("widefat");
                    echo '</div>';
                    if (!$custom) {
                        echo $paginator->links;
                    }
                    // write the export links
                    $this->exportLinks();
                }
            }
            // load tables
            $this->loadTables();
            // show tables list
            echo '
			<form action="tools.php?page=databasebrowser" method="post">
			<p>
				<label for="tablelist">' . __("Select table", "databasebrowser") . '</label>
				<select name="table" id="tablelist">
				';
            foreach ($this->tables as $table) {
                echo '
					<option value="' . $table . '">' . $table . '</option>
					';
            }
            echo '
				</select>
				<input type="submit" class="button-primary" value="' . __("Select table", "databasebrowser") . '" />
				' . wp_nonce_field("table") . '
			</p>
			</form>
			';
            if ($this->query != null && $this->query != "") {
                echo '
				<form action="tools.php?page=databasebrowser&amp;table=' . $this->table . '&amp;_wpnonce=' . wp_create_nonce("table") . '" method="post">
				<h4 id="queryheader">' . __("Query performed (click to toggle):", "databasebrowser") . '</h4>
//.........这里部分代码省略.........
开发者ID:ricasiano,项目名称:mca-site,代码行数:101,代码来源:database-browser.php


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