-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathexample.php
72 lines (58 loc) · 1.89 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
require 'vendor/autoload.php';
use Edudip\Next\ApiClient\AbstractRequest;
use Edudip\Next\ApiClient\EdudipNext;
use Edudip\Next\ApiClient\Webinar;
use Edudip\Next\ApiClient\WebinarDate;
use Edudip\Next\ApiClient\Participant;
// Set your API key
EdudipNext::setApiKey('Ve9dDJWfZzacOWlix314pa5U96PpBIuaAC3QPVgCJSVf7204EXQvrb6mXF8b');
// Lists all existing webinars:
$allWebinars = Webinar::all();
foreach ($allWebinars as $webinar) {
echo $webinar->getTitle(), PHP_EOL;
foreach ($webinar->getDates() as $webinarDate) {
echo ' Date: ', $webinarDate->getDate()->format('h:i:s m/d/Y'), PHP_EOL;
echo ' Duration: ', $webinarDate->getDuration(), ' mins.', PHP_EOL;
}
}
// Gets detailed data for a single webinar
if (count($allWebinars) !== 0) {
$singleWebinarDetails = Webinar::getById($allWebinars[0]->getId());
$creator = $singleWebinarDetails->getUser();
echo sprintf(
'Webinar has been created by %s %s',
$creator['firstname'],
$creator['lastname']
), PHP_EOL;
}
// Creates a new Webinar:
// Create the dates for the webinar
$webinarDates = [
new WebinarDate(
new DateTime('2020-01-01 12:00:00'), // When does the webinar start
30 // How long does the webinar in minutes
),
new WebinarDate(
new DateTime('2020-02-01 12:00:00'),
30
),
];
// Creates a webinar
$webinar = Webinar::create(
'Name/Title of the webinar' . rand(1, 20),
$webinarDates,
10, // Max participants
true // Record webinar
);
// Registers a participant
$participant = new Participant(
'John',
'Doe'
);
$registeredDates = $webinar->registerParticipant($participant);
var_dump($registeredDates);die;
foreach ($registeredDates as $registeredDate) {
echo 'User is registered for webinar date ', $registeredDate['date'], ' room link: ', $registeredDate['room_link'], PHP_EOL;
}