Commit 16ad720f authored by metzlerd's avatar metzlerd
Browse files

Support for internationalization of menus.

parent abce5581
......@@ -151,6 +151,9 @@ class FrxMenu {
$path = $menu['path'];
$type = @$menu['type'];
$title = @$menu['title'] ? $menu['title']: $row->title;
if (module_exists('locale')) {
}
//Default type
switch ($type) {
......@@ -198,6 +201,10 @@ class FrxMenu {
'page callback' => 'forena_report_menu_callback',
'page arguments' => $page_args,
);
if (module_exists('locale')) {
$items[$parent_path]['title callback'] = 'forena_report_title_callback';
$items[$parent_path]['title arguments'] = array($row->report_name, FALSE);
}
if ($access_callback === 'forena_check_all_access') $items[$parent_path]['access arguments'][] = $cache['access'];
}
}
......@@ -210,10 +217,14 @@ class FrxMenu {
'page callback' => 'forena_report_menu_callback',
'page arguments' => $page_args,
);
if (module_exists('locale')) {
$items[$new_path]['title callback'] = 'forena_report_title_callback';
$items[$new_path]['title arguments'] = array($row->report_name, FALSE);
}
if ($access_callback === 'forena_check_all_access') $items[$new_path]['access arguments'][] = $cache['access'];
}
}
}
......
......@@ -859,6 +859,19 @@ function forena_check_all_access($checks) {
return $access;
}
function forena_report_title_callback($report_name, $use_menu_title=TRUE) {
GLOBAL $language;
$title = '';
$lang = $language->language;
$result = db_query('SELECT * FROM {forena_reports} where report_name = :name and language=:language',
array(':name' => $report_name, 'language' => $lang));
foreach ($result as $row) {
$title = $use_menu_title && @$menu['title'] ? $menu['title']: $row->title;
}
if (!$title) $title = t('Title not found');
return $title;
}
/**
......
Supports Markdown
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