3 if ( !class_exists(
"report_user_per_group")) {
7 class Report_user_per_group
extends report_base
14 protected $_sThisTemplate =
"report_user_per_group.tpl";
21 public function drawReport()
23 $sQ =
"SELECT 1 FROM oxobject2group, oxuser, oxgroups
24 WHERE oxobject2group.oxobjectid = oxuser.oxid AND
25 oxobject2group.oxgroupsid = oxgroups.oxid";
34 public function user_per_group()
44 $sSQL =
"SELECT oxgroups.oxtitle,
49 WHERE oxobject2group.oxobjectid = oxuser.oxid AND
50 oxobject2group.oxgroupsid = oxgroups.oxid
51 GROUP BY oxobject2group.oxgroupsid
52 ORDER BY oxobject2group.oxgroupsid";
54 $rs = $oDb->execute( $sSQL);
55 if ($rs !=
false && $rs->recordCount() > 0) {
57 if ( $rs->fields[1]) {
58 $aDataX[] = $rs->fields[1];
59 $aDataY[] = $rs->fields[0];
65 header (
"Content-type: image/png" );
68 if (count($aDataX) > 10)
69 $graph =
new PieGraph(800, 830);
71 $graph =
new PieGraph(600, 600);
73 $graph->setBackgroundImage(
$myConfig->getImageDir(
true).
"/reportbgrnd.jpg", BGIMG_FILLFRAME);
81 $graph->title->setFont(FF_FONT1, FS_BOLD);
84 $bplot =
new PiePlot3D($aDataX);
87 $bplot->setCenter(0.5, 0.32);
90 $bplot->explodeAll(10);
92 foreach ($aDataX as $iVal)
94 for ($iCtr = 0; $iCtr < count($aDataX); $iCtr++) {
95 $iSLeng = strlen($aDataY[$iCtr]);
98 $aDataY[$iCtr] = trim(substr($aDataY[$iCtr], 0, 20)).
"...";
101 $aDataY[$iCtr] .=
" - ".$aDataX[$iCtr].
" Kund.";
103 $bplot->setLegends($aDataY);
105 if (count($aDataX) > 10) {
106 $graph->legend->pos(0.49, 0.66,
'center');
107 $graph->legend->setFont(FF_FONT0, FS_NORMAL);
108 $graph->legend->setColumns(4);
110 $graph->legend->pos(0.49, 0.70,
'center');
111 $graph->legend->setFont(FF_FONT1, FS_NORMAL);
112 $graph->legend->setColumns(2);