<?php
include '../../inc/config.inc.php';
include '../../inc/wap_tags.inc.php';
include '../../inc/functions.inc.php';
connect_to_db();
$today = date("Ymd");
$week_day = date("w");
print "<chart>\n";
print " <chart_data>\n";
print " <row>\n";
print " <string></string>\n";
$tel = array(
"Siemens",
"Nokia",
"Samsung",
"Motorola",
"LG",
"Sagem",
"SonyEricsson",
"Alcatel",
"Sharp",
"Pantech",
"Panasonic",
"Other"
);
// подсчет когад браузер не отределен
//$result = mysql_query("SELECT `Siemens`,`Nokia`,`Samsung`,`Motorola`,`LG`,`Sagem`,`SonyEricsson`,`Alcatel`,`Sharp`,`Pantech`,`Panasonic`,`Other` FROM `weeks` WHERE `date`=$today AND `day_week`=$week_day AND `uid`=$uid LIMIT 1");
$result = mysql_query("SELECT sum(`Siemens`),sum(`Nokia`),sum(`Samsung`),sum(`Motorola`),sum(`LG`),sum(`Sagem`),sum(`SonyEricsson`),sum(`Alcatel`),sum(`Sharp`),sum(`Pantech`),sum(`Panasonic`),sum(`Other`) FROM `weeks` WHERE `date`=".$today." AND `day_week`=".$week_day." AND `uid`!=1;");
$tel_data = mysql_fetch_row($result);
if (empty($tel_data)) $tel_data = array (0,0,0,0,0,0,0,0,0,0,0,0);
foreach ($tel_data as $index => $value)
{
if($value != 0)print " <string>".$tel[$index]."</string>\n";;
//print "".$value."\n";;
}
print " </row>\n";
print " <row>\n";
print " <string></string>\n";
foreach ($tel_data as $index => $value)
{
if($value != 0)print " <number>".$value."</number>\n";;
//print "".$value."\n";;
}
print " </row>\n";
print " </chart_data>\n";
print " <chart_grid_h alpha=\"20\" color=\"000000\" thickness=\"0\" type=\"solid\" />\n";
print " <chart_rect x=\"20\" y=\"7\" width=\"590\" height=\"190\" />\n";
print " <chart_type>3d pie</chart_type>\n";
echo " <chart_label shadow='low' color='ffffff' alpha='95' size='10' position='inside' as_percentage='true' />\n";
print " <chart_value color=\"cccccc\" alpha=\"90\" font=\"arial\" bold=\"1\" size=\"10\" position=\"inside\" prefix=\"\" suffix=\"\" decimals=\"0\" separator=\"\" as_percentage=\"1\" />\n";
print " <legend_label layout=\"horizontal\" bullet=\"circle\" font=\"arial\" bold=\"1\" size=\"13\" color=\"333333\" alpha=\"85\" />\n";
print " <legend_rect height=\"10\" />\n";
print "\n";
print " <series_explode>\n";
print " <value>5</value>\n";
print " <value>5</value>\n";
print " <value>5</value>\n";
print " <value>5</value>\n";
print " <value>5</value>\n";
print " <value>9</value>\n";
print " <value>5</value>\n";
print " <value>5</value>\n";
print " <value>5</value>\n";
print " <value>5</value>\n";
print " <value>5</value>\n";
print " <value>5</value>\n";
print " </series_explode>\n";
print "</chart>\n";
?>