2014-10-07 15:58:46 -04:00
|
|
|
<?php
|
|
|
|
|
|
2018-01-15 12:00:22 +00:00
|
|
|
use ProcessMaker\AuditLog\AuditLog;
|
2014-10-07 15:58:46 -04:00
|
|
|
|
2018-01-15 12:00:22 +00:00
|
|
|
$auditLog = new AuditLog();
|
|
|
|
|
$auditLog->setUserLogged($_SESSION["USER_LOGGED"]);
|
2014-10-07 15:58:46 -04:00
|
|
|
|
2018-01-15 12:00:22 +00:00
|
|
|
$response = [];
|
2014-10-07 15:58:46 -04:00
|
|
|
|
2018-01-15 12:00:22 +00:00
|
|
|
$option = (isset($_REQUEST["option"])) ? $_REQUEST["option"] : null;
|
2014-10-07 15:58:46 -04:00
|
|
|
|
|
|
|
|
switch ($option) {
|
|
|
|
|
case "LST":
|
|
|
|
|
$pageSize = $_REQUEST["pageSize"];
|
2017-10-10 12:33:25 -04:00
|
|
|
$workspace = config("system.workspace");
|
2014-10-10 12:19:34 -04:00
|
|
|
$action = $_REQUEST["action"];
|
2014-10-07 15:58:46 -04:00
|
|
|
$description = $_REQUEST["description"];
|
|
|
|
|
$dateFrom = $_REQUEST["dateFrom"];
|
|
|
|
|
$dateTo = $_REQUEST["dateTo"];
|
|
|
|
|
|
2018-01-15 12:00:22 +00:00
|
|
|
$arrayFilter = [
|
|
|
|
|
"workspace" => $workspace,
|
|
|
|
|
"action" => $action,
|
|
|
|
|
"description" => $description,
|
|
|
|
|
"dateFrom" => str_replace("T00:00:00", null, $dateFrom),
|
|
|
|
|
"dateTo" => str_replace("T00:00:00", null, $dateTo)
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$limit = isset($_REQUEST["limit"]) ? $_REQUEST["limit"] : $pageSize;
|
|
|
|
|
$start = isset($_REQUEST["start"]) ? $_REQUEST["start"] : 0;
|
|
|
|
|
|
|
|
|
|
list ($count, $data) = $auditLog->getAuditLogData($arrayFilter, $limit, $start);
|
|
|
|
|
$response = [
|
|
|
|
|
"success" => true,
|
|
|
|
|
"resultTotal" => $count,
|
|
|
|
|
"resultRoot" => $data
|
|
|
|
|
];
|
2014-10-07 15:58:46 -04:00
|
|
|
break;
|
|
|
|
|
case "EMPTY":
|
|
|
|
|
$status = 1;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
$file = PATH_DATA . "log" . PATH_SEP . "cron.log";
|
|
|
|
|
|
2018-01-15 12:00:22 +00:00
|
|
|
if (file_exists($file)) {
|
|
|
|
|
unlink($file);
|
2014-10-07 15:58:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$response["status"] = "OK";
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
$response["message"] = $e->getMessage();
|
|
|
|
|
$status = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($status == 0) {
|
|
|
|
|
$response["status"] = "ERROR";
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-15 12:00:22 +00:00
|
|
|
echo G::json_encode($response);
|