15 $userNode = eZUser::currentUser()->contentObject()->mainNode();
21 $host =
$ini->variable(
'DatabaseSettings',
'Server');
28 $db = ezcDbFactory::create(
"mysql://{$user}:{$passwd}@{$host}/{$dbname}" );
33 $datamap = $child->object()->dataMap();
34 $ages = array_filter(explode(
';',$datamap[
'age_slot2']->content()));
36 foreach ($ages as $age) {
37 $nodes[$age][] = $child->attribute(
'node_id');
41 $hash_i18n = array(0 => ezpI18n::tr(
'ipediatre/ages',
'0-3 months'),
42 1 => ezpI18n::tr(
'ipediatre/ages',
'4-6 months'),
43 2 => ezpI18n::tr(
'ipediatre/ages',
'7-9 months'),
44 3 => ezpI18n::tr(
'ipediatre/ages',
'10-12 months'),
45 4 => ezpI18n::tr(
'ipediatre/ages',
'1 year'),
46 5 => ezpI18n::tr(
'ipediatre/ages',
'2-3 years'));
52 foreach(
$nodes as $k=>$n) {
53 $q =
$db->createSelectQuery();
56 ->from(
'ipediatre_visits')
57 ->where(
$q->expr->in(
'node_id', $n))
62 $data[
" ".$hash_i18n[$k-1]] =
$rows[0];
66 $graph =
new ezcGraphPieChart();
67 $graph->legend->position = ezcGraph::RIGHT;
68 $graph->options->label =
'';
69 $graph->legend->portraitSize = 0.25;
71 if($Params[
'type'] !=
"svg")
73 $graph->driver =
new ezcGraphGdDriver();
74 $graph->options->font =
'design/standard/fonts/arial.ttf';
93 $graph->data[
'Access statistics'] =
new ezcGraphArrayDataSet($data);
95 $graph->renderToOutput(450,200);
98 }
catch(Exception $e) {
100 header(
"Content-Type: image/png");
101 $im = @imagecreate(1, 1);
102 $background_color = imagecolorallocate($im, 0, 0, 0);
108 eZExecution::cleanExit();