SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 308 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

Let's imagine that the entity with which we
are dealing has three columns: name, published, and id. This is an example of a
_buildQueryOrderBy() method:
/**
* Builds the ORDER part of a query
*
* @return string Part of an SQL query
*/
function _buildQueryOrderBy()
{
global $mainframe, $option;
// Array of allowable order fields
$orders = array('name', 'published', 'id');
// get the order field and direction
$filter_order = $mainframe->getUserStateFromRequest(
$option.'filter_order',
'filter_order', 'published');
$filter_order_Dir = strtoupper($mainframe->getUserStateFromRequest(
>$option.'filter_order_Dir',
'filter_order_Dir', 'ASC'));
// validate the order direction, must be ASC or DESC
if ($filter_order_Dir != 'ASC' && $filter_order_Dir != 'DESC')
{
$filter_order_Dir = 'ASC';
Chapter 8
[ 231 ]
}
// if order column is unknown use the default
if (!in_array($filter_order, $orders))
{
$filter_order = 'published';
}
// return the ORDER BY clause
return ' ORDER BY '.$filter_order.' '.


Pages:
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6