Esempio n. 1
0
function evors_metabox_content()
{
    global $post, $eventon_rs, $eventon;
    $optRS = $eventon_rs->evors_opt;
    $pmv = get_post_meta($post->ID);
    wp_nonce_field(plugin_basename(__FILE__), 'evors_nonce');
    ob_start();
    $evors_rsvp = !empty($pmv['evors_rsvp']) ? $pmv['evors_rsvp'][0] : null;
    $evors_show_rsvp = !empty($pmv['evors_show_rsvp']) ? $pmv['evors_show_rsvp'][0] : null;
    $evors_show_whos_coming = !empty($pmv['evors_show_whos_coming']) ? $pmv['evors_show_whos_coming'][0] : null;
    $evors_add_emails = !empty($pmv['evors_add_emails']) ? $pmv['evors_add_emails'][0] : null;
    ?>
	<div class='eventon_mb'>
	<div class="evors">
		<p class='yesno_leg_line ' style='padding:10px'>
			<?php 
    echo eventon_html_yesnobtn(array('var' => $evors_rsvp, 'attr' => array('afterstatement' => 'evors_details')));
    ?>
			<input type='hidden' name='evors_rsvp' value="<?php 
    echo $evors_rsvp == 'yes' ? 'yes' : 'no';
    ?>
"/>
			<label for='evors_rsvp'><?php 
    _e('Allow visitors to RSVP to this event');
    ?>
</label>
		</p>
		<div id='evors_details' class='evors_details evomb_body ' <?php 
    echo $evors_rsvp == 'yes' ? null : 'style="display:none"';
    ?>
>		
			<div class="evors_stats" style='padding-top:5px'>			
			<?php 
    $yes_count = $eventon_rs->frontend->functions->get_event_rsvp_count($post->ID, 'yes', $pmv);
    $maybe_count = $eventon_rs->frontend->functions->get_event_rsvp_count($post->ID, 'maybe', $pmv);
    $no_count = $eventon_rs->frontend->functions->get_event_rsvp_count($post->ID, 'no', $pmv);
    ?>
				<p><b><?php 
    echo $yes_count;
    ?>
</b><span><?php 
    _e('YES', 'eventon');
    ?>
</span></p>
				<p><b><?php 
    echo $maybe_count;
    ?>
</b><span><?php 
    _e('Maybe', 'eventon');
    ?>
</span></p>
				<p><b><?php 
    echo $no_count;
    ?>
</b><span><?php 
    _e('No', 'eventon');
    ?>
</span></p>
				<div class='clear'></div>
			</div>
			<div class='evo_negative_25'>
			<table width='100%' class='eventon_settings_table'>
				<tr><td colspan='2'>
					<p class='yesno_leg_line '>
						<?php 
    echo eventon_html_yesnobtn(array('var' => $evors_show_rsvp));
    ?>
					
						<input type='hidden' name='evors_show_rsvp' value="<?php 
    echo $evors_show_rsvp == 'yes' ? 'yes' : 'no';
    ?>
"/>
						<label for='evors_show_rsvp'><?php 
    _e('Show current RSVP count for event');
    ?>
</label>
					</p>
				</td></tr>
				<tr><td colspan='2'>
					<p class='yesno_leg_line '>
						<?php 
    echo eventon_html_yesnobtn(array('var' => $evors_show_whos_coming));
    ?>
						<input type='hidden' name='evors_show_whos_coming' value="<?php 
    echo $evors_show_whos_coming == 'yes' ? 'yes' : 'no';
    ?>
"/>
						<label for='evors_show_whos_coming'><?php 
    _e("Show who's coming to event");
    ?>
</label>
					</p>
				</td></tr>
				
				<?php 
    // if notifications enabled show additional emails field
    if (!empty($optRS['evors_notif']) && $optRS['evors_notif'] == 'yes') {
        ?>
						<tr><td colspan='2'>
						<p style='padding:5px 0'>
							<label for='evors_add_emails'><i><?php 
        _e('Additional email addresses to receive email notifications', 'eventon');
        echo $eventon->throw_guide("Set additional email addresses seperated by commas to receive email notifications upon new RSVP reciept", '', false);
        ?>
</i></label>
							<input type='text' name='evors_add_emails' value="<?php 
        echo $evors_add_emails;
        ?>
" style='width:100%' placeholder='eg. you@domain.com'/>			
						</p>
						</td></tr>
					<?php 
    }
    ?>

				<tr><td colspan='2'>			
					<?php 
    $evors_max_active = !empty($pmv['evors_max_active']) ? $pmv['evors_max_active'][0] : null;
    $evors_max_count = !empty($pmv['evors_max_count']) ? $pmv['evors_max_count'][0] : null;
    ?>
					<p class='yesno_leg_line '>
						<?php 
    echo eventon_html_yesnobtn(array('var' => $evors_max_active, 'attr' => array('afterstatement' => 'evors_max_count_row', 'as_type' => 'class')));
    ?>
						<input type='hidden' name='evors_max_active' value="<?php 
    echo $evors_max_active == 'yes' ? 'yes' : 'no';
    ?>
"/>
						<label for='evors_max_active'><?php 
    _e('Limit maximum capacity count per RSVP', 'eventon');
    echo $eventon->throw_guide('This will allow you to limit each RSVP reservation count to a set max number, then the guests can not book more spaces than this limit.');
    ?>
</label>
					</p>
				</td></tr>
					<tr class='evors_max_count_row yesnosub' style='display:<?php 
    echo $evors_max_active == 'yes' ? '' : 'none';
    ?>
'>
						<td><?php 
    _e('Maximum count number', 'eventon');
    ?>
</td>
						<td><input type='text' id='evors_max_count' name='evors_max_count' value="<?php 
    echo $evors_max_count;
    ?>
"/></td>
					</tr>


				<tr><td colspan='2'>			
					<?php 
    $evors_capacity = !empty($pmv['evors_capacity']) ? $pmv['evors_capacity'][0] : null;
    ?>
					<p class='yesno_leg_line '>
						<?php 
    echo eventon_html_yesnobtn(array('var' => $evors_capacity, 'attr' => array('afterstatement' => 'evors_capacity_row', 'as_type' => 'class')));
    ?>
						<input type='hidden' name='evors_capacity' value="<?php 
    echo $evors_capacity == 'yes' ? 'yes' : 'no';
    ?>
"/>
						<label for='evors_capacity'><?php 
    _e('Set capacity limit for RSVP', 'eventon');
    echo $eventon->throw_guide('Activating this will allow you to add a limit to how many RSVPs you can receive. When the limit is reached RSVP will close.');
    ?>
</label>
					</p>
				</td></tr>
				<?php 
    $evors_capacity_count = !empty($pmv['evors_capacity_count']) ? $pmv['evors_capacity_count'][0] : null;
    $evors_capacity_show = !empty($pmv['evors_capacity_show']) ? $pmv['evors_capacity_show'][0] : null;
    ?>
				<tr class='evors_capacity_row yesnosub' style='display:<?php 
    echo $evors_capacity == 'yes' ? '' : 'none';
    ?>
'>
					<td><?php 
    _e('Total available RSVP capacity', 'eventon');
    ?>
</td>
					<td><input type='text' id='evors_capacity_count' name='evors_capacity_count' value="<?php 
    echo $evors_capacity_count;
    ?>
"/></td>
				</tr>

				<?php 
    // manange RSVP capacity separate for repeating events
    if (!empty($pmv['evcal_repeat']) && $pmv['evcal_repeat'][0] == 'yes') {
        $manage_repeat_cap = evo_meta_yesno($pmv, '_manage_repeat_cap_rs', 'yes', 'yes', 'no');
        ?>
				<tr class='evors_capacity_row yesnosub' style='display:<?php 
        echo $evors_capacity == 'yes' ? '' : 'none';
        ?>
'><td colspan='2'>
					<p class='yesno_leg_line ' >
						<?php 
        echo eventon_html_yesnobtn(array('id' => 'evors_mcap', 'var' => $manage_repeat_cap, 'attr' => array('afterstatement' => 'evors_ri_cap')));
        ?>
						<input type='hidden' name='_manage_repeat_cap_rs' value="<?php 
        echo $manage_repeat_cap;
        ?>
"/>

						<label for='_manage_repeat_cap_rs'><?php 
        _e('Manage available capacity separate for each repeating interval of this event');
        echo $eventon->throw_guide('Once repeating event capacities are set the total capacity for event will be overridden. If you just made event repeat, this event need to be updated for repeat options to show up.', '', false);
        ?>
</label>
					</p>
				<?php 
        $repeat_intervals = !empty($pmv['repeat_intervals']) ? unserialize($pmv['repeat_intervals'][0]) : false;
        ?>
					<div id='evors_ri_cap' class='evotx_repeat_capacity' style='padding-top:15px; padding-bottom:20px;display:<?php 
        echo evo_meta_yesno($pmv, '_manage_repeat_cap_rs', 'yes', '', 'none');
        ?>
'>
						<p><em style='opacity:0.6'><?php 
        _e('NOTE: The capacity above should match the total number of capacity for each repeat occurance below for this event.', 'eventon');
        ?>
</em></p>
						<?php 
        // if repeat intervals set
        if ($repeat_intervals && count($repeat_intervals) > 0) {
            $count = 0;
            // get saved capacities for repeats
            $ri_capacity_rs = !empty($pmv['ri_capacity_rs']) ? unserialize($pmv['ri_capacity_rs'][0]) : false;
            echo "<div class='evotx_ri_cap_inputs'>";
            // for each repeat interval
            $evcal_opt1 = get_option('evcal_options_evcal_1');
            foreach ($repeat_intervals as $interval) {
                $date_format = eventon_get_timeNdate_format($evcal_opt1);
                $TIME = eventon_get_editevent_kaalaya($interval[0], $date_format[1], $date_format[2]);
                $ri_open_count = $ri_capacity_rs && !empty($ri_capacity_rs[$count]) ? $ri_capacity_rs[$count] : '0';
                echo "<p class='" . ($count > 10 ? 'hidden' : '') . "'><input type='text' name='ri_capacity_rs[]' value='" . $ri_open_count . "'/><span>" . $TIME[0] . "<br/><em>Remaining: " . $eventon_rs->frontend->functions->get_ri_remaining_count('y', $count, $ri_open_count, $pmv) . "</em></span></p>";
                $count++;
            }
            echo "<div class='clear'></div>";
            echo $count > 10 ? "<p class='evors_repeats_showrest'>" . __('Show Rest', 'eventon') . "</p>" : '';
            echo "</div>";
            echo count($repeat_intervals) > 5 ? "<p class='evotx_ri_view_more'><a class='button_evo'>Click here</a> to view the rest of repeat occurances.</p>" : null;
        }
        ?>
					</div>
				</td></tr>
				<?php 
    }
    ?>

				<tr class='evors_capacity_row yesnosub' style='display:<?php 
    echo $evors_capacity == 'yes' ? '' : 'none';
    ?>
'><td colspan='2'>
					<p class='yesno_leg_line '>
						<?php 
    echo eventon_html_yesnobtn(array('var' => $evors_capacity_show));
    ?>
						<input type='hidden' name='evors_capacity_show' value="<?php 
    echo $evors_capacity_show == 'yes' ? 'yes' : 'no';
    ?>
"/>
						<label for='evors_capacity_show'><?php 
    _e('Show available spaces count on front-end');
    ?>
</label>
					</p>
				</td></tr>
				<?php 
    $evors_close_time = !empty($pmv['evors_close_time']) ? $pmv['evors_close_time'][0] : null;
    ?>
				<tr>
					<td><?php 
    _e('Close RSVP before time (in minutes)', 'eventon');
    echo $eventon->throw_guide('Set how many minutes before the event end time to close RSVP form. Time must be in minutes. Leave blank to not close RSVP before event time.');
    ?>
</td>
					<td><input type='text' id='evors_close_time' name='evors_close_time' value="<?php 
    echo $evors_close_time;
    ?>
" placeholder='eg. 45'/></td>
				</tr>
				<tr>
					<td colspan='2'><?php 
    _e('Additional Information only visible to loggedin RSVPed guests & in Confirmation Email', 'eventon');
    echo $eventon->throw_guide('Information entered in here will only be visible on front-end once user has RSVPed to the event.');
    ?>
					<br/><textarea style='width:100%; margin-top:10px' name='evors_additional_data'><?php 
    echo !empty($pmv['evors_additional_data']) ? $pmv['evors_additional_data'][0] : null;
    ?>
</textarea>
					</td>
				</tr>
			</table>
			</div>
			<?php 
    // INITIAL information for lightbox data section
    // @version 0.2
    // DOWNLOAD CSV link
    $exportURL = add_query_arg(array('action' => 'the_ajax_evors_a3', 'e_id' => $post->ID), admin_url('admin-ajax.php'));
    // repeat event interval data
    $ri_count_active = $eventon_rs->frontend->functions->is_ri_count_active($pmv);
    $repeatIntervals = !empty($pmv['repeat_intervals']) ? unserialize($pmv['repeat_intervals'][0]) : false;
    $datetime = new evo_datetime();
    $wp_date_format = get_option('date_format');
    ?>
			<div class='evcal_rep evors_info_actions'>				
				<div class='evcalr_1'>
				<p class='actions'>
					<a id='evors_VA' data-e_id='<?php 
    echo $post->ID;
    ?>
' data-riactive='<?php 
    echo $ri_count_active && $repeatIntervals ? 'yes' : 'no';
    ?>
' data-popc='evors_lightbox' class='button_evo attendees ajde_popup_trig' ><?php 
    _e('View Attendees', 'eventon');
    ?>
</a> 
					<a class='button_evo download' href="<?php 
    echo $exportURL;
    ?>
"><?php 
    _e('Download (CSV)', 'eventon');
    ?>
</a> 
					<a id='evors_SY' data-e_id='<?php 
    echo $post->ID;
    ?>
' class='button_evo sync' ><?php 
    _e('Sync Count', 'eventon');
    ?>
</a> 
					<a id='evors_EMAIL' data-e_id='<?php 
    echo $post->ID;
    ?>
' data-popc='evors_email_attendee' class='button_evo email ajde_popup_trig' ><?php 
    _e('Emailing', 'eventon');
    ?>
</a> 
				</p>
				
				<?php 
    // lightbox content for emailing section
    ob_start();
    ?>
				<div id='evors_emailing' style=''>
					<p><label><?php 
    _e('Select emailing option', 'eventon');
    ?>
</label>
						<select name="" id="evors_emailing_options">
							<option value="someone"><?php 
    _e('Email Attendees List to someone', 'eventon');
    ?>
</option>
							<option value="coming"><?php 
    _e('Email only attending guests', 'eventon');
    ?>
</option>
							<option value="notcoming"><?php 
    _e('Email guests not coming to event', 'eventon');
    ?>
</option>
							<option value="all"><?php 
    _e('Email all rsvped guests', 'eventon');
    ?>
</option>
						</select>
					</p>
					<?php 
    // if repeat interval count separatly
    if ($ri_count_active && $repeatIntervals) {
        if (count($repeatIntervals) > 0) {
            echo "<p><label>" . __('Select Event Repeat Instance', 'eventon') . "</label> ";
            echo "<select name='repeat_interval' id='evors_emailing_repeat_interval'>\r\n\t\t\t\t\t\t\t\t\t<option value='all'>" . __('All', 'eventon') . "</option>";
            $x = 0;
            foreach ($repeatIntervals as $interval) {
                $time = $datetime->get_correct_formatted_event_repeat_time($pmv, $x, $wp_date_format);
                echo "<option value='" . $x . "'>" . $time['start'] . "</option>";
                $x++;
            }
            echo "</select>";
            echo $eventon->throw_guide("Select which instance of repeating events of this event you want to use for this emailing action.", '', false);
            echo "</p>";
        }
    }
    ?>
					<p style='' class='text'><label for=""><?php 
    _e('Email Addresses (separated by commas)', 'eventon');
    ?>
</label><br/><input style='width:100%' type="text"></p>
					<p style='' class='subject'><label for=""><?php 
    _e('Subject for email', 'eventon');
    ?>
 *</label><br/><input style='width:100%' type="text"></p>
					<p style='' class='textarea'><label for=""><?php 
    _e('Message for the email', 'eventon');
    ?>
</label><br/>
						<textarea cols="30" rows="5" style='width:100%'></textarea></p>
					<p><a data-eid='<?php 
    echo $post->ID;
    ?>
' id="evors_email_submit" class='evo_admin_btn btn_prime'><?php 
    _e('Send Email', 'eventon');
    ?>
</a></p>
				</div>
				<?php 
    $emailing_content = ob_get_clean();
    ?>

				<?php 
    // lightbox content for view attendees
    if ($repeatIntervals && $ri_count_active && count($repeatIntervals) > 0) {
        ob_start();
        ?>
					<div id='evors_view_attendees'>
						<p style='text-align:center'><label><?php 
        _e('Select Repeating Instance of Event', 'eventon');
        ?>
</label> 
							<select name="" id="evors_event_repeatInstance">
								<option value="all"><?php 
        _e('All Repeating Instances', 'eventon');
        ?>
</option>
								<?php 
        $x = 0;
        foreach ($repeatIntervals as $interval) {
            $time = $datetime->get_correct_formatted_event_repeat_time($pmv, $x, $wp_date_format);
            echo "<option value='" . $x . "'>" . $time['start'] . "</option>";
            $x++;
        }
        ?>
							</select>
						</p>
						<p style='text-align:center'><a id='evors_VA_submit' data-e_id='<?php 
        echo $post->ID;
        ?>
' class='evo_admin_btn btn_prime' ><?php 
        _e('Submit', 'eventon');
        ?>
</a> </p>
					</div>
					<div id='evors_view_attendees_list'></div>
					<?php 
        $viewattendee_content = ob_get_clean();
    } else {
        $viewattendee_content = "<div id='evors_view_attendees'>LOADING...</div>";
    }
    ?>

				<p id='evors_message' style='display:none'></p>
				<?php 
    echo $eventon->output_eventon_pop_window(array('class' => 'evors_lightbox', 'content' => $viewattendee_content, 'title' => __('View Attendee List', 'eventon'), 'type' => 'padded', 'max_height' => 450));
    echo $eventon->output_eventon_pop_window(array('class' => 'evors_email_attendee', 'content' => $emailing_content, 'title' => __('Email Attendee List', 'eventon'), 'type' => 'padded', 'max_height' => 450));
    ?>
				</div>
			</div>
		</div>
	</div>
	</div>
	<?php 
    echo ob_get_clean();
}
Esempio n. 2
0
 function repeat_event_header($ri, $eventid)
 {
     $ev_vals = get_post_meta($eventid);
     if (empty($ev_vals['evcal_repeat']) || !empty($ev_vals['evcal_repeat']) && $ev_vals['evcal_repeat'][0] == 'no') {
         return false;
     }
     $repeat_intervals = !empty($ev_vals['repeat_intervals']) ? is_serialized($ev_vals['repeat_intervals'][0]) ? unserialize($ev_vals['repeat_intervals'][0]) : $ev_vals['repeat_intervals'][0] : false;
     // if there are no repeat intervals or only one interval
     if ($repeat_intervals && !is_array($repeat_intervals) && (is_array($repeat_intervals) && count($repeat_intervals) == 1)) {
         return false;
     }
     $repeat_count = count($repeat_intervals) - 1;
     $date = new evo_datetime();
     $event_permalink = get_permalink($eventid);
     echo "<div class='evose_repeat_header'><p><span class='title'>" . evo_lang('This is a repeating event') . "</span>";
     echo "<span class='ri_nav'>";
     // previous link
     if ($ri > 0) {
         $prev = $date->get_correct_formatted_event_repeat_time($ev_vals, $ri - 1);
         // /print_r($prev);
         $prev_link = $this->get_repeat_event_url($event_permalink, $ri - 1);
         echo "<a href='{$prev_link}' class='prev' title='{$prev['start_']}'><b class='fa fa-angle-left'></b><em>{$prev['start_']}</em></a>";
     }
     // next link
     if ($ri < $repeat_count) {
         $next = $date->get_correct_formatted_event_repeat_time($ev_vals, $ri + 1);
         //print_r($next);
         $next_link = $this->get_repeat_event_url($event_permalink, $ri + 1);
         echo "<a href='{$next_link}' class='next' title='{$next['start_']}'><em>{$next['start_']}</em><b class='fa fa-angle-right'></b></a>";
     }
     echo "</span><span class='clear'></span></p></div>";
 }
