ConnectionIcon.php
1 year ago
ManualScheduling.php
1 year ago
SaveSchedulingButton.php
3 years ago
SchedulingActiveSitesLimitUI.php
1 year ago
SchedulingSubscribeUI.php
1 year ago
SchedulingUI.php
1 year ago
SchedulingUI.php
153 lines
| 1 | <?php |
| 2 | $scheduling = \Wpae\Scheduling\Scheduling::create(); |
| 3 | $hasActiveLicense = $scheduling->checkLicense()['success'] ?? false; |
| 4 | $cron_job_key = PMXE_Plugin::getInstance()->getOption('cron_job_key'); |
| 5 | $options = PMXE_Plugin::getInstance()->getOption(); |
| 6 | $export_id = $export->id; |
| 7 | $schedulingExportOptions = $export->options; |
| 8 | ?> |
| 9 | |
| 10 | <div class="wpallexport-preview-content" style="max-height: 950px; overflow: visible;"> |
| 11 | <input type="hidden" id="scheduling_export_id" value="<?php echo $export_id; ?>"/> |
| 12 | <div style="margin-bottom: 20px;"> |
| 13 | <label> |
| 14 | <input type="radio" name="scheduling_enable" |
| 15 | value="0" <?php if ((isset($post['scheduling_enable']) && $post['scheduling_enable'] == 0) || !isset($post['scheduling_enable'])) { ?> checked="checked" <?php } ?>/> |
| 16 | <h4 style="margin:0; display: inline-block;"><?php _e('Do Not Schedule'); ?></h4> |
| 17 | </label> |
| 18 | </div> |
| 19 | <div> |
| 20 | <label> |
| 21 | <input type="radio" name="scheduling_enable" |
| 22 | value="1" <?php if ($post['scheduling_enable'] == 1) { ?> checked="checked" <?php } ?>/> |
| 23 | <h4 style="margin: 0; display: inline-flex; align-items: center;"><?php _e('Automatic Scheduling', 'wp_all_export_plugin'); ?> |
| 24 | <span class="connection-icon" id="scheduling-connection-icon" style="margin-left: 8px; height: 16px;"> |
| 25 | <?php include_once(PMXE_Plugin::ROOT_DIR . '/src/Scheduling/views/ConnectionIcon.php'); ?> |
| 26 | </span> |
| 27 | </h4> |
| 28 | </label> |
| 29 | </div> |
| 30 | <<?php echo !empty($is_dialog_context) ? 'form' : 'div';?> id="scheduling-form"> |
| 31 | <div style="margin-bottom: 10px; margin-left:26px;"> |
| 32 | <label style="font-size: 13px;"> |
| 33 | <?php printf( |
| 34 | /* translators: 1: Export ID */ |
| 35 | esc_html__('Run export ID %d on a schedule.', 'wp_all_export_plugin'), |
| 36 | (int)$export_id |
| 37 | ); ?> |
| 38 | </label> |
| 39 | </div> |
| 40 | <div id="automatic-scheduling" |
| 41 | style="margin-left: 21px; <?php if ($post['scheduling_enable'] != 1) { ?> display: none; <?php } ?>"> |
| 42 | <div> |
| 43 | <div class="scheduling-schedule-input" id="scheduling-schedule-input"> |
| 44 | <div class="input"> |
| 45 | <label style="color: rgb(68,68,68);"> |
| 46 | <input type="radio" <?php if (isset($post['scheduling_run_on']) && $post['scheduling_run_on'] != 'monthly') { ?> checked="checked" <?php } ?> name="scheduling_run_on" value="weekly" checked="checked"/> |
| 47 | <?php _e('Every week on...', 'wp_all_export_plugin'); ?> |
| 48 | </label> |
| 49 | </div> |
| 50 | <input type="hidden" style="width: 500px;" name="scheduling_weekly_days" value="<?php echo $post['scheduling_weekly_days']; ?>" id="weekly_days"/> |
| 51 | <?php if (isset($post['scheduling_weekly_days'])) { |
| 52 | $weeklyArray = explode(',', $post['scheduling_weekly_days']); |
| 53 | } else { |
| 54 | $weeklyArray = array(); |
| 55 | } ?> |
| 56 | <ul class="days-of-week" id="weekly" style="<?php if ($post['scheduling_run_on'] == 'monthly') { ?> display: none; <?php } ?>"> |
| 57 | <li data-day="0" <?php if (in_array('0', $weeklyArray)) { ?> class="selected" <?php } ?>><?php _e('Mon', 'wp_all_export_plugin'); ?></li> |
| 58 | <li data-day="1" <?php if (in_array('1', $weeklyArray)) { ?> class="selected" <?php } ?>><?php _e('Tue', 'wp_all_export_plugin'); ?></li> |
| 59 | <li data-day="2" <?php if (in_array('2', $weeklyArray)) { ?> class="selected" <?php } ?>><?php _e('Wed', 'wp_all_export_plugin'); ?></li> |
| 60 | <li data-day="3" <?php if (in_array('3', $weeklyArray)) { ?> class="selected" <?php } ?>><?php _e('Thu', 'wp_all_export_plugin'); ?></li> |
| 61 | <li data-day="4" <?php if (in_array('4', $weeklyArray)) { ?> class="selected" <?php } ?>><?php _e('Fri', 'wp_all_export_plugin'); ?></li> |
| 62 | <li data-day="5" <?php if (in_array('5', $weeklyArray)) { ?> class="selected" <?php } ?>><?php _e('Sat', 'wp_all_export_plugin'); ?></li> |
| 63 | <li data-day="6" <?php if (in_array('6', $weeklyArray)) { ?> class="selected" <?php } ?>><?php _e('Sun', 'wp_all_export_plugin'); ?></li> |
| 64 | </ul> |
| 65 | <div style="clear: both;"></div> |
| 66 | <div> |
| 67 | <div class="input every-month"> |
| 68 | <label style="color: rgb(68,68,68); margin-top: 5px;"> |
| 69 | <input type="radio" <?php if (isset($post['scheduling_run_on']) && $post['scheduling_run_on'] == 'monthly') { ?> checked="checked" <?php } ?> name="scheduling_run_on" value="monthly"/> |
| 70 | <?php _e('Every month on the first...', 'wp_all_export_plugin'); ?> |
| 71 | </label> |
| 72 | </div> |
| 73 | <input type="hidden" name="scheduling_monthly_days" value="<?php echo isset($post['scheduling_monthly_days']) ? $post['scheduling_monthly_days'] : ''; ?>" id="monthly_days"/> |
| 74 | <?php if (isset($post['scheduling_monthly_days'])) { |
| 75 | $monthlyArray = explode(',', $post['scheduling_monthly_days']); |
| 76 | } else { |
| 77 | $monthlyArray = array(); |
| 78 | } ?> |
| 79 | <ul class="days-of-week" id="monthly" style="<?php if ($post['scheduling_run_on'] != 'monthly') { ?> display: none; <?php } ?>"> |
| 80 | <li data-day="0" <?php if (in_array('0', $monthlyArray)) { ?> class="selected" <?php } ?>><?php _e('Mon', 'wp_all_export_plugin'); ?></li> |
| 81 | <li data-day="1" <?php if (in_array('1', $monthlyArray)) { ?> class="selected" <?php } ?>><?php _e('Tue', 'wp_all_export_plugin'); ?></li> |
| 82 | <li data-day="2" <?php if (in_array('2', $monthlyArray)) { ?> class="selected" <?php } ?>><?php _e('Wed', 'wp_all_export_plugin'); ?></li> |
| 83 | <li data-day="3" <?php if (in_array('3', $monthlyArray)) { ?> class="selected" <?php } ?>><?php _e('Thu', 'wp_all_export_plugin'); ?></li> |
| 84 | <li data-day="4" <?php if (in_array('4', $monthlyArray)) { ?> class="selected" <?php } ?>><?php _e('Fri', 'wp_all_export_plugin'); ?></li> |
| 85 | <li data-day="5" <?php if (in_array('5', $monthlyArray)) { ?> class="selected" <?php } ?>><?php _e('Sat', 'wp_all_export_plugin'); ?></li> |
| 86 | <li data-day="6" <?php if (in_array('6', $monthlyArray)) { ?> class="selected" <?php } ?>><?php _e('Sun', 'wp_all_export_plugin'); ?></li> |
| 87 | </ul> |
| 88 | </div> |
| 89 | <div style="clear: both;"></div> |
| 90 | <div id="times-container" style="margin-left: 5px;"> |
| 91 | <div style="margin-top: 10px; margin-bottom: 5px;"> |
| 92 | <?php _e('What times do you want this export to run?', 'wp_all_export_plugin'); ?> |
| 93 | </div> |
| 94 | <div id="times" style="margin-bottom: 10px;"> |
| 95 | <?php if (isset($post['scheduling_times']) && is_array($post['scheduling_times'])) { |
| 96 | foreach ($post['scheduling_times'] as $time) { ?> |
| 97 | <?php if ($time) { ?> |
| 98 | <input class="timepicker" type="text" name="scheduling_times[]" value="<?php echo $time; ?>"/> |
| 99 | <?php } ?> |
| 100 | <?php } ?> |
| 101 | <input class="timepicker" type="text" name="scheduling_times[]"/> |
| 102 | <?php } ?> |
| 103 | </div> |
| 104 | <div style="clear: both;"></div> |
| 105 | <div class="timezone-select" style="position:absolute; margin-top: 10px;"> |
| 106 | <?php |
| 107 | $timezoneValue = $schedulingExportOptions['scheduling_timezone'] ?? false; |
| 108 | $timezoneSelect = new \Wpae\Scheduling\Timezone\TimezoneSelect(); |
| 109 | echo $timezoneSelect->getTimezoneSelect($timezoneValue); |
| 110 | ?> |
| 111 | </div> |
| 112 | </div> |
| 113 | </div> |
| 114 | <div style="height: 35px; margin-top: 30px;" id="subscribe-filler"> </div> |
| 115 | <?php if (!$hasActiveLicense) { |
| 116 | require_once(PMXE_Plugin::ROOT_DIR . '/src/Scheduling/views/SchedulingSubscribeUI.php'); |
| 117 | require_once(PMXE_Plugin::ROOT_DIR . '/src/Scheduling/views/SchedulingActiveSitesLimitUI.php'); |
| 118 | } ?> |
| 119 | </div> |
| 120 | </div> |
| 121 | </<?php echo !empty($is_dialog_context) ? 'form' : 'div';?>> |
| 122 | <?php require PMXE_Plugin::ROOT_DIR . '/src/Scheduling/views/ManualScheduling.php'; ?> |
| 123 | |
| 124 | <script type="text/javascript"> |
| 125 | jQuery(document).ready(function ($) { |
| 126 | let $timezone = $('#timezone'); |
| 127 | |
| 128 | $timezone.chosen({width: '320px'}); |
| 129 | |
| 130 | <?php if($schedulingExportOptions['scheduling_timezone'] == 'UTC') {?> |
| 131 | var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; |
| 132 | |
| 133 | if($timezone.find("option:contains('"+ timeZone +"')").length != 0){ |
| 134 | |
| 135 | $timezone.val(timeZone); |
| 136 | $timezone.trigger("chosen:updated"); |
| 137 | |
| 138 | }else{ |
| 139 | |
| 140 | var parts = timeZone.split('/'); |
| 141 | var lastPart = parts[parts.length-1]; |
| 142 | |
| 143 | var opt = $timezone.find("option:contains('"+ lastPart +"')"); |
| 144 | |
| 145 | $timezone.val(opt.val()); |
| 146 | $timezone.trigger("chosen:updated"); |
| 147 | |
| 148 | } |
| 149 | <?php |
| 150 | } |
| 151 | ?> |
| 152 | }); |
| 153 | </script> |