Location: PHPKode > projects > QT-registrations > qtregistrations/qtr_stats_g.php
<?php

// QT-registrations 2.4 build:20100313

include('qtr_stats_inc_g.php');

// Display title & option

echo '<table class="hidden" cellspacing="0">',N;
echo '<tr class="hidden">',N;
echo '<td><h2>',$y,($s>=0 ? ' '.$oVIP->sections[$s] : ''),($type=='I' ? ' '.$L['Inspections'] : ''),($type=='A' ? ' '.$L['Newss'] : ''),(empty($tag) ? '' : ', '.$L['With_tag'].' '.str_replace(';',' '.$L['or'].' ',$tag)),'</h2></td>',N;
If ( $oVIP->output=='screen' ) echo '<td class="small" style="text-align:right">',implode(' &middot; ',$arrMenuTime),'</td>',N;
echo '</tr></table>
';

// Display table header

echo '<table class="data_t" cellspacing="0">
<tr class="data_t">
<td class="th_o" style="width:85px">&nbsp;</td>
<td class="th_o" style="width:14px">&nbsp;</td>
';
switch($ch['time'])
{
case 'q': for ($i=1;$i<=$intMaxBt;$i++) { echo '<td class="th_o" style="text-align:center;">Q',$i,'</td>'; } break;
case 'm': for ($i=1;$i<=$intMaxBt;$i++) { echo '<td class="th_o" style="text-align:center;">',$L['dateMM'][$i],'</td>'; } break;
case 'd': for ($i=1;$i<=$intMaxBt;$i++) { echo '<td class="th_o" style="text-align:center;">',str_replace(' ','<br/>',QTdatestr(DateAdd($strTendaysago,$i,'day'),'d M','')),'</td>'; } break;
}
echo '<td class="th_o" style="text-align:center;"><b>',($ch['time']=='d' ? '10 '.strtolower($L['Days']) : $L['Year']),'</b></td>
</tr>';

// DISPLAY TOPICS

echo '<tr class="data_o">',N;
echo '<td class="th_o">',$L['Topics'],'</td>',N;
echo '<td class="th_o"><div style="margin:0 auto;background-color:#000066;width:8px;height:10px">&nbsp;</div></td>',N;
for ($intBt=1;$intBt<=$intMaxBt;$intBt++) 
{
  if ( isset($arrT[$y][$intBt]) ) { $str=$arrT[$y][$intBt]; } else { $str='&middot;'; }
  if ( $oVIP->output=='screen' && !empty($arrT[$y][$intBt]) && $ch['time']=='m' ) $str='<a href="'.Href('qtr_find.php').'?a=tst&amp;y='.$y.'&amp;k1='.$intBt.'&amp;s='.$s.'&amp;k2=-1">'.$arrT[$y][$intBt].'</a>';
  echo '<td class="td_o" style="text-align:center;">',$str,'</td>',N;
}
if ( $oVIP->output=='screen' && $arrTs[$y] && $ch['time']=='m' ) { $str='<a href="'.Href('qtr_find.php').'?a=tst&amp;y='.$y.'&amp;k1=y&amp;s='.$s.'&amp;k2=-1">'.$arrTs[$y].'</a>'; } else { $str=$arrTs[$y]; }
echo '<td class="td_o" style="text-align:center;padding:5px;"><b>',$str,'</b></td>',N;
echo '</tr>';

// DISPLAY REPLIES

echo '<tr class="data_o">',N;
echo '<td class="th_o">',$L['Replys'],'</td>',N;
echo '<td class="th_o"><div style="margin:0 auto;background-color:#990099;width:8px;height:10px">&nbsp;</div></td>',N;
for ($intBt=1;$intBt<=$intMaxBt;$intBt++) 
{
  echo '<td class="td_o" style="text-align:center;">',(isset($arrM[$y][$intBt]) ? $arrM[$y][$intBt] : '&middot;'),'</td>',N;
}
echo '<td class="td_o" style="text-align:center;padding:5px;"><b>',$arrMs[$y],'</b></td>',N;
echo '</tr>';

