diff --git a/lhc_web/design/defaulttheme/tpl/lhchat/lists/search_panel.tpl.php b/lhc_web/design/defaulttheme/tpl/lhchat/lists/search_panel.tpl.php index d54b553f32..89e9b4dfb7 100644 --- a/lhc_web/design/defaulttheme/tpl/lhchat/lists/search_panel.tpl.php +++ b/lhc_web/design/defaulttheme/tpl/lhchat/lists/search_panel.tpl.php @@ -43,7 +43,7 @@ -
+
@@ -78,7 +78,7 @@
-
+
@@ -111,13 +111,65 @@
-
- +
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
-
+
-
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+ +
diff --git a/lhc_web/design/defaulttheme/tpl/lhstatistic/tabs/performance.tpl.php b/lhc_web/design/defaulttheme/tpl/lhstatistic/tabs/performance.tpl.php index be2d193973..79893042a8 100644 --- a/lhc_web/design/defaulttheme/tpl/lhstatistic/tabs/performance.tpl.php +++ b/lhc_web/design/defaulttheme/tpl/lhstatistic/tabs/performance.tpl.php @@ -95,7 +95,21 @@
-
+
+
+ + 'user_id', + 'optional_field' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Select user'), + 'selected_id' => $input->user_id, + 'css_class' => 'form-control', + 'display_name' => 'name_official', + 'list_function' => 'erLhcoreClassModelUser::getUserList' + )); ?> +
+
+ +
'name', 'list_function' => 'erLhcoreClassModelGroup::getList' )); ?> -
+
-
+
-
+
- getTranslation('chat/statistic','Avg. Wait Time');?> + getTranslation('chat/statistic','Avg. Wait Time');?> getTranslation('chat/statistic','Chats Started');?> getTranslation('chat/statistic','Abandoned Chats');?> getTranslation('chat/statistic','% of chats');?> @@ -187,7 +201,7 @@ - + 0 ? round($stat['started']/$performanceStatistic['total_chats'],4)*100 : 0?> % diff --git a/lhc_web/lib/core/lhchat/lhchatstatistic.php b/lhc_web/lib/core/lhchat/lhchatstatistic.php index 8986389f9f..12c792e48b 100644 --- a/lhc_web/lib/core/lhchat/lhchatstatistic.php +++ b/lhc_web/lib/core/lhchat/lhchatstatistic.php @@ -1113,11 +1113,10 @@ public static function totalHoursOfChatsDialogsByUser($days = 30, $filter = arra $filter['filtergt']['user_id'] = 0; return erLhcoreClassChat::getCount(array_merge_recursive($filter,array('filtergt' => array('chat_duration' => 0),'filter' => array('status' => erLhcoreClassModelChat::STATUS_CLOSED_CHAT))),'lh_chat','SUM(chat_duration)'); } - - public static function getPerformanceStatistic($days = 30, $filter = array(), $filterParams = array()) - { - // wait_time - $dateRange = array( + + public static function getRangeWaitTime() + { + return array( array( 'from' => 0, 'to' => 5, @@ -1189,6 +1188,11 @@ public static function getPerformanceStatistic($days = 30, $filter = array(), $f 'tt' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/statistic','more than 10 min.') ) ); + } + + public static function getPerformanceStatistic($days = 30, $filter = array(), $filterParams = array()) + { + $dateRange = self::getRangeWaitTime(); $statusWorkflow = erLhcoreClassChatEventDispatcher::getInstance()->dispatch('statistic.getperformancestatistic',array('ranges' => $dateRange, 'days' => $days, 'filter' => $filter, 'filter_params' => $filterParams)); @@ -1225,9 +1229,8 @@ public static function getPerformanceStatistic($days = 30, $filter = array(), $f } elseif (isset($filterParams['input']->timefrom_include_hours) && is_numeric($filterParams['input']->timefrom_include_hours)) { $filterTimeout['customfilter'][] = 'FROM_UNIXTIME(time,\'%k\') >= '. (int)$filterParams['input']->timefrom_include_hours; } - - - $chatStarted = erLhcoreClassChat::getCount(array_merge_recursive($filter, $filterTimeout), 'lh_chat', 'count(id)'); + + $chatStarted = erLhcoreClassChat::getCount(array_merge_recursive($filter, $filterTimeout), 'lh_chat', 'count(id)'); $abandonedStarted = erLhcoreClassChat::getCount(array_merge_recursive($filter, $filterTimeout, array('filter' => array('user_id' => 0, 'status_sub' => erLhcoreClassModelChat::STATUS_SUB_USER_CLOSED_CHAT))), 'lh_chat', 'count(id)'); $stats['rows'][] = array( diff --git a/lhc_web/lib/core/lhchat/searchattr/chat_search.php b/lhc_web/lib/core/lhchat/searchattr/chat_search.php index aa7e6c514c..be13a39431 100644 --- a/lhc_web/lib/core/lhchat/searchattr/chat_search.php +++ b/lhc_web/lib/core/lhchat/searchattr/chat_search.php @@ -38,6 +38,54 @@ ) ); +$fieldsSearch['wait_time_from'] = array ( + 'type' => 'text', + 'trans' => 'id', + 'required' => false, + 'valid_if_filled' => false, + 'filter_type' => 'filtergt', + 'filter_table_field' => 'wait_time', + 'validation_definition' => new ezcInputFormDefinitionElement ( + ezcInputFormDefinitionElement::OPTIONAL, 'int' + ) +); + +$fieldsSearch['wait_time_till'] = array ( + 'type' => 'text', + 'trans' => 'id', + 'required' => false, + 'valid_if_filled' => false, + 'filter_type' => 'filterlte', + 'filter_table_field' => 'wait_time', + 'validation_definition' => new ezcInputFormDefinitionElement ( + ezcInputFormDefinitionElement::OPTIONAL, 'int' + ) +); + +$fieldsSearch['chat_duration_from'] = array ( + 'type' => 'text', + 'trans' => 'id', + 'required' => false, + 'valid_if_filled' => false, + 'filter_type' => 'filtergt', + 'filter_table_field' => 'chat_duration', + 'validation_definition' => new ezcInputFormDefinitionElement ( + ezcInputFormDefinitionElement::OPTIONAL, 'int' + ) +); + +$fieldsSearch['chat_duration_till'] = array ( + 'type' => 'text', + 'trans' => 'id', + 'required' => false, + 'valid_if_filled' => false, + 'filter_type' => 'filterlte', + 'filter_table_field' => 'chat_duration', + 'validation_definition' => new ezcInputFormDefinitionElement ( + ezcInputFormDefinitionElement::OPTIONAL, 'int' + ) +); + $fieldsSearch['timefrom'] = array ( 'type' => 'text', 'trans' => 'Timefrom', diff --git a/lhc_web/lib/core/lhchat/searchattr/performance_statistic.php b/lhc_web/lib/core/lhchat/searchattr/performance_statistic.php index 85a0b3308e..4a480dbbc6 100644 --- a/lhc_web/lib/core/lhchat/searchattr/performance_statistic.php +++ b/lhc_web/lib/core/lhchat/searchattr/performance_statistic.php @@ -95,14 +95,12 @@ 'required' => false, 'valid_if_filled' => false, 'filter_type' => 'filter', - 'filter_table_field' => 'user_id', + 'filter_table_field' => 'lh_chat.user_id', 'validation_definition' => new ezcInputFormDefinitionElement( ezcInputFormDefinitionElement::OPTIONAL, 'int', array( 'min_range' => 1) ) ); - - $fieldSortAttr = array ( 'field' => false, 'default' => false, diff --git a/lhc_web/lib/core/lhcore/lhsearchhandler.php b/lhc_web/lib/core/lhcore/lhsearchhandler.php index c22276aaea..30d8708452 100644 --- a/lhc_web/lib/core/lhcore/lhsearchhandler.php +++ b/lhc_web/lib/core/lhcore/lhsearchhandler.php @@ -119,20 +119,22 @@ public static function getParams($params = array()) } } } - } elseif ($field['filter_type'] == 'filtergte') { - + } elseif ($field['filter_type'] == 'filtergte' || $field['filter_type'] == 'filtergt') { + + $filterType = $field['filter_type']; + if (isset($field['datatype']) && $field['datatype'] == 'date') { $dateFormated = self::formatDateToTimestamp($inputParams->$key); if ($dateFormated != false) { - $filter['filtergte'][$field['filter_table_field']] = $dateFormated; + $filter[$filterType][$field['filter_table_field']] = $dateFormated; } } elseif (isset($field['datatype']) && $field['datatype'] == 'date_ymd') { $dateFormated = self::formatDateToDateYmd($inputParams->$key); if ($dateFormated != false) { - $filter['filtergte'][$field['filter_table_field']] = $dateFormated; + $filter[$filterType][$field['filter_table_field']] = $dateFormated; } } elseif (isset($field['datatype']) && $field['datatype'] == 'datetime') { @@ -162,12 +164,13 @@ public static function getParams($params = array()) $minutes = 0; } - $filter['filtergte'][$field['filter_table_field']] = $dateFormated + $hours + $minutes; + $filter[$filterType][$field['filter_table_field']] = $dateFormated + $hours + $minutes; } } else { - $filter['filtergte'][$field['filter_table_field']] = $inputParams->$key; + $filter[$filterType][$field['filter_table_field']] = $inputParams->$key; } + } elseif ($field['filter_type'] == 'filterlte' || $field['filter_type'] == 'filterlt') { $filterType = $field['filter_type']; diff --git a/lhc_web/modules/lhchat/module.php b/lhc_web/modules/lhchat/module.php index 035c481be4..5ec607e47a 100644 --- a/lhc_web/modules/lhchat/module.php +++ b/lhc_web/modules/lhchat/module.php @@ -176,7 +176,7 @@ $ViewList['list'] = array( 'params' => array(), - 'uparams' => array('chat_id','nick','email','timefrom','timeto','department_id','user_id','print','xls','fbst','chat_status','hum','product_id','timefrom','timefrom_minutes','timefrom_hours','timeto','timeto_minutes','timeto_hours'), + 'uparams' => array('chat_duration_from','chat_duration_till','wait_time_from','wait_time_till','chat_id','nick','email','timefrom','timeto','department_id','user_id','print','xls','fbst','chat_status','hum','product_id','timefrom','timefrom_minutes','timefrom_hours','timeto','timeto_minutes','timeto_hours'), 'functions' => array( 'use' ) );