示例#1
0
function evoRS_metabox_rsvp()
{
    global $post, $eventon_rs, $ajde, $pagenow;
    $pmv = get_post_meta($post->ID);
    $optRS = $eventon_rs->evors_opt;
    // Debug email templates
    $show_debug_email = false;
    if ($show_debug_email) {
        $tt = $eventon_rs->frontend->_get_email_body(array('e_id' => '90', 'rsvp' => 'y', 'count' => '1', 'first_name' => 'Jason', 'last_name' => 'Miller', 'rsvp_id' => '709', 'email' => '*****@*****.**'), 'confirmation_email');
        print_r($tt);
    }
    // get translated check-in status
    $_checkinST = !empty($pmv['status']) && $pmv['status'][0] == 'checked' ? 'checked' : 'check-in';
    $checkin_status = $eventon_rs->frontend->get_checkin_status($_checkinST);
    wp_nonce_field(plugin_basename(__FILE__), 'evorsvp_nonce');
    ?>
	
		<div class='eventon_mb' style='margin:-6px -12px -12px'>
		<div style='background-color:#ECECEC; padding:15px;'>
			<div style='background-color:#fff; border-radius:8px;'>
			<table id='evors_rsvp_tb' width='100%' class='evo_metatable'>				
				<tr><td><?php 
    _e('RSVP #', 'eventon');
    ?>
: </td><td><?php 
    echo $post->ID;
    ?>
</td></tr>
				<tr><td><?php 
    _e('RSVP Status', 'eventon');
    ?>
: </td>
					<td><select name='rsvp'>
					<?php 
    $savedrsvpO = !empty($pmv['rsvp']) ? $pmv['rsvp'][0] : false;
    foreach ($eventon_rs->rsvp_array_ as $rsvpOptions => $rsvpV) {
        echo "<option " . ($savedrsvpO && $rsvpOptions == $pmv['rsvp'][0] ? 'selected="selected"' : '') . " value='{$rsvpOptions}'>{$rsvpV}</option>";
    }
    ?>
					</select>
					</td></tr>
				<tr><td><?php 
    _e('Checkin Status', 'eventon');
    ?>
: </td><td><span class='rsvp_ch_st <?php 
    echo $_checkinST;
    ?>
' data-status='<?php 
    echo $_checkinST;
    ?>
' data-rsvpid='<?php 
    echo $post->ID;
    ?>
'><?php 
    echo $checkin_status;
    ?>
</span></td></tr>
				<tr><td><?php 
    _e('First Name', 'eventon');
    ?>
:* </td>
					<td><input type='text' name='first_name' value='<?php 
    echo !empty($pmv['first_name']) ? $pmv['first_name'][0] : '';
    ?>
'/>
					</td></tr>
				<tr><td><?php 
    _e('Last Name', 'eventon');
    ?>
: </td>
					<td><input type='text' name='last_name' value='<?php 
    echo !empty($pmv['last_name']) ? $pmv['last_name'][0] : '';
    ?>
'/>
					</td></tr>
				<tr><td><?php 
    _e('Email Address', 'eventon');
    ?>
:* </td>
					<td><input type='text' name='email' value='<?php 
    echo !empty($pmv['email']) ? $pmv['email'][0] : '';
    ?>
'/>
					</td></tr>
				<tr><td><?php 
    _e('Count', 'eventon');
    ?>
: </td>
					<td><input type='text' name='count' value='<?php 
    echo !empty($pmv['count']) ? $pmv['count'][0] : '1';
    ?>
'/></td></tr>
				<tr><td><?php 
    _e('Phone', 'eventon');
    ?>
: </td>
					<td><input type='text' name='phone' value='<?php 
    echo !empty($pmv['phone']) ? $pmv['phone'][0] : '';
    ?>
'/></td></tr>
				<tr><td><?php 
    _e('Receive Email Updates', 'eventon');
    ?>
: </td>
					<td><?php 
    echo $ajde->wp_admin->html_yesnobtn(array('id' => 'updates', 'input' => true, 'default' => !empty($pmv['updates']) && $pmv['updates'][0] == 'yes' ? 'yes' : 'no'));
    ?>
</td></tr>
				<tr><td><?php 
    _e('Event', 'eventon');
    ?>
: </td>
					<td><?php 
    // event for rsvp
    if (empty($pmv['e_id'])) {
        $events = get_posts(array('posts_per_page' => -1, 'post_type' => 'ajde_events'));
        if ($events && count($events) > 0) {
            echo "<select name='e_id'>";
            foreach ($events as $event) {
                echo "<option value='" . $event->ID . "'>" . get_the_title($event->ID) . "</option>";
            }
            echo "</select>";
        }
        wp_reset_postdata();
    } else {
        echo '<a href="' . get_edit_post_link($pmv['e_id'][0]) . '">' . get_the_title($pmv['e_id'][0]) . '</a></td></tr>';
    }
    // REPEATING interval
    if ($pagenow != 'post-new.php' && !empty($pmv['e_id'])) {
        $saved_ri = !empty($pmv['repeat_interval']) && $pmv['repeat_interval'][0] != '0' ? $pmv['repeat_interval'][0] : '0';
        $event_pmv = get_post_custom($pmv['e_id'][0]);
        ?>
					<tr><td><?php 
        _e('Event Date', 'eventon');
        ?>
: </td>
					<td><?php 
        $repeatIntervals = unserialize($event_pmv['repeat_intervals'][0]);
        if ($repeatIntervals && count($repeatIntervals) > 0) {
            $datetime = new evo_datetime();
            echo "<select name='repeat_interval'>";
            $x = 0;
            $wp_date_format = get_option('date_format');
            foreach ($repeatIntervals as $interval) {
                $time = $datetime->get_int_correct_event_time($event_pmv, $x);
                echo "<option value='" . $x . "' " . ($saved_ri == $x ? 'selected="selected"' : '') . ">" . date($wp_date_format . ' h:i:a', $time) . "</option>";
                $x++;
            }
            echo "</select>";
        }
        ?>
</td></tr>
					<?php 
    }
    // additional fields
    for ($x = 1; $x < 4; $x++) {
        // if fields is activated and name of the field is not empty
        if (evo_settings_val('evors_addf' . $x, $optRS) && !empty($optRS['evors_addf' . $x . '_1'])) {
            $FIELDTYPE = !empty($optRS['evors_addf' . $x . '_2']) ? $optRS['evors_addf' . $x . '_2'] : 'text';
            if ($FIELDTYPE == 'text') {
                echo "<tr><td>" . $optRS['evors_addf' . $x . '_1'] . "</td>\r\n\t\t\t\t\t\t\t\t<td><input type='text' name='evors_addf'.{$x}.'_1' value='" . (!empty($pmv['evors_addf' . $x . '_1']) ? $pmv['evors_addf' . $x . '_1'][0] : '-') . "'/></td></tr>";
            } else {
                echo "<tr><td>" . $optRS['evors_addf' . $x . '_1'] . "</td>\r\n\t\t\t\t\t\t\t\t<td><select name='evors_addf{$x}_1'>";
                $OPTIONS = $eventon_rs->frontend->get_additional_field_options($optRS['evors_addf' . $x . '_4']);
                foreach ($OPTIONS as $slug => $options) {
                    echo "<option " . (!empty($pmv['evors_addf' . $x . '_1']) && $slug == $pmv['evors_addf' . $x . '_1'][0] ? 'selected="selected"' : '') . " value='{$slug}'>{$options}</option>";
                }
                echo "</select></td></tr>";
            }
        }
    }
    // plugabble hook
    if (!empty($pmv['e_id'])) {
        do_action('eventonrs_rsvp_post_table', $post->ID, $pmv);
    }
    ?>
			</table>
			</div>
		</div>
		</div>
		<?php 
}
示例#2
0
?>
</p>


				<?php 
