Esempio n. 1
0
$u_today['from_t'] = $u_today['by_e_from_t'] + $u_today['by_f_from_t'] + $u_today['by_u_from_t'];
$u_today['from_o'] = $u_today['by_e_from_o'] + $u_today['by_f_from_o'] + $u_today['by_u_from_o'];
$u_today['from_s'] = $u_today['by_e_from_s'] + $u_today['by_f_from_s'] + $u_today['by_u_from_s'];
if ($u_today['from_a'] > $cur_month_max_h) {
    $cur_month_max_h = $u_today['from_a'];
}
if ($u_today['from_a'] > $cur_year_max_h) {
    $cur_year_max_h = $u_today['from_a'];
}
$u_month_sum['by_a'] = $u_today['from_a'];
$u_month_sum['by_e'] = $u_today['by_e'];
$u_month_sum['by_f'] = $u_today['by_f'];
$u_month_sum['by_u'] = $u_today['by_u'];
$u_last30 = array('from_c' => $u_summary['by_e_from_c_30d'] + $u_summary['by_f_from_c_30d'] + $u_summary['by_u_from_c_30d'], 'from_b' => $u_summary['by_e_from_b_30d'] + $u_summary['by_f_from_b_30d'] + $u_summary['by_u_from_b_30d'], 'from_p' => $u_summary['by_e_from_p_30d'] + $u_summary['by_f_from_p_30d'] + $u_summary['by_u_from_p_30d'], 'from_t' => $u_summary['by_e_from_t_30d'] + $u_summary['by_f_from_t_30d'] + $u_summary['by_u_from_t_30d'], 'from_o' => $u_summary['by_e_from_o_30d'] + $u_summary['by_f_from_o_30d'] + $u_summary['by_u_from_o_30d'], 'from_s' => $u_summary['by_e_from_s_30d'] + $u_summary['by_f_from_s_30d'] + $u_summary['by_u_from_s_30d'], 'from_a' => $u_summary['by_e_30d'] + $u_summary['by_f_30d'] + $u_summary['by_u_30d']);
// Находим параметры прогнозируемого параметра юзера.
if ($prm_is_PRO && ($y_prm_p = promotion::GetUserProPeriods($uid, $YEAR . '-01-01', TRUE)) || $prm_is_FP && ($y_prm_p = promotion::GetUserPsPeriods($uid, $YEAR . '-01-01')) || $prm_is_CTG && ($y_prm_p = promotion::GetUserPsPeriods($uid, $YEAR . '-01-01', -1, '<>'))) {
    // периоды в каталоге за год.
    // Вычисляем последний период использованный(зуемый) юзером, плюс склеиваем
    // смежные периоды в один отрезок (нужно для страницы прогнозов платных мест в каталоге).
    foreach ($y_prm_p as $pp) {
        $fday = substr($pp['from_time'], 0, 10);
        $tday = substr($pp['to_time'], 0, 10);
        $ltime = 0;
        if ($u_last_prm_period && ($ltime = strtotime($u_last_prm_period['to_day'])) >= strtotime($tday)) {
            continue;
        }
        if ($ltime >= strtotime($fday)) {
            $u_last_prm_period['to_day'] = $tday;
            $u_last_prm_period['to_time'] = $pp['to_time'];
        } else {
            if ($u_last_prm_period) {