function legal_versions_latest_get in Legal 6.8
Same name and namespace in other branches
- 7.2 legal.admin.inc \legal_versions_latest_get()
- 7 legal.admin.inc \legal_versions_latest_get()
Get latest version for each language.
1 call to legal_versions_latest_get()
- legal_languages in ./
legal.admin.inc - Languages administration form.
File
- ./
legal.admin.inc, line 333 - Administration functions for the Legal module.
Code
function legal_versions_latest_get($language = NULL) {
$conditions = array();
$current_version = db_result(db_query_range('SELECT version FROM {legal_conditions} ORDER BY version DESC', 0, 1));
// Get latest version for each language.
if (empty($language)) {
$languages = locale_language_list();
foreach ($languages as $language_id => $language_name) {
$row = db_fetch_object(db_query_range("SELECT * FROM {legal_conditions} WHERE version = %d AND language = '%s' ORDER BY revision DESC", $current_version, $language_id, 0, 1));
$conditions[$language_name] = legal_versions_latest_get_data($row);
}
}
else {
$row = db_fetch_object(db_query_range("SELECT * FROM {legal_conditions} WHERE language = '%s' GROUP BY language ORDER BY version DESC", $language, 0, 1));
$conditions[$language] = legal_versions_latest_get_data($row);
}
return $conditions;
}