newline before reservation warning
[raven.git] / apps / gacksadmin / user_reservations.php
1 <?php
2
3 // this must occur before linetabs.php, or linetabs won't work. I have no idea why.
4 drupal_add_js("misc/popup.js");
5
6 // Require login
7 require_once 'plc_login.php';
8
9 // Get session and API handles
10 require_once 'plc_session.php';
11 global $plc, $api, $adm;
12
13 // Common functions
14 require_once 'plc_functions.php';
15 require_once 'gacks_functions.php';
16 require_once 'table.php';
17 require_once 'linetabs.php';
18 require_once 'gacksclient.php';
19
20 // find person roles
21 $_person= $plc->person;
22 $_person_id = $plc->person['person_id'];
23 $_roles= $_person['role_ids'];
24
25 $timezone_offset_minutes = get_timezone();
26 $timezone_seconds = $timezone_offset_minutes * 60;
27
28 // Print header
29 require_once 'plc_drupal.php';
30 drupal_set_title('Manage Reservations');
31 include 'plc_header.php';
32
33 $gacksapi = new GACKSAPI();
34
35 $tabs['Add Reservation'] = array('method'=>'GET',
36                       'url'=>l_gacks_add_reservation(),
37                       'values'=>array(),
38                       'bubble'=>"Add a Reservation");
39
40 plekit_linetabs($tabs);
41
42 shrinkdiv_start();
43
44 $account_name = get_account_name($api, $_person_id);
45
46 $account = NULL;
47 if ($account_name != NULL) {\r
48     $account = $gacksapi->get_account(gacksid($account_name), "user", True);\r
49 }\r
50
51 if ($account == NULL) {
52     if ($account_name != NULL) {\r
53         print "Oops. We had an error retrieving the account details for $account_name.";\r
54     }
55 } else if (!array_key_exists("calendar", $account["reservable"])) {
56     $link = href(l_gacks_service_level($account_name), "upgrade");
57     print <<< EOF
58 <br><P>The service level of $account_name does not permit reservations.
59 To add reservation capabality, please $link the account to a higher service level.
60 </P>
61 EOF;
62
63 } else {
64     $account_hrn = slice_to_hrn($account_name);
65
66     $records = $gacksapi->query_overlap(NULL, 0, INFINITY, 0, INFINITY, NULL, $account_hrn);
67
68     record_table($records, $timezone_seconds);
69 }
70
71 shrinkdiv_end();
72
73 include 'plc_footer.php';
74
75 ?>
76