3 if (!class_exists(
"report_user_per_group")) {
9 class Report_user_per_group
extends report_base
17 protected $_sThisTemplate =
"report_user_per_group.tpl";
24 public function drawReport()
26 $sQ =
"SELECT 1 FROM oxobject2group, oxuser, oxgroups
27 WHERE oxobject2group.oxobjectid = oxuser.oxid AND
28 oxobject2group.oxgroupsid = oxgroups.oxid";
36 public function user_per_group()
46 $sSQL =
"SELECT oxgroups.oxtitle,
51 WHERE oxobject2group.oxobjectid = oxuser.oxid AND
52 oxobject2group.oxgroupsid = oxgroups.oxid
53 GROUP BY oxobject2group.oxgroupsid
54 ORDER BY oxobject2group.oxgroupsid";
56 $rs = $oDb->execute($sSQL);
57 if ($rs !=
false && $rs->recordCount() > 0) {
60 $aDataX[] = $rs->fields[1];
61 $aDataY[] = $rs->fields[0];
67 header(
"Content-type: image/png");
70 if (count($aDataX) > 10) {
71 $graph =
new PieGraph(800, 830);
73 $graph =
new PieGraph(600, 600);
76 $graph->setBackgroundImage(
$myConfig->getImageDir(
true) .
"/reportbgrnd.jpg", BGIMG_FILLFRAME);
84 $graph->title->setFont(FF_FONT1, FS_BOLD);
87 $bplot =
new PiePlot3D($aDataX);
90 $bplot->setCenter(0.5, 0.32);
93 $bplot->explodeAll(10);
95 foreach ($aDataX as $iVal) {
98 for ($iCtr = 0; $iCtr < count($aDataX); $iCtr++) {
99 $iSLeng = strlen($aDataY[$iCtr]);
102 $aDataY[$iCtr] = trim(substr($aDataY[$iCtr], 0, 20)) .
"...";
106 $aDataY[$iCtr] .=
" - " . $aDataX[$iCtr] .
" Kund.";
108 $bplot->setLegends($aDataY);
110 if (count($aDataX) > 10) {
111 $graph->legend->pos(0.49, 0.66,
'center');
112 $graph->legend->setFont(FF_FONT0, FS_NORMAL);
113 $graph->legend->setColumns(4);
115 $graph->legend->pos(0.49, 0.70,
'center');
116 $graph->legend->setFont(FF_FONT1, FS_NORMAL);
117 $graph->legend->setColumns(2);