Commit 9c5e4bc7 authored by alexpott's avatar alexpott

Issue #2002272 by elvis2, jibran, heddn: Rename Views method add_orderby() to addOrderby().

parent 2b51e787
......@@ -37,7 +37,7 @@ public function query() {
$this->user_field = $this->query->addField($this->user_table, 'name');
// Add the field.
$this->query->add_orderby(NULL, "LOWER(COALESCE($this->user_table.name, $this->tableAlias.$this->field))", $this->options['order'], $this->tableAlias . '_' . $this->field);
$this->query->addOrderBy(NULL, "LOWER(COALESCE($this->user_table.name, $this->tableAlias.$this->field))", $this->options['order'], $this->tableAlias . '_' . $this->field);
}
}
......@@ -22,7 +22,7 @@ class NcsLastUpdated extends Date {
public function query() {
$this->ensureMyTable();
$this->node_table = $this->query->ensure_table('node', $this->relationship);
$this->field_alias = $this->query->add_orderby(NULL, "GREATEST(" . $this->node_table . ".changed, " . $this->tableAlias . ".last_comment_timestamp)", $this->options['order'], $this->tableAlias . '_' . $this->field);
$this->field_alias = $this->query->addOrderBy(NULL, "GREATEST(" . $this->node_table . ".changed, " . $this->tableAlias . ".last_comment_timestamp)", $this->options['order'], $this->tableAlias . '_' . $this->field);
}
}
......@@ -25,12 +25,12 @@ public function query() {
//Read comment_render() in comment.module for an explanation of the
//thinking behind this sort.
if ($this->options['order'] == 'DESC') {
$this->query->add_orderby($this->tableAlias, $this->realField, $this->options['order']);
$this->query->addOrderBy($this->tableAlias, $this->realField, $this->options['order']);
}
else {
$alias = $this->tableAlias . '_' . $this->realField . 'asc';
//@todo is this secure?
$this->query->add_orderby(NULL, "SUBSTRING({$this->tableAlias}.{$this->realField}, 1, (LENGTH({$this->tableAlias}.{$this->realField}) - 1))", $this->options['order'], $alias);
$this->query->addOrderBy(NULL, "SUBSTRING({$this->tableAlias}.{$this->realField}, 1, (LENGTH({$this->tableAlias}.{$this->realField}) - 1))", $this->options['order'], $alias);
}
}
......
......@@ -260,7 +260,7 @@ public function clickSort($order) {
// Column is not in query; add a sort on it (without adding the column).
$this->aliases[$column] = $this->tableAlias . '.' . $column;
}
$this->query->add_orderby(NULL, NULL, $order, $this->aliases[$column]);
$this->query->addOrderBy(NULL, NULL, $order, $this->aliases[$column]);
}
protected function defineOptions() {
......
......@@ -27,7 +27,7 @@ public function query() {
foreach (array('filter', 'argument') as $type) {
foreach ($this->view->{$type} as $handler) {
if (isset($handler->search_score) && $handler->relationship == $this->relationship) {
$this->query->add_orderby(NULL, NULL, $this->options['order'], $handler->search_score);
$this->query->addOrderBy(NULL, NULL, $this->options['order'], $handler->search_score);
$this->tableAlias = $handler->tableAlias;
return;
}
......
......@@ -873,7 +873,7 @@ public function summaryBasics($count_field = TRUE) {
* The order selected in the UI.
*/
public function summarySort($order, $by = NULL) {
$this->query->add_orderby(NULL, NULL, $order, (!empty($by) ? $by : $this->name_alias));
$this->query->addOrderBy(NULL, NULL, $order, (!empty($by) ? $by : $this->name_alias));
}
/**
......
......@@ -170,7 +170,7 @@ public function clickSort($order) {
// Since fields should always have themselves already added, just
// add a sort on the field.
$params = $this->options['group_type'] != 'group' ? array('function' => $this->options['group_type']) : array();
$this->query->add_orderby(NULL, NULL, $order, $this->field_alias, $params);
$this->query->addOrderBy(NULL, NULL, $order, $this->field_alias, $params);
}
}
......
......@@ -948,9 +948,9 @@ public function addHavingExpression($group, $snippet, $args = array()) {
* @param $params
* Any params that should be passed through to the addField.
*/
function add_orderby($table, $field = NULL, $order = 'ASC', $alias = '', $params = array()) {
public function addOrderBy($table, $field = NULL, $order = 'ASC', $alias = '', $params = array()) {
// Only ensure the table if it's not the special random key.
// @todo: Maybe it would make sense to just add a add_orderby_rand or something similar.
// @todo: Maybe it would make sense to just add an addOrderByRand or something similar.
if ($table && $table != 'rand') {
$this->ensure_table($table);
}
......
......@@ -54,7 +54,7 @@ public function query() {
switch ($this->options['granularity']) {
case 'second':
default:
$this->query->add_orderby($this->tableAlias, $this->realField, $this->options['order']);
$this->query->addOrderBy($this->tableAlias, $this->realField, $this->options['order']);
return;
case 'minute':
$formula = $this->getDateFormat('YmdHi');
......@@ -74,7 +74,7 @@ public function query() {
}
// Add the field.
$this->query->add_orderby(NULL, $formula, $this->options['order'], $this->tableAlias . '_' . $this->field . '_' . $this->options['granularity']);
$this->query->addOrderBy(NULL, $formula, $this->options['order'], $this->tableAlias . '_' . $this->field . '_' . $this->options['granularity']);
}
}
......@@ -39,7 +39,7 @@ public function query() {
'function' => $this->options['group_type'],
);
$this->query->add_orderby($this->tableAlias, $this->realField, $this->options['order'], NULL, $params);
$this->query->addOrderBy($this->tableAlias, $this->realField, $this->options['order'], NULL, $params);
}
public function adminLabel($short = FALSE) {
......
......@@ -54,14 +54,14 @@ public function query() {
$join = Views::pluginManager('join')->createInstance('standard', $definition);
$menu_links = $this->query->addTable('menu_links', NULL, $join);
$this->query->add_orderby($menu_links, 'weight', $this->options['order']);
$this->query->add_orderby($menu_links, 'link_title', $this->options['order']);
$this->query->addOrderBy($menu_links, 'weight', $this->options['order']);
$this->query->addOrderBy($menu_links, 'link_title', $this->options['order']);
}
// We need this even when also sorting by weight and title, to make sure
// that children of two parents with the same weight and title are
// correctly separated.
$this->query->add_orderby($this->tableAlias, $this->field . $i, $this->options['order']);
$this->query->addOrderBy($this->tableAlias, $this->field . $i, $this->options['order']);
}
}
......
......@@ -17,7 +17,7 @@
class Random extends SortPluginBase {
public function query() {
$this->query->add_orderby('rand');
$this->query->addOrderBy('rand');
}
public function buildOptionsForm(&$form, &$form_state) {
......
......@@ -34,7 +34,7 @@ public function canExpose() { return TRUE; }
public function query() {
$this->ensureMyTable();
// Add the field.
$this->query->add_orderby($this->tableAlias, $this->realField, $this->options['order']);
$this->query->addOrderBy($this->tableAlias, $this->realField, $this->options['order']);
}
protected function defineOptions() {
......
......@@ -74,7 +74,7 @@ public function addField($table, $field, $alias = '', $params = array()) {
return $field;
}
public function add_orderby($table, $field = NULL, $order = 'ASC', $alias = '', $params = array()) {
public function addOrderBy($table, $field = NULL, $order = 'ASC', $alias = '', $params = array()) {
$this->orderBy = array('field' => $field, 'order' => $order);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment