3 if (!class_exists(
"report_user_per_group")) {
 
    7     class Report_user_per_group 
extends report_base
 
   15         protected $_sThisTemplate = 
"report_user_per_group.tpl";
 
   22         public function drawReport()
 
   24             $sQ = 
"SELECT 1 FROM oxobject2group, oxuser, oxgroups 
   25                WHERE oxobject2group.oxobjectid = oxuser.oxid AND 
   26                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) {
 
   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);
 
   74             $graph->setBackgroundImage(
$myConfig->getImageDir(
true) . 
"/reportbgrnd.jpg", BGIMG_FILLFRAME);
 
   82             $graph->title->setFont(FF_FONT1, FS_BOLD);
 
   85             $bplot = 
new PiePlot3D($aDataX);
 
   88             $bplot->setCenter(0.5, 0.32);
 
   91             $bplot->explodeAll(10);
 
   93             foreach ($aDataX as $iVal) {
 
   96             for ($iCtr = 0; $iCtr < count($aDataX); $iCtr++) {
 
   97                 $iSLeng = strlen($aDataY[$iCtr]);
 
  100                         $aDataY[$iCtr] = trim(substr($aDataY[$iCtr], 0, 20)) . 
"...";
 
  104                 $aDataY[$iCtr] .= 
" - " . $aDataX[$iCtr] . 
" Kund.";
 
  106             $bplot->setLegends($aDataY);
 
  108             if (count($aDataX) > 10) {
 
  109                 $graph->legend->pos(0.49, 0.66, 
'center');
 
  110                 $graph->legend->setFont(FF_FONT0, FS_NORMAL);
 
  111                 $graph->legend->setColumns(4);
 
  113                 $graph->legend->pos(0.49, 0.70, 
'center');
 
  114                 $graph->legend->setFont(FF_FONT1, FS_NORMAL);
 
  115                 $graph->legend->setColumns(2);