From 76affc9b4b279b4461e97e5134853e3a3d5a0dcf Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Sun, 22 Mar 2009 02:22:34 +0000 Subject: [PATCH] statistics git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@428 c66351dc-e62f-0410-b875-e3a5c0b9693f --- src/messenger/webim/default.css | 29 +++- src/messenger/webim/images/dash/stat.gif | Bin 0 -> 1196 bytes src/messenger/webim/libs/operator.php | 1 + src/messenger/webim/locales/en/properties | 18 +++ src/messenger/webim/locales/ru/properties | 18 +++ src/messenger/webim/operator/statistics.php | 80 +++++++++++ src/messenger/webim/view/inc_menu.php | 3 + src/messenger/webim/view/menu.php | 10 ++ src/messenger/webim/view/statistics.php | 148 ++++++++++++++++++++ 9 files changed, 302 insertions(+), 5 deletions(-) create mode 100644 src/messenger/webim/images/dash/stat.gif create mode 100644 src/messenger/webim/operator/statistics.php create mode 100644 src/messenger/webim/view/statistics.php diff --git a/src/messenger/webim/default.css b/src/messenger/webim/default.css index ffa17d6d..a8ea9231 100644 --- a/src/messenger/webim/default.css +++ b/src/messenger/webim/default.css @@ -388,7 +388,17 @@ input.formauth { padding-left: 4px; } -table.list, table.translate { +.tabletitle { + background: url(images/graydot.gif) repeat-x left bottom; + font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; + font-size: 1.4em; + margin: 10px 0px 20px; + padding-bottom: 10px; + color: #1D485E; + font-weight: bold; +} + +table.list, table.translate, table.statistics { font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; background: #fff; width: 100%; @@ -396,15 +406,17 @@ table.list, table.translate { text-align: left; } -table.list th, table.translate th { +table.list th, table.translate th, table.statistics th { font-size: 1.2em; font-weight: normal; - color: #1D485E; padding: 10px 8px; border-bottom: 2px solid #2F7598; } -table.list td { +table.list th, table.translate th { color: #1D485E; } +table.statistics th { color: #2F7598; } + +table.list td, table.statistics td { color: #2f7599; padding: 10px 8px; border-bottom: 1px solid #ccc; @@ -423,7 +435,7 @@ table.list td a.man { padding-left: 15px; } -table.list tbody tr:hover td, table.list tbody tr:hover td a { +table.list tbody tr:hover td, table.list tbody tr:hover td a, table.statistics tbody tr:hover td { color: #1D485E; } @@ -508,6 +520,13 @@ table.awaiting td.visitor { padding-right:5px; } +.searchctrl { + float: left; + margin:7px 20px 5px 0px; + padding-right:5px; + display: inline; +} + #searchtext input { width: 100%; margin: 0px; diff --git a/src/messenger/webim/images/dash/stat.gif b/src/messenger/webim/images/dash/stat.gif new file mode 100644 index 0000000000000000000000000000000000000000..9594d59baa52f0be6ea9e126d9290c6f55bfdf4a GIT binary patch literal 1196 zcmeH`?@!VR9LK*1G4;||cNtx}Fr9PRN|C$rGJ-D&a&jn>5F(vu22q;cZLXdnUFVO! zOF1o}08%YUK{;5N7w z!;sz&oVq1(A6&FR(qoVhfyH8xn;^vuq8>Q%4~Tj}Zib65A-8!9tp`azMAiVO9ni`- zYVph5mNBsrjywb5LpWvv{+$&@#Z0CJ1RZM`gYaV=L|vWu)duuyQ<6SN(0`N|A@MHI zO2>r{Ai8pjUAGv0bt26O7e;}tTVURpO?wK0JHWc>kURzM&1If$C9-HF_SRxd^}^mu zk{Y2V$_v4k(V8N zGoRekiukuTRIdE=e8$UHeYizoh&Z zvaOIg=$5|#TA5Ax9B7vvCr3ea4+OVA9;|W3wY~pIV=pj+^dTghK-v%dTdVxm53~!T zOzm_^FDQrM=SH_czq~7dWKX&6lOyD7zRUuFD+C;ZV93tT_|Km}JOSAv8A;76VUh?w zR8;JsP$=H`^0(S-U;iTFAyc<8_MHD#@7?#w)h5r%5bs2cSJ-#qKfI?i>an}jFU`o)KYj_6X=qL!47+<=AJbwPBm zAzg9>f~eY0Swg78f0S$_oOVseST(zmF6r=5*?0E%yxxLu!{{?lxcCUH2s>`oP?3Qv zVTN*)=o1uphH`I{kLvDQbJlGku6ODeUyru*fhwO0W7*b|WT(m2op}oBI=h-HRggBZ zBMJMn4gL(*o@KLJ)d*XHK_@;HR+SlA3ea-(zDkwO3XIN%s4Cp&}5!D|lSJ88cFPJhJjU zRR!OaDbfm$g>F}`$FvO8i})zihS8pgJ-kB0OPQXy#VK1cV~vawi5ZmclGu>OqooIT O*zK1R*jq@*zW)Ixa>E<| literal 0 HcmV?d00001 diff --git a/src/messenger/webim/libs/operator.php b/src/messenger/webim/libs/operator.php index f38a7d4e..bd5ba6df 100644 --- a/src/messenger/webim/libs/operator.php +++ b/src/messenger/webim/libs/operator.php @@ -221,6 +221,7 @@ function prepare_menu($operator,$hasright=true) { loadsettings(); $page['showban'] = $settings['enableban'] == "1"; $page['showdep'] = $settings['enabledepartments'] == "1"; + $page['showstat'] = true; //$settings['enablestatistics'] == "1"; $page['showadmin'] = is_capable($can_administrate, $operator); } } diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties index 8e908fa9..6e4dac32 100644 --- a/src/messenger/webim/locales/en/properties +++ b/src/messenger/webim/locales/en/properties @@ -295,6 +295,18 @@ permission.takeover=Take over chat thread permission.viewthreads=View another operator's chat thread permissions.intro=Here you can control operator's permissions permissions.title=Permissions +report.bydate.1=Date +report.bydate.2=Chat threads +report.bydate.3=Messages from operators +report.bydate.4=Messages from visitors +report.bydate.title=Usage statistics for each date +report.byoperator.1=Operator +report.byoperator.2=Chat Threads +report.byoperator.3=Messages +report.byoperator.4=Average message length (in chars) +report.byoperator.title=Threads by operator +report.no_items=Not enough data +report.total=Total: right.administration=Administration right.main=Main right.other=Other @@ -330,6 +342,12 @@ settings.usernamepattern=Visitor's identifier settings.wrong.email=Enter proper email address site.title=openwebim.org site.url=http://openwebim.org +statistics.dates=Select dates +statistics.description=Daily usage reports +statistics.from=From: +statistics.till=Till: +statistics.title=Statistics +statistics.wrong.dates=You have selected From date after Till date tag.pagination.info=Page {0} of {1}, {2}-{3} from {4} tag.pagination.next=next tag.pagination.no_items.elements=No elements diff --git a/src/messenger/webim/locales/ru/properties b/src/messenger/webim/locales/ru/properties index 844e776b..f33ed679 100644 --- a/src/messenger/webim/locales/ru/properties +++ b/src/messenger/webim/locales/ru/properties @@ -277,6 +277,18 @@ permissions.title= right.administration=Управление right.main=Посетители right.other=Остальное +report.bydate.1=Дата +report.bydate.2=Диалогов +report.bydate.3=Сообщений операторов +report.bydate.4=Сообщений посетителей +report.bydate.title=Использование мессенджера по дням +report.byoperator.1=Оператор +report.byoperator.2=Диалогов +report.byoperator.3=Сообщений +report.byoperator.4=Средняя длина сообщения (в символах) +report.byoperator.title=Статистика по операторам +report.no_items=Мало данных +report.total=Итого: settings.chat.title.description=Например, название отдела вашей компании settings.chat.title=Заголовок в чат окне settings.chatstyle.description=Предпросмотр всех страниц каждого стиля доступен здесь @@ -307,6 +319,12 @@ settings.usernamepattern= settings.wrong.email=Введите правильный адрес электронной почты site.title=openwebim.org site.url=http://openwebim.org +statistics.dates=Выберите даты +statistics.description=Различные отчеты по посетителям и использованию мессенджера +statistics.from=С: +statistics.till=По: +statistics.title=Статистика +statistics.wrong.dates=Вы выбрали дату для начала отчета после даты конца tag.pagination.info=Страница {0} из {1}, показаны {2}-{3} из {4} tag.pagination.next=следующая tag.pagination.no_items.elements=Нет элементов для отображения. diff --git a/src/messenger/webim/operator/statistics.php b/src/messenger/webim/operator/statistics.php new file mode 100644 index 00000000..bf894e6f --- /dev/null +++ b/src/messenger/webim/operator/statistics.php @@ -0,0 +1,80 @@ + $end ) { + $errors[] = getlocal("statistics.wrong.dates"); +} + +$link = connect(); + +$page['reportByDate'] = select_multi_assoc("select DATE(dtmcreated) as date, COUNT(distinct threadid) as threads, SUM(chatmessage.ikind = $kind_agent) as agents, SUM(chatmessage.ikind = $kind_user) as users ". + "from chatmessage where unix_timestamp(dtmcreated) >= $start AND unix_timestamp(dtmcreated) < $end group by DATE(dtmcreated) order by dtmcreated desc", $link); + +$page['reportByDateTotal'] = select_one_row("select COUNT(distinct threadid) as threads, SUM(chatmessage.ikind = $kind_agent) as agents, SUM(chatmessage.ikind = $kind_user) as users ". + "from chatmessage where unix_timestamp(dtmcreated) >= $start AND unix_timestamp(dtmcreated) < $end", $link); + +$page['reportByAgent'] = select_multi_assoc("select vclocalename as name, COUNT(distinct threadid) as threads, SUM(ikind = $kind_agent) as msgs, AVG(CHAR_LENGTH(tmessage)) as avglen ". + "from chatmessage, chatoperator ". + "where agentId = operatorid AND unix_timestamp(dtmcreated) >= $start AND unix_timestamp(dtmcreated) < $end group by operatorid", $link); + +$page['showresults'] = count($errors) == 0; + +mysql_close($link); + +prepare_menu($operator); +start_html_output(); +require('../view/statistics.php'); +?> \ No newline at end of file diff --git a/src/messenger/webim/view/inc_menu.php b/src/messenger/webim/view/inc_menu.php index 32b26e7b..a5ef1fed 100644 --- a/src/messenger/webim/view/inc_menu.php +++ b/src/messenger/webim/view/inc_menu.php @@ -15,6 +15,9 @@ function tpl_menu() { global $page, $webimroot, $errors; > > > + + > + > diff --git a/src/messenger/webim/view/menu.php b/src/messenger/webim/view/menu.php index f9079046..27e1a64f 100644 --- a/src/messenger/webim/view/menu.php +++ b/src/messenger/webim/view/menu.php @@ -59,6 +59,16 @@ function tpl_content() { global $page, $webimroot, $current_locale, $menuItemsCo $menuItemsCount = 2; if( $page['showban'] ) { ?> + + + + + + + + + + diff --git a/src/messenger/webim/view/statistics.php b/src/messenger/webim/view/statistics.php new file mode 100644 index 00000000..eb074319 --- /dev/null +++ b/src/messenger/webim/view/statistics.php @@ -0,0 +1,148 @@ + + + +
+
+ + +
+
+ + +
+
+
+
+
+ + + + +
+
+ + + + +
+
+ +
+
+
+
+
+ +
+
+ + + +
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ +
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ +
+ + + + \ No newline at end of file