// DISPLAY USERS

echo '<tr class="data_o">',N;
echo '<td class="th_o">',$L['Users'],'*</td>',N;
echo '<td class="th_o"><div style="margin:0 auto;background-color:#009999;width:8px;height:10px">&nbsp;</div></td>',N;
for ($intBt=1;$intBt<=$intMaxBt;$intBt++) 
{
  if ( isset($arrU[$y][$intBt]) ) { $str=$arrU[$y][$intBt]; } else { $str='&middot;'; }
  if ( $oVIP->output=='screen' && !empty($arrU[$y][$intBt]) && $ch['time']=='m' ) $str='<a href="'.Href('qtr_stat.php').'?y='.$y.'&amp;m='.$intBt.'&amp;s='.$s.'">'.$arrU[$y][$intBt].'</a>';
  echo '<td class="td_o" style="text-align:center;">',$str,'</td>',N;
}
if ( $oVIP->output=='screen' && $arrUs[$y] && $ch['time']=='m' ) { $str='<a href="'.Href('qtr_stat.php').'?y='.$y.'&amp;s='.$s.'">'.$arrUs[$y].'</a>'; } else { $str=$arrUs[$y]; }
echo '<td class="td_o" style="text-align:center;padding:5px;"><b>',$str,'</b></td>',N;
echo '</tr>
</table>
';

echo '<p>*  <span class="small">',$L['Distinct_users'],'</span></p>
';

// After values display, change the null values to zero to be able to make charts

foreach($arrYears as $y)
{
$arrT[$y] = QTarrayzero($arrT[$y]);
$arrM[$y] = QTarrayzero($arrM[$y]);
$arrU[$y] = QTarrayzero($arrU[$y]);
}

// PCHART OR CHART

