1. First, you need to load the link from the database and store it as an additional property of the event data object. This can be done in the backend API endpoint that returns events. In most PHP examples, it is called backend_events.php.
<?php
require_once '_db.php';
$stmt = $db->prepare('SELECT * FROM events WHERE NOT ((end <= :start) OR (start >= :end))');
$stmt->bindParam(':start', $_GET['start']);
$stmt->bindParam(':end', $_GET['end']);
$stmt->execute();
$result = $stmt->fetchAll();
class Event {}
$events = array();
foreach($result as $row) {
$e = new Event();
$e->id = $row['id'];
$e->text = $row['name'];
$e->start = $row['start'];
$e->end = $row['end'];
$e->resource = $row['resource_id'];
$e->url= $row['URL'];
$events[] = $e;
}
header('Content-Type: application/json');
echo json_encode($events);
2. Then you need to add the context menu to events (https://api.daypilot.org/daypilot-scheduler-contextmenu/) and add an item that opens the specified URL:
dp.contextMenu = new DayPilot.Menu({
items: [
{ text: "Click to Open", onClick: args => location.href = args.source.data.url }
]
});