Esempio n. 3
0
 function emailing_rsvp_admin()
 {
     global $eventon_rs, $eventon;
     $eid = $_POST['eid'];
     $type = $_POST['type'];
     $RI = !empty($_POST['repeat_interval']) ? $_POST['repeat_interval'] : 'all';
     // repeat interval
     $emails = $EMAILED = $_message_addition = false;
     // email attendees list to someone
     if ($type == 'someone') {
         $emails = explode(',', str_replace(' ', '', htmlspecialchars_decode($_POST['emails'])));
         $guests = $eventon_rs->frontend->functions->GET_rsvp_list($eid, $RI);
         if (is_array($guests) && isset($guests['y']) && count($guests['y']) > 0) {
             ob_start();
             $datetime = new evo_datetime();
             $epmv = get_post_custom($eid);
             $eventdate = $datetime->get_correct_formatted_event_repeat_time($epmv, $RI == 'all' ? '0' : $RI);
             echo "<p>Guests Attending to " . get_the_title($eid) . " on " . $eventdate['start'] . "</p>";
             echo "<table style='padding-top:15px; width:100%;text-align:left'><thead><tr><th>Last Name</th><th>First Name</th><th>Email</th><th>Count</th></tr></thead>\r\n\t\t\t\t\t<tbody>";
             foreach ($guests['y'] as $guest) {
                 echo "<tr><td>" . $guest['lname'] . "</td><td>" . $guest['fname'] . "</td><td>" . $guest['email'] . "</td><td>" . $guest['count'] . "</td></tr>";
             }
             echo "</tbody></table>";
             $_message_addition = ob_get_clean();
         }
     } elseif ($type == 'coming') {
         $guests = $eventon_rs->frontend->functions->GET_rsvp_list($eid, $RI);
         foreach (array('y', 'm') as $rsvp_status) {
             if (is_array($guests) && isset($guests[$rsvp_status]) && count($guests[$rsvp_status]) > 0) {
                 foreach ($guests[$rsvp_status] as $guest) {
                     $emails .= $guest['email'] . ',';
                 }
             }
         }
     } elseif ($type == 'notcoming') {
         $guests = $eventon_rs->frontend->functions->GET_rsvp_list($eid, $RI);
         if (is_array($guests) && isset($guests['n']) && count($guests['n']) > 0) {
             foreach ($guests['n'] as $guest) {
                 $emails .= $guest['email'] . ',';
             }
         }
     } elseif ($type == 'all') {
         $guests = $eventon_rs->frontend->functions->GET_rsvp_list($eid, $RI);
         foreach (array('y', 'm', 'n') as $rsvp_status) {
             if (is_array($guests) && isset($guests[$rsvp_status]) && count($guests[$rsvp_status]) > 0) {
                 foreach ($guests[$rsvp_status] as $guest) {
                     $emails .= $guest['email'] . ',';
                 }
             }
         }
     }
     // emaling
     if ($emails) {
         $messageBODY = "<div style='padding:15px'>" . (!empty($_POST['message']) ? strip_tags($_POST['message']) . '<br/><br/>' : '') . ($_message_addition ? $_message_addition : '') . "</div>";
         $messageBODY = $eventon_rs->frontend->get_evo_email_body($messageBODY);
         $from_email = $eventon_rs->frontend->get_from_email();
         $args = array('html' => 'yes', 'to' => $type == 'someone' ? $emails : $from_email, 'subject' => $_POST['subject'], 'from' => $from_email, 'message' => $messageBODY);
         $headers = 'From: ' . $from_email . "\r\n";
         $headers .= 'Reply-To: ' . $from_email . "\r\n";
         if ($type != 'someone') {
             $headers .= 'Bcc: ' . $emails . "\r\n";
         }
         $args['header'] = $headers;
         //print_r($args);
         $EMAILED = $eventon_rs->helper->send_email($args);
     }
     $return_content = array('status' => $EMAILED ? '0' : 'did not go', 'other' => $args);
     echo json_encode($return_content);
     exit;
 }