This commit is contained in:
Marco Antonio Nina Mena
2017-12-04 13:25:35 +00:00
committed by Julio Cesar Laura Avendaño
parent abe71a6ffe
commit 0d533e19d9
363 changed files with 23948 additions and 44623 deletions

View File

@@ -24,10 +24,10 @@
require_once 'classes/model/Process.php';
$start = isset( $_POST['start'] ) ? $_POST['start'] : 0;
$limit = isset( $_POST['limit'] ) ? $_POST['limit'] : '';
$dir = isset( $_POST['dir'] ) ? $_POST['dir'] : 'ASC';
$sort = isset( $_POST['sort'] ) ? $_POST['sort'] : '';
$start = isset($_POST['start']) ? $_POST['start'] : 0;
$limit = isset($_POST['limit']) ? $_POST['limit'] : '';
$dir = isset($_POST['dir']) ? $_POST['dir'] : 'ASC';
$sort = isset($_POST['sort']) ? $_POST['sort'] : '';
$oProcess = new Process();
$oProcess->dir = $dir;
@@ -36,19 +36,20 @@ $oProcess->sort = $sort;
$memkey = 'no memcache';
$memcacheUsed = 'not used';
$totalCount = 0;
if (isset( $_POST['category'] ) && $_POST['category'] !== '<reset>') {
if (isset( $_POST['processName'] ))
$proData = $oProcess->getAllProcesses( $start, $limit, $_POST['category'], $_POST['processName'], true, false, $_SESSION["USER_LOGGED"]);
else
$proData = $oProcess->getAllProcesses( $start, $limit, $_POST['category'], null, true, false, $_SESSION["USER_LOGGED"]);
if (isset($_POST['category']) && $_POST['category'] !== '<reset>') {
if (isset($_POST['processName'])) {
$proData = $oProcess->getAllProcesses($start, $limit, $_POST['category'], $_POST['processName'], true, false, $_SESSION["USER_LOGGED"]);
} else {
$proData = $oProcess->getAllProcesses($start, $limit, $_POST['category'], null, true, false, $_SESSION["USER_LOGGED"]);
}
} else {
if (isset( $_POST['processName'] )) {
if (isset($_POST['processName'])) {
$memkey = 'processList-' . $start . '-' . $limit . '-' . $_POST['processName'];
$memcacheUsed = 'yes';
$proData = $memcache->get( $memkey );
$proData = $memcache->get($memkey);
if ($proData === false) {
$proData = $oProcess->getAllProcesses( $start, $limit, null, $_POST['processName'], true, false, $_SESSION["USER_LOGGED"]);
$memcache->set( $memkey, $proData, PMmemcached::ONE_HOUR );
$proData = $oProcess->getAllProcesses($start, $limit, null, $_POST['processName'], true, false, $_SESSION["USER_LOGGED"]);
$memcache->set($memkey, $proData, PMmemcached::ONE_HOUR);
$totalCount = count($proData);
$proData = array_splice($proData, $start, $limit);
$memcacheUsed = 'no';
@@ -61,18 +62,18 @@ if (isset( $_POST['category'] ) && $_POST['category'] !== '<reset>') {
$memkey = 'processList-allProcesses-' . $start . '-' . $limit;
$memkeyTotal = $memkey . '-total';
$memcacheUsed = 'yes';
if (($proData = $memcache->get( $memkey )) === false || ($totalCount = $memcache->get( $memkeyTotal )) === false) {
$proData = $oProcess->getAllProcesses( $start, $limit, null, null, true, false, $_SESSION["USER_LOGGED"]);
if (($proData = $memcache->get($memkey)) === false || ($totalCount = $memcache->get($memkeyTotal)) === false) {
$proData = $oProcess->getAllProcesses($start, $limit, null, null, true, false, $_SESSION["USER_LOGGED"]);
$totalCount = count($proData);
$proData = array_splice($proData, $start, $limit);
$memcache->set( $memkey, $proData, PMmemcached::ONE_HOUR );
$memcache->set( $memkeyTotal, $totalCount, PMmemcached::ONE_HOUR );
$memcache->set($memkey, $proData, PMmemcached::ONE_HOUR);
$memcache->set($memkeyTotal, $totalCount, PMmemcached::ONE_HOUR);
$memcacheUsed = 'no';
} else {
$proData = $oProcess->orderMemcache($proData, $start, $limit);
$proData = $oProcess->orderMemcache($proData, $start, $limit);
$totalCount = $proData->totalCount;
$proData = $proData->dataMemcache;
}
}
}
}
$r = new stdclass();
@@ -81,4 +82,4 @@ $r->memcache = $memcacheUsed;
$r->data = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($proData);
$r->totalCount = $totalCount;
echo G::json_encode( $r );
echo G::json_encode($r);