CommonJs.php
4 years ago
ConnectionIcon.php
4 years ago
ManualScheduling.php
4 years ago
SaveSchedulingButton.php
4 years ago
SchedulingHelp.php
4 years ago
SchedulingOptions.php
4 years ago
SchedulingUI.php
4 years ago
SchedulingOptions.php
876 lines
| 1 | <?php |
| 2 | $scheduling = \Wpae\Scheduling\Scheduling::create(); |
| 3 | $schedulingExportOptions = $export->options; |
| 4 | $hasActiveLicense = $scheduling->checkLicense(); |
| 5 | $cron_job_key = PMXE_Plugin::getInstance()->getOption('cron_job_key'); |
| 6 | $options = \PMXE_Plugin::getInstance()->getOption(); |
| 7 | ?> |
| 8 | <style type="text/css"> |
| 9 | .days-of-week { |
| 10 | margin-left: 5px; |
| 11 | } |
| 12 | |
| 13 | .days-of-week li { |
| 14 | border: 1px solid #ccc; |
| 15 | border-radius: 5px; |
| 16 | padding: 10px 30px;; |
| 17 | display: inline-block; |
| 18 | margin-right: 10px; |
| 19 | cursor: pointer; |
| 20 | font-weight: bold; |
| 21 | width: 38px; |
| 22 | text-align: center; |
| 23 | height: 16px; |
| 24 | color: rgb(68,68,68); |
| 25 | float: left; |
| 26 | } |
| 27 | |
| 28 | .days-of-week li.selected { |
| 29 | color: #fff; |
| 30 | background-color: #425F9A; |
| 31 | border-color: #585858; |
| 32 | } |
| 33 | |
| 34 | #weekly, #monthly { |
| 35 | height: 40px; |
| 36 | } |
| 37 | |
| 38 | .timepicker { |
| 39 | width: 100px; |
| 40 | padding: 10px; |
| 41 | border-radius: 5px; |
| 42 | margin-right: 10px; |
| 43 | } |
| 44 | |
| 45 | #times { |
| 46 | margin-top: 5px; |
| 47 | width: 800px; |
| 48 | } |
| 49 | |
| 50 | #times input { |
| 51 | margin-top: 10px; |
| 52 | margin-left: 0; |
| 53 | float: left; |
| 54 | } |
| 55 | |
| 56 | #times input.error { |
| 57 | border-color: red !important; |
| 58 | } |
| 59 | |
| 60 | .subscribe { |
| 61 | |
| 62 | } |
| 63 | |
| 64 | .subscribe .button-container { |
| 65 | float: left; |
| 66 | width: 150px; |
| 67 | } |
| 68 | |
| 69 | .subscribe .text-container { |
| 70 | float: left; |
| 71 | width: auto; |
| 72 | } |
| 73 | |
| 74 | .subscribe .text-container p { |
| 75 | margin: 0; |
| 76 | color: #425F9A; |
| 77 | font-size: 14px; |
| 78 | font-weight: bold; |
| 79 | } |
| 80 | |
| 81 | .subscribe .text-container p a { |
| 82 | color: #425F9A; |
| 83 | text-decoration: underline; |
| 84 | } |
| 85 | |
| 86 | .save { |
| 87 | padding-left: 5px; |
| 88 | padding-top: 5px; |
| 89 | width: auto; |
| 90 | } |
| 91 | |
| 92 | .ui-timepicker-wrapper { |
| 93 | width: 98px; |
| 94 | } |
| 95 | |
| 96 | .easing-spinner { |
| 97 | width: 30px; |
| 98 | height: 30px; |
| 99 | position: relative; |
| 100 | display: inline-block; |
| 101 | |
| 102 | margin-top: 7px; |
| 103 | margin-left: -25px; |
| 104 | |
| 105 | float: left; |
| 106 | } |
| 107 | |
| 108 | .double-bounce1, .double-bounce2 { |
| 109 | width: 100%; |
| 110 | height: 100%; |
| 111 | border-radius: 50%; |
| 112 | background-color: #fff; |
| 113 | opacity: 0.6; |
| 114 | position: absolute; |
| 115 | top: 0; |
| 116 | left: 0; |
| 117 | |
| 118 | -webkit-animation: sk-bounce 2.0s infinite ease-in-out; |
| 119 | animation: sk-bounce 2.0s infinite ease-in-out; |
| 120 | } |
| 121 | |
| 122 | .double-bounce2 { |
| 123 | -webkit-animation-delay: -1.0s; |
| 124 | animation-delay: -1.0s; |
| 125 | } |
| 126 | |
| 127 | .wpae-save-button svg { |
| 128 | margin-top: 7px; |
| 129 | margin-left: -215px; |
| 130 | display: inline-block; |
| 131 | position: relative; |
| 132 | } |
| 133 | |
| 134 | @-webkit-keyframes sk-bounce { |
| 135 | 0%, 100% { |
| 136 | -webkit-transform: scale(0.0) |
| 137 | } |
| 138 | 50% { |
| 139 | -webkit-transform: scale(1.0) |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | @keyframes sk-bounce { |
| 144 | 0%, 100% { |
| 145 | transform: scale(0.0); |
| 146 | -webkit-transform: scale(0.0); |
| 147 | } |
| 148 | 50% { |
| 149 | transform: scale(1.0); |
| 150 | -webkit-transform: scale(1.0); |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | #add-subscription-field { |
| 155 | position: absolute; |
| 156 | left: -152px; |
| 157 | top: -2px; |
| 158 | height: 46px; |
| 159 | border-radius: 5px; |
| 160 | font-size: 17px; |
| 161 | padding-left: 10px; |
| 162 | display: none; |
| 163 | width: 140px; |
| 164 | } |
| 165 | |
| 166 | #find-subscription-link { |
| 167 | position: absolute; |
| 168 | left: 133px; |
| 169 | top: 14px; |
| 170 | height:30px; |
| 171 | width: 300px; |
| 172 | display: none; |
| 173 | } |
| 174 | |
| 175 | #find-subscription-link a { |
| 176 | display: block; |
| 177 | width: 100%; |
| 178 | height: 46px; |
| 179 | white-space: nowrap; |
| 180 | } |
| 181 | |
| 182 | #weekly li.error, #monthly li.error { |
| 183 | border-color: red; |
| 184 | } |
| 185 | |
| 186 | .chosen-single { |
| 187 | margin-bottom: 0 !important; |
| 188 | } |
| 189 | |
| 190 | .chosen-container.chosen-with-drop .chosen-drop { |
| 191 | margin-top: 0 !important; |
| 192 | } |
| 193 | |
| 194 | .wpallexport-preview-content h4{ |
| 195 | font-size: 14px; |
| 196 | margin-bottom: 5px; |
| 197 | color: #40acad; |
| 198 | text-decoration: none; |
| 199 | } |
| 200 | .manual-scheduling { margin-left: 26px;} |
| 201 | </style> |
| 202 | |
| 203 | <script type="text/javascript"> |
| 204 | (function ($) { |
| 205 | $(function () { |
| 206 | |
| 207 | var hasActiveLicense = <?php echo $hasActiveLicense? 'true':'false'; ?>; |
| 208 | |
| 209 | function isAutomaticSchedulingEnabled() { |
| 210 | return $('input[name="scheduling_enable"]:checked').val() == 1; |
| 211 | } |
| 212 | |
| 213 | $(document).ready(function () { |
| 214 | |
| 215 | function openSchedulingAccordeonIfClosed() { |
| 216 | if ($('.wpallexport-file-options').hasClass('closed')) { |
| 217 | // Open accordion |
| 218 | $('#scheduling-title').trigger('click'); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | window.pmxeValidateSchedulingForm = function () { |
| 223 | |
| 224 | var schedulingEnabled = isAutomaticSchedulingEnabled(); |
| 225 | |
| 226 | if (!schedulingEnabled) { |
| 227 | return { |
| 228 | isValid: true |
| 229 | }; |
| 230 | } |
| 231 | |
| 232 | var runOn = $('input[name="scheduling_run_on"]:checked').val(); |
| 233 | |
| 234 | // Validate weekdays |
| 235 | if (runOn == 'weekly') { |
| 236 | var weeklyDays = $('#weekly_days').val(); |
| 237 | |
| 238 | if (weeklyDays == '') { |
| 239 | $('#weekly li').addClass('error'); |
| 240 | return { |
| 241 | isValid: false, |
| 242 | message: 'Please select at least a day on which the export should run' |
| 243 | } |
| 244 | } |
| 245 | } else if (runOn == 'monthly') { |
| 246 | var monthlyDays = $('#monthly_days').val(); |
| 247 | |
| 248 | if (monthlyDays == '') { |
| 249 | $('#monthly li').addClass('error'); |
| 250 | return { |
| 251 | isValid: false, |
| 252 | message: 'Please select at least a day on which the export should run' |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | // Validate times |
| 258 | var timeValid = true; |
| 259 | var timeMessage = 'Please select at least a time for the export to run'; |
| 260 | var timeInputs = $('.timepicker'); |
| 261 | var timesHasValues = false; |
| 262 | |
| 263 | timeInputs.each(function (key, $elem) { |
| 264 | |
| 265 | if($(this).val() !== ''){ |
| 266 | timesHasValues = true; |
| 267 | } |
| 268 | |
| 269 | if (!$(this).val().match(/^(0?[1-9]|1[012])(:[0-5]\d)[APap][mM]$/) && $(this).val() != '') { |
| 270 | $(this).addClass('error'); |
| 271 | timeValid = false; |
| 272 | } else { |
| 273 | $(this).removeClass('error'); |
| 274 | } |
| 275 | }); |
| 276 | |
| 277 | if(!timesHasValues) { |
| 278 | timeValid = false; |
| 279 | $('.timepicker').addClass('error'); |
| 280 | } |
| 281 | |
| 282 | if (!timeValid) { |
| 283 | return { |
| 284 | isValid: false, |
| 285 | message: timeMessage |
| 286 | }; |
| 287 | } |
| 288 | |
| 289 | return { |
| 290 | isValid: true |
| 291 | }; |
| 292 | }; |
| 293 | |
| 294 | |
| 295 | |
| 296 | $('#weekly li').click(function () { |
| 297 | |
| 298 | $('#weekly li').removeClass('error'); |
| 299 | |
| 300 | if ($(this).hasClass('selected')) { |
| 301 | $(this).removeClass('selected'); |
| 302 | } else { |
| 303 | $(this).addClass('selected'); |
| 304 | } |
| 305 | |
| 306 | $('#weekly_days').val(''); |
| 307 | |
| 308 | $('#weekly li.selected').each(function () { |
| 309 | var val = $(this).data('day'); |
| 310 | $('#weekly_days').val($('#weekly_days').val() + val + ','); |
| 311 | }); |
| 312 | |
| 313 | $('#weekly_days').val($('#weekly_days').val().slice(0, -1)); |
| 314 | |
| 315 | }); |
| 316 | |
| 317 | $('#monthly li').click(function () { |
| 318 | |
| 319 | $('#monthly li').removeClass('error'); |
| 320 | $(this).parent().parent().find('.days-of-week li').removeClass('selected'); |
| 321 | $(this).addClass('selected'); |
| 322 | |
| 323 | $('#monthly_days').val($(this).data('day')); |
| 324 | }); |
| 325 | |
| 326 | $('input[name="scheduling_run_on"]').change(function () { |
| 327 | var val = $('input[name="scheduling_run_on"]:checked').val(); |
| 328 | if (val == "weekly") { |
| 329 | |
| 330 | $('#weekly').slideDown({ |
| 331 | queue: false |
| 332 | }); |
| 333 | $('#monthly').slideUp({ |
| 334 | queue: false |
| 335 | }); |
| 336 | |
| 337 | } else if (val == "monthly") { |
| 338 | |
| 339 | $('#weekly').slideUp({ |
| 340 | queue: false |
| 341 | }); |
| 342 | $('#monthly').slideDown({ |
| 343 | queue: false |
| 344 | }); |
| 345 | } |
| 346 | }); |
| 347 | |
| 348 | $('.timepicker').timepicker(); |
| 349 | |
| 350 | var selectedTimes = []; |
| 351 | |
| 352 | var onTimeSelected = function () { |
| 353 | |
| 354 | selectedTimes.push([$(this).val(), $(this).val() + 1]); |
| 355 | |
| 356 | var isLastChild = $(this).is(':last-child'); |
| 357 | if (isLastChild) { |
| 358 | $(this).parent().append('<input class="timepicker" name="scheduling_times[]" style="display: none;" type="text" />'); |
| 359 | $('.timepicker:last-child').timepicker({ |
| 360 | 'disableTimeRanges': selectedTimes |
| 361 | }); |
| 362 | $('.timepicker:last-child').fadeIn('fast'); |
| 363 | $('.timepicker').on('changeTime', onTimeSelected); |
| 364 | } |
| 365 | }; |
| 366 | |
| 367 | $('.timepicker').on('changeTime', onTimeSelected); |
| 368 | |
| 369 | $('#timezone').chosen({width: '320px'}); |
| 370 | |
| 371 | |
| 372 | $('.wpae-save-button').click(function (e) { |
| 373 | |
| 374 | var initialValue = $(this).find('.save-text').html(); |
| 375 | var schedulingEnable = $('input[name="scheduling_enable"]:checked').val() == 1; |
| 376 | if(!hasActiveLicense) { |
| 377 | if (!$(this).data('iunderstand') && schedulingEnable) { |
| 378 | $('#no-subscription').slideDown(); |
| 379 | $(this).find('.save-text').html('<?php echo _e('I Understand');?>'); |
| 380 | $(this).find('.save-text').css('left', '100px'); |
| 381 | $(this).data('iunderstand', 1); |
| 382 | |
| 383 | openSchedulingAccordeonIfClosed(); |
| 384 | e.preventDefault(); |
| 385 | return; |
| 386 | } else { |
| 387 | var submitEvent = $.Event('wpae-scheduling-options-form:submit'); |
| 388 | $(document).trigger(submitEvent); |
| 389 | |
| 390 | return; |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | // Don't process scheduling |
| 395 | if (!hasActiveLicense) { |
| 396 | var submitEvent = $.Event('wpae-scheduling-options-form:submit'); |
| 397 | $(document).trigger(submitEvent); |
| 398 | |
| 399 | return; |
| 400 | } |
| 401 | |
| 402 | var validationResponse = pmxeValidateSchedulingForm(); |
| 403 | if (!validationResponse.isValid) { |
| 404 | |
| 405 | openSchedulingAccordeonIfClosed(); |
| 406 | $('html, body').animate({ |
| 407 | scrollTop: $("#scheduling-title").offset().top-100 |
| 408 | }, 500); |
| 409 | e.preventDefault(); |
| 410 | return false; |
| 411 | } |
| 412 | |
| 413 | var $button = $(this); |
| 414 | |
| 415 | var formData = $('#scheduling-form :input').serializeArray(); |
| 416 | |
| 417 | formData.push({name: 'security', value: wp_all_export_security}); |
| 418 | formData.push({name: 'action', value: 'save_scheduling'}); |
| 419 | formData.push({name: 'element_id', value: <?php echo $export_id; ?>}); |
| 420 | formData.push({name: 'scheduling_enable', value: $('input[name="scheduling_enable"]:checked').val()}); |
| 421 | |
| 422 | $button.find('.easing-spinner').toggle(); |
| 423 | |
| 424 | $.ajax({ |
| 425 | type: 'POST', |
| 426 | url: ajaxurl, |
| 427 | data: formData, |
| 428 | success: function (response) { |
| 429 | $button.find('.easing-spinner').toggle(); |
| 430 | $button.find('.save-text').html(initialValue); |
| 431 | $button.find('svg').show(); |
| 432 | |
| 433 | setTimeout(function(){ |
| 434 | var submitEvent = $.Event('wpae-scheduling-options-form:submit'); |
| 435 | $(document).trigger(submitEvent); |
| 436 | }, 1000); |
| 437 | |
| 438 | }, |
| 439 | error: function () { |
| 440 | $button.find('.easing-spinner').toggle(); |
| 441 | $button.find('.save-text').html(initialValue); |
| 442 | } |
| 443 | }); |
| 444 | }); |
| 445 | |
| 446 | $('.wp_all_export_confirm_and_run').click(function(e){ |
| 447 | |
| 448 | e.preventDefault(); |
| 449 | |
| 450 | var schedulingEnable = isAutomaticSchedulingEnabled(); |
| 451 | |
| 452 | if(schedulingEnable) { |
| 453 | |
| 454 | |
| 455 | if(!hasActiveLicense) { |
| 456 | if (!$(this).data('iunderstand') && schedulingEnable) { |
| 457 | $('#no-subscription').slideDown(); |
| 458 | $(this).find('.save-text').html('<?php echo _e('I Understand');?>'); |
| 459 | $(this).find('.save-text').css('left', '100px'); |
| 460 | $(this).data('iunderstand', 1); |
| 461 | |
| 462 | openSchedulingAccordeonIfClosed(); |
| 463 | |
| 464 | $('html, body').animate({ |
| 465 | scrollTop: $(".wpallexport-submit-buttons").offset().top+200 |
| 466 | }, 900); |
| 467 | |
| 468 | e.preventDefault(); |
| 469 | return; |
| 470 | } else { |
| 471 | var submitEvent = $.Event('wpae-scheduling-options-form:submit'); |
| 472 | $(document).trigger(submitEvent); |
| 473 | |
| 474 | return; |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | var validationResponse = pmxeValidateSchedulingForm(); |
| 479 | if (!validationResponse.isValid) { |
| 480 | |
| 481 | openSchedulingAccordeonIfClosed(); |
| 482 | $('html, body').animate({ |
| 483 | scrollTop: $("#scheduling-title").offset().top-100 |
| 484 | }, 500); |
| 485 | e.preventDefault(); |
| 486 | return false; |
| 487 | } |
| 488 | |
| 489 | var $button = $('.wpae-scheduling-status'); |
| 490 | $button.find('.easing-spinner').toggle(); |
| 491 | |
| 492 | var formData = $('#scheduling-form :input').serializeArray(); |
| 493 | |
| 494 | formData.push({name: 'security', value: wp_all_export_security}); |
| 495 | formData.push({name: 'action', value: 'save_scheduling'}); |
| 496 | formData.push({name: 'element_id', value: <?php echo $export_id; ?>}); |
| 497 | formData.push({name: 'scheduling_enable', value: $('input[name="scheduling_enable"]:checked').val()}); |
| 498 | |
| 499 | $.ajax({ |
| 500 | type: 'POST', |
| 501 | url: ajaxurl, |
| 502 | data: formData, |
| 503 | success: function (response) { |
| 504 | $button.find('.easing-spinner').toggle(); |
| 505 | $button.find('svg').show(); |
| 506 | |
| 507 | setTimeout(function(){ |
| 508 | var submitEvent = $.Event('wpae-scheduling-options-form:submit'); |
| 509 | $(document).trigger(submitEvent); |
| 510 | }, 1000); |
| 511 | |
| 512 | }, |
| 513 | error: function () { |
| 514 | $button.find('.easing-spinner').toggle(); |
| 515 | } |
| 516 | }); |
| 517 | |
| 518 | return false; |
| 519 | } else { |
| 520 | $('form.choose-export-options').submit(); |
| 521 | |
| 522 | } |
| 523 | |
| 524 | return false; |
| 525 | }); |
| 526 | |
| 527 | <?php if($schedulingExportOptions['scheduling_timezone'] == 'UTC') { |
| 528 | ?> |
| 529 | var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; |
| 530 | |
| 531 | if($('#timezone').find("option:contains('"+ timeZone +"')").length != 0){ |
| 532 | $('#timezone').trigger("chosen:updated"); |
| 533 | $('#timezone').val(timeZone); |
| 534 | $('#timezone').trigger("chosen:updated"); |
| 535 | }else{ |
| 536 | var parts = timeZone.split('/'); |
| 537 | var lastPart = parts[parts.length-1]; |
| 538 | var opt = $('#timezone').find("option:contains('"+ lastPart +"')"); |
| 539 | |
| 540 | $('#timezone').val(opt.val()); |
| 541 | $('#timezone').trigger("chosen:updated"); |
| 542 | } |
| 543 | |
| 544 | <?php |
| 545 | } |
| 546 | ?> |
| 547 | |
| 548 | var saveSubscription = false; |
| 549 | |
| 550 | $('#add-subscription').click(function(){ |
| 551 | |
| 552 | $('#add-subscription-field').show(); |
| 553 | $('#add-subscription-field').animate({width:'400px'}, 225); |
| 554 | $('#add-subscription-field').animate({left:'-1px'}, 225); |
| 555 | $('#subscribe-button .button-subscribe').css('background-color','#46ba69'); |
| 556 | |
| 557 | $('.text-container p').fadeOut(); |
| 558 | |
| 559 | setTimeout(function () { |
| 560 | $('#find-subscription-link').show(); |
| 561 | $('#find-subscription-link').animate({left: '410px'}, 300, 'swing'); |
| 562 | }, 225); |
| 563 | $('.subscribe-button-text').html('<?php _e('Activate'); ?>'); |
| 564 | saveSubscription = true; |
| 565 | return false; |
| 566 | }); |
| 567 | |
| 568 | $('#subscribe-button').click(function(){ |
| 569 | |
| 570 | if(saveSubscription) { |
| 571 | $('#subscribe-button .easing-spinner').show(); |
| 572 | |
| 573 | var license = $('#add-subscription-field').val(); |
| 574 | $.ajax({ |
| 575 | url:ajaxurl+'?action=wpae_api&q=schedulingLicense/saveSchedulingLicense&security=<?php echo wp_create_nonce("wp_all_export_secure");?>', |
| 576 | type:"POST", |
| 577 | data: { |
| 578 | license: license |
| 579 | }, |
| 580 | dataType:"json", |
| 581 | success: function(response){ |
| 582 | |
| 583 | $('#subscribe-button .button-subscribe').css('background-color','#425f9a'); |
| 584 | if(response.success) { |
| 585 | hasActiveLicense = true; |
| 586 | $('#subscribe-button .easing-spinner').hide(); |
| 587 | $('#subscribe-button svg.success').show(); |
| 588 | $('#subscribe-button svg.success').fadeOut(3000, function () { |
| 589 | $('.subscribe').hide({queue: false}); |
| 590 | $('#subscribe-filler').show({queue: false}); |
| 591 | }); |
| 592 | |
| 593 | $('.wpai-no-license').hide(); |
| 594 | $('.wpai-license').show(); |
| 595 | } else { |
| 596 | $('#subscribe-button .easing-spinner').hide(); |
| 597 | $('#subscribe-button svg.error').show(); |
| 598 | $('.subscribe-button-text').html('<?php _e('Subscribe'); ?>'); |
| 599 | |
| 600 | $('#subscribe-button svg.error').fadeOut(3000, function () { |
| 601 | $('#subscribe-button svg.error').hide({queue: false}); |
| 602 | |
| 603 | }); |
| 604 | |
| 605 | $('#add-subscription').html('<?php _e('Invalid license, try again?');?>'); |
| 606 | $('.text-container p').fadeIn(); |
| 607 | |
| 608 | $('#find-subscription-link').animate({width: 'toggle'}, 300, 'swing'); |
| 609 | |
| 610 | setTimeout(function () { |
| 611 | $('#add-subscription-field').animate({width:'140px'}, 225); |
| 612 | $('#add-subscription-field').animate({left:'-152px'}, 225); |
| 613 | }, 300); |
| 614 | |
| 615 | $('#add-subscription-field').val(''); |
| 616 | |
| 617 | $('#subscribe-button-text').html('<?php _e('Subscribe'); ?>'); |
| 618 | saveSubscription = false; |
| 619 | } |
| 620 | } |
| 621 | }); |
| 622 | |
| 623 | return false; |
| 624 | } |
| 625 | }); |
| 626 | }); |
| 627 | // help scheduling template |
| 628 | $('.help_scheduling').click(function(){ |
| 629 | |
| 630 | $('.wp-all-export-scheduling-help').css('left', ($( document ).width()/2) - 255 ).show(); |
| 631 | $('#wp-all-export-scheduling-help-inner').css('max-height', $( window ).height()-150).show(); |
| 632 | $('.wpallexport-overlay').show(); |
| 633 | return false; |
| 634 | }); |
| 635 | |
| 636 | $('.wp_all_export_scheduling_help').find('h3').click(function(){ |
| 637 | var $action = $(this).find('span').html(); |
| 638 | $('.wp_all_export_scheduling_help').find('h3').each(function(){ |
| 639 | $(this).find('span').html("+"); |
| 640 | }); |
| 641 | if ( $action == "+" ) { |
| 642 | $('.wp_all_export_help_tab').slideUp(); |
| 643 | $('.wp_all_export_help_tab[rel=' + $(this).attr('id') + ']').slideDown(); |
| 644 | $(this).find('span').html("-"); |
| 645 | } |
| 646 | else{ |
| 647 | $('.wp_all_export_help_tab[rel=' + $(this).attr('id') + ']').slideUp(); |
| 648 | $(this).find('span').html("+"); |
| 649 | } |
| 650 | }); |
| 651 | }); |
| 652 | })(jQuery); |
| 653 | |
| 654 | </script> |
| 655 | <?php require __DIR__.'/CommonJs.php'; ?> |
| 656 | <div class="wpallexport-collapsed wpallexport-section wpallexport-file-options closed" |
| 657 | style="margin-top: -10px; margin-bottom: 10px;"> |
| 658 | <div id="scheduling-form"> |
| 659 | |
| 660 | <div class="wpallexport-content-section" style="padding-bottom: 15px; margin-bottom: 10px;"> |
| 661 | <div class="wpallexport-collapsed-header" id="scheduling-options-header" style="padding-left: 25px;"> |
| 662 | <h3 id="scheduling-title" style="position: relative;"> |
| 663 | <?php _e('Scheduling Options', PMXE_Plugin::LANGUAGE_DOMAIN); ?> |
| 664 | </h3> |
| 665 | </div> |
| 666 | |
| 667 | <div class="wpallexport-collapsed-content" style="padding: 0; height: auto; display: none;"> |
| 668 | <div class="wpallexport-collapsed-content-inner" style="padding-bottom: 0; overflow: auto;"> |
| 669 | <div style="margin-bottom: 20px;"> |
| 670 | <label> |
| 671 | <input type="radio" name="scheduling_enable" value="0" <?php if(!$schedulingExportOptions['scheduling_enable']) { ?> checked="checked" <?php } ?>/> |
| 672 | <h4 style="display: inline-block; margin-top:3px; margin-bottom:-2px;"><?php _e('Do Not Schedule'); ?></h4> |
| 673 | </label> |
| 674 | </div> |
| 675 | <div> |
| 676 | <label> |
| 677 | <input type="radio" name="scheduling_enable" value="1" <?php if($schedulingExportOptions['scheduling_enable'] == 1) {?> checked="checked" <?php }?>/> |
| 678 | |
| 679 | <h4 style="margin: 0; display: inline-flex; align-items: center;"><?php _e('Automatic Scheduling', PMXE_Plugin::LANGUAGE_DOMAIN); ?> |
| 680 | <span class="connection-icon" style="margin-left: 8px;"> |
| 681 | <?php include_once('ConnectionIcon.php'); ?> |
| 682 | </span> |
| 683 | <?php if (!$scheduling->checkConnection()) { ?> |
| 684 | <span class="wpai-license" style="margin-left: 8px; font-weight: normal; <?php if(!$hasActiveLicense) { ?> display: none; <?php }?> color: #f2b03d; ">Unable to connect, please contact support.</span> |
| 685 | <?php } ?> |
| 686 | </h4> |
| 687 | </label> |
| 688 | </div> |
| 689 | <div style="margin-bottom: 10px; margin-left:26px;"> |
| 690 | <label style="font-size: 13px;"> |
| 691 | <?php _e('Run this export on a schedule.'); ?> |
| 692 | </label> |
| 693 | </div> |
| 694 | <div id="automatic-scheduling" |
| 695 | style="margin-left: 21px; <?php if ($schedulingExportOptions['scheduling_enable'] != 1) { ?> display: none; <?php } ?>"> |
| 696 | <div> |
| 697 | <div class="input"> |
| 698 | <label style="color: rgb(68,68,68);"> |
| 699 | <input |
| 700 | type="radio" <?php if ($schedulingExportOptions['scheduling_run_on'] != 'monthly') { ?> checked="checked" <?php } ?> |
| 701 | name="scheduling_run_on" value="weekly" |
| 702 | checked="checked"/> <?php _e('Every week on...', PMXE_Plugin::LANGUAGE_DOMAIN); ?> |
| 703 | </label> |
| 704 | </div> |
| 705 | <input type="hidden" style="width: 500px;" name="scheduling_weekly_days" |
| 706 | value="<?php echo $schedulingExportOptions['scheduling_weekly_days']; ?>" id="weekly_days"/> |
| 707 | <?php |
| 708 | if (isset($schedulingExportOptions['scheduling_weekly_days'])) { |
| 709 | $weeklyArray = explode(',', $schedulingExportOptions['scheduling_weekly_days']); |
| 710 | } else { |
| 711 | $weeklyArray = array(); |
| 712 | } |
| 713 | ?> |
| 714 | <ul class="days-of-week" id="weekly" style="<?php if ($schedulingExportOptions['scheduling_run_on'] == 'monthly') { ?> display: none; <?php } ?>"> |
| 715 | <li data-day="0" <?php if (in_array('0', $weeklyArray)) { ?> class="selected" <?php } ?>> |
| 716 | Mon |
| 717 | </li> |
| 718 | <li data-day="1" <?php if (in_array('1', $weeklyArray)) { ?> class="selected" <?php } ?>> |
| 719 | Tue |
| 720 | </li> |
| 721 | <li data-day="2" <?php if (in_array('2', $weeklyArray)) { ?> class="selected" <?php } ?>> |
| 722 | Wed |
| 723 | </li> |
| 724 | <li data-day="3" <?php if (in_array('3', $weeklyArray)) { ?> class="selected" <?php } ?>> |
| 725 | Thu |
| 726 | </li> |
| 727 | <li data-day="4" <?php if (in_array('4', $weeklyArray)) { ?> class="selected" <?php } ?>> |
| 728 | Fri |
| 729 | </li> |
| 730 | <li data-day="5" <?php if (in_array('5', $weeklyArray)) { ?> class="selected" <?php } ?>> |
| 731 | Sat |
| 732 | </li> |
| 733 | <li data-day="6" <?php if (in_array('6', $weeklyArray)) { ?> class="selected" <?php } ?>> |
| 734 | Sun |
| 735 | </li> |
| 736 | </ul> |
| 737 | </div> |
| 738 | <div style="clear: both;"></div> |
| 739 | <div> |
| 740 | <div class="input"> |
| 741 | <label style="color: rgb(68,68,68);"> |
| 742 | <input |
| 743 | type="radio" <?php if ($schedulingExportOptions['scheduling_run_on'] == 'monthly') { ?> checked="checked" <?php } ?> |
| 744 | name="scheduling_run_on" |
| 745 | value="monthly"/> <?php _e('Every month on the first...', PMXE_Plugin::LANGUAGE_DOMAIN); ?> |
| 746 | </label> |
| 747 | </div> |
| 748 | <input type="hidden" name="scheduling_monthly_days" value="<?php if (isset($schedulingExportOptions['scheduling_monthly_days'])) echo $schedulingExportOptions['scheduling_monthly_days']; ?>" id="monthly_days"/> |
| 749 | <?php |
| 750 | if (isset($schedulingExportOptions['scheduling_monthly_days'])) { |
| 751 | $monthlyArray = explode(',', $schedulingExportOptions['scheduling_monthly_days']); |
| 752 | } else { |
| 753 | $monthlyArray = array(); |
| 754 | } |
| 755 | ?> |
| 756 | <ul class="days-of-week" id="monthly" |
| 757 | style="<?php if ($schedulingExportOptions['scheduling_run_on'] != 'monthly') { ?> display: none; <?php } ?>"> |
| 758 | <li data-day="0" <?php if (in_array('0', $monthlyArray)) { ?> class="selected" <?php } ?>> |
| 759 | Mon |
| 760 | </li> |
| 761 | <li data-day="1" <?php if (in_array('1', $monthlyArray)) { ?> class="selected" <?php } ?>> |
| 762 | Tue |
| 763 | </li> |
| 764 | <li data-day="2" <?php if (in_array('2', $monthlyArray)) { ?> class="selected" <?php } ?>> |
| 765 | Wed |
| 766 | </li> |
| 767 | <li data-day="3" <?php if (in_array('3', $monthlyArray)) { ?> class="selected" <?php } ?>> |
| 768 | Thu |
| 769 | </li> |
| 770 | <li data-day="4" <?php if (in_array('4', $monthlyArray)) { ?> class="selected" <?php } ?>> |
| 771 | Fri |
| 772 | </li> |
| 773 | <li data-day="5" <?php if (in_array('5', $monthlyArray)) { ?> class="selected" <?php } ?>> |
| 774 | Sat |
| 775 | </li> |
| 776 | <li data-day="6" <?php if (in_array('6', $monthlyArray)) { ?> class="selected" <?php } ?>> |
| 777 | Sun |
| 778 | </li> |
| 779 | </ul> |
| 780 | </div> |
| 781 | <div style="clear: both;"></div> |
| 782 | |
| 783 | <div id="times-container" style="margin-left: 5px;"> |
| 784 | <div style="margin-top: 10px; margin-bottom: 5px;"> |
| 785 | What times do you want this export to run? |
| 786 | </div> |
| 787 | |
| 788 | <div id="times" style="margin-bottom: 10px;"> |
| 789 | <?php if (is_array($schedulingExportOptions['scheduling_times'])) { |
| 790 | foreach ($schedulingExportOptions['scheduling_times'] as $time) { ?> |
| 791 | |
| 792 | <?php if ($time) { ?> |
| 793 | <input class="timepicker" type="text" name="scheduling_times[]" |
| 794 | value="<?php echo $time; ?>"/> |
| 795 | <?php } ?> |
| 796 | <?php } ?> |
| 797 | <input class="timepicker" type="text" name="scheduling_times[]"/> |
| 798 | <?php } ?> |
| 799 | </div> |
| 800 | <div style="clear: both;"></div> |
| 801 | <div class="timezone-select" style="position:absolute; margin-top: 10px;"> |
| 802 | <?php |
| 803 | |
| 804 | $timezoneValue = false; |
| 805 | if ($schedulingExportOptions['scheduling_timezone']) { |
| 806 | $timezoneValue = $schedulingExportOptions['scheduling_timezone']; |
| 807 | } |
| 808 | |
| 809 | $timezoneSelect = new \Wpae\Scheduling\Timezone\TimezoneSelect(); |
| 810 | echo $timezoneSelect->getTimezoneSelect($timezoneValue); |
| 811 | ?> |
| 812 | </div> |
| 813 | </div> |
| 814 | <div style="height: 60px; margin-top: 30px; <?php if(!$hasActiveLicense) {?>display: none; <?php } ?>" id="subscribe-filler"> </div> |
| 815 | <?php |
| 816 | if (!$hasActiveLicense) { |
| 817 | ?> |
| 818 | <div class="subscribe" style="margin-left: 5px; margin-top: 65px; margin-bottom: 130px; position: relative;"> |
| 819 | <div class="button-container"> |
| 820 | |
| 821 | <a href="https://www.wpallimport.com/checkout/?edd_action=add_to_cart&download_id=515704&utm_source=export-plugin-free&utm_medium=upgrade-notice&utm_campaign=automatic-scheduling" target="_blank" id="subscribe-button"> |
| 822 | <div class="button button-primary button-hero wpallexport-large-button button-subscribe" |
| 823 | style="background-image: none; width: 140px; text-align: center; position: absolute; z-index: 4;"> |
| 824 | <svg class="success" width="30" height="30" viewBox="0 0 1792 1792" |
| 825 | xmlns="http://www.w3.org/2000/svg" |
| 826 | style="fill: white; display: none; position: absolute; top: 6px; left: 15px;"> |
| 827 | <path |
| 828 | d="M1671 566q0 40-28 68l-724 724-136 136q-28 28-68 28t-68-28l-136-136-362-362q-28-28-28-68t28-68l136-136q28-28 68-28t68 28l294 295 656-657q28-28 68-28t68 28l136 136q28 28 28 68z" |
| 829 | fill="white"/> |
| 830 | </svg> |
| 831 | <svg class="error" width="30" height="30" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg" |
| 832 | style="fill: red; display: none; position: absolute; top: 6px; left: 15px;"> |
| 833 | <path d="M1490 1322q0 40-28 68l-136 136q-28 28-68 28t-68-28l-294-294-294 294q-28 28-68 28t-68-28l-136-136q-28-28-28-68t28-68l294-294-294-294q-28-28-28-68t28-68l136-136q28-28 68-28t68 28l294 294 294-294q28-28 68-28t68 28l136 136q28 28 28 68t-28 68l-294 294 294 294q28 28 28 68z"/></svg> |
| 834 | <div class="easing-spinner" style="display: none; position: absolute; left: 37px;"> |
| 835 | <div class="double-bounce1"></div> |
| 836 | <div class="double-bounce2"></div> |
| 837 | </div> |
| 838 | |
| 839 | <span class="subscribe-button-text"> |
| 840 | <?php _e('Subscribe'); ?> |
| 841 | </span> |
| 842 | </div> |
| 843 | </a> |
| 844 | </div> |
| 845 | <div class="text-container" style="position: absolute; left: 150px; top: 2px;"> |
| 846 | <p><?php _e('Get automatic scheduling for unlimited sites, just $9/mo.', PMXE_Plugin::LANGUAGE_DOMAIN); ?></p> |
| 847 | <p><?php _e('Have a license?', PMXE_Plugin::LANGUAGE_DOMAIN); ?> |
| 848 | <a href="#" id="add-subscription"><?php _e('Register this site.'); ?></a> <?php _e('Questions?', PMXE_Plugin::LANGUAGE_DOMAIN); ?> <a href="#" class="help_scheduling">Read more.</a></p> |
| 849 | <input type="password" id="add-subscription-field" style="position: absolute; z-index: 2; font-size: 14px;" placeholder="<?php _e('Enter your license', PMXE_Plugin::LANGUAGE_DOMAIN); ?>"/> |
| 850 | <div style="position: absolute;" id="find-subscription-link"><a href="http://www.wpallimport.com/portal/automatic-scheduling/" target="_blank"><?php _e('Find your license at the customer portal.', PMXE_Plugin::LANGUAGE_DOMAIN);?></a></div> |
| 851 | </div> |
| 852 | </div> |
| 853 | <?php |
| 854 | } ?> |
| 855 | </div> |
| 856 | <div style="clear:both"></div> |
| 857 | <?php require 'ManualScheduling.php'; ?> |
| 858 | </div> |
| 859 | </div> |
| 860 | </div> |
| 861 | |
| 862 | <div style="clear: both;"></div> |
| 863 | </div> |
| 864 | </div> |
| 865 | |
| 866 | <fieldset class="optionsset column rad4 wp-all-export-scheduling-help"> |
| 867 | |
| 868 | <div class="title"> |
| 869 | <span style="font-size:1.5em;" class="wpallexport-add-row-title"><?php _e('Automatic Scheduling', 'wp_all_export_plugin'); ?></span> |
| 870 | </div> |
| 871 | |
| 872 | <?php |
| 873 | include_once 'SchedulingHelp.php'; |
| 874 | ?> |
| 875 | </fieldset> |
| 876 |