public static function activity_admin_delete_post() { if (!isset($_GET['post_id']) || !wp_verify_nonce($_GET['_wpnonce'], self::NONCE)) { self::activity_admin_display_message('error', '非法请求!'); } else { $the_post = get_post(intval($_GET['post_id'])); if (!empty($the_post)) { global $wpdb; $table_name = $wpdb->prefix . 'activity_meta'; $signup_delete = Activity_Signup::activity_signup_delete_all(intval($_GET['post_id'])); $actiity_meta_delete = $wpdb->delete($table_name, array('post_id' => intval($_GET['post_id']))); $post_deleted = wp_delete_post(intval($_GET['post_id']), true); if ($post_deleted !== false && !empty($signup_delete) && !empty($actiity_meta_delete)) { self::activity_admin_display_message('updated', '活动删除成功!'); } else { self::activity_admin_display_message('error', '删除活动失败!'); } } else { self::activity_admin_display_message('error', '非法请求!'); } } Activity::activity_view('activity_admin_list'); }
" class="page-title-action">添加活动</a></h1> <table class="am-table am-table-hover"> <?php if (!empty($all_activity)) { ?> <tr> <td>ID</td> <td>标题</td> <td>报名数</td> <td>最后修改</td> <td>操作</td> </tr> <?php foreach ($all_activity as $activity) { $activity_signup_count = Activity_Signup::activity_signup_count($activity->ID); $activity_capacity = Activity_Admin::activity_admin_get_capacity($activity->ID); echo '<tr>' . '<td>' . $activity->ID . '</td>' . '<td><a href="' . esc_url(Activity_Admin::activity_admin_get_url('activity_admin_signup_list', $activity->ID)) . '">' . $activity->post_title . '</a></td>'; if ($activity_capacity == 0) { echo '<td style="color: #00ff00;">' . $activity_signup_count . '</td>'; } else { echo '<td' . ($activity_signup_count / $activity_capacity >= 0.9 ? ' style="color: #ff0000;"' : ' style="color: #00ff00;"') . '>' . $activity_signup_count . ' / ' . $activity_capacity . '</td>'; } echo '<td>' . $activity->post_modified . '</td>' . '<td><a href="' . esc_url(Activity_Admin::activity_admin_get_url('activity_admin_edit_post', $activity->ID)) . '">编辑</a> | <a href="' . esc_url(Activity_Admin::activity_admin_get_url('activity_admin_delete_post', $activity->ID)) . '">删除</a></td>' . '</tr>'; } } else { echo '<h2>没有活动!</h2>'; } ?> </table> </div>
<?php include 'style.php'; $add_new = $_GET['signup_action'] == 'add' ? true : false; $post_id = isset($_GET['post_id']) ? intval($_GET['post_id']) : 0; if (!$add_new) { $signup = Activity_Signup::activity_signup_get_signup(intval($_GET['signup_id'])); } ?> <div class="wrap"> <form class="am-form am-form-horizontal" method="POST" action="<?php echo esc_url(Activity_Admin::activity_admin_get_url('activity_admin_process_signup')); ?> "> <fieldset> <legend><?php echo $add_new ? '添加参与者' : '编辑参与者'; ?> </legend> <input type="hidden" name="is_new" value="<?php echo $add_new ? 1 : -1; ?> "> <input type="hidden" name="post_id" value="<?php echo $post_id; ?> "> <input type="hidden" name="signup_id" value="<?php
<?php include 'style.php'; $post_id = isset($_GET['post_id']) ? intval($_GET['post_id']) : 0; $list = Activity_Signup::activity_signup_get_list($post_id); ?> <div class="wrap"> <h1><?php echo $post_id == 0 ? 'No Activity' : get_the_title($post_id); ?> <a href="<?php echo esc_url(Activity_Admin::activity_admin_get_url('activity_admin_add_signup', $post_id)); ?> " class="page-title-action">添加参与者</a></h1> <table class="am-table am-table-hover"> <?php if ($post_id != 0) { ?> <tr style="text-align:center;"> <td>ID</td> <td>姓名</td> <td>E-mail</td> <td>电话</td> <td>是否付费</td> <td>AUT学生</td> <td>CSA会员</td> <td>最后修改</td> <td>操作</td> </tr> <?php