53 if ( ($to = Option::get(
'conversion',
'START_DATE_TIME',
'undefined')) !=
'undefined'
55 && ($to =
new DateTime($to,
'Y-m-d H:i:s'))
56 && $to->format(
'Y-m-d H:i:s') > $from->
format(
'Y-m-d H:i:s')
57 && Option::get(
'conversion',
'GENERATE_INITIAL_DATA',
'undefined') ==
'undefined')
59 Option::set(
'conversion',
'GENERATE_INITIAL_DATA',
'generated');
67 foreach (EventManager::getInstance()->findEventHandlers(
'conversion',
'OnGenerateInitialData') as $handler)
69 $result = ExecuteModuleEventEx($handler, array($from, $to));
71 foreach ($result as $row)
74 $context->attributes = array();
75 $context->setAttributes($row[
'ATTRIBUTES']);
78 if ($dayCounters =& $data[$context->id])
80 self::appendDayCounters($dayCounters, $row[
'DAY_COUNTERS']);
84 $dayCounters = $row[
'DAY_COUNTERS'];
94 unset($numerators[
'conversion_visit_day']);
96 foreach ($data as
$id => $dayCounters)
100 foreach ($dayCounters as $day => $counters)
102 $day =
new Date($day,
'Y-m-d');
107 unset($counters[
'conversion_visit_day']);
109 foreach ($counters as $name => $value)
111 $context->addCounter($day, $name, $value);
113 if ($numerators[$name])
120 $context->addCounter($day,
'conversion_visit_day', $visitQuantity ? round($visitSum / $visitQuantity * 100) + 1 : 1);