-
Notifications
You must be signed in to change notification settings - Fork 1
/
plugin.php
71 lines (58 loc) · 2.49 KB
/
plugin.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
class RegistrationPlugin extends SecurePlugin
{
function get_secure_menu_entries($page, $user)
{
$ret = array('View Registrations'=>$page->secure_root.'register/view.php');
$data_set = false;
try{
$data_set = \Flipside\DataSetFactory::getDataSetByName('registration');
} catch(Exception $e) {
return;
}
$vars_data_table = $data_set['vars'];
$vars = $vars_data_table->read(new \Flipside\Data\Filter('name eq tcRegDates'));
$tcDates = $vars[0]['value'];
$vars = $vars_data_table->read(new \Flipside\Data\Filter('name eq artRegDates'));
$artDates = $vars[0]['value'];
$vars = $vars_data_table->read(new \Flipside\Data\Filter('name eq dmvRegDates'));
$dmvDates = $vars[0]['value'];
$vars = $vars_data_table->read(new \Flipside\Data\Filter('name eq eventRegDates'));
$evtDates = $vars[0]['value'];
$now = getdate();
$tcStart = date_parse($tcDates['start']);
$tcEnd = date_parse($tcDates['end']);
$artStart = date_parse($artDates['start']);
$artEnd = date_parse($artDates['end']);
$dmvStart = date_parse($dmvDates['start']);
$dmvEnd = date_parse($dmvDates['end']);
$evtStart = date_parse($evtDates['start']);
$evtEnd = date_parse($evtDates['end']);
if($now > $tcStart && $now < $tcEnd)
{
$ret['Theme Camp Registration']=$page->secure_root.'register/tc_reg.php';
}
if($now > $artStart && $now < $artEnd)
{
$ret['Art Project Registration']=$page->secure_root.'register/art_reg.php';
}
if($now > $dmvStart && $now < $dmvEnd)
{
$ret['Art Car Registration']=$page->secure_root.'register/artCar_reg.php';
}
if($now > $evtStart && $now < $evtEnd)
{
$ret['Event Registration']=$page->secure_root.'register/event_reg.php';
}
if($user !== null &&
($user->isInGroupNamed('RegistrationAdmins') || $user->isInGroupNamed('ArtAdmins') || $user->isInGroupNamed('CampAdmins') || $user->isInGroupNamed('DMVAdmins') || $user->isInGroupNamed('EventAdmins')))
{
$ret['Registration Admin'] = $page->secure_root.'register/_admin/index.php';
}
return $ret;
}
function get_plugin_entry_point()
{
return array('name'=>'Theme Camp, Art Project, Art Car, and Event Registration', 'link'=>'register/index.php');
}
}