← All changes
|
includes/admin/tasks/open_task/wppm_edit_task_status.php
+52
-52
6.0.3
→
6.0.6
View file →
| @@ -1,52 +1,52 @@ | ||
| 1 | -<?php | |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | - exit; // Exit if accessed directly | |
| 4 | -} | |
| 5 | -global $wpdb,$wppmfunction,$current_user; | |
| 6 | -$task_id = isset($_POST['task_id']) ? absint(sanitize_text_field(wp_unslash($_POST['task_id']))) : '' ; | |
| 7 | -$proj_id = isset($_POST['proj_id']) ? absint(sanitize_text_field(wp_unslash($_POST['proj_id']))) : '' ; | |
| 8 | -$current_project_id = isset($_POST['project_id']) ? absint(sanitize_text_field(wp_unslash($_POST['project_id']))) : '' ; | |
| 9 | -if (!(($current_user->ID && $current_user->has_cap('manage_options')) || $wppmfunction->has_permission('change_status',$task_id))) {exit;} | |
| 10 | -$task_data = $wppmfunction->get_task($task_id); | |
| 11 | -$statuses = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}wppm_task_statuses"); | |
| 12 | -$status_id = $task_data['status']; | |
| 13 | -$priority_id = $task_data['priority']; | |
| 14 | -ob_start(); | |
| 15 | -?> | |
| 16 | -<form id="frm_get_task_change_status" method="post"> | |
| 17 | - <div class="form-group"> | |
| 18 | - <label class="wppm_edit_task_status_label" for="wppm_default_task_status"><?php echo esc_html_e('Task Status','taskbuilder');?></label> | |
| 19 | - <select class="form-control" name="wppm_status"> | |
| 20 | - <?php | |
| 21 | - if(!empty($statuses)){ | |
| 22 | - foreach ( $statuses as $status ) : | |
| 23 | - $selected = $status_id == $status->id ? 'selected="selected"' : ''; | |
| 24 | - echo '<option '.esc_attr($selected).' value="'.esc_attr($status->id).'">'.esc_html($status->name).'</option>'; | |
| 25 | - endforeach; | |
| 26 | - } | |
| 27 | - ?> | |
| 28 | - </select> | |
| 29 | - </div> | |
| 30 | - <?php do_action('wppm_after_edit_change_task_status',$task_id);?> | |
| 31 | - <input type="hidden" name="action" value="wppm_set_change_task_status" /> | |
| 32 | - <input type="hidden" name="_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppm_set_change_task_status' ) ); ?>"> | |
| 33 | - <input type="hidden" id="wppm_task_id" name="task_id" value="<?php echo (esc_attr($task_id)) ?>" /> | |
| 34 | - | |
| 35 | - | |
| 36 | -</form> | |
| 37 | -<?php | |
| 38 | -$body = ob_get_clean(); | |
| 39 | - | |
| 40 | -ob_start(); | |
| 41 | -?> | |
| 42 | -<button type="button" class="btn <?php echo ($proj_id!="0")?'wppm_popup_close':'wppm_task_popup_close'?>" onclick="<?php echo ($proj_id!="0")?'wppm_modal_close();':'wppm_task_modal_close();'?>"><?php echo esc_html_e('Close','taskbuilder');?></button> | |
| 43 | -<button type="button" class="btn <?php echo ($proj_id!="0")?'wppm_popup_action':'wppm_task_popup_action'?>" onclick="wppm_set_change_task_status(<?php echo (esc_js($task_id))?>,<?php echo esc_js($proj_id) ?>,<?php echo esc_js($current_project_id) ?>);"><?php echo esc_html_e('Save','taskbuilder');?></button> | |
| 44 | -<?php | |
| 45 | -$footer = ob_get_clean(); | |
| 46 | - | |
| 47 | -$output = array( | |
| 48 | - 'body' => $body, | |
| 49 | - 'footer' => $footer | |
| 50 | -); | |
| 51 | - | |
| 52 | -echo wp_json_encode($output); | |
| 1 | +<?php | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; // Exit if accessed directly | |
| 4 | +} | |
| 5 | +global $wpdb,$wppmfunction,$current_user; | |
| 6 | +$task_id = isset($_POST['task_id']) ? absint(sanitize_text_field(wp_unslash($_POST['task_id']))) : '' ; | |
| 7 | +$proj_id = isset($_POST['proj_id']) ? absint(sanitize_text_field(wp_unslash($_POST['proj_id']))) : '' ; | |
| 8 | +$current_project_id = isset($_POST['project_id']) ? absint(sanitize_text_field(wp_unslash($_POST['project_id']))) : '' ; | |
| 9 | +if (!(($current_user->ID && $current_user->has_cap('manage_options')) || $wppmfunction->has_permission('change_status',$task_id))) {exit;} | |
| 10 | +$task_data = $wppmfunction->get_task($task_id); | |
| 11 | +$statuses = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}wppm_task_statuses"); | |
| 12 | +$status_id = $task_data['status']; | |
| 13 | +$priority_id = $task_data['priority']; | |
| 14 | +ob_start(); | |
| 15 | +?> | |
| 16 | +<form id="frm_get_task_change_status" method="post"> | |
| 17 | + <div class="form-group"> | |
| 18 | + <label class="wppm_edit_task_status_label" for="wppm_default_task_status"><?php echo esc_html_e('Task Status','taskbuilder');?></label> | |
| 19 | + <select class="form-control" name="wppm_status"> | |
| 20 | + <?php | |
| 21 | + if(!empty($statuses)){ | |
| 22 | + foreach ( $statuses as $status ) : | |
| 23 | + $selected = $status_id == $status->id ? 'selected="selected"' : ''; | |
| 24 | + echo '<option '.esc_attr($selected).' value="'.esc_attr($status->id).'">'.esc_html($status->name).'</option>'; | |
| 25 | + endforeach; | |
| 26 | + } | |
| 27 | + ?> | |
| 28 | + </select> | |
| 29 | + </div> | |
| 30 | + <?php do_action('wppm_after_edit_change_task_status',$task_id);?> | |
| 31 | + <input type="hidden" name="action" value="wppm_set_change_task_status" /> | |
| 32 | + <input type="hidden" name="_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppm_set_change_task_status' ) ); ?>"> | |
| 33 | + <input type="hidden" id="wppm_task_id" name="task_id" value="<?php echo (esc_attr($task_id)) ?>" /> | |
| 34 | + | |
| 35 | + | |
| 36 | +</form> | |
| 37 | +<?php | |
| 38 | +$body = ob_get_clean(); | |
| 39 | + | |
| 40 | +ob_start(); | |
| 41 | +?> | |
| 42 | +<button type="button" class="btn <?php echo ($proj_id!="0")?'wppm_popup_close':'wppm_task_popup_close'?>" onclick="<?php echo ($proj_id!="0")?'wppm_modal_close();':'wppm_task_modal_close();'?>"><?php echo esc_html_e('Close','taskbuilder');?></button> | |
| 43 | +<button type="button" class="btn <?php echo ($proj_id!="0")?'wppm_popup_action':'wppm_task_popup_action'?>" onclick="wppm_set_change_task_status(<?php echo (esc_js($task_id))?>,<?php echo esc_js($proj_id) ?>,<?php echo esc_js($current_project_id) ?>);"><?php echo esc_html_e('Save','taskbuilder');?></button> | |
| 44 | +<?php | |
| 45 | +$footer = ob_get_clean(); | |
| 46 | + | |
| 47 | +$output = array( | |
| 48 | + 'body' => $body, | |
| 49 | + 'footer' => $footer | |
| 50 | +); | |
| 51 | + | |
| 52 | +echo wp_json_encode($output); | |