-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscriptfunctions.gs
More file actions
75 lines (58 loc) · 1.91 KB
/
Copy pathscriptfunctions.gs
File metadata and controls
75 lines (58 loc) · 1.91 KB
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
72
73
74
75
// calendar stuff
function getOverlappingEquipmentReservations(equipmentName, startDate, endDate){
cal = getReservationCal();
var filterFunction = function(event){
if(event.getDescription.match(equipmentName)){
return true;
}
}
return getOverlappingEvents(cal, startDate, endDate, filterFunction);
}
function createReservationEvent(startTime, endTime, title, description, guests){
var cal = getReservationCal();
return createCalEvent(cal, startTime, endTime, title, description, guests);
}
function createStaffConsultationEvent(startTime, endTime, title, description, guests){
var cal = getStaffConsultationCal();
return createCalEvent(cal, startTime, endTime, title, description, guests);
}
// Get Events
function getEquipmentReservationEvents(startTime, endTime){
var cal = getReservationCal();
return getCalEvents(cal, startTime, endTime);
}
function getStaffScheduleEvents(startTime, endTime){
var cal = getStaffScheduleCal();
return getCalEvents(cal, startTime, endTime);
}
function getStaffConsultationEvents(startTime, endTime){
var cal = getStaffConsultationCal();
return getCalEvents(cal, startTime, endTime);
}
///// Get Current User informations
function getNetId() {
var email = Session.getActiveUser().getEmail();
Logger.log(email);
var user = "";
if(email.trim() != ""){
user = email.split("@")[0];
}
return user;
}
// get information about the user (volunteer/staff/visitor, authorizations, etc)
function getUserTableDataFromNetId(netId){
var userTableData = userTable
.getActiveSheet()
.getDataRange()
.getValues();
var userData = dataIntoHashRows(userTableData, 0, 1, function(row){
if(row["netid"].toString().trim() == netId.toString().trim()){
return true;
}
return false;
}); //, function(row){ return row['NetId'] == netId;}).data;
if(userData.data.length > 0){
return userData.data[0];
}
return false;
}