Add an icon to indicate translation status of notifications
Showing
1 changed file
with
70 additions
and
18 deletions
| ... | @@ -2,6 +2,7 @@ | ... | @@ -2,6 +2,7 @@ |
| 2 | use Tz\WordPress\Tools; | 2 | use Tz\WordPress\Tools; |
| 3 | use Tz\WordPress\Tools\Notifications; | 3 | use Tz\WordPress\Tools\Notifications; |
| 4 | use Tz\WordPress\Tools\Notifications\Settings; | 4 | use Tz\WordPress\Tools\Notifications\Settings; |
| 5 | |||
| 5 | ?> | 6 | ?> |
| 6 | 7 | ||
| 7 | <link rel="stylesheet" href="<?php echo Tools\url('assets/css/notifications.css', __FILE__) ?>"/> | 8 | <link rel="stylesheet" href="<?php echo Tools\url('assets/css/notifications.css', __FILE__) ?>"/> |
| ... | @@ -34,21 +35,28 @@ use Tz\WordPress\Tools\Notifications\Settings; | ... | @@ -34,21 +35,28 @@ use Tz\WordPress\Tools\Notifications\Settings; |
| 34 | ?> | 35 | ?> |
| 35 | <tr> | 36 | <tr> |
| 36 | <td><?php echo $entry->post_title; ?></td> | 37 | <td><?php echo $entry->post_title; ?></td> |
| 37 | <td><?php echo date("M j, Y @ h:i A", strtotime($entry->execute_date)); ?></td> | 38 | <td><?php echo date('M j, Y @ h:i A', strtotime($entry->execute_date)); ?></td> |
| 38 | <td><?php echo ucwords($sendto); ?></td> | 39 | <td><?php echo ucwords($sendto); ?></td> |
| 39 | <td><?php if ($entry->is_email): ?><img | ||
| 40 | src="<?php echo Tools\url('assets/images/accept.png', __FILE__) ?>" /><?php endif;?></td> | ||
| 41 | <td><?php if ($entry->is_system): ?><img | ||
| 42 | src="<?php echo Tools\url('assets/images/accept.png', __FILE__) ?>" /><?php endif;?></td> | ||
| 43 | <td> | 40 | <td> |
| 44 | 41 | <?php if ($entry->is_email): ?> | |
| 42 | <img src="<?php echo Tools\url('assets/images/accept.png', __FILE__) ?>"/> | ||
| 43 | <?php endif;?> | ||
| 44 | </td> | ||
| 45 | <td> | ||
| 46 | <?php if ($entry->is_system): ?> | ||
| 47 | <img src="<?php echo Tools\url('assets/images/accept.png', __FILE__) ?>"/> | ||
| 48 | <?php endif;?> | ||
| 49 | </td> | ||
| 50 | <td> | ||
| 45 | <?php | 51 | <?php |
| 46 | |||
| 47 | if (strtotime($entry->execute_date) > current_time('timestamp')):?> | 52 | if (strtotime($entry->execute_date) > current_time('timestamp')):?> |
| 48 | <a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>">edit</a> | 53 | <a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>"> |
| 54 | edit | ||
| 55 | </a> | ||
| 49 | | <a | 56 | | <a |
| 50 | href="/wp-admin/admin.php?page=notifications&action=delete&page_id=<?php echo $entry->ID; ?>" | 57 | href="/wp-admin/admin.php?page=notifications&action=delete&page_id=<?php echo $entry->ID; ?>" |
| 51 | onclick="return confirm('Are you sure?');">delete</a></td> | 58 | onclick="return confirm('Are you sure?');">delete</a> |
| 59 | </td> | ||
| 52 | 60 | ||
| 53 | <?php else: ?> | 61 | <?php else: ?> |
| 54 | <a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>">edit</a> | | 62 | <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; | ... | @@ -59,12 +67,12 @@ use Tz\WordPress\Tools\Notifications\Settings; |
| 59 | </tbody> | 67 | </tbody> |
| 60 | </table> | 68 | </table> |
| 61 | 69 | ||
| 62 | |||
| 63 | <h3 class="table-caption">System Triggered Notifications</h3> | 70 | <h3 class="table-caption">System Triggered Notifications</h3> |
| 64 | <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;"> | 71 | <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;"> |
| 65 | <thead> | 72 | <thead> |
| 66 | <tr> | 73 | <tr> |
| 67 | <th scope="col" class="manage-column">Description</th> | 74 | <th scope="col" class="manage-column">Description</th> |
| 75 | <th scope="col"> </th> | ||
| 68 | <?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?> | 76 | <?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?> |
| 69 | <th scope="col" width="200" class="manage-column">Trigger/Slug</th> | 77 | <th scope="col" width="200" class="manage-column">Trigger/Slug</th> |
| 70 | <?php endif; ?> | 78 | <?php endif; ?> |
| ... | @@ -78,16 +86,62 @@ use Tz\WordPress\Tools\Notifications\Settings; | ... | @@ -78,16 +86,62 @@ use Tz\WordPress\Tools\Notifications\Settings; |
| 78 | <?php foreach ($notifications['triggered'] as $entry): ?> | 86 | <?php foreach ($notifications['triggered'] as $entry): ?> |
| 79 | <tr> | 87 | <tr> |
| 80 | <td><?php echo $entry->post_title; ?></td> | 88 | <td><?php echo $entry->post_title; ?></td> |
| 89 | |||
| 90 | <td> | ||
| 91 | <a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>#tab-2" | ||
| 92 | title="Add translation to French"> | ||
| 93 | <?php | ||
| 94 | $emailData = $entry->email; | ||
| 95 | $systemData = $entry->system; | ||
| 96 | $isTranslated = false; | ||
| 97 | |||
| 98 | foreach (['subject', 'text', 'html'] as $field) { | ||
| 99 | if (isset($emailData['fr_'.$field]) && !empty($emailData['fr_'.$field])) { | ||
| 100 | $isTranslated = true; | ||
| 101 | break; | ||
| 102 | } | ||
| 103 | } | ||
| 104 | |||
| 105 | if ( | ||
| 106 | !$isTranslated | ||
| 107 | && isset($systemData['fr_message']) | ||
| 108 | && !empty($systemData['fr_message']) | ||
| 109 | ) { | ||
| 110 | $isTranslated = true; | ||
| 111 | } | ||
| 112 | |||
| 113 | if ($isTranslated): | ||
| 114 | ?> | ||
| 115 | <img style="padding: 1px; margin: 2px;" | ||
| 116 | src="/wp-content/plugins/sitepress-multilingual-cms/res/img/edit_translation.png" | ||
| 117 | alt="Add translation to French"> | ||
| 118 | <?php else: ?> | ||
| 119 | <img style="padding: 1px; margin: 2px;" | ||
| 120 | src="/wp-content/plugins/sitepress-multilingual-cms/res/img/add_translation.png" | ||
| 121 | alt="Add translation to French"> | ||
| 122 | <?php endif; ?> | ||
| 123 | </a> | ||
| 124 | </td> | ||
| 125 | |||
| 81 | <?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?> | 126 | <?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?> |
| 82 | <td><?php echo $entry->trigger; ?></td> | 127 | <td><?php echo $entry->trigger; ?></td> |
| 83 | <?php endif; ?> | 128 | <?php endif; ?> |
| 84 | 129 | ||
| 85 | <td><?php if ($entry->is_email): ?><img | 130 | <td> |
| 86 | src="<?php echo Tools\url('assets/images/accept.png', __FILE__) ?>" /><?php endif; ?></td> | 131 | <?php if ($entry->is_email): ?> |
| 87 | <td><?php if ($entry->is_system): ?><img | 132 | <img src="<?php echo Tools\url('assets/images/accept.png', __FILE__) ?>"/> |
| 88 | src="<?php echo Tools\url('assets/images/accept.png', __FILE__) ?>" /><?php endif; ?></td> | 133 | <?php endif; ?> |
| 134 | </td> | ||
| 135 | <td> | ||
| 136 | <?php if ($entry->is_system): ?> | ||
| 137 | <img src="<?php echo Tools\url('assets/images/accept.png', __FILE__) ?>"/> | ||
| 138 | <?php endif; ?> | ||
| 139 | </td> | ||
| 89 | 140 | ||
| 90 | <td><a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>">edit</a> | 141 | <td> |
| 142 | <a href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>"> | ||
| 143 | edit | ||
| 144 | </a> | ||
| 91 | <?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?> | 145 | <?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?> |
| 92 | | <a | 146 | | <a |
| 93 | href="/wp-admin/admin.php?page=notifications&action=delete&page_id=<?php echo $entry->ID; ?>" | 147 | 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; | ... | @@ -98,6 +152,4 @@ use Tz\WordPress\Tools\Notifications\Settings; |
| 98 | <?php endforeach; ?> | 152 | <?php endforeach; ?> |
| 99 | </tbody> | 153 | </tbody> |
| 100 | </table> | 154 | </table> |
| 101 | |||
| 102 | |||
| 103 | </div> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 155 | </div> | ... | ... |
-
Please register or sign in to post a comment