Files
crm.twinpol.com/modules/Schedulers/EcmNotificationAjax.php

29 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2025-05-12 15:44:39 +00:00
<?php
require 'include/ECM/EcmNotifications/EcmNotification.php';
if(!defined('sugarEntry') || !sugarEntry) die('-1');
if (!$_POST['job'] || $_POST['job']=='') die ('-1');
switch ($_POST['job']) {
case 'updateNotificationStatus': updateNotificationStatus($_POST['id'],$_POST['flag']); break;
case 'changeNotificationDate': changeNotificationDate($_POST['id'],$_POST['flag']); break;
case 'getLeaveadNotifications': getLeaveadNotifications($_POST['user_id']); break;
}
function updateNotificationStatus($id,$flag){
$EcmNotification = new EcmNotification();
echo $EcmNotification->setNotificationFlag($id,$flag);
unset($EcmNotification);
}
function changeNotificationDate($id,$flag){
$EcmNotification = new EcmNotification();
echo $EcmNotification->setNotificationDate($id,$flag);
unset($EcmNotification);
}
function getLeaveadNotifications($user_id){
$EcmNotification = new EcmNotification($user_id);
echo json_encode($EcmNotification->searchLeavedNotifications(), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
unset($EcmNotification);
}
?>