This repository has been archived by the owner on Nov 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.ctp
229 lines (217 loc) · 9.18 KB
/
index.ctp
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<div class="row">
<div class="col-md-4">
<!-- Sidebar -->
<div class="row">
<div class="col-md-12">
<h4><a href="<?=$this->Wb->eventUrl('/Profile/View')?>"><?=$this->Wb->userDisplayName($wannabe->user)?></a></h4>
</div>
</div>
<div class="row">
<?php if ( $wannabe->user['User']['image'] != '' ) { ?>
<div class="col-xs-4">
<ul class="media-grid">
<li>
<a href="<?=$this->Wb->eventUrl('/Profile/Picture')?>"><img class="thumbnail" src="/<?="{$wannabe->user['User']['image']}_100.png?".time();?>" alt="" /></a>
</li>
</ul>
</div>
<?php } ?>
<?php
if($crewmember) {
?>
<div class="col-xs-8">
<h5><?=__("Member of:")?></h5>
<ul>
<?php foreach($wannabe->user['Crew'] as $crew) { ?>
<li>
<?=$this->Wb->crewLink2($crew['name'])?>
</li>
<?php } ?>
</ul>
</div>
<?php
}
?>
</div>
<div class="span6 home-profile">
<h4><?=__("Actions")?></h4>
<p><a href="<?=$this->Wb->eventUrl('/Profile/View')?>" class="btn btn-default"><?=__("Full profile")?></a> <a href="<?=$this->Wb->eventUrl('/Profile/Edit')?>" class="btn btn-default"><?=__("Edit profile")?></a> <a href="<?=$this->Wb->eventUrl('/Profile/Picture')?>" class="btn btn-default"><?=__("Upload picture")?></a></p>
</div>
<?php if((!empty($settings) && $settings['EnrollSetting']['enrollactive']) && $accessToEnroll && $activeApplicationsList) { ?>
<div class="row">
<div class="col-md-12 home-profile">
<ul>
<?php foreach($activeApplicationsList as $key => $crew){ ?>
<li><a href="<?=$this->Wb->eventUrl('/Enroll/filter?crew_id='.$wannabe->user['Crew'][$key]['id'])?>"><?=$crew>1 ? __("%s active applications for %s", $crew, $wannabe->user['Crew'][$key]['name']) : __("%s active application for %s", $crew, $wannabe->user['Crew'][$key]['name'])?></a></li>
<? } ?>
</ul>
</div>
</div>
<?php } ?>
<?php
if($crewmember && sizeof($availableIrcChannels) > 0) { ?>
<div class="row">
<div class="col-md-12 home-profile">
<h4><?=__("Access to IRC")?></h4>
<ul>
<?foreach($availableIrcChannels as $arr => $chan) { ?>
<li><strong><?=$chan[0]['channelname']?></strong>: <?=$chan[0]['channelkey']?></li>
<? } ?>
</ul>
</div>
</div>
<? } ?>
<?php
if($crewmember && sizeof($smsbudget) > 0) { ?>
<div class="row">
<div class="col-md-12 home-profile">
<h4><?=__("SMS Budget")?></h4>
<ul class="unstyled profile">
<li>Used: <?= $smsbudget['SmsBudget']['sms_sent'] ?></li>
<li>Limit: <?= $smsbudget['SmsBudget']['sms_limit'] ?></li>
</ul>
</div>
</div>
<? } ?>
<?php if($crewmember && sizeof($birthdays) > 0) { ?>
<div class="row">
<div class="col-md-12 home-profile">
<h4><?=__("Todays birthdays")?></h4>
<ul>
<?php foreach($birthdays as $birthday) { ?>
<li>
<?=$this->Wb->userLink($birthday)?> (<?=$this->Wb->calculateAge($birthday['User']['birth'])?> <?=__("Years")?>)
</li>
<?php } ?>
</ul>
</div>
</div>
<? } ?>
<?php if($crewmember && sizeof($activeUsers) > 0) { ?>
<div class="row">
<div class="col-md-12 home-profile">
<h4><?=__("Last active")?></h4>
<ul>
<?php foreach($activeUsers as $user): ?>
<li><?=$this->Wb->userLink($user)?> (<?=$this->Wb->lastActive($user)?>)</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<?php } ?>
</div>
<div class="col-md-8">
<!-- Main content -->
<div class="row">
<?php
if(!$crewmember && $wannabe->event->can_apply_for_crew) {
?>
<div class="col-md-12">
<h2><?=__("Apply for crew")?> <small><?=__("One of the best experiences of your life!")?></small></h2>
<p><?=__("A fan of The Gathering? Join us and make it happen! Contribute with your time and skills and we will guarantee that you will have one of the best experiences of your life.")?></p>
<p><?=__("Check out %s to find out which crew that fits you best.", $this->Wb->eventLink(__("descriptions"), '/Crew/Description'))?></p>
<?php if(!empty($application)) { ?>
<p><?=__("Thank you for submitting your application. You will recieve feedback by email.")?></p>
<p><a class="btn success" href="<?=$this->Wb->eventUrl("/Application")?>"><?=__("Edit your application")?></a></p>
<?php } else { ?>
<p><a class="btn success" href="<?=$this->Wb->eventUrl("/Application")?>"><?=__("Apply for crew now")?></a></p>
<?php } ?>
</div>
<?php
} else if ($crewmember) {
?>
<div class="col-md-12">
<?=$this->element('wikipage', array('page' => "Front"))?>
</div>
<?php
} else if (!$cfadMembership) {
?>
<div class="col-md-12">
<h2><?=__("This event is not yet open for applications.")?></h2>
<br>
<blockquote>
<p>He that can have patience can have what he will</p>
<small>Benjamin Franklin</small>
</blockquote>
</div>
<?php
}
?>
<?php
if(!$crewmember && isset($cfadSettings['CfadApplicationSetting']['can_apply']) && $cfadSettings['CfadApplicationSetting']['can_apply'] && $accessToCfad) {
if(isset($cfadMembership[0])) {
?>
<div class="col-md-12">
<h2><?=__("CFAD")?> </h2>
<h5><?=__("Member of:")?></h5>
<li> <?= $cfadMembership[0]['crews']['name'] ?></li>
</div>
<?php
} else {
?>
<div class="col-md-12">
<h2><?=__("Apply for crew for a day")?> </h2>
<p><a class="btn success" href="<?=$this->Wb->eventUrl("/cfad/CfadApplication")?>"><?=__("Apply for crew for a day now")?></a></p>
</div>
<?php
}
}
?>
</div>
</div>
</div>
<?php if($geocode->userNeedGeocodeUpdate): ?>
<script type="text/javascript">
function initUserGeocoder() {
geocoder = new google.maps.Geocoder();
var address = "<?=$geocode->userAddress?>";
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var latlng = results[0].geometry.location;
var post = $.post("<?=$this->Wb->eventUrl('/Geocode')?>", {
address: "<?=$geocode->userAddress?>",
latitude: latlng.lat(),
longitude: latlng.lng(),
user_id: <?=$wannabe->user['User']['id']?>,
})
.success(function(data) {
data = $.parseJSON(data);
if(data.success == false) {
showAlert("Error saving geocode to cache", '<a class="btn small" href="mailto:wannabe@gathering.org"><?=__("Report this")?></a>');
}
})
.error(function() {
showAlert("Error saving geocode to cache", '<a class="btn small" href="mailto:wannabe@gathering.org"><?=__("Report this")?></a>');
})
} else {
if(status == 'ZERO_RESULTS') {
var post = $.post("<?=$this->Wb->eventUrl('/Geocode/invalidate')?>", {
address: "<?=$geocode->userAddress?>"
})
.success(function(data) {
data = $.parseJSON(data);
if(data.success) {
showAlert(
'<?=__("Your address did not match any geograpical coordinates, which probably means your address is invalid. You might want to update your address!")?>',
'<a class="btn small" href="<?=$this->Wb->eventUrl('/Profile/Edit')?>"><?=__("Edit your profile")?></a> <a class="btn small" href="mailto:wannabe@gathering.org"><?=__("Report this")?></a>'
);
}
})
.error(function() {
showAlert("Error saving geocode to cache", '<a class="btn small" href="mailto:wannabe@gathering.org"><?=__("Report this")?></a>');
})
} else {
showAlert("Geocode was not successful for the following reason: " + status, '<a class="btn small" href="mailto:wannabe@gathering.org"><?=__("Report this")?></a>');
}
}
});
}
function loadGoogleMapsAPI() {
var s=document.createElement("script");
s.type="text/javascript";
s.src="https://maps.googleapis.com/maps/api/js?key=<?=$geocode->apikey?>&sensor=false&callback=initUserGeocoder";
document.body.appendChild(s);
}
window.onload = loadGoogleMapsAPI;
</script>
<? endif; ?>