| 1 |
<?php if (!defined('ABSPATH')) exit; // if accessed directly exit |
| 2 |
/** |
| 3 |
* Daily task summary (sent by Fluent Boards Pro). Tasks due today, grouped by board. |
| 4 |
* |
| 5 |
* @var iterable $tasks Tasks with a loaded ->board |
| 6 |
* @var string $name Recipient display name |
| 7 |
* @var string $page_url App base URL ending in "#/" |
| 8 |
*/ |
| 9 |
|
| 10 |
$fluent_boards_groups = []; |
| 11 |
foreach ($tasks as $fluent_boards_task) { |
| 12 |
$fluent_boards_board_id = $fluent_boards_task->board->id; |
| 13 |
if (!isset($fluent_boards_groups[$fluent_boards_board_id])) { |
| 14 |
$fluent_boards_groups[$fluent_boards_board_id] = [ |
| 15 |
'board' => $fluent_boards_task->board, |
| 16 |
'tasks' => [], |
| 17 |
]; |
| 18 |
} |
| 19 |
$fluent_boards_groups[$fluent_boards_board_id]['tasks'][] = $fluent_boards_task; |
| 20 |
} |
| 21 |
$fluent_boards_task_count = array_sum(array_map(function ($group) { |
| 22 |
return count($group['tasks']); |
| 23 |
}, $fluent_boards_groups)); |
| 24 |
|
| 25 |
ob_start(); |
| 26 |
?> |
| 27 |
<p style="margin: 0 0 16px;"> |
| 28 |
<span class="fbs_email_pill_accent" style="display: inline-block; padding: 4px 10px; border-radius: 999px; background: #EEF2FF; color: #2547D0; font-size: 12px; font-weight: 600; line-height: 18px;"><?php esc_html_e('Daily summary', 'fluent-boards'); ?></span> |
| 29 |
</p> |
| 30 |
<h1 class="fbs_email_text fbs_email_heading" style="margin: 0; color: #0E121B; font-size: 22px; font-weight: 600; line-height: 30px;"> |
| 31 |
<?php |
| 32 |
/* translators: %s is the recipient's name */ |
| 33 |
echo esc_html(sprintf(__('Good morning, %s', 'fluent-boards'), $name)); |
| 34 |
?> |
| 35 |
</h1> |
| 36 |
<p class="fbs_email_text2" style="margin: 6px 0 0; color: #525866; font-size: 14px; line-height: 22px;"> |
| 37 |
<?php |
| 38 |
echo esc_html(date_i18n(__('l, F j, Y', 'fluent-boards'))); |
| 39 |
echo ' · '; |
| 40 |
/* translators: %d is the number of tasks due today */ |
| 41 |
echo esc_html(sprintf(_n('%d task due today', '%d tasks due today', $fluent_boards_task_count, 'fluent-boards'), $fluent_boards_task_count)); |
| 42 |
?> |
| 43 |
</p> |
| 44 |
|
| 45 |
<p class="fbs_email_text2" style="margin: 24px 0 8px; color: #525866; font-size: 12px; font-weight: 600; line-height: 16px; letter-spacing: 0.06em; text-transform: uppercase;"><?php esc_html_e('Due today', 'fluent-boards'); ?></p> |
| 46 |
|
| 47 |
<?php foreach ($fluent_boards_groups as $fluent_boards_group): |
| 48 |
$fluent_boards_board = $fluent_boards_group['board']; |
| 49 |
$fluent_boards_board_url = $page_url . 'boards/' . $fluent_boards_board->id; |
| 50 |
?> |
| 51 |
<table role="presentation" class="fbs_email_border" cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-bottom: 12px; border: 1px solid #E1E4EA; border-radius: 10px;"> |
| 52 |
<tr> |
| 53 |
<td class="fbs_email_inset" style="padding: 12px 16px; background: #F5F7FA; border-bottom: 1px solid #E1E4EA; border-radius: 10px 10px 0 0; font-size: 13px; line-height: 18px;"> |
| 54 |
<a class="fbs_email_text" href="<?php echo esc_url($fluent_boards_board_url); ?>" target="_blank" style="color: #0E121B; font-weight: 600; text-decoration: none;"><?php echo esc_html($fluent_boards_board->title); ?></a> |
| 55 |
<span class="fbs_email_text2" style="color: #525866;"> |
| 56 |
· |
| 57 |
<?php |
| 58 |
$fluent_boards_board_count = count($fluent_boards_group['tasks']); |
| 59 |
/* translators: %d is the number of tasks */ |
| 60 |
echo esc_html(sprintf(_n('%d task', '%d tasks', $fluent_boards_board_count, 'fluent-boards'), $fluent_boards_board_count)); |
| 61 |
?> |
| 62 |
</span> |
| 63 |
</td> |
| 64 |
</tr> |
| 65 |
<?php foreach ($fluent_boards_group['tasks'] as $fluent_boards_index => $fluent_boards_task): |
| 66 |
$fluent_boards_task_url = $page_url . 'boards/' . $fluent_boards_board->id . '/tasks/' . $fluent_boards_task->id . '-' . substr($fluent_boards_task->title, 0, 10); |
| 67 |
$fluent_boards_stage = $fluent_boards_task->stage ? $fluent_boards_task->stage->title : ''; |
| 68 |
?> |
| 69 |
<tr> |
| 70 |
<td class="fbs_email_border" style="padding: 14px 16px;<?php echo $fluent_boards_index ? ' border-top: 1px solid #E1E4EA;' : ''; ?>"> |
| 71 |
<a class="fbs_email_text" href="<?php echo esc_url($fluent_boards_task_url); ?>" target="_blank" style="display: block; color: #0E121B; font-size: 15px; font-weight: 600; line-height: 22px; text-decoration: none;"><?php echo esc_html($fluent_boards_task->title); ?></a> |
| 72 |
<?php if ($fluent_boards_stage || $fluent_boards_task->due_at): ?> |
| 73 |
<span class="fbs_email_text2" style="display: block; color: #525866; font-size: 13px; line-height: 18px;"> |
| 74 |
<?php echo esc_html($fluent_boards_stage); ?> |
| 75 |
<?php if ($fluent_boards_stage && $fluent_boards_task->due_at): ?>·<?php endif; ?> |
| 76 |
<?php if ($fluent_boards_task->due_at): ?> |
| 77 |
<?php echo esc_html(date_i18n(get_option('time_format'), strtotime($fluent_boards_task->due_at))); ?> |
| 78 |
<?php endif; ?> |
| 79 |
</span> |
| 80 |
<?php endif; ?> |
| 81 |
</td> |
| 82 |
</tr> |
| 83 |
<?php endforeach; ?> |
| 84 |
</table> |
| 85 |
<?php endforeach; ?> |
| 86 |
|
| 87 |
<p style="margin: 24px 0 0;"> |
| 88 |
<a class="fbs_email_btn" href="<?php echo esc_url($page_url); ?>" target="_blank" style="display: inline-block; padding: 8px 16px; border-radius: 8px; background: #222530; color: #FFFFFF; font-size: 14px; font-weight: 500; line-height: 20px; text-decoration: none;"><?php esc_html_e('Open dashboard', 'fluent-boards'); ?></a> |
| 89 |
</p> |
| 90 |
<?php |
| 91 |
$fluent_boards_email_content = ob_get_clean(); |
| 92 |
|
| 93 |
if (empty($email_reason)) { |
| 94 |
$email_reason = __('You’re getting this daily summary because it’s on in your notification settings.', 'fluent-boards'); |
| 95 |
} |
| 96 |
|
| 97 |
include __DIR__ . '/template.php'; |
| 98 |
|