<?php

include 'style.php';
$add_new = $_GET['post_action'] == 'add' ? true : false;
$post_id = $add_new ? 0 : intval($_GET['post_id']);
$the_post = !$add_new ? get_post($post_id) : null;
$the_post_meta = !$add_new ? Activity_Admin::activity_admin_get_post_meta($post_id) : null;
if (!$add_new) {
    $signup_time = new DateTime($the_post_meta->signup_time);
    $activity_time = new DateTime($the_post_meta->activity_time);
    $the_post_meta_signup_date = date_format($signup_time, 'Y-m-d');
    $the_post_meta_signup_time = date_format($signup_time, 'H:i');
    $the_post_meta_activity_date = date_format($activity_time, 'Y-m-d');
    $the_post_meta_activity_time = date_format($activity_time, 'H:i');
}
?>

<div class="wrap">
	<form class="am-form" method="post" action="<?php 
echo esc_url(Activity_Admin::activity_admin_get_url('activity_admin_process_post'));
?>
">
		<fieldset>

			<legend><?php 
echo $add_new ? '添加活动' : '编辑活动';
?>
</legend>

			<input type="hidden" name="is_new" id="is_new" value="<?php 
echo $add_new ? 1 : -1;