if ( file_exists('pChart/pChart.class') && file_exists('pChart/pData.class') && file_exists('pChart/pCache.class') && !isset($_GET['oldgraph']) )
{
  // Standard inclusions and prepare CACHE
  include('pChart/pData.class');
  include('pChart/pChart.class');
  include('pChart/pCache.class');
  $Cache = new pCache('pChart/Cache/');

  // Check cache, clear cache if to much files
  $intHandle = opendir('pChart/Cache');
  $i = 0;
  while ( false!==($strFile = readdir($intHandle)) ) $i++;
  closedir($intHandle);
  if ( $i>60 || isset($_GET['clearcache']) ) $Cache->ClearCache();
  
  // -------
  // Graphs
  // -------

  // charttitle,abscise,datasets,datasetnames,graphoptions,filename,color,cumul
  $strChart1 = QTpchart(
    $L['Topics_per_'.$ch['time']].($ch['value']=='p' ? ' (%)' : ''),
    $arrA,
    array( 'Serie1'=>$arrT[$y] ),
    array( 'Serie1'=>$y ),
    $ch,
    $tt.'1'.$y.implode('',$ch),
    1);
  $strChart2 = QTpchart(
    $L['Topics_per_'.$ch['time'].'_cumul'].($ch['value']=='p' ? ' (%)' : ''),
    $arrA,
    array( 'Serie1'=>$arrT[$y] ),
    array( 'Serie1'=>$y ),
    $ch,
    $tt.'2'.$y.implode('',$ch),
    1,true); //cumul
  $strChart3 = QTpchart(
    $L['Replies_per_'.$ch['time']].($ch['value']=='p' ? ' (%)' : ''),
    $arrA,
    array( 'Serie1'=>$arrM[$y] ),
    array( 'Serie1'=>$y ),
    $ch,
    $tt.'3'.$y.implode('',$ch),
    2);
  $strChart4 = QTpchart(
    $L['Users_per_'.$ch['time']].($ch['value']=='p' ? ' (%)' : ''),
    $arrA,
    array( 'Serie1'=>$arrU[$y] ),
    array( 'Serie1'=>$y ),
    $ch,
    $tt.'4'.$y.implode('',$ch),
    3);

  // -------
  // DISPLAY
  // -------

  if ( $oVIP->output=='screen' ) echo '<p class="small" style="text-align:right">',implode(' &middot; ',$arrMenuType),' | ',implode(' &middot; ',$arrMenuValue),'</p>';

  echo '<table class="hidden" cellspacing="0">',N;
  echo '<tr class="hidden">',N;
  echo '<td class="hidden"><img src="'.$strChart1.'"/></td>',N;
  echo '<td class="hidden" style="text-align:right"><img src="'.$strChart2.'"/></td>',N;
  echo '</tr>';
  echo '<tr class="hidden">',N;
  echo '<td class="hidden"><img src="'.$strChart3.'"/></td>',N;
  echo '<td class="hidden" style="text-align:right"><img src="'.$strChart4.'"/></td>',N;
  echo '</tr>';
  echo '</table>';
  
}
elseif ( file_exists('bin/qt_lib_graph.php') && file_exists($_SESSION[QT]['skin_dir'].'/qtr_main2.css') )
{

  if ( $oVIP->output=='screen' ) echo '<p class="small" style="text-align:right">',implode(' &middot; ',$arrMenuValue),'</p>';
  
  // Topics & cumulated topics
  
  echo '<table class="data_t" cellspacing="0">',N;
  echo '<tr class="data_t">',N;

  echo '<td class="td_o" style="width:355px">',N;
  
  if ( $ch['value']=='a' ) 
  {
  QTbarchart(QTarraymerge($arrA,$arrT[$y]),320,100,QTroof($arrT[$y]),2,true,$L['Topics_per_'.$ch['time']],'','1');
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,QTpercent($arrT[$y])),350,100,100,2,'P',$L['Topics_per_'.$ch['time']].' (%)','','1');
  }

  echo '</td>',N;  
  echo '<td class="td_o">&nbsp;</td>',N;
  echo '<td class="td_o" style="width:355px">',N;

  if ( $ch['value']=='a' ) 
  {
  QTbarchart(QTarraymerge($arrA,QTcumul($arrT[$y])),320,100,QTroof(QTcumul($arrT[$y])),2,true,$L['Topics_per_'.$ch['time'].'_cumul'],'','1');
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,QTcumul(QTpercent($arrT[$y],2))),350,100,100,2,'P',$L['Topics_per_'.$ch['time'].'_cumul'].' (%)','','1');
  }
  echo '</td>',N;
  echo '</tr>',N;
  
  // Replies & Users
  
  echo '<tr class="data_o">',N;

  echo '<td class="td_o" style="width:355px">',N;
  
  if ( $ch['value']=='a' ) 
  {
  QTbarchart(QTarraymerge($arrA,$arrM[$y]),320,100,QTroof($arrM[$y]),2,true,$L['Replies_per_'.$ch['time']],'','2');
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,QTpercent($arrM[$y])),350,100,100,2,'P',$L['Replies_per_'.$ch['time']].' (%)','','2');
  }

  echo '</td>',N;  
  echo '<td class="td_o">&nbsp;</td>',N;
  echo '<td class="td_o" style="width:355px">',N;

  if ( $ch['value']=='a' ) 
  {
  QTbarchart(QTarraymerge($arrA,$arrU[$y]),320,100,QTroof($arrM[$y]),2,true,$L['Users_per_'.$ch['time']],'','3');
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,QTpercent($arrU[$y])),350,100,100,2,'P',$L['Users_per_'.$ch['time']].' (%)','','3');
  }
  echo '</td>',N;
  echo '</tr></table>',N;

}
else
{
  echo '<p class="small">Graphs cannot be displayed because one of these files is missing: bin/qt_lib_graph.php, ',$_SESSION[QT]['skin_dir'].'/qtr_main2.css</p>';
}

?>
Return current item: QT-registrations