<?php 
    if(isset($_GET['id']) && !empty($_GET['id'])) {
        $webinar = $zoomApi->getWebinarFromDb($_GET['id']);
        $start = strtotime($webinar['start_time']);
        $end = strtotime($webinar['start_time'].' + '.$webinar['duration'].' minute');
        $name = $webinar['topic'];
        $description = "Konu: ".$webinar['topic']."\\n\\nWebinar ID: ".$webinar['webinar_id']."\\nParola: ".$webinar['password']."\\n\\nKayıt Linki: ".$webinar['registration_url']."\\nKatılma Linki: ".$webinar['join_url']."\\nBaşlatma Linki: ".$webinar['start_url'];
        $location = $webinar['join_url'];
        
        $icsCreator->create($start,$end,$name,$description,$location);
        $icsCreator->show();

    }else{
        $session->data['messageType'] = "error"; 
        $session->data['messageTitle'] = "Hata!"; 
        $session->data['message'] = "Bir hata oluştu ve web semineri bulunamadı."; 

        header('Location: /admin/webinar/list');
        exit();
    }