Update KPIs on applicable pages at back office

This commit is contained in:
Abhishek Kumar
2022-05-13 18:11:51 +05:30
parent 0954235b04
commit c72ecb08b2
7 changed files with 99 additions and 44 deletions

View File

@@ -508,7 +508,8 @@ class AdminCustomerThreadsControllerCore extends AdminController
$time = time();
$kpis = array();
/* The data generation is located in AdminStatsControllerCore */
$statsController = new AdminStatsController();
$this->context->controller = $this;
$helper = new HelperKpi();
$helper->id = 'box-pending-messages';
@@ -518,6 +519,8 @@ class AdminCustomerThreadsControllerCore extends AdminController
$helper->title = $this->l('Pending Discussion Threads', null, null, false);
if (ConfigurationKPI::get('PENDING_MESSAGES') !== false) {
$helper->value = ConfigurationKPI::get('PENDING_MESSAGES');
} else {
$helper->value = $statsController->getLatestKpiValue('pending_messages');
}
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=pending_messages';
$helper->refresh = (bool)(ConfigurationKPI::get('PENDING_MESSAGES_EXPIRE') < $time);
@@ -531,6 +534,8 @@ class AdminCustomerThreadsControllerCore extends AdminController
$helper->subtitle = $this->l('30 days', null, null, false);
if (ConfigurationKPI::get('AVG_MSG_RESPONSE_TIME') !== false) {
$helper->value = ConfigurationKPI::get('AVG_MSG_RESPONSE_TIME');
} else {
$helper->value = $statsController->getLatestKpiValue('avg_msg_response_time');
}
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=avg_msg_response_time';
$helper->refresh = (bool)(ConfigurationKPI::get('AVG_MSG_RESPONSE_TIME_EXPIRE') < $time);
@@ -544,6 +549,8 @@ class AdminCustomerThreadsControllerCore extends AdminController
$helper->subtitle = $this->l('30 day', null, null, false);
if (ConfigurationKPI::get('MESSAGES_PER_THREAD') !== false) {
$helper->value = ConfigurationKPI::get('MESSAGES_PER_THREAD');
} else {
$helper->value = $statsController->getLatestKpiValue('messages_per_thread');
}
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=messages_per_thread';
$helper->refresh = (bool)(ConfigurationKPI::get('MESSAGES_PER_THREAD_EXPIRE') < $time);