// local_main_nav_update allows sites to customise the menu by munging the $menu array.
// as there is no internal way to know if the local_main_nav array has changed we keep it outside the cached menu
if(function_exists('local_main_nav_update')){
local_main_nav_update($menu);
}
$menu_structure=find_menu_children($menu,'');
return$menu_structure;
}
/**
* Clear the cached menu so that the next visit to the site will recreate the cache.
*
* @param string $institution Optional institution name if we only want to delete cache from a certain institution
*/
functionclear_menu_cache($institution=null){
if($institution){
try{
delete_records_sql("DELETE FROM {institution_config} WHERE field IN ('adminnav','instadminnav','staffnav','inststaffnav','standardnav') AND institution = ?",array($institution));
}
catch(SQLException$e){
// Institution_config table may not exist on install/upgrade at this point
}
}
else{
try{
delete_records_sql("DELETE FROM {institution_config} WHERE field IN ('adminnav','instadminnav','staffnav','inststaffnav','standardnav')",array());
}
catch(SQLException$e){
// Institution_config table may not exist on install/upgrade at this point