本文整理汇总了PHP中pagination::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP pagination::reset方法的具体用法?PHP pagination::reset怎么用?PHP pagination::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pagination
的用法示例。
在下文中一共展示了pagination::reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
if (isset($_SERVER["hide_ss"]) == false) {
$_SERVER["hide_ss"] = true;
}
if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["submit_button"] == "hidess") {
$_SERVER["hide_ss"] = is_true($_POST["hide_ss"]);
}
$this->output->add_css("banshee/filter.css");
$filter = new filter($this->db, $this->output, $this->user);
$filter->to_output($this->model->table, false);
if (($count = $this->model->count_events($filter->webserver, $_SERVER["hide_ss"])) === false) {
$this->output->add_tag("result", "Database error.");
return;
}
$paging = new pagination($this->output, "events", $this->settings->event_page_size, $count);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$paging->reset();
}
if (($events = $this->model->get_events($paging->offset, $paging->size, $filter->webserver, $_SERVER["hide_ss"])) === false) {
$this->output->add_tag("result", "Database error.");
return;
}
$this->output->open_tag("events", array("hide_ss" => show_boolean($_SERVER["hide_ss"])));
foreach ($events as $event) {
$event["timestamp"] = date("j F Y, H:i:s", $event["timestamp"]);
$event["event"] = $this->output->secure_string($event["event"], "_");
$this->output->record($event, "event");
}
$paging->show_browse_links();
$this->output->close_tag();
}
示例2: show_overview
protected function show_overview()
{
switch ($this->browsing) {
case "alphabetize":
$alphabet = new alphabetize($this->output, "tableadmin_" . $this->model->table);
if ($_POST["submit_button"] == "Search") {
$alphabet->reset();
}
if (($items = $this->model->get_items($alphabet->char)) === false) {
$this->output->add_tag("result", "Error while creating overview.");
return;
}
break;
case "pagination":
if (($item_count = $this->model->count_items()) === false) {
$this->output->add_tag("result", "Error while counting items.");
return;
}
$paging = new pagination($this->output, "tableadmin_" . $this->model->table, $this->page_size, $item_count);
if ($_POST["submit_button"] == "Search") {
$paging->reset();
}
if (($items = $this->model->get_items($paging->offset, $paging->size)) === false) {
$this->output->add_tag("result", "Error while creating overview.");
return;
}
break;
case "datatables":
$this->output->add_javascript("jquery/jquery.js");
$this->output->add_javascript("banshee/jquery.datatables.js");
$this->output->run_javascript("\$(document).ready(function(){ \$('table.datatable').dataTable(); });");
$this->output->add_css("banshee/datatables.css");
$this->_table_class = "datatable";
$this->enable_search = false;
default:
if (($items = $this->model->get_items()) === false) {
$this->output->add_tag("result", "Error while creating overview.");
return;
}
}
if ($this->table_class != null) {
$this->_table_class .= " " . $this->table_class;
}
$params = array("class" => $this->_table_class, "allow_create" => show_boolean($this->model->allow_create));
$this->output->open_tag("overview", $params);
/* Labels
*/
$this->output->open_tag("labels", array("name" => strtolower($this->name)));
foreach ($this->model->elements as $name => $element) {
$args = array("name" => $name, "overview" => show_boolean($element["overview"]));
if ($element["overview"]) {
$this->output->add_tag("label", $element["label"], $args);
}
}
$this->output->close_tag();
/* Values
*/
$this->output->open_tag("items");
foreach ($items as $item) {
$this->output->open_tag("item", array("id" => $item["id"]));
foreach ($item as $name => $value) {
$element = $this->model->elements[$name];
if ($element["overview"]) {
switch ($element["type"]) {
case "boolean":
$value = show_boolean($value);
break;
case "date":
$value = date("j F Y", strtotime($value));
break;
case "timestamp":
$value = date("j F Y H:i", strtotime($value));
break;
case "foreignkey":
if ($value === null) {
$value = $this->foreign_null;
} else {
if (($result = $this->db->entry($element["table"], $value)) != false) {
if (is_array($element["column"]) == false) {
$value = $result[$element["column"]];
} else {
$values = array();
foreach ($element["column"] as $column) {
array_push($values, $result[$column]);
}
$value = implode(" ", $values);
}
}
}
break;
}
$this->output->add_tag("value", $value, array("name" => $name));
}
}
$this->output->close_tag();
}
$this->output->close_tag();
switch ($this->browsing) {
case "alphabetize":
$alphabet->show_browse_links();
//.........这里部分代码省略.........