function GetEvents() { if (($r = CStatisticWS::CheckAuth()) !== False) { return $r; } $arResult = array(); $e_by = "s_stat"; $e_order = "desc"; $dbAdv = CStatEventType::GetList($e_by, $e_order, array("DATE1_PERIOD" => "", "DATE2_PERIOD" => ""), $is_filtered); $i = 0; while ($arAdv = $dbAdv->Fetch()) { $i++; $arResult[$i . ':top'] = array("id" => $arAdv["ID"], "name" => $arAdv["EVENT"], "today" => $arAdv["TODAY_COUNTER"], "yesterday" => $arAdv["YESTERDAY_COUNTER"], "bef_yesterday" => $arAdv["B_YESTERDAY_COUNTER"], "all" => $arAdv["TOTAL_COUNTER"]); if ($i >= COption::GetOptionInt("statistic", "STAT_LIST_TOP_SIZE", 10)) { break; } } return $arResult; }
$show_money = false; } //no setting (will be read later from session) if (isset($summa)) { if ($summa != "Y") { $summa = "N"; } } else { $summa = false; } //no setting (will be read later from session) define("HELP_FILE", "event_type_list.php"); $sTableID = "tbl_event_graph_list"; $lAdmin = new CAdminList($sTableID); $arrDef = array(); $rs = CStatEventType::GetList($v1 = "s_total_counter", $v2 = "desc", $arF, $v3); while ($ar = $rs->Fetch()) { if ($ar["DIAGRAM_DEFAULT"] == "Y") { $arrDef[] = $ar["ID"]; } $arrEVENTS[$ar["ID"]] = $ar["EVENT"] . " [" . $ar["ID"] . "]"; } if ($lAdmin->IsDefaultFilter()) { $find_events = array(); if (is_array($arrEVENTS)) { foreach ($arrEVENTS as $key => $value) { if ($i <= 9 && in_array($key, $arrDef)) { $find_events[] = $key; $i++; } }
if ($STAT_RIGHT == "D") { $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); } include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/statistic/colors.php"; require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/img.php"; $diameter = COption::GetOptionString("statistic", "DIAGRAM_DIAMETER"); // create image $ImageHandle = CreateImageHandle($diameter, $diameter, "FFFFFF", true); // get plot data $arr = array(); $arFilter = array("ID" => implode(" | ", $find_events), "DATE1_PERIOD" => $find_date1, "DATE2_PERIOD" => $find_date2); if (strlen($find_date1) > 0 || strlen($find_date2) > 0) { $period = "Y"; } $by = $period == "Y" ? "s_period_counter" : "s_total_counter"; $w = CStatEventType::GetList($by, $order = "desc", $arFilter, $is_filtered); while ($wr = $w->Fetch()) { $total++; $count = $period == "Y" ? $wr["PERIOD_COUNTER"] : $wr["TOTAL_COUNTER"]; if ($count > 0) { $arr[] = array("COUNTER" => $count); } } $arChart = array(); while (list($key, $sector) = each($arr)) { $color = GetNextRGB($color, $total); $arChart[] = array("COUNTER" => $sector["COUNTER"], "COLOR" => $color); } // draw pie chart imagefill($ImageHandle, 0, 0, imagecolorallocate($ImageHandle, 255, 255, 255)); Circular_Diagram($ImageHandle, $arChart, "FFFFFF", $diameter, $diameter / 2, $diameter / 2, true);
$statDB->Commit(); break; case "clear": @set_time_limit(0); $statDB->StartTransaction(); if (!CStatEventType::Delete($ID, "N")) { $statDB->Rollback(); $lAdmin->AddGroupError(GetMessage("STAT_DELETE_ERROR"), $ID); } $statDB->Commit(); break; } } } $cData = new CStatEventType(); $rsData = $cData->GetList($by, $order, $arFilter, $is_filtered); $rsData = new CAdminResult($rsData, $sTableID); $rsData->NavStart(); $lAdmin->NavText($rsData->GetNavPrint(GetMessage("STAT_EVENT_TYPE_PAGES"))); $arHeaders = array(); if ($group_by == "") { $arHeaders[] = array("id" => "ID", "content" => "ID", "sort" => "s_id", "align" => "right", "default" => true); $arHeaders[] = array("id" => "NAME", "content" => GetMessage("STAT_NAME") . $group_by, "sort" => "s_name", "default" => true); } if ($group_by == "" || $group_by == "event1") { $arHeaders[] = array("id" => "EVENT1", "content" => "event1", "sort" => "s_event1", "default" => true); } if ($group_by == "" || $group_by == "event2") { $arHeaders[] = array("id" => "EVENT2", "content" => "event2", "sort" => "s_event2", "default" => true); } $arHeaders[] = array("id" => "TODAY_COUNTER", "content" => GetMessage("STAT_TODAY_COUNTER"), "sort" => "s_today_counter", "align" => "right", "default" => true);
?> <tr><td align="center" colspan="5"><?php echo GetMessage("GD_STAT_NO_DATA"); ?> </td></tr><?php } ?> </tbody> </table><?php } elseif ($_REQUEST["table_id"] == "event") { if ($site_filter == "Y") { die; } $e_by = "s_stat"; $e_order = "desc"; $rsEvents = CStatEventType::GetList($e_by, $e_order, $arEVENTF, $is_filtered, 10); ?> <table class="bx-gadgets-table"> <tbody> <tr> <th><?php echo GetMessage("GD_STAT_EVENT"); ?> </th> <th><a href="/bitrix/admin/event_list.php?lang=<?php echo $_REQUEST["lang"]; ?> &find_date1=<?php echo $now_date; ?> &find_date2=<?php
$row->AddViewField("COUNTER", $strHTML); } $max_date = mktime(24, 59, 59, $arMaxMin["MAX_MONTH"], $arMaxMin["MAX_DAY"], $arMaxMin["MAX_YEAR"]); $min_date = mktime(0, 0, 0, $arMaxMin["MIN_MONTH"], $arMaxMin["MIN_DAY"], $arMaxMin["MIN_YEAR"]); if (strlen($arFilter["DATE1"]) > 0) { $mindate = $arFilter["DATE1"]; } else { $mindate = GetTime($min_date); } if (strlen($arFilter["DATE2"]) > 0) { $maxdate = $arFilter["DATE2"]; } else { $maxdate = GetTime($max_date); } $arF = array("ID" => $find_event_id, "DATE1_PERIOD" => $mindate, "DATE2_PERIOD" => $maxdate); $rsEventType = CStatEventType::GetList($by2, $order2, $arF, $is_filtered); $arEventType = $rsEventType->Fetch(); $arFooter = array(); $arFooter[] = array("title" => GetMessage("MAIN_ADMIN_LIST_SELECTED"), "value" => $rsData->SelectedRowsCount()); $arFooter[] = array("title" => GetMessage("STAT_TOTAL"), "value" => strlen($arF["DATE1_PERIOD"]) > 0 || strlen($arF["DATE2_PERIOD"]) > 0 ? intval($arEventType["PERIOD_COUNTER"]) : intval($arEventType["TOTAL_COUNTER"])); $arFooter[] = array("title" => GetMessage("STAT_TOTAL_TIME"), "value" => IntVal(($max_date - $min_date) / 86400)); $lAdmin->AddFooter($arFooter); $dynamic_days = CStatEventType::DynamicDays($find_event_id, $arFilter["DATE1"], $arFilter["DATE2"]); if ($dynamic_days >= 2 && function_exists("ImageCreate")) { $aContext = array(array("TEXT" => GetMessage("STAT_MNU_GRAPH"), "LINK" => htmlspecialcharsbx("event_graph_list.php?lang=" . LANGUAGE_ID . "&find_events[]=" . $find_event_id . "&find_date1=" . $arFilter["DATE1"] . "&find_date2=" . $arFilter["DATE2"] . "&set_filter=Y"), "TITLE" => GetMessage("STAT_GRAPH"))); $lAdmin->AddAdminContextMenu($aContext); } $lAdmin->CheckListMode(); $APPLICATION->SetTitle(GetMessage("STAT_RECORDS_LIST", array("#STATISTIC_DAYS#" => $STORED_DAYS))); require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php"; $arFilterDropDown = array(GetMessage("STAT_F_PERIOD"));
function SendDailyStatistics() { __SetNoKeepStatistics(); if ($_SESSION["SESS_NO_AGENT_STATISTIC"] != "Y" && !defined("NO_AGENT_STATISTIC")) { global $MESS; $rsSite = CSite::GetDefList(); $arSite = $rsSite->Fetch(); $charset = $arSite["CHARSET"]; $now_full_date = GetTime(time(), "FULL", $arSite["ID"], true); $now_date = GetTime(time(), "SHORT", $arSite["ID"], true); $yesterday_date = GetTime(time() - 86400, "SHORT", $arSite["ID"], true); $bef_yesterday_date = GetTime(time() - 172800, "SHORT", $arSite["ID"], true); $arComm = CTraffic::GetCommonValues(); $adv = CAdv::GetList($a_by, $a_order, array(), $is_filtered, "", $arrGROUP_DAYS, $v); $events = CStatEventType::GetList($e_by = "s_stat", $e_order = "desc", array(), $is_filtered); $referers = CTraffic::GetRefererList($by, $order, array(), $is_filtered); $phrases = CTraffic::GetPhraseList($s_by, $s_order, array(), $is_filtered); $searchers = CSearcher::GetList($f_by = "s_stat", $f_order = "desc", array(), $is_filtered); $OLD_MESS = $MESS; $MESS = array(); IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/statistic/include.php", $arSite["LANGUAGE_ID"]); IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/statistic/admin/stat_list.php", $arSite["LANGUAGE_ID"]); $HTML_HEADER = ' <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=' . $charset . '"> <style> .tablehead1 {background-color:#C2DBED; padding:2px; border-top: 1px solid #A8C2D7; border-bottom: 1px solid #A8C2D7; border-left: 1px solid #A8C2D7;} .tablehead2 {background-color:#C2DBED; padding:2px; border-top: 1px solid #A8C2D7; border-bottom: 1px solid #A8C2D7;} .tablehead3 {background-color:#C2DBED; padding:2px; border-top: 1px solid #A8C2D7; border-bottom: 1px solid #A8C2D7; border-right: 1px solid #A8C2D7;} .tablebody1 {background-color:#F0F1F2; padding:2px; border-left:#B9D3E6 solid 1px; border-bottom:#B9D3E6 solid 1px;} .tablebody2 {background-color:#F0F1F2; padding:2px; border-bottom:#B9D3E6 solid 1px;} .tablebody3 {background-color:#F0F1F2; padding:2px; border-right:#B9D3E6 solid 1px; border-bottom:#B9D3E6 solid 1px;} .tablebodytext {font-family: Arial, Helvetica, sans-serif; font-size:12px; color:#000000;} .tableheadtext {font-family: Arial, Helvetica, sans-serif; font-size:12px; color:#000000;} .tablelinebottom {border-bottom:1pt solid #D1D1D1} .notesmall {font-family: Arial, Helvetica, sans-serif; font-size:11px; color:#008400; font-weight:normal;} .tablebody1_sel {background-color:#E0EBF1; padding:2px; border-left:#B9D3E6 solid 1px; border-bottom:#B9D3E6 solid 1px;} .tablebody2_sel {background-color:#E0EBF1; padding:2px; border-bottom:#B9D3E6 solid 1px;} .tablebody3_sel {background-color:#E0EBF1; padding:2px; border-right:#B9D3E6 solid 1px; border-bottom:#B9D3E6 solid 1px;} </style> </head> <body bgcolor="FFFFFF" leftmargin="2" topmargin="2" marginwidth="2" marginheight="2"> '; $HTML_COMMON = ' <table border="0" cellspacing="1" cellpadding="3" width="100%"> <tr> <td valign="top" align="center" class="tablehead1" width="48%" nowrap><font class="tableheadtext">' . GetMessage("STAT_VISIT") . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tableheadtext">' . GetMessage("STAT_TODAY") . '</font><br><font class="notesmall">' . $now_date . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tableheadtext">' . GetMessage("STAT_YESTERDAY") . '</font><br><font class="notesmall">' . $yesterday_date . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tableheadtext">' . GetMessage("STAT_BEFORE_YESTERDAY") . '</font><br><font class="notesmall">' . $bef_yesterday_date . '</font></td> <td valign="top" align="center" class="tablehead3" width="13%" nowrap><font class="tableheadtext">' . GetMessage("STAT_TOTAL_1") . '</font></td> </tr> <tr valign="top"> <td valign="top" class="tablebody1" width="48%" nowrap><font class="tablebodytext">' . GetMessage("STAT_HITS") . '</font></td> <td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["TODAY_HITS"] . '</font></td> <td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["YESTERDAY_HITS"] . '</font></td> <td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["B_YESTERDAY_HITS"] . '</font></td> <td valign="top" align="right" class="tablebody3" width="13%" nowrap><font class="tablebodytext">' . $arComm["TOTAL_HITS"] . ' </font></td> </tr> <tr valign="top"> <td valign="top" class="tablebody1" width="48%" nowrap><font class="tablebodytext">' . GetMessage("STAT_HOSTS") . '</font></td> <td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["TODAY_HOSTS"] . '</font></td> <td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["YESTERDAY_HOSTS"] . '</font></td> <td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["B_YESTERDAY_HOSTS"] . '</font></td> <td valign="top" align="right" class="tablebody3" width="13%" nowrap><font class="tablebodytext">' . $arComm["TOTAL_HOSTS"] . ' </font></td> </tr> <tr valign="top"> <td valign="top" class="tablebody1" width="48%" nowrap><font class="tablebodytext">' . GetMessage("STAT_SESSIONS") . '</font></td> <td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["TODAY_SESSIONS"] . '</font></td> <td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["YESTERDAY_SESSIONS"] . '</font></td> <td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["B_YESTERDAY_SESSIONS"] . '</font></td> <td valign="top" align="right" class="tablebody3" width="13%" nowrap><font class="tablebodytext">' . $arComm["TOTAL_SESSIONS"] . ' </font></td> </tr> <tr valign="top"> <td valign="top" class="tablebody1" width="48%" nowrap><font class="tablebodytext">' . GetMessage("STAT_C_EVENTS") . '</font></td> <td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["TODAY_EVENTS"] . '</font></td> <td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["YESTERDAY_EVENTS"] . '</font></td> <td valign="top" align="right" class="tablebody2" width="13%" nowrap><font class="tablebodytext">' . $arComm["B_YESTERDAY_EVENTS"] . '</font></td> <td valign="top" align="right" class="tablebody3" width="13%" nowrap><font class="tablebodytext">' . $arComm["TOTAL_EVENTS"] . ' </font></td> </tr> <tr valign="top"> <td valign="top" class="tablebody1" width="48%" nowrap> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td width="100%"><font class="tablebodytext">' . GetMessage("STAT_GUESTS") . '</font></td> <td width="0%" align="right" class="tablelinebottom" nowrap><font class="tablebodytext">' . GetMessage("STAT_TOTAL") . '</font></td> </tr> <tr> <td></td> <td class="tablelinebottom" align="right" nowrap><font class="tablebodytext">' . GetMessage("STAT_NEW") . '</font></td> </tr> <tr> <td></td> <td align="right" nowrap><font class="tablebodytext">' . GetMessage("STAT_ONLINE") . '</font></td> </tr> </table></td> <td valign="top" align="right" class="tablebody2" width="13%" nowrap> <table cellspacing=0 cellpadding=0 width="100%"> <tr><td class="tablelinebottom" align="right" width="100%"><font class="tablebodytext">' . $arComm["TODAY_GUESTS"] . '</font></td></tr> <tr><td class="tablelinebottom" align="right"><font class="tablebodytext">' . $arComm["TODAY_NEW_GUESTS"] . '</font></td></tr> <tr><td align="right"><font class="tablebodytext">' . $arComm["ONLINE_GUESTS"] . '</font></td></tr> </table></td> <td valign="top" align="right" class="tablebody2" width="13%" nowrap> <table cellspacing=0 cellpadding=0 width="100%"> <tr><td class="tablelinebottom" align="right" width="100%"><font class="tablebodytext">' . $arComm["YESTERDAY_GUESTS"] . '</font></td></tr> <tr><td class="tablelinebottom" align="right"><font class="tablebodytext">' . $arComm["YESTERDAY_NEW_GUESTS"] . '</font></td></tr> </table></td> <td valign="top" align="right" class="tablebody2" width="13%" nowrap> <table cellspacing=0 cellpadding=0 width="100%"> <tr><td align="right" class="tablelinebottom" width="100%"><font class="tablebodytext">' . $arComm["B_YESTERDAY_GUESTS"] . '</font></td></tr> <tr><td class="tablelinebottom" align="right"><font class="tablebodytext">' . $arComm["B_YESTERDAY_NEW_GUESTS"] . '</font></td></tr> </table></td> <td valign="top" align="right" class="tablebody3" width="13%" nowrap> <table cellspacing=0 cellpadding=0 width="100%"> <tr><td class="tablelinebottom" align="right" width="100%"><font class="tablebodytext">' . $arComm["TOTAL_GUESTS"] . ' </font></td></tr> <tr><td class="tablelinebottom" align="right"><font class="tablebodytext"> </font></td></tr> </table></td> </tr> </table> </td> </tr> </table> '; $HTML_ADV = ' <font class="tablebodytext">' . GetMessage("STAT_ADV") . ' (' . GetMessage("STAT_DIRECT_SESSIONS") . ') (Top 10):</font><br> <table border="0" cellspacing="1" cellpadding="3" width="100%"> <tr> <td valign="top" align="center" class="tablehead1" width="48%" nowrap><font class="tableheadtext">' . GetMessage("STAT_ADV_NAME") . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tableheadtext">' . GetMessage("STAT_TODAY") . '</font><br><font class="notesmall">' . $now_date . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tableheadtext">' . GetMessage("STAT_YESTERDAY") . '</font><br><font class="notesmall">' . $yesterday_date . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tableheadtext">' . GetMessage("STAT_BEFORE_YESTERDAY") . '</font><br><font class="notesmall">' . $bef_yesterday_date . '</font></td> <td valign="top" align="center" class="tablehead3" width="13%" nowrap><font class="tableheadtext">' . GetMessage("STAT_TOTAL_1") . '</font></td> </tr> '; $i = 0; $total_SESSIONS_TODAY = 0; $total_SESSIONS_YESTERDAY = 0; $total_SESSIONS_BEF_YESTERDAY = 0; $total_SESSIONS = 0; while ($ar = $adv->Fetch()) { $i++; $total_SESSIONS_TODAY += $ar["SESSIONS_TODAY"]; $total_SESSIONS_YESTERDAY += $ar["SESSIONS_YESTERDAY"]; $total_SESSIONS_BEF_YESTERDAY += $ar["SESSIONS_BEF_YESTERDAY"]; $total_SESSIONS += $ar["SESSIONS"]; if ($i <= 10) { $HTML_ADV .= ' <tr> <td valign="top" class="tablebody1"><font class="tablebodytext">[' . $ar["ID"] . '] ' . $ar["REFERER1"] . ' / ' . $ar["REFERER2"] . '</font></td> <td valign="top" align="right" class="tablebody2"><font class="tablebodytext"> ' . ($ar["SESSIONS_TODAY"] > 0 ? $ar["SESSIONS_TODAY"] : " ") . '</font></td> <td valign="top" align="right" class="tablebody2"><font class="tablebodytext"> ' . ($ar["SESSIONS_YESTERDAY"] > 0 ? $ar["SESSIONS_YESTERDAY"] : " ") . '</font></td> <td valign="top" align="right" class="tablebody2"><font class="tablebodytext"> ' . ($ar["SESSIONS_BEF_YESTERDAY"] > 0 ? $ar["SESSIONS_BEF_YESTERDAY"] : " ") . '</font></td> <td valign="top" align="right" class="tablebody3"><font class="tablebodytext"> ' . ($ar["SESSIONS"] > 0 ? $ar["SESSIONS"] : " ") . '</font></td> </tr> '; } } $HTML_ADV .= ' <tr> <td valign="top" align="right" class="tablebody1_sel" style="padding:3px"><font class="tablebodytext">' . GetMessage("STAT_TOTAL") . '</font></td> <td valign="top" align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext"> ' . ($total_SESSIONS_TODAY > 0 ? $total_SESSIONS_TODAY : " ") . '</font></td> <td valign="top" align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext"> ' . ($total_SESSIONS_YESTERDAY > 0 ? $total_SESSIONS_YESTERDAY : " ") . '</font></td> <td valign="top" align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext"> ' . ($total_SESSIONS_BEF_YESTERDAY > 0 ? $total_SESSIONS_BEF_YESTERDAY : " ") . '</font></td> <td valign="top" align="right" class="tablebody3_sel" style="padding:3px"><font class="tablebodytext"> ' . ($total_SESSIONS > 0 ? $total_SESSIONS : " ") . '</font></td> </table> '; $HTML_EVENTS = ' <font class="tablebodytext">' . GetMessage("STAT_EVENTS_2") . ' (Top 10):</font><br> <table border="0" cellspacing="1" cellpadding="3" width="100%"> <tr> <td valign="top" align="center" class="tablehead1" width="48%" nowrap><font class="tableheadtext">' . GetMessage("STAT_EVENT") . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap> <font class="tablebodytext">' . GetMessage("STAT_TODAY") . '</font><br><font class="notesmall">' . $now_date . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap> <font class="tablebodytext">' . GetMessage("STAT_YESTERDAY") . '</font><br><font class="notesmall">' . $yesterday_date . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap> <font class="tablebodytext">' . GetMessage("STAT_BEFORE_YESTERDAY") . '</font><br><font class="notesmall">' . $bef_yesterday_date . '</font></td> <td valign="top" align="center" class="tablehead3" width="13%" nowrap> <font class="tablebodytext">' . GetMessage("STAT_TOTAL_1") . '</font></td> </tr> '; $i = 0; $total_TODAY_COUNTER = 0; $total_YESTERDAY_COUNTER = 0; $total_B_YESTERDAY_COUNTER = 0; $total_TOTAL_COUNTER = 0; while ($er = $events->Fetch()) { $i++; $total_TODAY_COUNTER += intval($er["TODAY_COUNTER"]); $total_YESTERDAY_COUNTER += intval($er["YESTERDAY_COUNTER"]); $total_B_YESTERDAY_COUNTER += intval($er["B_YESTERDAY_COUNTER"]); $total_TOTAL_COUNTER += intval($er["TOTAL_COUNTER"]); if ($i <= 10) { $HTML_EVENTS .= ' <tr valign="top"> <td valign="top" class="tablebody1" width="0%" nowrap><font class="tablebodytext">' . $er["EVENT"] . '</font></td> <td valign="top" align="right" class="tablebody2" width="0%" nowrap><font class="tablebodytext">' . ($er["TODAY_COUNTER"] > 0 ? $er["TODAY_COUNTER"] : " ") . '</font></td> <td valign="top" align="right" class="tablebody2" width="0%" nowrap><font class="tablebodytext">' . ($er["YESTERDAY_COUNTER"] > 0 ? $er["YESTERDAY_COUNTER"] : " ") . '</font></td> <td valign="top" align="right" class="tablebody2" width="0%" nowrap><font class="tablebodytext">' . ($er["B_YESTERDAY_COUNTER"] > 0 ? $er["B_YESTERDAY_COUNTER"] : " ") . '</font></td> <td valign="top" align="right" class="tablebody3" width="0%" nowrap><font class="tablebodytext">' . ($er["TOTAL_COUNTER"] > 0 ? $er["TOTAL_COUNTER"] : " ") . '</font></td> </tr> '; } } $HTML_EVENTS .= ' <tr valign="top"> <td align="right" class="tablebody1_sel" style="padding:3px"><font class="tablebodytext">' . GetMessage("STAT_TOTAL") . '</font></td> <td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_TODAY_COUNTER > 0 ? $total_TODAY_COUNTER : " ") . '</font></td> <td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_YESTERDAY_COUNTER > 0 ? $total_YESTERDAY_COUNTER : " ") . '</font></td> <td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_B_YESTERDAY_COUNTER > 0 ? $total_B_YESTERDAY_COUNTER : " ") . '</font></td> <td align="right" class="tablebody3_sel" style="padding:3px"><font class="tablebodytext">' . ($total_TOTAL_COUNTER > 0 ? $total_TOTAL_COUNTER : " ") . '</font></td> </table> '; $HTML_REFERERS = ' <font class="tablebodytext">' . GetMessage("STAT_REFERERS") . ' (Top 10):</font><br> <table border="0" cellspacing="1" cellpadding="3" width="100%"> <tr> <td valign="top" align="center" class="tablehead1" width="48%" nowrap><font class="tableheadtext">' . GetMessage("STAT_SERVER") . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_TODAY") . '</font><br><font class="notesmall">' . $now_date . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_YESTERDAY") . '</font><br><font class="notesmall">' . $yesterday_date . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_BEFORE_YESTERDAY") . '</font><br><font class="notesmall">' . $bef_yesterday_date . '</font></td> <td valign="top" align="center" class="tablehead3" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_TOTAL_1") . '</font></td> </tr> '; $i = 0; $total_TODAY_REFERERS = 0; $total_YESTERDAY_REFERERS = 0; $total_B_YESTERDAY_REFERERS = 0; $total_TOTAL_REFERERS = 0; while ($rr = $referers->Fetch()) { $i++; $total_TODAY_REFERERS += $rr["TODAY_REFERERS"]; $total_YESTERDAY_REFERERS += $rr["YESTERDAY_REFERERS"]; $total_B_YESTERDAY_REFERERS += $rr["B_YESTERDAY_REFERERS"]; $total_TOTAL_REFERERS += $rr["TOTAL_REFERERS"]; if ($i <= 10) { $HTML_REFERERS .= ' <tr> <td valign="top" class="tablebody1" nowrap><font class="tablebodytext">' . $rr["SITE_NAME"] . '</font></td> <td align="right" class="tablebody2"><font class="tablebodytext">' . ($rr["TODAY_REFERERS"] > 0 ? $rr["TODAY_REFERERS"] : " ") . '</font></td> <td align="right" class="tablebody2"><font class="tablebodytext">' . ($rr["YESTERDAY_REFERERS"] > 0 ? $rr["YESTERDAY_REFERERS"] : " ") . '</font></td> <td align="right" class="tablebody2"><font class="tablebodytext">' . ($rr["B_YESTERDAY_REFERERS"] > 0 ? $rr["B_YESTERDAY_REFERERS"] : " ") . '</font></td> <td align="right" class="tablebody3"><font class="tablebodytext">' . ($rr["TOTAL_REFERERS"] > 0 ? $rr["TOTAL_REFERERS"] : " ") . '</font></td> </tr> '; } } $HTML_REFERERS .= ' <tr valign="top"> <td align="right" class="tablebody1_sel" style="padding:3px"><font class="tablebodytext">' . GetMessage("STAT_TOTAL") . '</font></td> <td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_TODAY_REFERERS > 0 ? $total_TODAY_REFERERS : " ") . '</font></td> <td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_YESTERDAY_REFERERS > 0 ? $total_YESTERDAY_REFERERS : " ") . '</font></td> <td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_B_YESTERDAY_REFERERS > 0 ? $total_B_YESTERDAY_REFERERS : " ") . '</font></td> <td align="right" class="tablebody3_sel" style="padding:3px"><font class="tablebodytext">' . ($total_TOTAL_REFERERS > 0 ? $total_TOTAL_REFERERS : " ") . '</font></td> </table> '; $HTML_PHRASES = ' <font class="tablebodytext">' . GetMessage("STAT_PHRASES") . ' (Top 10):</font><br> <table border="0" cellspacing="1" cellpadding="3" width="100%"> <tr> <td valign="top" align="center" class="tablehead1" width="48%" nowrap><font class="tableheadtext">' . GetMessage("STAT_PHRASE") . '</td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_TODAY") . '</font><br><font class="notesmall">' . $now_date . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_YESTERDAY") . '</font><br><font class="notesmall">' . $yesterday_date . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_BEFORE_YESTERDAY") . '</font><br><font class="notesmall">' . $bef_yesterday_date . '</font></td> <td valign="top" align="center" class="tablehead3" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_TOTAL_1") . '</font></td> </tr> '; $i = 0; $total_TODAY_PHRASES = 0; $total_YESTERDAY_PHRASES = 0; $total_B_YESTERDAY_PHRASES = 0; $total_TOTAL_PHRASES = 0; while ($pr = $phrases->GetNext()) { $i++; $total_TODAY_PHRASES += $pr["TODAY_PHRASES"]; $total_YESTERDAY_PHRASES += $pr["YESTERDAY_PHRASES"]; $total_B_YESTERDAY_PHRASES += $pr["B_YESTERDAY_PHRASES"]; $total_TOTAL_PHRASES += $pr["TOTAL_PHRASES"]; if ($i <= 10) { $HTML_PHRASES .= ' <tr valign="top"> <td valign="top" class="tablebody1" width="0%" nowrap><font class="tablebodytext">' . TruncateText($pr["PHRASE"], 50) . '</font></td> <td align="right" class="tablebody2"><font class="tablebodytext">' . ($pr["TODAY_PHRASES"] > 0 ? $pr["TODAY_PHRASES"] : " ") . '</font></td> <td align="right" class="tablebody2"><font class="tablebodytext">' . ($pr["YESTERDAY_PHRASES"] > 0 ? $pr["YESTERDAY_PHRASES"] : " ") . '</font></td> <td align="right" class="tablebody2"><font class="tablebodytext">' . ($pr["B_YESTERDAY_PHRASES"] > 0 ? $pr["B_YESTERDAY_PHRASES"] : " ") . '</font></td> <td align="right" class="tablebody3"><font class="tablebodytext">' . ($pr["TOTAL_PHRASES"] > 0 ? $pr["TOTAL_PHRASES"] : " ") . '</font></td> </tr> '; } } $HTML_PHRASES .= ' <tr valign="top"> <td align="right" class="tablebody1_sel" style="padding:3px"><font class="tablebodytext">' . GetMessage("STAT_TOTAL") . '</font></td> <td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_TODAY_PHRASES > 0 ? $total_TODAY_PHRASES : " ") . '</font></td> <td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_YESTERDAY_PHRASES > 0 ? $total_YESTERDAY_PHRASES : " ") . '</font></td> <td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_B_YESTERDAY_PHRASES > 0 ? $total_B_YESTERDAY_PHRASES : " ") . '</font></td> <td align="right" class="tablebody3_sel" style="padding:3px"><font class="tablebodytext">' . ($total_TOTAL_PHRASES > 0 ? $total_TOTAL_PHRASES : " ") . '</font></td> </table> '; $HTML_SEARCHERS = ' <font class="tablebodytext">' . GetMessage("STAT_SITE_INDEXING") . ' (Top 10):</font><br> <table border="0" cellspacing="1" cellpadding="3" width="100%"> <tr> <td valign="top" align="center" class="tablehead1" width="48%" nowrap><font class="tableheadtext">' . GetMessage("STAT_SEARCHER") . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_TODAY") . '</font><br><font class="notesmall">' . $now_date . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_YESTERDAY") . '</font><br><font class="notesmall">' . $yesterday_date . '</font></td> <td valign="top" align="center" class="tablehead2" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_BEFORE_YESTERDAY") . '</font><br><font class="notesmall">' . $bef_yesterday_date . '</font></td> <td valign="top" align="center" class="tablehead3" width="13%" nowrap><font class="tablebodytext">' . GetMessage("STAT_TOTAL_1") . '</font></td> </tr> '; $i = 0; $total_TODAY_HITS = 0; $total_YESTERDAY_HITS = 0; $total_B_YESTERDAY_HITS = 0; $total_TOTAL_HITS = 0; while ($fr = $searchers->Fetch()) { $i++; $total_TODAY_HITS += $fr["TODAY_HITS"]; $total_YESTERDAY_HITS += $fr["YESTERDAY_HITS"]; $total_B_YESTERDAY_HITS += $fr["B_YESTERDAY_HITS"]; $total_TOTAL_HITS += $fr["TOTAL_HITS"]; if ($i <= 10) { $HTML_SEARCHERS .= ' <tr valign="top"> <td valign="top" class="tablebody1" width="0%" nowrap><font class="tablebodytext">' . $fr["NAME"] . '</font></td> <td align="right" class="tablebody2"><font class="tablebodytext">' . ($fr["TODAY_HITS"] > 0 ? $fr["TODAY_HITS"] : " ") . '</font></td> <td align="right" class="tablebody2"><font class="tablebodytext">' . ($fr["YESTERDAY_HITS"] > 0 ? $fr["YESTERDAY_HITS"] : " ") . '</font></td> <td align="right" class="tablebody2"><font class="tablebodytext">' . ($fr["B_YESTERDAY_HITS"] > 0 ? $fr["B_YESTERDAY_HITS"] : " ") . '</font></td> <td align="right" class="tablebody3"><font class="tablebodytext">' . ($fr["TOTAL_HITS"] > 0 ? $fr["TOTAL_HITS"] : " ") . '</font></td> </tr> '; } } $HTML_SEARCHERS .= ' <tr valign="top"> <td align="right" class="tablebody1_sel" style="padding:3px"><font class="tablebodytext">' . GetMessage("STAT_TOTAL") . '</font></td> <td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_TODAY_HITS > 0 ? $total_TODAY_HITS : " ") . '</font></td> <td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_YESTERDAY_HITS > 0 ? $total_YESTERDAY_HITS : " ") . '</font></td> <td align="right" class="tablebody2_sel" style="padding:3px"><font class="tablebodytext">' . ($total_B_YESTERDAY_HITS > 0 ? $total_B_YESTERDAY_HITS : " ") . '</font></td> <td align="right" class="tablebody3_sel" style="padding:3px"><font class="tablebodytext">' . ($total_TOTAL_HITS > 0 ? $total_TOTAL_HITS : " ") . '</font></td> </table> '; $HTML_FOOTER = ' </body> </html> '; $arEventFields = array("SERVER_TIME" => $now_full_date, "HTML_HEADER" => $HTML_HEADER, "HTML_FOOTER" => $HTML_FOOTER, "HTML_COMMON" => $HTML_COMMON, "HTML_ADV" => $HTML_ADV, "HTML_EVENTS" => $HTML_EVENTS, "HTML_REFERERS" => $HTML_REFERERS, "HTML_PHRASES" => $HTML_PHRASES, "HTML_SEARCHERS" => $HTML_SEARCHERS, "EMAIL_TO" => COption::GetOptionString("main", "email_from", "")); /* echo $HTML_HEADER."<br>"; echo $HTML_FOOTER."<br>"; echo $HTML_COMMON."<br>"; echo $HTML_ADV."<br>"; echo $HTML_EVENTS."<br>"; echo $HTML_REFERERS."<br>"; echo $HTML_PHRASES."<br>"; echo $HTML_SEARCHERS."<br>"; die(); */ CEvent::Send("STATISTIC_DAILY_REPORT", $arSite["ID"], $arEventFields); $MESS = $OLD_MESS; } return "SendDailyStatistics();"; }