-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle-event.php
138 lines (121 loc) · 5.73 KB
/
single-event.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
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
<?php
/**
* Apocrypha Theme Homepage Template
* Andrew Clayton
* Version 2.0
* 11-22-2014
*/
// Get the calendar event
$event = new Apoc_Event();
$capacity = $event->capacity;
$confirmed = $event->confirmed;
$maybe = $event->maybe;
$declined = $event->declined;
$rsvps = $event->rsvps;
$user_id = get_current_user_id();
// Maybe use a different header or sidebar
$group = ( $event->calendar->slug == 'entropy-rising' ) ? "er" : ""; ?>
<?php get_header($group); ?>
<div id="content" role="main">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php apoc_breadcrumbs(); ?>
<article id="post-<?php the_ID(); ?>" class="post">
<header class="post-header <?php apoc_post_header_class('post'); ?>">
<h1 class="post-title"><?php the_title(); ?></h1>
<p class="post-byline"><?php echo apoc()->description; ?></p>
</header>
<section class="post-content double-border event">
<div class="event-datetime">
<span class="event-day"><?php echo $event->day; ?></span>
<span class="event-date"><?php echo $event->date; ?></span>
<span class="event-time"><?php echo $event->time; ?> EST</span>
</div>
<div class="event-content">
<?php the_content(); ?>
</div>
</section>
<footer class="post-footer">
<span class="post-categories">
<i class="fa fa-tags"></i>
<?php echo get_the_term_list( get_the_ID() , 'calendar', 'Posted On: ', ', ', '' ); ?>
</span>
</footer>
</article>
<div class="event-attendance">
<?php if ( $confirmed > 0 ) : ?>
<h2 class="calendar-header">Attending (<?php echo $confirmed; ?>)</h2>
<ul class="respondent-list attending">
<?php foreach ( $rsvps as $uid => $response ) :
if ( 'yes' == $response['rsvp'] ) :
echo '<li class="event-respondent">' . implode( ' | ' , array_filter( array( $response['link'] , $response['role'] , stripslashes( $response['comment'] ) ) ) ) . '</li>';
endif;
endforeach; ?>
</ul>
<?php endif; ?>
<?php if ( $maybe > 0 ) : ?>
<h2 class="calendar-header">Maybe (<?php echo $maybe; ?>)</h2>
<ul class="respondent-list attending">
<?php foreach ( $rsvps as $responder => $response ) :
if ( 'maybe' == $response['rsvp'] ) :
echo '<li class="event-respondent">' . implode( ' | ' , array_filter( array( $response['link'] , $response['role'] , stripslashes( $response['comment'] ) ) ) ) . '</li>';
endif;
endforeach; ?>
</ul>
<?php endif; ?>
<?php if ( $declined > 0 ) : ?>
<h2 class="calendar-header">Not Attending (<?php echo $declined; ?>)</h2>
<ul class="respondent-list attending">
<?php foreach ( $rsvps as $responder => $response ) :
if ( 'no' == $response['rsvp'] ) :
echo '<li class="event-respondent">' . implode( ' | ' , array( $response['link'] , stripslashes( $response['comment'] ) ) ) . '</li>';
endif;
endforeach; ?>
</ul>
<?php endif; ?>
<?php if ( 0 == count( $rsvps ) ) : ?>
<h2 class="calendar-header">No Responses Yet!</h2>
<?php endif; ?>
</div>
<?php if ( !$event->is_past ) : ?>
<h2 class="calendar-header">Respond to this Event</h2>
<form action="<?php echo apoc()->url; ?>" name="calendar-rsvp-form" id="calendar-rsvp-form" method="post">
<?php do_action( 'template_notices' ); ?>
<fieldset>
<div class="form-left">
<ul class="checkbox-list">
<?php if ( $confirmed < $capacity || ( isset( $rsvps[$user_id] ) && 'yes' == $rsvps[$user_id]['rsvp'] ) ) : ?>
<li><input type="radio" name="attendance" value="yes" <?php if ( isset( $rsvps[$user_id] ) ) checked( $rsvps[$user_id]['rsvp'] , 'yes' ); ?>/><label for="attendance">Yes</label></li>
<li><input type="radio" name="attendance" value="no" <?php if ( isset( $rsvps[$user_id] ) ) checked( $rsvps[$user_id]['rsvp'] , 'no' ); ?>/><label for="playstyle">No</label></li>
<li><input type="radio" name="attendance" value="maybe" <?php if ( isset( $rsvps[$user_id] ) ) checked( $rsvps[$user_id]['rsvp'] , 'maybe' ); ?>/><label for="attendance">Maybe</label></li>
<?php else : ?>
<li><input type="radio" name="attendance" value="maybe" <?php if ( isset( $rsvps[$user_id] ) ) checked( $rsvps[$user_id]['rsvp'] , 'maybe' ); ?>/><label for="attendance">Standby</label></li>
<li><input type="radio" name="attendance" value="no" <?php if ( isset( $rsvps[$user_id] ) ) checked( $rsvps[$user_id]['rsvp'] , 'no' ); ?>/><label for="playstyle">No</label></li>
<?php endif; ?>
</ul>
</div>
<?php if ( $event->req_role ) : ?>
<div class="form-right">
<label for="rsvp-role">Preferred Role:</label>
<select name="rsvp-role">
<option></option>
<option value="tank" <?php if ( isset( $rsvps[$user_id] ) ) selected( $rsvps[$user_id]['role'] , 'tank' ); ?>>Tank</option>
<option value="healer" <?php if ( isset( $rsvps[$user_id] ) ) selected( $rsvps[$user_id]['role'] , 'healer' ); ?>>Healer</option>
<option value="dps" <?php if ( isset( $rsvps[$user_id] ) ) selected( $rsvps[$user_id]['role'] , 'dps' ); ?>>DPS</option>
</select>
</div>
<?php endif; ?>
<div class="form-full">
<label for="rsvp-comment">Comment:</label><br/>
<textarea type="textarea" name="rsvp-comment" value="" rows="2" ><?php if ( isset( $rsvps[$user_id] ) ) echo stripslashes( $rsvps[$user_id]['comment'] ); ?></textarea>
</div>
<div class="form-right">
<?php wp_nonce_field( 'event-rsvp' , 'event_rsvp_nonce' ) ?>
<button type="submit" name="submit"><i class="fa fa-calendar"></i>Respond</button>
</div>
</fieldset>
</form>
<?php endif; ?>
<?php endwhile; endif; ?>
</div>
<?php apoc_primary_sidebar($group); ?>
<?php get_footer(); ?>