Exemple #1
0
    }
    $scale = $topRateType['SCALE'];
} else {
    $topRateName = null;
    $topRateType = null;
    $scale = array(0.5, 1, 1.5, 2, 5);
}
// FILTER
$filter = array('from' => $from->toString(), 'to' => $to->toString(), 'site' => $site, 'split' => $attributeGroupName, 'rate' => $topRateName);
CUserOptions::SetOption('conversion', 'filter', array_merge($userOptions, $filter));
$filter['lang'] = LANGUAGE_ID;
// CONTEXT
GeneratorContext::generateInitialData($from);
$context = new ReportContext();
$context->setAttribute('conversion_site', $site);
$splitRates = $context->getSplitRatesDeprecated($splits, $rateTypes, array('>=DAY' => $from, '<=DAY' => $to), array('FORMAT' => 'Y-m-d', 'SELECT' => 'RATE'));
$totalRates = $splitRates['total'];
unset($splitRates['total']);
if ($totalTopRate = reset($totalRates)) {
    $totalTopDenominator = $totalTopRate['DENOMINATOR'];
    $totalTopConversion = $totalTopRate['RATE'] * 100;
} else {
    $totalTopDenominator = 0;
    $totalTopConversion = 0;
}
// VIEW
require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_admin_after.php';
require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/conversion/admin/helpers/scale.php';
$APPLICATION->SetTitle(Loc::getMessage('CONVERSION_SUMMARY_TITLE'));
CJSCore::Init(array('amcharts', 'amcharts_serial'));
function conversion_renderRate(array $rate, array $rateType)
Exemple #2
0
        }
    }
});
// SPLITS
$splits = array();
foreach ($attributeTypes[$splitByAttribute]['VALUES'] as $name => $type) {
    $splits[$name] = array('NAME' => $splitByAttribute, 'VALUE' => $name, 'TITLE' => $type['NAME']);
}
// CONTEXT
$context = new ReportContext();
foreach ($attributeTypes as $name => $type) {
    if ($value = $filter[$name]) {
        $context->setAttribute($name, $value);
    }
}
$splitRates = $context->getSplitRatesDeprecated($splits, array($rateName => $rateType), array('>=DAY' => $filter['from'], '<=DAY' => $filter['to']));
unset($splitRates['total'], $splitRates['other']);
// TODO loop through getRates
// LIST
$adminList = new CAdminList($sTableID, $oSort);
$adminList->AddHeaders(array(array('id' => 'TITLE', 'default' => true, 'content' => Loc::getMessage('CONVERSION_DETAILED_HEAD_TITLE')), array('id' => 'CONVERSION', 'default' => true, 'content' => Loc::getMessage('CONVERSION_DETAILED_HEAD_CONVERSION')), array('id' => 'SUM', 'default' => true, 'content' => Loc::getMessage('CONVERSION_DETAILED_HEAD_SUM')), array('id' => 'ACHIEVEMENTS', 'default' => true, 'content' => Loc::getMessage('CONVERSION_DETAILED_HEAD_ACHIEVEMENTS')), array('id' => 'TRAFFIC', 'default' => true, 'content' => Loc::getMessage('CONVERSION_DETAILED_HEAD_TRAFFIC'))));
foreach ($splitRates as $name => $rates) {
    $split = $splits[$name];
    $rate = current($rates);
    $row =& $adminList->AddRow();
    $row->AddField('TITLE', $split['TITLE']);
    $row->AddField('CONVERSION', number_format($rate['RATE'] * 100, 2) . ' %');
    $row->AddField('SUM', isset($rate['SUM']) ? isset($rateType['FORMAT']['SUM']) ? $rateType['FORMAT']['SUM']($rate['SUM']) : $rate['SUM'] : '');
    $row->AddField('ACHIEVEMENTS', number_format($rate['NUMERATOR']));
    $row->AddField('TRAFFIC', number_format($rate['DENOMINATOR']));
}