Using function from agenda.lib.php -refs #6926