admin.php
9.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<?php
use Tz\WordPress\Tools;
use Tz\WordPress\Tools\Notifications;
use Tz\WordPress\Tools\Notifications\Settings;
use Tz\WordPress\UAM;
$user_ID = get_current_user_id();
$AAL = get_user_meta($user_ID, '_AAL', false);
if(!in_array('notifications_full', $AAL[0])) {
echo '<style type="text/css"> .translation-link, .edit, .delete{ display:none; }</style>';
};
?>
<link rel="stylesheet" href="<?php echo Tools\url('assets/css/notifications.css', __FILE__) ?>"/>
<script src="<?php echo Tools\url('assets/scripts/jquery.qtip-1.0.0-rc3.js', __FILE__) ?>"></script>
<div id="" class="wrap">
<h2>Notifications</h2>
<h3 class="table-caption">Scheduled 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" width="200" class="manage-column">Execute Date/Time</th>
<th scope="col" width="200" class="manage-column">Send To</th>
<th scope="col" width="60" class="manage-column">Email</th>
<th scope="col" width="60" class="manage-column">System</th>
<th scope="col" width="200" class="manage-column"> </th>
</tr>
</thead>
<tbody>
<?php foreach ($notifications['scheduled'] as $entry):
$sendto = $entry->sendto;
if (is_numeric($sendto)) {
$sendto = Notifications\getGroups($sendto)." Group";
} else {
$sendto = Notifications\get_field_lookup($sendto);
}
?>
<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 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 (strtotime($entry->execute_date) > current_time('timestamp')):?>
<a class="edit" href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>">
edit
</a>
| <a class="delete"
href="/wp-admin/admin.php?page=notifications&action=delete&page_id=<?php echo $entry->ID; ?>"
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> |
<em>In progress....</em>
<?php endif; ?>
</tr>
<?php endforeach; ?>
<?php foreach ($notifications['newsletter'] as $entry):
$sendto = $entry->sendto;
if (is_numeric($sendto)) {
$sendto = UAM\getGroups($sendto)." Group";
} else {
$sendto = Notifications\get_field_lookup($sendto);
}
?>
<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 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 (strtotime($entry->execute_date) > current_time('timestamp')):?>
<a class="edit" href="/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo $entry->ID; ?>">
edit
</a>
| <a class="delete"
href="/wp-admin/admin.php?page=notifications&action=delete&page_id=<?php echo $entry->ID; ?>"
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> |
<em>In progress....</em>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</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"> </th>
<?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?>
<th scope="col" width="200" class="manage-column">Trigger/Slug</th>
<?php endif; ?>
<th scope="col" width="60" class="manage-column">Email</th>
<th scope="col" width="60" class="manage-column">System</th>
<th scope="col" width="200" class="manage-column"> </th>
</tr>
</thead>
<tbody>
<?php foreach ($notifications['triggered'] as $entry): ?>
<tr>
<td><?php echo $entry->post_title; ?></td>
<td>
<a class="translation-link" 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>
<a class="edit" 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 class="delete"
href="/wp-admin/admin.php?page=notifications&action=delete&page_id=<?php echo $entry->ID; ?>"
onclick="return confirm('Are you sure?');">delete</a>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>