← All changes
|
includes/admin/projects/wppm_get_bulk_assign_users.php
+96
-96
6.0.2
→
6.0.6
View file →
| @@ -1,97 +1,97 @@ | ||
| 1 | -<?php | |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | - exit; // Exit if accessed directly | |
| 4 | -} | |
| 5 | -global $wpdb,$wppmfunction,$current_user; | |
| 6 | -$wppm_users_role = get_option('wppm_user_role'); | |
| 7 | -$proj_ids = isset($_POST['proj_ids']) ? $wppmfunction->sanitize_array($_POST['proj_ids']) : '' ; | |
| 8 | -$wppm_current_user_capability = get_user_meta( $current_user->ID, 'wppm_capability', true ); | |
| 9 | -$settings = get_option("wppm-ap-modal"); | |
| 10 | -ob_start(); | |
| 11 | -?> | |
| 12 | -<form id="frm_get_bulk_project_users"> | |
| 13 | - <div id="wppm_get_users"> | |
| 14 | - <input type="text" id="wppm_user_name" class="wppm_user_name form-control regi_user_autocomplete ui-autocomplete-input" name="user_name" autocomplete="off" placeholder="Search User"> | |
| 15 | - <div class="wppm_filter_display_container" id="wppm_bulk_proj_users_display_container"> | |
| 16 | - <input type="hidden" name="action" value="wppm_set_bulk_project_users" /> | |
| 17 | - <input type="hidden" name="_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppm_set_bulk_project_users' ) ); ?>"> | |
| 18 | - <input type="hidden" id="wppm_proj_id" name="proj_ids" value="<?php echo esc_attr( implode( ',', $proj_ids ) ); ?>" /> | |
| 19 | - </div> | |
| 20 | -</form> | |
| 21 | -<style> | |
| 22 | - li { | |
| 23 | - color:<?php echo esc_attr( $settings['body-text-color'])?>!important; | |
| 24 | - } | |
| 25 | -</style> | |
| 26 | -<script> | |
| 27 | - jQuery(document).ready(function(){ | |
| 28 | - jQuery("input[name='user_name']").keypress(function(e) { | |
| 29 | - //Enter key | |
| 30 | - if (e.which == 13) { | |
| 31 | - return false; | |
| 32 | - } | |
| 33 | - }); | |
| 34 | - | |
| 35 | - jQuery( ".wppm_user_name" ).autocomplete({ | |
| 36 | - minLength: 1, | |
| 37 | - appendTo: jQuery('.wppm_user_name').parent(), | |
| 38 | - source: function( request, response ) { | |
| 39 | - var term = request.term; | |
| 40 | - request = { | |
| 41 | - action: 'wppm_filter_autocomplete', | |
| 42 | - term : term, | |
| 43 | - field : 'users_name', | |
| 44 | - } | |
| 45 | - jQuery.getJSON( wppm_admin.ajax_url, request, function( data, status, xhr ) { | |
| 46 | - response(data); | |
| 47 | - }); | |
| 48 | - }, | |
| 49 | - select: function (event, ui) { | |
| 50 | - var html_str = '<div id="wppm_user_display_container_'+ui.item.user_id+'" class="row wppm_user_display_container">' | |
| 51 | - +'<div class="flex-container col-sm-4">' | |
| 52 | - +'<span class="wppm_filter_display_text">' | |
| 53 | - +ui.item.label | |
| 54 | - +'<input type="hidden" name="user_names[]" value="'+ui.item.user_id+'">' | |
| 55 | - +'</span>' | |
| 56 | - +'</div>' | |
| 57 | - +'<div class="col-sm-4 wppm_user_role">' | |
| 58 | - +'<select size="sm" class="form-control" id="wppm_select_user_role_'+ui.item.user_id+'" name="wppm_select_user_role_'+ui.item.user_id+'">'+ | |
| 59 | - <?php | |
| 60 | - if(!empty($wppm_users_role)){ | |
| 61 | - foreach($wppm_users_role as $key=>$role){ | |
| 62 | - if(!empty($role)){ | |
| 63 | - foreach($role as $k=>$val){ | |
| 64 | - ?>'<option value="<?php echo esc_attr($key) ?>"><?php echo esc_html($role['label']) ?></option>'+<?php | |
| 65 | - } | |
| 66 | - } | |
| 67 | - } | |
| 68 | - } | |
| 69 | - ?> | |
| 70 | - '</select>' | |
| 71 | - +'</div>' | |
| 72 | - +'<div class="col-sm-4 wppm_delete_user_icon">' | |
| 73 | - +'<span onclick="wppm_remove_filter('+ui.item.user_id+');"><img src="<?php echo esc_url( WPPM_PLUGIN_URL . 'asset/images/trash.svg'); ?>" alt="delete"></span>' | |
| 74 | - +'</div>' | |
| 75 | - +'</div>'; | |
| 76 | - jQuery('.wppm_project_users_not_assign_label').hide(); | |
| 77 | - jQuery('#wppm_get_users #wppm_bulk_proj_users_display_container').append(html_str); | |
| 78 | - jQuery(this).val(''); return false; | |
| 79 | - } | |
| 80 | - }).focus(function() { | |
| 81 | - jQuery(this).autocomplete("search", ""); | |
| 82 | - }); | |
| 83 | - }); | |
| 84 | -</script> | |
| 85 | -<?php | |
| 86 | -$body = ob_get_clean(); | |
| 87 | -ob_start(); | |
| 88 | -?> | |
| 89 | -<button type="button" class="btn wppm_popup_close" onclick="wppm_modal_close();"><?php echo esc_html_e('Close','taskbuilder');?></button> | |
| 90 | -<button type="button" class="btn wppm_popup_action" onclick="wppm_set_bulk_project_users();"><?php echo esc_html_e('Save','taskbuilder');?></button> | |
| 91 | -<?php | |
| 92 | -$footer = ob_get_clean(); | |
| 93 | -$output = array( | |
| 94 | - 'body' => $body, | |
| 95 | - 'footer' => $footer | |
| 96 | -); | |
| 1 | +<?php | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; // Exit if accessed directly | |
| 4 | +} | |
| 5 | +global $wpdb,$wppmfunction,$current_user; | |
| 6 | +$wppm_users_role = get_option('wppm_user_role'); | |
| 7 | +$proj_ids = isset($_POST['proj_ids']) ? $wppmfunction->sanitize_array($_POST['proj_ids']) : '' ; | |
| 8 | +$wppm_current_user_capability = get_user_meta( $current_user->ID, 'wppm_capability', true ); | |
| 9 | +$settings = get_option("wppm-ap-modal"); | |
| 10 | +ob_start(); | |
| 11 | +?> | |
| 12 | +<form id="frm_get_bulk_project_users"> | |
| 13 | + <div id="wppm_get_users"> | |
| 14 | + <input type="text" id="wppm_user_name" class="wppm_user_name form-control regi_user_autocomplete ui-autocomplete-input" name="user_name" autocomplete="off" placeholder="Search User"> | |
| 15 | + <div class="wppm_filter_display_container" id="wppm_bulk_proj_users_display_container"> | |
| 16 | + <input type="hidden" name="action" value="wppm_set_bulk_project_users" /> | |
| 17 | + <input type="hidden" name="_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppm_set_bulk_project_users' ) ); ?>"> | |
| 18 | + <input type="hidden" id="wppm_proj_id" name="proj_ids" value="<?php echo esc_attr( implode( ',', $proj_ids ) ); ?>" /> | |
| 19 | + </div> | |
| 20 | +</form> | |
| 21 | +<style> | |
| 22 | + li { | |
| 23 | + color:<?php echo esc_attr( $settings['body-text-color'])?>!important; | |
| 24 | + } | |
| 25 | +</style> | |
| 26 | +<script> | |
| 27 | + jQuery(document).ready(function(){ | |
| 28 | + jQuery("input[name='user_name']").keypress(function(e) { | |
| 29 | + //Enter key | |
| 30 | + if (e.which == 13) { | |
| 31 | + return false; | |
| 32 | + } | |
| 33 | + }); | |
| 34 | + | |
| 35 | + jQuery( ".wppm_user_name" ).autocomplete({ | |
| 36 | + minLength: 1, | |
| 37 | + appendTo: jQuery('.wppm_user_name').parent(), | |
| 38 | + source: function( request, response ) { | |
| 39 | + var term = request.term; | |
| 40 | + request = { | |
| 41 | + action: 'wppm_filter_autocomplete', | |
| 42 | + term : term, | |
| 43 | + field : 'users_name', | |
| 44 | + } | |
| 45 | + jQuery.getJSON( wppm_admin.ajax_url, request, function( data, status, xhr ) { | |
| 46 | + response(data); | |
| 47 | + }); | |
| 48 | + }, | |
| 49 | + select: function (event, ui) { | |
| 50 | + var html_str = '<div id="wppm_user_display_container_'+ui.item.user_id+'" class="row wppm_user_display_container">' | |
| 51 | + +'<div class="flex-container col-sm-4">' | |
| 52 | + +'<span class="wppm_filter_display_text">' | |
| 53 | + +ui.item.label | |
| 54 | + +'<input type="hidden" name="user_names[]" value="'+ui.item.user_id+'">' | |
| 55 | + +'</span>' | |
| 56 | + +'</div>' | |
| 57 | + +'<div class="col-sm-4 wppm_user_role">' | |
| 58 | + +'<select size="sm" class="form-control" id="wppm_select_user_role_'+ui.item.user_id+'" name="wppm_select_user_role_'+ui.item.user_id+'">'+ | |
| 59 | + <?php | |
| 60 | + if(!empty($wppm_users_role)){ | |
| 61 | + foreach($wppm_users_role as $key=>$role){ | |
| 62 | + if(!empty($role)){ | |
| 63 | + foreach($role as $k=>$val){ | |
| 64 | + ?>'<option value="<?php echo esc_attr($key) ?>"><?php echo esc_html($role['label']) ?></option>'+<?php | |
| 65 | + } | |
| 66 | + } | |
| 67 | + } | |
| 68 | + } | |
| 69 | + ?> | |
| 70 | + '</select>' | |
| 71 | + +'</div>' | |
| 72 | + +'<div class="col-sm-4 wppm_delete_user_icon">' | |
| 73 | + +'<span onclick="wppm_remove_filter('+ui.item.user_id+');"><img src="<?php echo esc_url( WPPM_PLUGIN_URL . 'asset/images/trash.svg'); ?>" alt="delete"></span>' | |
| 74 | + +'</div>' | |
| 75 | + +'</div>'; | |
| 76 | + jQuery('.wppm_project_users_not_assign_label').hide(); | |
| 77 | + jQuery('#wppm_get_users #wppm_bulk_proj_users_display_container').append(html_str); | |
| 78 | + jQuery(this).val(''); return false; | |
| 79 | + } | |
| 80 | + }).focus(function() { | |
| 81 | + jQuery(this).autocomplete("search", ""); | |
| 82 | + }); | |
| 83 | + }); | |
| 84 | +</script> | |
| 85 | +<?php | |
| 86 | +$body = ob_get_clean(); | |
| 87 | +ob_start(); | |
| 88 | +?> | |
| 89 | +<button type="button" class="btn wppm_popup_close" onclick="wppm_modal_close();"><?php echo esc_html_e('Close','taskbuilder');?></button> | |
| 90 | +<button type="button" class="btn wppm_popup_action" onclick="wppm_set_bulk_project_users();"><?php echo esc_html_e('Save','taskbuilder');?></button> | |
| 91 | +<?php | |
| 92 | +$footer = ob_get_clean(); | |
| 93 | +$output = array( | |
| 94 | + 'body' => $body, | |
| 95 | + 'footer' => $footer | |
| 96 | +); | |
| 97 | 97 | echo wp_json_encode($output); |