echo $__item_p_beg;
echo $eventon_rs->lang('evoRSLX_003a', 'Receive Updates', $lang);
?>
:</span> <?php 
echo evo_meta($rsvp_pmv, 'updates');
?>
</p>
				<?php 
//additional fields
for ($x = 1; $x < 4; $x++) {
    if (evo_settings_val('evors_addf' . $x, $optRS) && !empty($optRS['evors_addf' . $x . '_1']) && !empty($rsvp_pmv['evors_addf' . $x . '_1'])) {
        echo $__item_p_beg . $optRS['evors_addf' . $x . '_1'] . ": </span>" . (!empty($rsvp_pmv['evors_addf' . $x . '_1']) ? $rsvp_pmv['evors_addf' . $x . '_1'][0] : '-') . "</p>";
    }
}
?>
			</div>
		</td>
	</tr>
	<?php 
$rsvp_edit_link = get_edit_post_link($args['rsvp_id']);
$event_edit_link = get_edit_post_link($args['e_id']);
if (!empty($rsvp_edit_link) && !empty($event_edit_link)) {
    ?>

	<tr>
		<td  style='padding:20px; text-align:left;border-top:1px dashed #d1d1d1; font-style:italic; color:#ADADAD'>					
示例#3
0
 function _form_save_rsvp($args)
 {
     global $eventon_rs;
     $status = 0;
     // add new rsvp
     if ($created_rsvp_id = $this->create_post()) {
         //$pmv = get_post_meta($args['e_id']);
         $_count = empty($args['count']) ? 1 : $args['count'];
         $_count = (int) $_count;
         // save rsvp data
         $this->create_custom_fields($created_rsvp_id, 'first_name', $args['first_name']);
         if (!empty($args['last_name'])) {
             $this->create_custom_fields($created_rsvp_id, 'last_name', $args['last_name']);
         }
         if (!empty($args['email'])) {
             $this->create_custom_fields($created_rsvp_id, 'email', $args['email']);
         }
         if (!empty($args['phone'])) {
             $this->create_custom_fields($created_rsvp_id, 'phone', $args['phone']);
         }
         $this->create_custom_fields($created_rsvp_id, 'rsvp', $args['rsvp']);
         // y n m
         $this->create_custom_fields($created_rsvp_id, 'updates', $args['updates']);
         $this->create_custom_fields($created_rsvp_id, 'count', $_count);
         $this->create_custom_fields($created_rsvp_id, 'e_id', $args['e_id']);
         $__repeat_interval = !empty($args['repeat_interval']) ? $args['repeat_interval'] : '0';
         $this->create_custom_fields($created_rsvp_id, 'repeat_interval', $__repeat_interval);
         // save additional form fields
         $optRS = $this->optRS;
         for ($x = 1; $x < 4; $x++) {
             if (evo_settings_val('evors_addf' . $x, $optRS) && !empty($optRS['evors_addf' . $x . '_1'])) {
                 $value = !empty($args['evors_addf' . $x . '_1']) ? $args['evors_addf' . $x . '_1'] : '-';
                 $this->create_custom_fields($created_rsvp_id, 'evors_addf' . $x . '_1', $value);
             }
         }
         // save loggedin user ID if prefill fields for loggedin enabled
         $prefill_enabled = !empty($optRS['evors_prefil']) && $optRS['evors_prefil'] == 'yes' ? true : false;
         if ($this->functions->get_current_userid() && $prefill_enabled || !empty($args['uid'])) {
             // user ID if provided or find loggedin user id
             $CURRENT_user_id = !empty($args['uid']) ? $args['uid'] : $this->functions->get_current_userid();
             $this->create_custom_fields($created_rsvp_id, 'userid', $CURRENT_user_id);
             // add user meta
             $this->functions->add_user_meta($CURRENT_user_id, $args['e_id'], $__repeat_interval, $args['rsvp']);
         }
         $args['rsvp_id'] = $created_rsvp_id;
         // SYNC event's rsvp counts
         $this->functions->sync_rsvp_count($args['e_id']);
         // send out email confirmation
         if ($args['rsvp'] != 'n') {
             $this->send_email_conf($args);
         }
         $this->send_email_notif($args);
         $status = $created_rsvp_id;
     } else {
         $status = 7;
         // new rsvp post was not created
     }
     return $status;
 }