forked from vanderbilt-redcap/email-alerts-module
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdateQueue.php
More file actions
25 lines (19 loc) · 765 Bytes
/
Copy pathupdateQueue.php
File metadata and controls
25 lines (19 loc) · 765 Bytes
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
<?php
namespace Vanderbilt\EmailTriggerExternalModule;
use ExternalModules\AbstractExternalModule;
use ExternalModules\ExternalModules;
require_once __DIR__.'/vendor/autoload.php';
$project_id = $_GET['pid'];
$alert = $_REQUEST['index_modal_queue'];
$email_queue = empty($module->getProjectSetting('email-queue'))?array():$module->getProjectSetting('email-queue');
$queue_aux = $email_queue;
foreach ($email_queue as $index=>$queue){
if($alert == $queue['alert'] && $project_id == $queue['project_id']){
$queue_aux[$index]['last_sent'] = date('Y-m-d');
$queue_aux[$index]['times_sent'] = "1";
$module->setProjectSetting('email-queue', $queue_aux,$queue['project_id']);
}
}
echo json_encode(array(
'status' => 'success'
));