本文整理汇总了PHP中Spotter::getOrderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Spotter::getOrderBy方法的具体用法?PHP Spotter::getOrderBy怎么用?PHP Spotter::getOrderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spotter
的用法示例。
在下文中一共展示了Spotter::getOrderBy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Spotter
<?php
require 'require/class.Connection.php';
require 'require/class.Spotter.php';
$Spotter = new Spotter();
$orderby = $Spotter->getOrderBy();
$title = "Search";
$page_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
//$title = "Search";
require 'header.php';
if (isset($_GET['start_date'])) {
//for the date manipulation into the query
if ($_GET['start_date'] != "" && $_GET['end_date'] != "") {
$start_date = $_GET['start_date'] . ":00";
$end_date = $_GET['end_date'] . ":00";
$sql_date = $start_date . "," . $end_date;
} else {
if ($_GET['start_date'] != "") {
$start_date = $_GET['start_date'] . ":00";
$sql_date = $start_date;
} else {
if ($_GET['start_date'] == "" && $_GET['end_date'] != "") {
$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")) . "," . $_GET['end_date'] . ":00";
$sql_date = $end_date;
} else {
$sql_date = '';
}
}
}
} else {
$sql_date = '';
示例2: getUpcomingFlights
/**
* Gets all the spotter information based on calculated upcoming flights
*
* @return Array the spotter information
*
*/
public static function getUpcomingFlights($limit = '', $sort = '')
{
global $global_query, $globalDBdriver, $globalTimezone;
date_default_timezone_set('UTC');
if ($limit != "") {
$limit_array = explode(",", $limit);
$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
if ($limit_array[0] >= 0 && $limit_array[1] >= 0) {
//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
$limit_query = " LIMIT " . $limit_array[1] . " OFFSET " . $limit_array[0];
}
}
$currentHour = date("G");
$next3Hours = date("G", strtotime("+3 hour"));
//if the next 3 hours is already equal to/past midnight, we limit it to stay there, otherwise the query will fail
if ($currentHour >= 21 && $next3Hours >= 00) {
$next3Hours = 24;
}
$currentDayofWeek = date("l");
if ($globalDBdriver == 'mysql') {
if ($sort != "") {
$search_orderby_array = Spotter::getOrderBy();
$orderby_query = $search_orderby_array[$sort]['sql'];
} else {
$orderby_query = " ORDER BY HOUR(spotter_output.date) ASC";
}
$query = "SELECT spotter_output.*, count(spotter_output.ident) as ident_count\n\t\t\t FROM spotter_output\n\t\t\t WHERE DAYNAME(spotter_output.date) = '{$currentDayofWeek}' AND HOUR(spotter_output.date) >= '{$currentHour}' AND HOUR(spotter_output.date) <= '{$next3Hours}'\n\t\t\t GROUP BY spotter_output.ident HAVING ident_count > 10 {$orderby_query}";
$spotter_array = Spotter::getDataFromDB($query . $limit_query);
} else {
if ($globalDBdriver == 'pgsql') {
if ($sort != "") {
$search_orderby_array = Spotter::getOrderBy();
$orderby_query = $search_orderby_array[$sort]['sql'];
} else {
$orderby_query = " ORDER BY EXTRACT (HOUR FROM spotter_output.date) ASC";
}
$query = "SELECT spotter_output.*, count(spotter_output.ident) as ident_count\n\t\t\t FROM spotter_output\n\t\t\t WHERE DATE_PART('dow', spotter_output.date) = DATE_PART('dow', date 'now' AT TIME ZONE :timezone) AND EXTRACT (HOUR FROM spotter_output.date AT TIME ZONE :timezone) >= '{$currentHour}' AND EXTRACT (HOUR FROM spotter_output.date AT TIME ZONE :timezone) <= '{$next3Hours}'\n\t\t\t GROUP BY spotter_output.ident, spotter_output.spotter_id HAVING count(spotter_output.ident) > 10 {$orderby_query}";
$spotter_array = Spotter::getDataFromDB($query . $limit_query, array(':timezone' => $globalTimezone));
}
}
return $spotter_array;
}
示例3: date
<?php
require 'require/class.Connection.php';
require 'require/class.Spotter.php';
$orderby = Spotter::getOrderBy();
$title = "Search";
$page_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
//$title = "Search";
require 'header.php';
if (isset($_GET['start_date'])) {
//for the date manipulation into the query
if ($_GET['start_date'] != "" && $_GET['end_date'] != "") {
$start_date = $_GET['start_date'] . ":00";
$end_date = $_GET['end_date'] . ":00";
$sql_date = $start_date . "," . $end_date;
} else {
if ($_GET['start_date'] != "") {
$start_date = $_GET['start_date'] . ":00";
$sql_date = $start_date;
} else {
if ($_GET['start_date'] == "" && $_GET['end_date'] != "") {
$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")) . "," . $_GET['end_date'] . ":00";
$sql_date = $end_date;
} else {
$sql_date = '';
}
}
}
} else {
$sql_date = '';
}