views_handler_sort_random.inc
Same filename in other branches
File
-
handlers/
views_handler_sort_random.inc
View source
<?php
/**
* Handle a random sort.
*
* @ingroup views_sort_handlers
*/
class views_handler_sort_random extends views_handler_sort {
function query() {
global $db_type;
switch ($db_type) {
case 'mysql':
case 'mysqli':
$formula = 'RAND()';
break;
case 'pgsql':
$formula = 'RANDOM()';
break;
}
if (!empty($formula)) {
$this->query
->add_orderby(NULL, $formula, $this->options['order'], '_' . $this->field);
}
}
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['order']['#access'] = FALSE;
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
views_handler_sort_random | Handle a random sort. |