PluginProbe
Taskbuilder – Project Management & Task Management Tool With Kanban Board / 6.0.6
Taskbuilder – Project Management & Task Management Tool With Kanban Board v6.0.6
6.0.6 6.0.5 6.0.2 6.0.3 6.0.4 6.0.1 6.0.0 5.0.8 5.0.9 4.0.9 5.0.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 All 58 releases
← All changes | includes/admin/tasks/open_task/wppm_edit_task_status.php +52 -50 1.0.26.0.6 View file →
@@ -1,50 +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']) ? intval(sanitize_text_field($_POST['task_id'])) : '' ;
7 -$proj_id = isset($_POST['proj_id']) ? intval(sanitize_text_field($_POST['proj_id'])) : '' ;
8 -if (!(($current_user->ID && $current_user->has_cap('manage_options')) || $wppmfunction->has_permission('change_status',$task_id))) {exit;}
9 -$task_data = $wppmfunction->get_task($task_id);
10 -$statuses = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}wppm_task_statuses");
11 -$status_id = $task_data['status'];
12 -$priority_id = $task_data['priority'];
13 -ob_start();
14 -?>
15 -<form id="frm_get_task_change_status" method="post">
16 - <div class="form-group">
17 - <label class="wppm_edit_task_status_label" for="wppm_default_task_status"><?php echo esc_html_e('Task Status','taskbuilder');?></label>
18 - <select class="form-control" name="wppm_status">
19 - <?php
20 - if(!empty($statuses)){
21 - foreach ( $statuses as $status ) :
22 - $selected = $status_id == $status->id ? 'selected="selected"' : '';
23 - echo '<option '.esc_attr($selected).' value="'.esc_attr($status->id).'">'.esc_html($status->name).'</option>';
24 - endforeach;
25 - }
26 - ?>
27 - </select>
28 - </div>
29 - <?php do_action('wppm_after_edit_change_task_status',$task_id);?>
30 - <input type="hidden" name="action" value="wppm_set_change_task_status" />
31 - <input type="hidden" id="wppm_task_id" name="task_id" value="<?php echo htmlentities(esc_attr($task_id)) ?>" />
32 -
33 -
34 -</form>
35 -<?php
36 -$body = ob_get_clean();
37 -
38 -ob_start();
39 -?>
40 -<button type="button" class="btn wppm_popup_close" onclick="wppm_modal_close();"><?php echo esc_html_e('Close','taskbuilder');?></button>
41 -<button type="button" class="btn wppm_popup_action" onclick="wppm_set_change_task_status(<?php echo htmlentities(esc_attr($task_id))?>,<?php echo esc_attr($proj_id) ?> );"><?php echo esc_html_e('Save','taskbuilder');?></button>
42 -<?php
43 -$footer = ob_get_clean();
44 -
45 -$output = array(
46 - 'body' => $body,
47 - 'footer' => $footer
48 -);
49 -
50 -echo 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);