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
taskbuilder / includes / admin / email_notifications / wppm_get_edit_email_notification.php

wppm_get_edit_email_notification.php in Taskbuilder – Project Management & Task Management Tool With Kanban Board 6.0.6, at includes/admin/email_notifications/wppm_get_edit_email_notification.php

133 lines 6.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; // Exit if accessed directly
4 }
5
6 global $current_user, $wppmfunction;
7 if (!($current_user->ID && $current_user->has_cap('wppm_admin') || $current_user->has_cap('manage_options'))) {
8 exit;
9 }
10 $id = isset($_POST) && isset($_POST['id']) ? absint(sanitize_text_field(wp_unslash($_POST['id']))) : 0;
11 if(!$id) die();
12 $user_role = get_option('wppm_user_role');
13 $wppm_email_notificatins = get_option('wppm_email_notification');
14 $notification_types = $wppmfunction->get_email_notification_types();
15 $directionality = $wppmfunction->check_rtl();
16 if(!empty($wppm_email_notificatins)){
17 foreach($wppm_email_notificatins as $key=>$email){
18 if($id==$key){
19 $type = $email['type'];
20 $subject = $email['subject'];
21 $body = $email['body'];
22 $recipients = $email['recipients'];
23 }
24 }
25 }
26 ?>
27 <h4 style="margin-bottom:20px;"><?php echo esc_html_e('Edit email notification','taskbuilder');?></h4>
28 <form id="wppm_edit_email_notification_settings" method="post" action="javascript:wppm_set_edit_email_notification();">
29 <div class="form-group">
30 <label for="wppm_en_type"><?php echo esc_html_e('Type','taskbuilder');?></label>
31 <p class="help-block"><?php echo esc_html_e('Select event to send this email.','taskbuilder');?></p>
32 <select class="form-control" name="wppm_en_type" id="wppm_en_type">
33 <?php foreach ($notification_types as $key => $value) :?>
34 <option <?php echo esc_attr($key)==esc_attr($type) ?'selected="selected"':''?> value="<?php echo esc_attr($key)?>"><?php echo (esc_html($value))?></option>
35 <?php endforeach;?>
36 </select>
37 </div>
38 <div class="form-group">
39 <label for="wppm_en_subject"><?php echo esc_html_e('Email Subject','taskbuilder');?></label>
40 <p class="help-block"><?php echo esc_html_e('Subject for email to send.','taskbuilder');?></p>
41 <input type="text" class="form-control" name="wppm_en_subject" id="wppm_en_subject" value="<?php echo esc_attr( wp_unslash( $subject ) ); ?>" />
42 </div>
43 <div class="form-group">
44 <label for="wppm_en_body"><?php echo esc_html_e('Email Body','taskbuilder');?></label>
45 <p class="help-block"><?php echo esc_html_e('Body for email to send. Use macros for project and task specific details. Macros will get replaced by its value while sending an email.','taskbuilder');?></p>
46 <div class="text-right">
47 <button id="visual" class="btn btn-primary btn-xs" type="button" onclick="wppm_get_tinymce('wppm_en_body','email_body');"><?php echo esc_html_e('Visual', 'taskbuilder');?></button>
48 <button id="text" class="btn btn-default btn-xs" type="button" onclick="wppm_get_textarea()"><?php echo esc_html_e('Text', 'taskbuilder');?></button>
49 </div>
50 <textarea type="text" class="form-control" name="wppm_en_body" id="wppm_en_body"><?php echo (esc_textarea(wp_unslash($body)))?></textarea>
51 <div class="row attachment_link">
52 <span onclick="wppm_get_templates(); "><?php echo esc_html_e('Insert Macros','taskbuilder') ?></span>
53 </div>
54 </div>
55 <div class="form-group">
56 <label for=""><?php echo esc_html_e('Recipients','taskbuilder');?></label>
57 <p class="help-block"><?php echo esc_html_e('Select roles who will receive email notifications.','taskbuilder');?></p>
58 <div class="row">
59 <?php foreach ($user_role as $key => $role ) : ?>
60 <div class="col-sm-4" style="margin-bottom:10px; display:flex;">
61 <div style="width:25px;"><input type="checkbox" <?php echo esc_attr(in_array($key,$recipients))?'checked="checked"':''?> name="wppm_en_recipients[]" value="<?php echo esc_attr($key) ?>" /></div>
62 <div style="padding-top:3px;"><?php echo esc_html($role['label']) ?></div>
63 </div>
64 <?php endforeach;?>
65 <?php if($type=='new_project' || $type=='new_task'){
66 $style='display:none';
67 } else{
68 $style='display:flex';
69 }?>
70 <div class="col-sm-4 prev_assigned" style="margin-bottom:10px;<?php echo esc_attr($style) ?>">
71 <div style="width:25px;"><input type="checkbox" <?php echo esc_attr(in_array('previously_assigned_user',$recipients))?'checked="checked"':''?> name="wppm_en_recipients[]" value="previously_assigned_user" /></div>
72 <div style="padding-top:3px;"><?php echo esc_html_e('Previously Assigned Users','taskbuilder')?></div>
73 </div>
74 </div>
75 <div class="row">
76 <div class="col-sm-4 proj_creator" style="margin-bottom:10px;display:flex;">
77 <div style="width:25px;"><input type="checkbox" <?php echo esc_attr(in_array('project_creator',$recipients))?'checked="checked"':''?> name="wppm_en_recipients[]" value="project_creator" /></div>
78 <div style="padding-top:3px;"><?php echo esc_html_e('Project Creator','taskbuilder')?></div>
79 </div>
80 <?php
81 if($type=='new_task' || $type=='change_task_status' || $type=='change_task_assign_users'|| $type=='new_discussion'){
82 $tc_style='margin-bottom:10px;display:flex';
83 } else{
84 $tc_style='display:none';
85 }?>
86 <div class="col-sm-4 task_creator" style="<?php echo esc_attr($tc_style)?>">
87 <div style="width:25px;"><input type="checkbox" <?php echo esc_attr(in_array('task_creator',$recipients))?'checked="checked"':''?> name="wppm_en_recipients[]" value="task_creator" /></div>
88 <div style="padding-top:3px;"><?php echo esc_html_e('Task Creator','taskbuilder')?></div>
89 </div>
90 </div>
91 <?php do_action('wppm_en_after_edit_recipients',$recipients);?>
92 </div>
93 <?php do_action('wppm_get_edit_email_notification',$id);?>
94
95 <button type="submit" class="wppm-submit-btn"><?php echo esc_html_e('Save Changes','taskbuilder');?></button>
96 <img class="wppm_submit_wait" style="display:none;" src="<?php echo esc_url((WPPM_PLUGIN_URL)).'asset/images/ajax-loader@2x.gif';?>">
97 <input type="hidden" name="action" value="wppm_set_edit_email_notification" />
98 <input type="hidden" name="_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppm_set_edit_email_notification' ) ); ?>">
99 <input type="hidden" name="id" value="<?php echo (esc_attr($id)) ?>" />
100 </form>
101
102 <script>
103 tinymce.remove();
104 tinymce.init({
105 selector:'#wppm_en_body',
106 body_id: 'email_body',
107 menubar: false,
108 statusbar: false,
109 height : '200',
110 plugins: [
111 'lists link image directionality'
112 ],
113 image_advtab: true,
114 toolbar: 'bold italic underline blockquote | alignleft aligncenter alignright | bullist numlist | rtl | link image',
115 branding: false,
116 autoresize_bottom_margin: 20,
117 browser_spellcheck : true,
118 relative_urls : false,
119 remove_script_host : false,
120 convert_urls : true,
121 setup: function (editor) {
122 }
123 });
124 </script>
125 <script>
126 jQuery('#wppm_en_type').on('change', function(){
127 if(jQuery('#wppm_en_type').val() == 'new_ticket'){
128 jQuery('.prev_assigned').css({"display" : "none"});
129 } else{
130 jQuery('.prev_assigned').css({"display" : "flex"});
131 }
132 });
133 </script>