6 ? 0 : $ind; } function tabecho($value) { echo (double)$value>0?$value:'-'; } function WeekInit() // reset week data { global $week; $week['num']=''; for ($i=0; $i<7; $i++) { $week['date'][$i]=''; $week['views'][$i]=0; $week['clicks'][$i]=0; $week["ctr"][$i]=0; $week['unix_time'][$i]=0; } } function WeekSetDates() // set all missing dates in week { global $week; global $php_week_sign; // find first col with valid date $i=0; while(empty($week['date'][$i])){$i++;} // calc timestamp for first row $stamp = $week['unix_time'][$i]-$i*24*60*60; // adjust timestamp to country settings if needed if ($i==0 && $GLOBALS['phpAds_begin_of_week']==1) $stamp -= 7*24*60*60; // check all day rows for ($i=0;$i<7;$i++) { // fill date in row if empty if (empty($week['date'][$i])) { $mult = $i; // adjust multiplier to country settings if needed if ($mult==0 && $GLOBALS['phpAds_begin_of_week']==1) $mult=7; // sunday (col=0) is last day of the week $week['date'][$i] = strftime($GLOBALS['date_format'],$stamp+$mult*24*60*60); } } // check calendar week for zero value if (strftime($php_week_sign,$stamp) == 0) // replace by last calendar week of elapsed year $week['num']=strftime($php_week_sign."/Y",mktime(0,0,0,12,31,strftime('Y',$stamp)-1)); } function WeekStat() // calculate daily ctr and summary { global $week; $weekdays_complete = 0; $week['clicksum']=0; $week['viewsum']=0; $week['days_set']=0; for ($i=0; $i<7; $i++) { $week["ctr"][$i] = $week['views'][$i] > 0 ? $week['clicks'][$i]/$week['views'][$i]*100 : 0; if ($week['views'][$i]) { $week['viewsum']+=$week['views'][$i]; $week['days_set']++; } if ($week['clicks'][$i]) { $week['clicksum']+=$week['clicks'][$i]; } if (empty($week['date'][$i]) && !$weekdays_complete) { WeekSetDates(); // set all missing dates $weekdays_complete=1; } } $week['ctrsum'] = $week['viewsum'] > 0 ? $week['clicksum']/$week['viewsum']*100 : 0; } function WeekFill($day_array, $actweek) // insert actual day in weekly data { global $week, $php_week_sign; $week['num'] = $day_array['week_num']; // internally work with sunday = 0 $day_of_week = $day_array['day_num']; $week['views'][$day_of_week]=$day_array['views']; $week['clicks'][$day_of_week]=$day_array['clicks']; $week['date'][$day_of_week]=$day_array['date']; $week['unix_time'][$day_of_week]=$day_array['unix_time']; } function WeekPrint() // html generator for one week { global $week; global $phpAds_percentage_decimals; static $j=1; if ( $week['num'] ) // only if already filled (not at first call) { // set background color $bgcolor=$GLOBALS['phpAds_table_back_color_alternative'];; $j % 2 ? 0: $bgcolor = $GLOBALS['phpAds_table_back_color']; $j++; WeekStat(); // calculate daily ctr and summary echo sprintf(" \n", $GLOBALS['strWeek'], $week['num'] ); ?>     0?$week['viewsum']/$week['days_set']:0; ?> 0?$week['clicksum']/$week['days_set']:0; ?> 0?$week['ctrsum']/$week['days_set']:0; ?>   1 ) { ?>
%s",$which=0?$GLOBALS["strClientNoStats"]:$GLOBALS["strBannerNoStats"]); else { ?> ">
".$strDayShortCuts[DayInd($i)]."\n"; } ?> = $max_weeks ) break; WeekPrint(); // print old week $oldweek = $actweek; WeekInit(); $weeks_done++; // reset old values } WeekFill( $days[$i], $actweek ); // insert daily data into weeks data } WeekPrint(); // print the last week ?>
"> ">  "> "> ">
0?sprintf(" %.".$GLOBALS['phpAds_percentage_decimals']."f%%",$total_clicks/$total_views*100):0); ?>