views_handler_sort_term_edge_hierarchy.inc in Taxonomy Edge 6
File
views_taxonomy_edge/handlers/views_handler_sort_term_edge_hierarchy.inc
View source
<?php
class views_handler_sort_term_edge_hierarchy extends views_handler_sort {
function query() {
$edge = $this->query
->ensure_table('term_edge');
if (taxonomy_edge_is_order_invalid()) {
$sort_path = _taxonomy_edge_generate_term_path_query("{$edge}.tid");
$alias = $this->query
->add_field(NULL, $sort_path, 'sort_path');
$this->query
->add_orderby(NULL, NULL, $this->options['order'], 'sort_path');
}
else {
$sort_path = "(SELECT o.oid FROM {term_edge_order} o WHERE o.eid = {$edge}.eid)";
$alias = $this->query
->add_field(NULL, $sort_path, 'oid');
$this->query
->add_orderby(NULL, NULL, $this->options['order'], 'oid');
}
}
}