Merged in dashboards2 (pull request #1955)

Dashboard refactorization and upgrades
This commit is contained in:
Julio Cesar Laura Avendaño
2015-04-20 11:46:47 -04:00
20 changed files with 2280 additions and 2022 deletions

View File

@@ -18,7 +18,7 @@ class ReportingIndicators
*
* return decimal value
*/
public function getPeiCompleteData($indicatorUid, $measureDate, $compareDate, $language)
public function getPeiCompleteData($indicatorUid, $compareDate, $measureDate, $language)
{
G::loadClass('indicatorsCalculator');
$calculator = new \IndicatorsCalculator();
@@ -30,7 +30,10 @@ class ReportingIndicators
$peiCost = current(reset($calculator->peiCostHistoric($processesId, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE)));
$peiCompare = current(reset($calculator->peiHistoric($processesId, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE)));
$retval = array("efficiencyIndex" => $peiValue,
$retval = array(
"id" => $indicatorUid,
"efficiencyIndex" => $peiValue,
"efficiencyIndexCompare" => $peiCompare,
"efficiencyVariation" => ($peiValue-$peiCompare),
"inefficiencyCost" => $peiCost,
"data"=>$processes);
@@ -47,32 +50,22 @@ class ReportingIndicators
*
* return decimal value
*/
public function getUeiCompleteData($indicatorUid, $measureDate, $compareDate, $language)
public function getUeiCompleteData($indicatorUid, $compareDate, $measureDate,$language)
{
G::loadClass('indicatorsCalculator');
$calculator = new \IndicatorsCalculator();
$groups = $calculator->ueiUserGroups($indicatorUid, $measureDate, $measureDate, $language);
$groupIds = array();
foreach($groups as $p) {
array_push($groupIds, $p['uid']);
}
if (sizeof($groupIds) == 0) {
$groupIds = null;
}
//TODO think what if each indicators has a group or user subset assigned. Now are all
$ueiValue = current(reset($calculator->ueiHistoric(null, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE)));
$arrCost = $calculator->ueiUserGroups($indicatorUid, $measureDate, $measureDate, $language);
$ueiCost = (sizeof($arrCost) > 0)
? $arrCost[0]['inefficiencyCost']
: null;
$ueiCost = current(reset($calculator->ueiCostHistoric(null, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE)));
$ueiCompare = current(reset($calculator->ueiHistoric(null, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE)));
$retval = array("efficiencyIndex" => $ueiValue,
$retval = array(
"id" => $indicatorUid,
"efficiencyIndex" => $ueiValue,
"efficiencyVariation" => ($ueiValue-$ueiCompare),
"inefficiencyCost" => $ueiCost,
"data"=>$groups);
@@ -296,5 +289,27 @@ class ReportingIndicators
);
return $returnValue;
}
/**
* Get list status indicator
*
* @access public
* @param array $options, Data for list
* @return array
*
* @author Marco Antonio Nina <marco.antonio.nina@colosa.com>
* @copyright Colosa - Bolivia
*/
public function getStatusIndicator($options = array())
{
Validator::isArray($options, '$options');
$usrUid = isset( $options["usrUid"] ) ? $options["usrUid"] : "";
G::loadClass('indicatorsCalculator');
$calculator = new \IndicatorsCalculator();
$result = $calculator->statusIndicator($usrUid);
return $result;
}
}

View File

@@ -71,223 +71,6 @@ class ReportingIndicators extends Api
}
}
// /**
// * Returns the aggregate Efficiency of a employee or set of employees
// *
// * @param string $employee_list {@from path}
// * @param string $init_date {@from path}
// * @param string $end_date {@from path}
// * @return array
// *
// * @url GET /employee-efficiency-index
// */
// public function doGetEmployeeEfficiencyIndex($employee_list, $init_date, $end_date)
// {
// try {
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
// $listArray = (strlen($employee_list) > 1)
// ? $listArray = explode(',', $employee_list)
// : null;
// $response = $indicatorsObj->getEmployeeEfficiencyIndex($listArray,
// new \DateTime($init_date),
// new \DateTime($end_date));
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
// }
//
// /**
// * Lists tasks of a employee and it's statistics (efficiency, average times, etc.)
// *
// * @param string $employee_list {@from path}
// * @param string $init_date {@from path}
// * @param string $end_date {@from path}
// * @param string $language {@from path}
// * @return array
// *
// * @url GET /employee-tasks
// */
// public function doGetEmployeeTasksInfo($employee_list, $init_date, $end_date, $language)
// {
// if ($employee_list == null || strlen($employee_list) <= 1)
// throw new InvalidArgumentException ('employee_list must have at least a value', 0);
//
// try {
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
// $listArray = $listArray = explode(',', $employee_list);
// $response = $indicatorsObj->getEmployeeTasksInfoList($listArray,
// new \DateTime($init_date),
// new \DateTime($end_date),
// $language);
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
// }
//
// /**
// * Returns the percent of Cases with Overdue time
// *
// * @param string $$process_list {@from path}
// * @param string $init_date {@from path}
// * @param string $end_date {@from path}
// * @return array
// *
// * @url GET /percent-overdue-cases
// */
// public function doGetPercentOverdueByProcess($process_list, $init_date, $end_date)
// {
// try {
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
// $listArray = (strlen($process_list) > 1)
// ? $listArray = explode(',', $process_list)
// : null;
// $response = $indicatorsObj->getPercentOverdueCasesByProcess($listArray,
// new \DateTime($init_date),
// new \DateTime($end_date));
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
// }
//
// /**
// * Returns the percent of Cases with Overdue time with the selected periodicity
// *
// * @param string $$process_list {@from path}
// * @param string $init_date {@from path}
// * @param string $end_date {@from path}
// * @param string $periodicity {@from path}
// * @return array
// *
// * @url GET /percent-overdue-cases-history
// */
// public function doGetPercentOverdueByProcessHistory($process_list, $init_date, $end_date, $periodicity)
// {
// try {
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
// $listArray = (strlen($process_list) > 1)
// ? $listArray = explode(',', $process_list)
// : null;
// $response = $indicatorsObj->getPercentOverdueCasesByProcessHistory($listArray,
// new \DateTime($init_date),
// new \DateTime($end_date),
// $periodicity);
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
// }
//
// /**
// * Returns the total of Cases with New time
// *
// * @param string $$process_list {@from path}
// * @param string $init_date {@from path}
// * @param string $end_date {@from path}
// * @return array
// *
// * @url GET /total-new-cases
// */
// public function doGetTotalNewByProcess($process_list, $init_date, $end_date)
// {
// try {
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
// $listArray = (strlen($process_list) > 1)
// ? $listArray = explode(',', $process_list)
// : null;
// $response = $indicatorsObj->getPercentNewCasesByProcess($listArray,
// new \DateTime($init_date),
// new \DateTime($end_date));
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
// }
//
// /**
// * Returns the total of Cases with New time with the selected periodicity
// *
// * @param string $$process_list {@from path}
// * @param string $init_date {@from path}
// * @param string $end_date {@from path}
// * @param string $periodicity {@from path}
// * @return array
// *
// * @url GET /total-new-cases-history
// */
// public function doGetTotalNewByProcessHistory($process_list, $init_date, $end_date, $periodicity)
// {
// try {
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
// $listArray = (strlen($process_list) > 1)
// ? $listArray = explode(',', $process_list)
// : null;
// $response = $indicatorsObj->getPercentNewCasesByProcessHistory($listArray,
// new \DateTime($init_date),
// new \DateTime($end_date),
// $periodicity);
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
// }
//
// /**
// * Returns the total of Cases with Completed time
// *
// * @param string $$process_list {@from path}
// * @param string $init_date {@from path}
// * @param string $end_date {@from path}
// * @return array
// *
// * @url GET /total-completed-cases
// */
// public function doGetTotalCompletedByProcess($process_list, $init_date, $end_date)
// {
// try {
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
// $listArray = (strlen($process_list) > 1)
// ? $listArray = explode(',', $process_list)
// : null;
// $response = $indicatorsObj->getPercentCompletedCasesByProcess($listArray,
// new \DateTime($init_date),
// new \DateTime($end_date));
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
// }
//
// /**
// * Returns the total of Cases with Completed time with the selected periodicity
// *
// * @param string $$process_list {@from path}
// * @param string $init_date {@from path}
// * @param string $end_date {@from path}
// * @param string $periodicity {@from path}
// * @return array
// *
// * @url GET /total-completed-cases-history
// */
// public function doGetTotalCompletedByProcessHistory($process_list, $init_date, $end_date, $periodicity)
// {
// try {
// $indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
// $listArray = (strlen($process_list) > 1)
// ? $listArray = explode(',', $process_list)
// : null;
// $response = $indicatorsObj->getPercentCompletedCasesByProcessHistory($listArray,
// new \DateTime($init_date),
// new \DateTime($end_date),
// $periodicity);
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
// }
//
/**
* Returns the total of Cases with Completed time with the selected periodicity
*
@@ -299,7 +82,7 @@ class ReportingIndicators extends Api
*
* @url GET /process-efficiency-data
*/
public function doGetProcessEficciencyData($indicator_uid, $measure_date, $compare_date, $language)
public function doGetProcessEficciencyData($indicator_uid, $compare_date, $measure_date, $language)
{
try {
$indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
@@ -324,7 +107,7 @@ class ReportingIndicators extends Api
*
* @url GET /employee-efficiency-data
*/
public function doGetEmployeeEficciencyData($indicator_uid, $measure_date, $compare_date, $language)
public function doGetEmployeeEficciencyData($indicator_uid, $compare_date, $measure_date, $language)
{
try {
$indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
@@ -390,6 +173,29 @@ class ReportingIndicators extends Api
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Get list Status indicator
*
* @return array
*
* @author Marco Antonio Nina <marco.antonio.nina@colosa.com>
* @copyright Colosa - Bolivia
*
* @url GET /status-indicator
*/
public function doGetStatusIndicator() {
try {
$options['usrUid'] = $this->getUserId();
$indicatorsObj = new \ProcessMaker\BusinessModel\ReportingIndicators();
$response = $indicatorsObj->getStatusIndicator($options);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}