| 1 |
<?php |
<?php |
| 2 |
// $Id: apachesolr.module,v 1.1.2.12.2.155.2.38 2009/11/20 14:27:08 robertDouglass Exp $ |
// $Id: apachesolr.module,v 1.1.2.12.2.155.2.39 2009/11/20 17:13:51 robertDouglass Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 843 |
$facet_text = $facet_callback($facet, $options); |
$facet_text = $facet_callback($facet, $options); |
| 844 |
} |
} |
| 845 |
// If this block is to be alphabetically sorted, change $sortpre. |
// If this block is to be alphabetically sorted, change $sortpre. |
| 846 |
if (isset($facet_query_sorts[$module][$delta]) && ($facet_query_sorts[$module][$delta] == 'index')) { |
if (isset($facet_query_sorts[$module][$delta]) && ($facet_query_sorts[$module][$delta] != 'count')) { |
| 847 |
$sortpre = $facet_text; |
$sortpre = $facet_text; |
| 848 |
} |
} |
| 849 |
$unclick_link = ''; |
$unclick_link = ''; |
| 868 |
} |
} |
| 869 |
// Unless a facet is active only display 2 or more. |
// Unless a facet is active only display 2 or more. |
| 870 |
if ($items && ($response->response->numFound > 1 || $contains_active)) { |
if ($items && ($response->response->numFound > 1 || $contains_active)) { |
| 871 |
ksort($items, SORT_STRING); |
if (!isset($facet_query_sorts[$module][$delta]) || ($facet_query_sorts[$module][$delta] == 'index asc')) { |
| 872 |
|
ksort($items, SORT_STRING); |
| 873 |
|
} |
| 874 |
|
else if ($facet_query_sorts[$module][$delta] == 'index desc') { |
| 875 |
|
krsort($items, SORT_STRING); |
| 876 |
|
} |
| 877 |
// Get information needed by the rest of the blocks about limits. |
// Get information needed by the rest of the blocks about limits. |
| 878 |
$initial_limits = variable_get('apachesolr_facet_query_initial_limits', array()); |
$initial_limits = variable_get('apachesolr_facet_query_initial_limits', array()); |
| 879 |
$limit = isset($initial_limits[$module][$delta]) ? $initial_limits[$module][$delta] : variable_get('apachesolr_facet_query_initial_limit_default', 10); |
$limit = isset($initial_limits[$module][$delta]) ? $initial_limits[$module][$delta] : variable_get('apachesolr_facet_query_initial_limit_default', 10); |
| 1138 |
$form['apachesolr_facet_query_sort'] = array( |
$form['apachesolr_facet_query_sort'] = array( |
| 1139 |
'#type' => 'radios', |
'#type' => 'radios', |
| 1140 |
'#title' => t('Sort order of facet links'), |
'#title' => t('Sort order of facet links'), |
| 1141 |
'#options' => array('count' => t('Count'), 'index' => t('Alphanumeric')), |
'#options' => array('count' => t('Count'), 'index asc' => t('Alphanumeric, ascending'), 'index desc' => t('Alphanumeric, descending')), |
| 1142 |
'#description' => t('The sort order of facet links in this block. %Count, which is the default, will show facets with the most results first. %Alphanumeric will sort alphabetically, ascending.', array('%Count' => t('Count'), '%Alphanumeric' => t('Alphanumeric'))), |
'#description' => t('The sort order of facet links in this block. %Count, which is the default, will show facets with the most results first. %Alphanumeric will sort alphabetically, either ascending or descending.', array('%Count' => t('Count'), '%Alphanumeric' => t('Alphanumeric'))), |
| 1143 |
'#default_value' => isset($sorts[$module][$delta]) ? $sorts[$module][$delta] : 'count', |
'#default_value' => isset($sorts[$module][$delta]) ? $sorts[$module][$delta] : 'count', |
| 1144 |
); |
); |
| 1145 |
} |
} |