59f86b07 by Marty Penner

Add an icon to indicate translation status of notifications

1 parent f440737b
......@@ -2,6 +2,7 @@
use Tz\WordPress\Tools;
use Tz\WordPress\Tools\Notifications;
use Tz\WordPress\Tools\Notifications\Settings;
?>
<link rel="stylesheet" href="<?php echo Tools\url('assets/css/notifications.css', __FILE__) ?>"/>
......@@ -34,21 +35,28 @@ use Tz\WordPress\Tools\Notifications\Settings;
?>
<tr>
<td><?php echo $entry->post_title; ?></td>
<td><?php echo date("M j, Y @ h:i A", strtotime($entry->execute_date)); ?></td>
<td><?php echo date('M j, Y @ h:i A', strtotime($entry->execute_date)); ?></td>
<td><?php echo ucwords($sendto); ?></td>
<td><?php if ($entry->is_email): ?><img
src="<?php echo Tools\url('assets/images/accept.png', __FILE__) ?>" /><?php endif;?></td>
<td><?php if ($entry->is_system): ?><img
src="<?php echo Tools\url('assets/images/accept.png', __FILE__) ?>" /><?php endif;?></td>
<td>
<?php if ($entry->is_email): ?>
<img src="<?php echo Tools\url('assets/images/accept.png', __FILE__) ?>"/>
<?php endif;?>
</td>
<td>
<?php if ($entry->is_system): ?>
<img src="<?php echo Tools\url('assets/images/accept.png', __FILE__) ?>"/>
<?php endif;?>
</td>
<td>
<?php
if (strtotime($entry->execute_date) > current_time('timestamp')):?>
<a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>">edit</a>
<a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>">
edit
</a>
| <a
href="/wp-admin/admin.php?page=notifications&action=delete&page_id=<?php echo $entry->ID; ?>"
onclick="return confirm('Are you sure?');">delete</a></td>
onclick="return confirm('Are you sure?');">delete</a>
</td>
<?php else: ?>
<a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>">edit</a> |
......@@ -59,12 +67,12 @@ use Tz\WordPress\Tools\Notifications\Settings;
</tbody>
</table>
<h3 class="table-caption">System Triggered Notifications</h3>
<table cellspacing="0" class="widefat post fixed" style="margin-top:15px;">
<thead>
<tr>
<th scope="col" class="manage-column">Description</th>
<th scope="col">&nbsp;</th>
<?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?>
<th scope="col" width="200" class="manage-column">Trigger/Slug</th>
<?php endif; ?>
......@@ -78,16 +86,62 @@ use Tz\WordPress\Tools\Notifications\Settings;
<?php foreach ($notifications['triggered'] as $entry): ?>
<tr>
<td><?php echo $entry->post_title; ?></td>
<td>
<a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>#tab-2"
title="Add translation to French">
<?php
$emailData = $entry->email;
$systemData = $entry->system;
$isTranslated = false;
foreach (['subject', 'text', 'html'] as $field) {
if (isset($emailData['fr_'.$field]) && !empty($emailData['fr_'.$field])) {
$isTranslated = true;
break;
}
}
if (
!$isTranslated
&& isset($systemData['fr_message'])
&& !empty($systemData['fr_message'])
) {
$isTranslated = true;
}
if ($isTranslated):
?>
<img style="padding: 1px; margin: 2px;"
src="/wp-content/plugins/sitepress-multilingual-cms/res/img/edit_translation.png"
alt="Add translation to French">
<?php else: ?>
<img style="padding: 1px; margin: 2px;"
src="/wp-content/plugins/sitepress-multilingual-cms/res/img/add_translation.png"
alt="Add translation to French">
<?php endif; ?>
</a>
</td>
<?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?>
<td><?php echo $entry->trigger; ?></td>
<?php endif; ?>
<td><?php if ($entry->is_email): ?><img
src="<?php echo Tools\url('assets/images/accept.png', __FILE__) ?>" /><?php endif; ?></td>
<td><?php if ($entry->is_system): ?><img
src="<?php echo Tools\url('assets/images/accept.png', __FILE__) ?>" /><?php endif; ?></td>
<td>
<?php if ($entry->is_email): ?>
<img src="<?php echo Tools\url('assets/images/accept.png', __FILE__) ?>"/>
<?php endif; ?>
</td>
<td>
<?php if ($entry->is_system): ?>
<img src="<?php echo Tools\url('assets/images/accept.png', __FILE__) ?>"/>
<?php endif; ?>
</td>
<td><a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>">edit</a>
<td>
<a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>">
edit
</a>
<?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?>
| <a
href="/wp-admin/admin.php?page=notifications&action=delete&page_id=<?php echo $entry->ID; ?>"
......@@ -98,6 +152,4 @@ use Tz\WordPress\Tools\Notifications\Settings;
<?php endforeach; ?>
</tbody>
</table>
</div>
\ No newline at end of file
</div>
......