| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
|
| 6 |
if ( ! class_exists( 'WPSC_Ticket_Form_Field' ) ) : |
| 7 |
|
| 8 |
class WPSC_Ticket_List { |
| 9 |
|
| 10 |
var $slug; |
| 11 |
var $type; |
| 12 |
var $placeholder_text; |
| 13 |
var $label; |
| 14 |
var $extra_info; |
| 15 |
var $status; |
| 16 |
var $options; |
| 17 |
var $required; |
| 18 |
var $width; |
| 19 |
var $col_class; |
| 20 |
var $visibility; |
| 21 |
var $visibility_conditions; |
| 22 |
var $field_label; |
| 23 |
var $ticket_id; |
| 24 |
|
| 25 |
function __construct(){ |
| 26 |
$this->field_label = get_option('wpsc_custom_fields_localize'); |
| 27 |
$this->extra_info = get_option('wpsc_custom_fields_extra_info'); |
| 28 |
$this->ticket_id = isset($_POST['ticket_id']) ? intval($_POST['ticket_id']) : 0; |
| 29 |
} |
| 30 |
|
| 31 |
function print_field($field){ |
| 32 |
|
| 33 |
$this->slug = $field->slug; |
| 34 |
$this->type = get_term_meta( $field->term_id, 'wpsc_tf_type', true); |
| 35 |
$this->placeholder_text_text = get_term_meta( $field->term_id, 'wpsc_tf_placeholder_text', true); |
| 36 |
$this->status = get_term_meta( $field->term_id, 'wpsc_tf_status', true); |
| 37 |
$this->options = get_term_meta( $field->term_id, 'wpsc_tf_options', true); |
| 38 |
$this->required = get_term_meta( $field->term_id, 'wpsc_tf_required', true); |
| 39 |
$this->width = get_term_meta( $field->term_id, 'wpsc_tf_width', true); |
| 40 |
$this->visibility = get_term_meta( $field->term_id, 'wpsc_tf_visibility', true); |
| 41 |
$this->visibility_conditions = is_array($this->visibility) && $this->visibility ? implode(';;', $this->visibility) : ''; |
| 42 |
$this->visibility_conditions = str_replace('"','"',$this->visibility_conditions); |
| 43 |
$this->limit = get_term_meta($field->term_id,'wpsc_tf_limit',true); |
| 44 |
$this->limit = $this->limit ? $this->limit:"0"; |
| 45 |
$this->col_class = 'col-sm-12'; |
| 46 |
|
| 47 |
if ($this->type=='0') { |
| 48 |
switch ($field->slug) { |
| 49 |
default: |
| 50 |
do_action('wpsc_print_edit_default_form_field', $field, $this); |
| 51 |
break; |
| 52 |
} |
| 53 |
|
| 54 |
} else { |
| 55 |
|
| 56 |
switch ($this->type) { |
| 57 |
|
| 58 |
case '1': |
| 59 |
$this->print_text_field($field); |
| 60 |
break; |
| 61 |
|
| 62 |
case '2': |
| 63 |
$this->print_drop_down($field); |
| 64 |
break; |
| 65 |
|
| 66 |
case '3': |
| 67 |
$this->print_checkbox($field); |
| 68 |
break; |
| 69 |
|
| 70 |
case '4': |
| 71 |
$this->print_radio_btn($field); |
| 72 |
break; |
| 73 |
|
| 74 |
case '5': |
| 75 |
$this->print_textarea($field); |
| 76 |
break; |
| 77 |
|
| 78 |
case '6': |
| 79 |
$this->print_date($field); |
| 80 |
break; |
| 81 |
|
| 82 |
case '7': |
| 83 |
$this->print_url($field); |
| 84 |
break; |
| 85 |
|
| 86 |
case '8': |
| 87 |
$this->print_email($field); |
| 88 |
break; |
| 89 |
|
| 90 |
case '9': |
| 91 |
$this->print_numberonly($field); |
| 92 |
break; |
| 93 |
|
| 94 |
case '10': |
| 95 |
$this->print_file_attachment($field); |
| 96 |
break; |
| 97 |
|
| 98 |
case '18': |
| 99 |
$this->print_date_time($field); |
| 100 |
break; |
| 101 |
|
| 102 |
case '21': |
| 103 |
$this->print_time($field); |
| 104 |
break; |
| 105 |
|
| 106 |
|
| 107 |
default: |
| 108 |
do_action('wpsc_print_edit_custom_form_field', $field, $this); |
| 109 |
break; |
| 110 |
} |
| 111 |
|
| 112 |
} |
| 113 |
|
| 114 |
} |
| 115 |
|
| 116 |
function print_text_field($field){ |
| 117 |
|
| 118 |
global $wpscfunction; |
| 119 |
$label = $wpscfunction->get_ticket_meta($this->ticket_id,$field->slug, true); |
| 120 |
?> |
| 121 |
<div data-fieldtype="text" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 122 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 123 |
<?php echo esc_attr($this->field_label['custom_fields_'.$field->term_id]);?> |
| 124 |
</label> |
| 125 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 126 |
<input type="text" id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_date" placeholder=" <?php echo esc_attr($this->placeholder_text); ?>" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" value="<?php echo esc_attr($label)?>" onkeypress="wpsc_text_limit(event,this,<?php echo esc_attr($this->limit) ?>);"> |
| 127 |
</div> |
| 128 |
<?php |
| 129 |
} |
| 130 |
|
| 131 |
function print_drop_down($field){ |
| 132 |
global $wpscfunction; |
| 133 |
$label = $wpscfunction->get_ticket_meta($this->ticket_id, $field->slug, true ); |
| 134 |
?> |
| 135 |
<div data-fieldtype="dropdown" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 136 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 137 |
<?php echo esc_attr($this->field_label['custom_fields_'.$field->term_id]);?> |
| 138 |
</label> |
| 139 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 140 |
<select id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_drop_down" name="<?php echo esc_attr($this->slug);?>"> |
| 141 |
<option value=""></option> |
| 142 |
<?php |
| 143 |
foreach ( $this->options as $key => $val ) : |
| 144 |
$value = trim(stripcslashes($val)); |
| 145 |
$selected = $value == $label ? 'selected="selected"' : ''; |
| 146 |
?> |
| 147 |
|
| 148 |
<option <?php echo esc_attr($selected)?> value="<?php echo esc_attr($value)?>"><?php echo esc_attr($val)?></option> |
| 149 |
|
| 150 |
<?php |
| 151 |
endforeach; |
| 152 |
?> |
| 153 |
</select> |
| 154 |
</div> |
| 155 |
<?php |
| 156 |
} |
| 157 |
|
| 158 |
function print_checkbox($field){ |
| 159 |
global $wpscfunction; |
| 160 |
$label = $wpscfunction->get_ticket_meta($this->ticket_id, $field->slug); |
| 161 |
?> |
| 162 |
<div data-fieldtype="checkbox" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 163 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 164 |
<?php echo esc_attr($this->field_label['custom_fields_'.$field->term_id]);?> |
| 165 |
</label> |
| 166 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 167 |
<input type="hidden" name="<?php echo esc_attr($field->slug) ?>" value=""> |
| 168 |
<?php |
| 169 |
foreach ( $this->options as $key => $value ) : |
| 170 |
$checked =in_array( $value, $label) ? 'checked="checked"' : ''; |
| 171 |
?> |
| 172 |
<div class="row"> |
| 173 |
<div class="col-sm-12" style="margin-bottom:10px; display:flex;"> |
| 174 |
<div style="width:25px;"><input <?php echo esc_attr($checked) ?> type="checkbox" class="wpsc_checkbox" name="<?php echo esc_attr($this->slug)?>[]" value="<?php echo esc_attr($value)?>"></div> |
| 175 |
<div style="padding-top:3px;"><?php echo esc_attr($value)?></div> |
| 176 |
</div> |
| 177 |
</div> |
| 178 |
<?php |
| 179 |
endforeach; |
| 180 |
?> |
| 181 |
</div> |
| 182 |
<?php |
| 183 |
} |
| 184 |
|
| 185 |
function print_radio_btn($field){ |
| 186 |
global $wpscfunction; |
| 187 |
$label = $wpscfunction->get_ticket_meta($this->ticket_id, $field->slug, true ); |
| 188 |
?> |
| 189 |
<div data-fieldtype="radio" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 190 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 191 |
<?php echo esc_attr($this->field_label['custom_fields_'.$field->term_id]);?> |
| 192 |
</label> |
| 193 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 194 |
<input type="hidden" name="<?php echo esc_attr($field->slug) ?>" value=""> |
| 195 |
<?php |
| 196 |
foreach ( $this->options as $key => $value ) : |
| 197 |
$checked = $value == $label ? 'checked' : ''; |
| 198 |
?> |
| 199 |
<div class="row"> |
| 200 |
<div class="col-sm-12" style="margin-bottom:10px; display:flex;"> |
| 201 |
<div style="width:25px;"><input <?php echo esc_attr($checked) ?> type="radio" class="wpsc_radio_btn" name="<?php echo esc_attr($this->slug)?>" value="<?php echo esc_attr($value)?>"></div> |
| 202 |
<div style="padding-top:3px;"><?php echo esc_attr($value)?></div> |
| 203 |
</div> |
| 204 |
</div> |
| 205 |
<?php |
| 206 |
endforeach; |
| 207 |
?> |
| 208 |
</div> |
| 209 |
<?php |
| 210 |
} |
| 211 |
|
| 212 |
function print_textarea($field){ |
| 213 |
global $wpscfunction; |
| 214 |
$label = $wpscfunction->get_ticket_meta($this->ticket_id, $field->slug, true ); |
| 215 |
$data = stripslashes($label); |
| 216 |
?> |
| 217 |
<div data-fieldtype="textarea" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 218 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 219 |
<?php echo esc_attr($this->field_label['custom_fields_'.$field->term_id]);?> |
| 220 |
</label> |
| 221 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 222 |
<textarea id="<?php echo esc_attr($this->slug);?>" class="wpsc_textarea" placeholder=" <?php echo esc_attr($this->placeholder_text); ?>" name="<?php echo esc_attr($this->slug);?>" onkeypress="wpsc_text_limit(event,this,<?php echo esc_attr($this->limit) ?>);"><?php echo esc_attr($data) ?></textarea> |
| 223 |
</div> |
| 224 |
<?php |
| 225 |
} |
| 226 |
|
| 227 |
function print_date($field){ |
| 228 |
global $wpscfunction; |
| 229 |
$value = $wpscfunction->get_ticket_meta($this->ticket_id, $field->slug,true); |
| 230 |
$date=''; |
| 231 |
$date_range = get_term_meta ($field->term_id, 'wpsc_date_range',true); |
| 232 |
if( strlen($value) != 0 ){ |
| 233 |
$date = $wpscfunction->datetimeToCalenderFormat($value); |
| 234 |
} |
| 235 |
?> |
| 236 |
<div data-fieldtype="date" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 237 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 238 |
<?php echo esc_attr($this->field_label['custom_fields_'.$field->term_id]);?> |
| 239 |
</label> |
| 240 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 241 |
<input type="text" id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_date" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" placeholder="<?php echo esc_attr($this->placeholder_text); ?>" value="<?php echo esc_attr($date);?>" onkeypress='return false'> |
| 242 |
</div> |
| 243 |
<script type="text/javascript"> |
| 244 |
jQuery(document).ready(function(){ |
| 245 |
jQuery("#<?php echo esc_attr($this->slug)?>").datepicker({ |
| 246 |
dateFormat : '<?php echo esc_attr(get_option('wpsc_calender_date_format'))?>', |
| 247 |
showAnim : 'slideDown', |
| 248 |
changeMonth: true, |
| 249 |
changeYear: true, |
| 250 |
yearRange: "-100:+100",<?php |
| 251 |
if($date_range == 'future'){?> |
| 252 |
minDate: 0,<?php |
| 253 |
}elseif($date_range == 'past'){?> |
| 254 |
maxDate: 0,<?php |
| 255 |
}elseif($date_range == 'range'){ |
| 256 |
$from = get_term_meta($field->term_id, 'date_range_from', true); |
| 257 |
$to = get_term_meta($field->term_id, 'date_range_to', true);?> |
| 258 |
minDate:'<?php echo esc_attr($from)?>', |
| 259 |
maxDate:'<?php echo esc_attr($to)?>'<?php |
| 260 |
}?> |
| 261 |
|
| 262 |
}); |
| 263 |
}); |
| 264 |
</script> |
| 265 |
<?php |
| 266 |
} |
| 267 |
|
| 268 |
function print_url($field){ |
| 269 |
global $wpscfunction; |
| 270 |
$label = $wpscfunction->get_ticket_meta($this->ticket_id, $field->slug, true ); |
| 271 |
?> |
| 272 |
<div data-fieldtype="url" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 273 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 274 |
<?php echo esc_attr($this->field_label['custom_fields_'.$field->term_id]);?> |
| 275 |
</label> |
| 276 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 277 |
<input type="text" id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_url" placeholder=" <?php echo esc_attr($this->placeholder_text); ?>" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" value="<?php echo esc_attr($label) ?>" onkeypress="wpsc_text_limit(event,this,<?php echo esc_attr($this->limit) ?>);"> |
| 278 |
</div> |
| 279 |
<?php |
| 280 |
} |
| 281 |
|
| 282 |
function print_email($field){ |
| 283 |
global $wpscfunction; |
| 284 |
$label = $wpscfunction->get_ticket_meta($this->ticket_id, $field->slug, true ); |
| 285 |
?> |
| 286 |
<div data-fieldtype="email" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 287 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 288 |
<?php echo esc_attr($this->field_label['custom_fields_'.$field->term_id]);?> |
| 289 |
</label> |
| 290 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 291 |
<input type="text" id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_email" placeholder=" <?php echo esc_attr($this->placeholder_text); ?>" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" value="<?php echo esc_attr($label) ?>" onkeypress="wpsc_text_limit(event,this,<?php echo esc_attr($this->limit) ?>);"> |
| 292 |
</div> |
| 293 |
<?php |
| 294 |
} |
| 295 |
|
| 296 |
function print_numberonly($field){ |
| 297 |
global $wpscfunction; |
| 298 |
$label = $wpscfunction->get_ticket_meta($this->ticket_id, $field->slug, true ); |
| 299 |
?> |
| 300 |
<div data-fieldtype="number" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 301 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 302 |
<?php echo esc_attr($this->field_label['custom_fields_'.$field->term_id]);?> |
| 303 |
</label> |
| 304 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 305 |
<input type="number" id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_numberonly" placeholder="<?php echo esc_attr($this->placeholder_text); ?>" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" value="<?php echo esc_attr($label) ?>" onkeypress="wpsc_text_limit(event,this,<?php echo esc_attr($this->limit) ?>);"> |
| 306 |
</div> |
| 307 |
<?php |
| 308 |
} |
| 309 |
|
| 310 |
function print_file_attachment($field){ |
| 311 |
global $wpscfunction; |
| 312 |
$ticket_auth_code = $wpscfunction->get_ticket_fields($this->ticket_id,'ticket_auth_code'); |
| 313 |
$auth_id = $ticket_auth_code; |
| 314 |
$attachments = $wpscfunction->get_ticket_meta($this->ticket_id,$field->slug); |
| 315 |
?> |
| 316 |
<div data-fieldtype="file_attachment" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 317 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 318 |
<?php echo esc_attr($this->field_label['custom_fields_'.$field->term_id]);?> |
| 319 |
</label> |
| 320 |
<div class="row attachment" style="margin-bottom:10px;"> |
| 321 |
<div class="row attachment_link"> |
| 322 |
<span onclick="wpsc_attachment_upload('<?php echo 'attach_'.esc_attr($field->term_id)?>','<?php echo esc_attr($field->slug) ?>');"><?php _e('Attach file','supportcandy')?></span> |
| 323 |
<div id="<?php echo 'attach_'.esc_attr($field->term_id)?>" class="row attachment_container" ></div> |
| 324 |
<?php |
| 325 |
$notice_flag = true; |
| 326 |
$wpsc_allow_attachment_type = get_option('wpsc_allow_attachment_type'); |
| 327 |
$max_attachment_limit = get_option('wpsc_attachment_max_filesize'); |
| 328 |
$wpsc_show_attachment_notice = get_option('wpsc_show_attachment_notice'); |
| 329 |
if($wpsc_show_attachment_notice && $notice_flag){ |
| 330 |
$attach_notice = get_option('wpsc_attachment_notice'); |
| 331 |
?> |
| 332 |
<p class="help-block"> <i> <?php echo esc_attr($attach_notice);?></i></p> |
| 333 |
<?php |
| 334 |
} |
| 335 |
?> |
| 336 |
</div> |
| 337 |
</div> |
| 338 |
<?php if($attachments): ?> |
| 339 |
<table class="wpsc_attachment_tbl"> |
| 340 |
<tbody> |
| 341 |
<?php |
| 342 |
foreach( $attachments as $attachment): |
| 343 |
$attach = array(); |
| 344 |
$attach_meta = get_term_meta($attachment); |
| 345 |
foreach ($attach_meta as $key => $value) { |
| 346 |
$attach[$key] = $value[0]; |
| 347 |
} |
| 348 |
$upload_dir = wp_upload_dir(); |
| 349 |
|
| 350 |
$wpsp_file = get_term_meta($attachment,'wpsp_file'); |
| 351 |
|
| 352 |
if ($wpsp_file) { |
| 353 |
$file_url = $upload_dir['basedir'] . '/wpsp/'. $attach['save_file_name']; |
| 354 |
}else { |
| 355 |
if( isset($attach['is_restructured']) && $attach['is_restructured']){ |
| 356 |
$updated_time = get_term_meta($attachment,'time_uploaded',true); |
| 357 |
$time = strtotime($updated_time); |
| 358 |
$month = date("m",$time); |
| 359 |
$year = date("Y",$time); |
| 360 |
$file_url = $upload_dir['basedir'] . '/wpsc/'.$year.'/'.$month.'/'. $attach['save_file_name']; |
| 361 |
}else{ |
| 362 |
$file_url = $upload_dir['basedir'] . '/wpsc/'. $attach['save_file_name']; |
| 363 |
} |
| 364 |
} |
| 365 |
|
| 366 |
$download_url = home_url().'?wpsc_attachment='.$attachment.'&tid='.$this->ticket_id.'&tac='.$auth_id; |
| 367 |
?> |
| 368 |
<tr> |
| 369 |
<td> |
| 370 |
<div class="" id="<?php echo 'attach_'.esc_attr($attachment); ?>"> |
| 371 |
<input type="hidden" name="<?php echo esc_attr($field->slug) ?>[]" value="<?php echo esc_attr($attachment) ?>"> |
| 372 |
<span style="padding: 7px;"><a href="<?php echo esc_attr($download_url)?>" target="_blank"><?php echo esc_attr($attach['filename']);?></a></span> |
| 373 |
<span onclick="wpsc_delete_attached_files('<?php echo esc_attr($attachment) ?>','<?php echo esc_attr($this->ticket_id) ?>','<?php echo esc_attr($field->slug)?>','<?php echo wp_create_nonce('set_delete_attached_files')?>');" class="fa fa-trash" ></span> |
| 374 |
</div> |
| 375 |
</td> |
| 376 |
</tr> |
| 377 |
<div> |
| 378 |
<?php endforeach;?> |
| 379 |
</tbody> |
| 380 |
</table> |
| 381 |
<?php endif; ?> |
| 382 |
</div> |
| 383 |
|
| 384 |
|
| 385 |
<?php |
| 386 |
} |
| 387 |
|
| 388 |
|
| 389 |
function print_date_time($field){ |
| 390 |
global $wpscfunction; |
| 391 |
$value = $wpscfunction->get_ticket_meta($this->ticket_id, $field->slug,true); |
| 392 |
$date=''; |
| 393 |
if( strlen($value) != 0 ){ |
| 394 |
$date = $value; |
| 395 |
} |
| 396 |
?> |
| 397 |
<div data-fieldtype="date" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 398 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 399 |
<?php echo esc_attr($this->field_label['custom_fields_'.$field->term_id]);?> |
| 400 |
</label> |
| 401 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 402 |
<input type="text" id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_datetime" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" value="<?php echo esc_attr($date);?>" placeholder="<?php echo esc_attr($this->placeholder_text); ?>" onkeypress='return false'> |
| 403 |
</div> |
| 404 |
<script type="text/javascript"> |
| 405 |
jQuery(document).ready(function(){ |
| 406 |
jQuery('.wpsc_datetime').datetimepicker({ |
| 407 |
dateFormat : '<?php echo esc_attr(get_option('wpsc_calender_date_format'))?>', |
| 408 |
showAnim : 'slideDown', |
| 409 |
changeMonth: true, |
| 410 |
changeYear: true, |
| 411 |
timeFormat: 'HH:mm:ss' |
| 412 |
}) |
| 413 |
}); |
| 414 |
</script> |
| 415 |
<?php |
| 416 |
} |
| 417 |
|
| 418 |
function print_time($field){ |
| 419 |
global $wpscfunction; |
| 420 |
$time_format = get_term_meta($field->term_id,'wpsc_time_format',true); |
| 421 |
$value = $wpscfunction->get_ticket_meta($this->ticket_id, $field->slug,true); |
| 422 |
$time = ''; |
| 423 |
|
| 424 |
if( strlen($value) != 0 ){ |
| 425 |
if($time_format == '12'){ |
| 426 |
$time = date("h:i:s a", strtotime($value)); |
| 427 |
|
| 428 |
}else{ |
| 429 |
$time = $value; |
| 430 |
} |
| 431 |
} |
| 432 |
$time_format = get_term_meta($field->term_id,'wpsc_time_format',true); |
| 433 |
?> |
| 434 |
<div data-fieldtype="time" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 435 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 436 |
<?php echo esc_attr($this->field_label['custom_fields_'.$field->term_id]);?> |
| 437 |
</label> |
| 438 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 439 |
<input type="text" id="<?php echo esc_attr($this->slug);?>" onkeypress='return false' class="form-control <?php echo esc_attr($this->slug) ?>" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" value="<?php echo esc_attr($time);?>"> |
| 440 |
</div> |
| 441 |
<script type="text/javascript"> |
| 442 |
jQuery(document).ready(function(){ |
| 443 |
jQuery('.<?php echo esc_attr($this->slug) ?>').timepicker({ |
| 444 |
<?php |
| 445 |
if($time_format == '12'){ |
| 446 |
?> |
| 447 |
timeFormat:'hh:mm:ss tt', |
| 448 |
<?php |
| 449 |
}else{ |
| 450 |
?> |
| 451 |
timeFormat:'HH:mm:ss' |
| 452 |
<?php |
| 453 |
} |
| 454 |
?> |
| 455 |
}); |
| 456 |
}); |
| 457 |
|
| 458 |
</script> |
| 459 |
<?php |
| 460 |
} |
| 461 |
|
| 462 |
} |
| 463 |
|
| 464 |
|
| 465 |
endif; |