Ejemplo n.º 1
0
# searches so that we don't have to run it for each page.
if (!isset($total)) {
    $total = sql_query1("SELECT count(*) FROM {$tbl_entry} E WHERE {$sql_pred}");
}
if ($total <= 0) {
    echo "<B>" . get_vocab("nothing_found") . "</B>\n";
    include "trailer.inc";
    exit;
}
if (!isset($search_pos) || $search_pos <= 0) {
    $search_pos = 0;
} elseif ($search_pos >= $total) {
    $search_pos = $total - $total % $search["count"];
}
# Now we set up the "real" query using LIMIT to just get the stuff we want.
$sql = "SELECT E.id, E.create_by, E.name, E.description, E.start_time, R.area_id\n        FROM {$tbl_entry} E, {$tbl_room} R\n        WHERE {$sql_pred}\n        AND E.room_id = R.id\n        ORDER BY E.start_time asc " . sql_syntax_limit($search["count"], $search_pos);
# this is a flag to tell us not to display a "Next" link
$result = sql_query($sql);
if (!$result) {
    fatal_error(0, sql_error());
}
$num_records = sql_count($result);
$has_prev = $search_pos > 0;
$has_next = $search_pos < $total - $search["count"];
if ($has_prev || $has_next) {
    echo "<B>" . get_vocab("records") . ($search_pos + 1) . get_vocab("through") . ($search_pos + $num_records) . get_vocab("of") . $total . "</B><br>";
    # display a "Previous" button if necessary
    if ($has_prev) {
        echo "<A HREF=\"search.php?search_str={$search_url}&amp;search_pos=";
        echo max(0, $search_pos - $search["count"]);
        echo "&amp;total={$total}&amp;year={$year}&amp;month={$month}&amp;day={$day}\">";
Ejemplo n.º 2
0
    fatal_error(FALSE, get_vocab("fatal_db_error"));
}
if ($total <= 0) {
    echo "<p id=\"nothing_found\">" . get_vocab("nothing_found") . "</p>\n";
    require_once "trailer.inc";
    exit;
}
if (!isset($search_pos) || $search_pos <= 0) {
    $search_pos = 0;
} else {
    if ($search_pos >= $total) {
        $search_pos = $total - $total % $search["count"];
    }
}
// Now we set up the "real" query using LIMIT to just get the stuff we want.
$sql = "SELECT E.id AS entry_id, E.create_by, E.name, E.description, E.start_time,\n               R.area_id, A.enable_periods\n          FROM {$tbl_entry} E, {$tbl_room} R, {$tbl_area} A\n         WHERE {$sql_pred}\n      ORDER BY E.start_time asc " . sql_syntax_limit($search["count"], $search_pos);
// this is a flag to tell us not to display a "Next" link
$result = sql_query($sql);
if (!$result) {
    trigger_error(sql_error(), E_USER_WARNING);
    fatal_error(FALSE, get_vocab("fatal_db_error"));
}
$num_records = sql_count($result);
$has_prev = $search_pos > 0;
$has_next = $search_pos < $total - $search["count"];
if ($has_prev || $has_next) {
    echo "<div id=\"record_numbers\">\n";
    echo get_vocab("records") . ($search_pos + 1) . get_vocab("through") . ($search_pos + $num_records) . get_vocab("of") . $total;
    echo "</div>\n";
    echo "<div id=\"record_nav\">\n";
    $query_string = formatURLSearch($year, $month, $day, $search_str, $total, NULL);
Ejemplo n.º 3
0
    $search_pos = 0;
} else {
    if ($search_pos >= $total) {
        $search_pos = $total - $total % $search["count"];
    }
}
// If we're Ajax capable and this is not an Ajax request then don't ouput
// the table body, because that's going to be sent later in response to
// an Ajax request - so we don't need to do the query
if (!$ajax_capable || $ajax) {
    // Now we set up the "real" query
    $sql = "SELECT E.id AS entry_id, E.create_by, E.name, E.description, E.start_time,\n                 R.area_id, A.enable_periods\n            FROM {$tbl_entry} E, {$tbl_room} R, {$tbl_area} A\n           WHERE {$sql_pred}\n        ORDER BY E.start_time asc";
    // If it's an Ajax query we want everything.  Otherwise we use LIMIT to just get
    // the stuff we want.
    if (!$ajax) {
        $sql .= " " . sql_syntax_limit($search["count"], $search_pos);
    }
    // this is a flag to tell us not to display a "Next" link
    $result = sql_query($sql);
    if (!$result) {
        trigger_error(sql_error(), E_USER_WARNING);
        fatal_error(FALSE, get_vocab("fatal_db_error"));
    }
    $num_records = sql_count($result);
}
if (!$ajax_capable) {
    echo generate_search_nav_html($search_pos, $total, $num_records, $search_str);
}
if (!$ajax) {
    echo "<div id=\"search_output\" class=\"datatable_container\">\n";
    echo "<table id=\"search_results\" class=\"admin_table display\">\n";
Ejemplo n.º 4
0
# searches so that we don't have to run it for each page.
if (!isset($total)) {
    $total = sql_query1("SELECT count(*) FROM mrbs_entry WHERE {$sql_pred}");
}
if ($total <= 0) {
    echo "<B>" . $lang["nothing_found"] . "</B>\n";
    include "trailer.inc";
    exit;
}
if (!isset($search_pos) || $search_pos <= 0) {
    $search_pos = 0;
} elseif ($search_pos >= $total) {
    $search_pos = $total - $total % $search["count"];
}
# Now we set up the "real" query using LIMIT to just get the stuff we want.
$sql = "SELECT id, create_by, name, description, start_time\n        FROM mrbs_entry\n        WHERE {$sql_pred}\n        ORDER BY start_time asc " . sql_syntax_limit($search["count"], $search_pos);
# this is a flag to tell us not to display a "Next" link
$result = sql_query($sql);
if (!$result) {
    fatal_error(0, sql_error());
}
$num_records = sql_count($result);
$has_prev = $search_pos > 0;
$has_next = $search_pos < $total - $search["count"];
if ($has_prev || $has_next) {
    echo "<B>" . $lang["records"] . ($search_pos + 1) . $lang["through"] . ($search_pos + $num_records) . $lang["of"] . $total . "</B><BR>";
    # display a "Previous" button if necessary
    if ($has_prev) {
        echo "<A HREF=\"search.php?search_str={$search_url}&search_pos=";
        echo max(0, $search_pos - $search["count"]);
        echo "&total={$total}&year={$year}&month={$month}&day={$day}\">";