| | |
| | | |
| | | defined('ABSPATH') || exit; |
| | | |
| | | /** |
| | | * æ ¼å¼åç± MySQL CURRENT_TIMESTAMPï¼æçº¯ SQL åå
¥ï¼äº§çç DATETIMEã |
| | | * æ¤ç±»å¼é MySQL ä¼è¯æ¶åºèå®ï¼æç®¡ç¯å¢å¤ä¸º UTCï¼å
æè¯¥æ¶åºè§£æä¸ºç¬é´ï¼åç¨ç«ç¹æ¶åºæ¾ç¤ºã |
| | | * |
| | | * å¯éè¿è¿æ»¤å¨ im_mysql_datetime_timezone æ¹ä¸ºä¸æ°æ®åºä¸è´çæ¶åºæ è¯ï¼ä¾å¦ 'America/Toronto'ã |
| | | * |
| | | * @param string|null $mysql_datetime |
| | | */ |
| | | function im_wp_format_mysql_clock_datetime($mysql_datetime, string $format): string |
| | | { |
| | | if ($mysql_datetime === null || $mysql_datetime === '' || $mysql_datetime === '0000-00-00 00:00:00') { |
| | | return ''; |
| | | } |
| | | $tz_id = apply_filters('im_mysql_datetime_timezone', 'UTC'); |
| | | try { |
| | | $tz = new DateTimeZone($tz_id); |
| | | $dt = new DateTimeImmutable($mysql_datetime, $tz); |
| | | } catch (Exception $e) { |
| | | return ''; |
| | | } |
| | | return wp_date($format, $dt->getTimestamp()); |
| | | } |
| | | |
| | | /* ============================================================ |
| | | 注åèå |
| | | ============================================================ */ |
| | |
| | | <?php endif; ?> |
| | | </td> |
| | | <td><a href="mailto:<?= esc_attr($c->email) ?>"><?= esc_html($c->email) ?></a></td> |
| | | <td style="font-size:13px"><?= esc_html(date('Y-m-d H:i', strtotime($c->updated_at))) ?></td> |
| | | <td style="font-size:13px"><?= esc_html(im_wp_format_mysql_clock_datetime($c->updated_at, 'Y-m-d H:i')) ?></td> |
| | | <td> |
| | | <span class="im-badge" |
| | | style="background:<?= $color ?>18;color:<?= $color ?>;border-color:<?= $color ?>44"><?= $clabel ?></span> |
| | |
| | | <?php endif; ?> |
| | | <?php elseif ($c->status === 'trained'): ?> |
| | | <?php if (!empty($c->training_completed_at)): ?> |
| | | <div style="font-size:12px;color:#059669;margin-top:4px">â <?= date('m/d H:i', strtotime($c->training_completed_at)) ?> Completed</div> |
| | | <div style="font-size:12px;color:#059669;margin-top:4px">â <?= esc_html(mysql2date('m/d H:i', $c->training_completed_at, false) ?: '') ?> Completed</div> |
| | | <?php endif; ?> |
| | | <?php endif; ?> |
| | | </td> |
| | |
| | | <h3 style="color:#c2410c">Training In Progress</h3> |
| | | <p style="color:#ea580c">Candidate is completing training modules</p> |
| | | <?php if (!empty($c->training_opened_at)): ?> |
| | | <div style="font-size:13px;color:#059669;margin-bottom:12px;font-weight:600">â Opened training page at <?= date('Y/m/d H:i', strtotime($c->training_opened_at)) ?></div> |
| | | <div style="font-size:13px;color:#059669;margin-bottom:12px;font-weight:600">â Opened training page at <?= esc_html(im_wp_format_mysql_clock_datetime($c->training_opened_at, 'Y/m/d H:i')) ?></div> |
| | | <?php else: ?> |
| | | <div style="font-size:13px;color:#9ca3af;margin-bottom:12px">â Training page not opened yet</div> |
| | | <?php endif; ?> |
| | |
| | | <h3 style="color:#0e7490">Training Completed</h3> |
| | | <p style="color:#0891b2">Candidate has passed all training modules</p> |
| | | <?php if (!empty($c->training_completed_at)): ?> |
| | | <div style="font-size:13px;color:#059669;font-weight:600;margin-bottom:12px">â Completed training at <?= date('Y/m/d H:i', strtotime($c->training_completed_at)) ?></div> |
| | | <div style="font-size:13px;color:#059669;font-weight:600;margin-bottom:12px">â Completed training at <?= esc_html(mysql2date('Y/m/d H:i', $c->training_completed_at, false) ?: '') ?></div> |
| | | <?php endif; ?> |
| | | <button class="im-btn-primary im-action-btn" data-action="resend_trained_email" data-id="<?= $c->id ?>" |
| | | data-name="<?= esc_attr($full_name) ?>"> |
| | |
| | | <?php if ($tokens): |
| | | foreach ($tokens as $tk): |
| | | $used = (bool) $tk->is_used; |
| | | $expired = strtotime($tk->expires_at) < time(); |
| | | $expired = empty($tk->expires_at) ? true : (int) mysql2date('U', $tk->expires_at, false) < time(); |
| | | if ($used) { |
| | | $bs = '#dcfce7'; |
| | | $bc = '#86efac'; |
| | |
| | | <span class="im-badge" |
| | | style="background:<?= $bs ?>;color:<?= $bt ?>;border-color:<?= $bc ?>"><?= $bl ?></span> |
| | | </div> |
| | | <div class="im-token-date"><?= date('Y/m/d H:i', strtotime($tk->created_at)) ?> Sent</div> |
| | | <div class="im-token-date"><?= esc_html(im_wp_format_mysql_clock_datetime($tk->created_at, 'Y/m/d H:i')) ?> Sent</div> |
| | | <div class="im-token-exp" style="margin-bottom:8px">Valid until |
| | | <?= date('m/d H:i', strtotime($tk->expires_at)) ?> |
| | | <?= esc_html(mysql2date('m/d H:i', $tk->expires_at, false) ?: '') ?> |
| | | </div> |
| | | |
| | | <?php if (!empty($tk->opened_at)): ?> |
| | | <div class="im-token-exp" style="color:#059669;font-weight:600"> |
| | | â Viewed questions at <?= date('Y/m/d H:i', strtotime($tk->opened_at)) ?> <?= $used ? '' : '(countdown active)' ?> |
| | | â Viewed questions at <?= esc_html(mysql2date('Y/m/d H:i', $tk->opened_at, false) ?: '') ?> <?= $used ? '' : '(countdown active)' ?> |
| | | </div> |
| | | <?php else: ?> |
| | | <div class="im-token-exp" style="color:#f59e0b">â Candidate has not opened the link</div> |
| | |
| | | <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4M7 10l5 5 5-5M12 15V3"/></svg>Download |
| | | </a> |
| | | </div> |
| | | <div style="margin-top:6px;font-size:12px;color:#94a3b8"><?= date('m/d H:i', strtotime($tk->submitted_at)) ?> submitted</div> |
| | | <div style="margin-top:6px;font-size:12px;color:#94a3b8"><?= esc_html(mysql2date('m/d H:i', $tk->submitted_at, false) ?: '') ?> submitted</div> |
| | | <?php else: ?> |
| | | <video controls class="im-video-player" preload="metadata"> |
| | | <source src="<?= esc_url($vurl) ?>"> |
| | | </video> |
| | | <div class="im-video-footer"> |
| | | <span><?= date('m/d H:i', strtotime($tk->submitted_at)) ?> submitted</span> |
| | | <span><?= esc_html(mysql2date('m/d H:i', $tk->submitted_at, false) ?: '') ?> submitted</span> |
| | | <a href="<?= esc_url($vurl) ?>" download class="im-video-dl"> |
| | | <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" |
| | | stroke-width="2"> |