Location: PHPKode > projects > QuickTalk Forum > quicktalk/qtf_stats_out.php
<?php

// QuickTalk 2.5.1 build:20101027

switch($tt)
{

//--------
case 'g':
//--------

$arrSeries[$L['Topics']] = GetSerie($arrT,$arrTs,$y,$intMaxBt);
$arrSeries[$L['Replys']] = GetSerie($arrM,$arrMs,$y,$intMaxBt);
$arrSeries[$L['Users'].'*'] = GetSerie($arrU,$arrUs,$y,$intMaxBt);
// add link for serie month and output screen
if ( $ch['time']=='m' )
{
  for($intBt=1;$intBt<=$intMaxBt;$intBt++)
  {
  if ( !empty($arrT[$y][$intBt]) ) $arrSeries[$L['Topics']][$intBt]='<a href="'.Href('qtf_find.php').'?a=tst&amp;y='.$y.'&amp;k1='.$intBt.'&amp;s='.$s.'&amp;k2=-1">'.$arrT[$y][$intBt].'</a>';
  }
  if ( !empty($arrTs[$y]) ) $arrSeries[$L['Topics']][$intMaxBt+1]='<a class="bold" href="'.Href('qtf_find.php').'?a=tst&amp;y='.$y.'&amp;k1=y&amp;s='.$s.'&amp;k2=-1">'.$arrTs[$y].'</a>';
  
  for ($intBt=1;$intBt<=$intMaxBt;$intBt++)
  {
  if ( !empty($arrU[$y][$intBt]) ) $arrSeries[$L['Users'].'*'][$intBt]='<a href="'.Href('qtf_stat.php').'?y='.$y.'&amp;m='.$intBt.'&amp;s='.$s.'">'.$arrU[$y][$intBt].'</a>';
  }
  if ( !empty($arrUs[$y]) ) $arrSeries[$L['Users'].'*'][$intMaxBt+1]='<a class="bold" href="'.Href('qtf_stat.php').'?y='.$y.'&amp;s='.$s.'">'.$arrUs[$y].'</a>';
}

$arrSeriesColor = array($L['Topics']=>'#000066',$L['Replys']=>'#990099',$L['Users'].'*'=>'#009999');

QTtablechart($arrHeader,$arrSeries,$arrSeriesColor,array('th'=>'colhd','td'=>'colct'));

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

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

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

// PCHART OR CHART

if ( file_exists('pChart/pChart.class') && file_exists('pChart/pData.class') )
{
  // Abscise Label
  $arrA = GetAbscise($ch['time'],$intMaxBt,$strTendaysago);
  
  // Standard inclusions and prepare CACHE
  include('pChart/pData.class');
  include('pChart/pChart.class');
  if ( file_exists('pChart/pCache.class') )
  {
  include('pChart/pCache.class');
  $Cache = new pCache('pChart/Cache/'); // variable must be created here (re-used as global in QTpchart function)
  CheckChartCache($Cache);
  }

  // charttitle,abscise,dataset,datasetname,graphoptions,filename,color,cumul
  // note: language code is added to the filename to enable refreshing cached-graph when user change language.
  $strChart1 = QTpchart(
    $L['Topics_per_'.$ch['time']].($ch['value']=='p' ? ' (%)' : ''),
    $arrA,
    array( 'Serie1'=>$arrT[$y] ),
    array( 'Serie1'=>$y ),
    $ch,
    $tt.'1'.$y.implode('',$ch).$lang,
    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).$lang,
    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).$lang,
    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).$lang,
    3);
    
  // DISPLAY

  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'].'/qtf_main2.css') )
{

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

  echo '<td class="hidden" 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="hidden">&nbsp;</td>',N;
  echo '<td class="hidden" style="width:355px">',N;

  if ( $ch['value']=='a' ) 
  {
  QTbarchart(QTarraymerge($arrA,QTcumul($arrT[$y])),320,100,QTroof($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="hidden">',N;

  echo '<td class="hidden" 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="hidden">&nbsp;</td>',N;
  echo '<td class="hidden" 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'].'/qtf_main2.css</p>';
}
break;

//--------
case 'gt':
//--------

foreach($arrYears as $y)
{
$arrSeries[$L['Topics']] = GetSerie($arrT,$arrTs,$y,$intMaxBt);
$arrSeries[$L['Replys']] = GetSerie($arrM,$arrMs,$y,$intMaxBt);
$arrSeries[$L['Users'].'*'] = GetSerie($arrU,$arrUs,$y,$intMaxBt);
$arrSeriesColor = array($L['Topics']=>($y==$intCurrentYear ? '#000066' : '#00AFFF'),$L['Replys']=>($y==$intCurrentYear ? '#990099' : '#F1B8FF'),$L['Users'].'*'=>($y==$intCurrentYear ? '#009999' : '#00E7B7'));
QTtablechart($arrHeader,$arrSeries,$arrSeriesColor,array('th'=>'colhd','td'=>'colct'),$y);
}

echo '<p class="small" style="text-align:right">',implode(' &middot; ',$arrMenuTrend),'</p>';

$arrSeries[$L['Topics']] = GetSerieDelta($arrT,$arrTs,$y,$intMaxBt,$ch['trend']=='p');
$arrSeries[$L['Replys']] = GetSerieDelta($arrM,$arrMs,$y,$intMaxBt,$ch['trend']=='p');
$arrSeries[$L['Users'].'*'] = GetSerieDelta($arrU,$arrUs,$y,$intMaxBt,$ch['trend']=='p');
$arrSeriesColor = array($L['Topics']=>'',$L['Replys']=>'',$L['Users'].'*'=>'');
QTtablechart($arrHeader,$arrSeries,$arrSeriesColor,array('th'=>'colhd','td'=>'colct'),$L['Trends']);

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

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

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

// -----
// GRAPH
// -----

if ( file_exists('pChart/pChart.class') && file_exists('pChart/pData.class') )
{
  // abscise Label
  $arrA = GetAbscise($ch['time'],$intMaxBt,$strTendaysago);

  // Standard inclusions and prepare CACHE
  include('pChart/pData.class');
  include('pChart/pChart.class');
  if ( file_exists('pChart/pCache.class') )
  {
  include('pChart/pCache.class');
  $Cache = new pCache('pChart/Cache/'); // variable must be created here (re-used as global in QTpchart function)
  CheckChartCache($Cache);
  }

  // charttitle,abscise,dataset,datasetname,graphoptions,filename,color,cumul
  $strChart1 = QTpchart(
    $L['Topics_per_'.$ch['time']].($ch['value']=='p' ? ' (%)' : ''),
    $arrA,
    array( 'Serie1'=>$arrT[$y-1],'Serie2'=>$arrT[$y] ),
    array( 'Serie1'=>$y-1,'Serie2'=>$y ),
    $ch,
    $tt.'1'.$y.implode('',$ch).$lang,
    1);
  $strChart2 = QTpchart(
    $L['Replies_per_'.$ch['time']].($ch['value']=='p' ? ' (%)' : ''),
    $arrA,
    array( 'Serie1'=>$arrM[$y-1],'Serie2'=>$arrM[$y] ),
    array( 'Serie1'=>$y-1,'Serie2'=>$y ),
    $ch,
    $tt.'2'.$y.implode('',$ch).$lang,
    2);
  $strChart3 = QTpchart(
    $L['Users_per_'.$ch['time']].($ch['value']=='p' ? ' (%)' : ''),
    $arrA,
    array( 'Serie1'=>$arrU[$y-1],'Serie2'=>$arrU[$y] ),
    array( 'Serie1'=>$y-1,'Serie2'=>$y ),
    $ch,
    $tt.'3'.$y.implode('',$ch).$lang,
    3);
  
  // -------
  // DISPLAY
  // -------

  echo '<div style="margin:0 auto; width:600px">',N;
  echo '<p class="small" style="text-align:right">',implode(' &middot; ',$arrMenuType),'</p>';
  echo '<img src="'.$strChart1.'"/><br/>';
  echo '<img src="'.$strChart2.'"/><br/>';
  echo '<img src="'.$strChart3.'"/><br/>';
  echo '</div>',N;

}
elseif ( file_exists('bin/qt_lib_graph.php') && file_exists($_SESSION[QT]['skin_dir'].'/qtf_main2.css') )
{

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

  // TOPIC first serie
  
  $intTopY = QTroof( array(max($arrT[$y-1]),max($arrT[$y])) );
  
  echo '<table class="hidden" cellspacing="0">',N;
  echo '<tr class="hidden">',N;
  echo '<td class="hidden" style="width:355px">',N;
  
  if ( $ch['value']=='p' ) 
  {
  QTbarchart(QTarraymerge($arrA,QTpercent($arrT[$y-1])),350,100,$intTopY,2,'P',$L['Topics_per_'.$ch['time']].' (%)'.' '.($y-1));
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,$arrT[$y-1]),320,100,$intTopY,2,true,$L['Topics_per_'.$ch['time']].' '.($y-1));
  }

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

  // TOPIC second serie

  if ( $ch['value']=='p' ) 
  {
  QTbarchart(QTarraymerge($arrA,QTpercent($arrT[$y])),350,100,$intTopY,2,'P',$L['Topics_per_'.$ch['time']].' (%)'.' '.$y);
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,$arrT[$y]),320,100,$intTopY,2,true,$L['Topics_per_'.$ch['time']].' '.$y);
  }

  echo '</td>',N;
  echo '</tr>',N;

  // MESSAGE first serie
  
  $intTopY = QTroof( array(max($arrM[$y-1]),max($arrM[$y])) );
  
  echo '<tr class="hidden">',N;
  echo '<td class="hidden" style="width:355px">',N;
  
  if ( $ch['value']=='p' ) 
  {
  QTbarchart(QTarraymerge($arrA,QTpercent($arrM[$y-1])),350,100,$intTopY,2,'P',$L['Replies_per_'.$ch['time']].' (%)'.' '.($y-1),'','2');
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,$arrM[$y-1]),320,100,$intTopY,2,true,$L['Replies_per_'.$ch['time']].' '.($y-1),'','2');
  }

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

  // MESSAGE second serie

  if ( $ch['value']=='p' ) 
  {
  QTbarchart(QTarraymerge($arrA,QTpercent($arrM[$y])),350,100,$intTopY,2,'P',$L['Replies_per_'.$ch['time']].' (%)'.' '.$y,'','2');
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,$arrM[$y]),320,100,$intTopY,2,true,$L['Replies_per_'.$ch['time']].' '.$y,'','2');
  }

  echo '</td>',N;
  echo '</tr>',N;

  // USER first serie
  
  $intTopY = QTroof( array(max($arrU[$y-1]),max($arrU[$y])) );
  
  echo '<tr class="hidden">',N;
  echo '<td class="hidden" style="width:355px">',N;
  
  if ( $ch['value']=='a' ) 
  {
  QTbarchart(QTarraymerge($arrA,$arrU[$y-1]),320,100,$intTopY,2,true,$L['Users_per_'.$ch['time']].' '.($y-1),'','3');
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,QTpercent($arrU[$y-1])),350,100,$intTopY,2,'P',$L['Users_per_'.$ch['time']].' (%)'.' '.($y-1),'','3');
  }

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

  // USER second serie

  if ( $ch['value']=='a' ) 
  {
  QTbarchart(QTarraymerge($arrA,$arrU[$y]),320,100,$intTopY,2,true,$L['Users_per_'.$ch['time']].' '.$y,'','3');
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,QTpercent($arrU[$y])),350,100,$intTopY,2,'P',$L['Users_per_'.$ch['time']].' (%)'.' '.$y,'','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'].'/qtf_main2.css</p>';
}

break;

//--------
case 'd':
//--------

$arrSeries[$L['New_topics']]=GetSerie($arrN,$arrNs,$y,$intMaxBt);
$arrSeries[$L['Closed_topics']]=GetSerie($arrC,$arrCs,$y,$intMaxBt);
$arrSeries[$L['Backlog']]=GetSerie($arrT,$arrTs,$y,$intMaxBt);
$arrSeriesColor = array($L['New_topics']=>'#000066',$L['Closed_topics']=>'#990099',$L['Backlog']=>'#009999');

QTtablechart($arrHeader,$arrSeries,$arrSeriesColor,array('th'=>'colhd','td'=>'colct'));

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

foreach($arrYears as $intYear)
{
$arrT[$intYear] = QTarrayzero($arrT[$intYear]);
$arrN[$intYear] = QTarrayzero($arrN[$intYear]);
$arrC[$intYear] = QTarrayzero($arrC[$intYear]);
}

// PCHART OR CHART

if ( file_exists('pChart/pChart.class') && file_exists('pChart/pData.class') )
{
  // absciseLabel
  $arrA = GetAbscise($ch['time'],$intMaxBt,$strTendaysago);

  // Standard inclusions and prepare CACHE
  include('pChart/pData.class');
  include('pChart/pChart.class');
  if ( file_exists('pChart/pCache.class') )
  {
  include('pChart/pCache.class');
  $Cache = new pCache('pChart/Cache/'); // variable must be created here (re-used as global in QTpchart function)
  CheckChartCache($Cache);
  }
  
  // QTpchart(charttitle,abscise,dataset,datasetname,graphoptions,filename,color,cumul)
  // note: language code is added to the filename to enable refreshing cached-graph when user change language.
  $strChart1 = QTpchart(
    $L['New_topics'].($ch['value']=='p' ? ' (%)' : ''),
    $arrA,
    array( 'Serie1'=>$arrN[$y] ),
    array( 'Serie1'=>$y ),
    $ch,
    $tt.'1'.$y.implode('',$ch).$lang,
    1);
  $strChart2 = QTpchart(
    $L['Closed_topics'].($ch['value']=='p' ? ' (%)' : ''),
    $arrA,
    array( 'Serie1'=>$arrC[$y] ),
    array( 'Serie1'=>$y ),
    $ch,
    $tt.'2'.$y.implode('',$ch).$lang,
    2);
  $strChart3 = QTpchart(
    $L['Backlog'].($ch['value']=='p' ? ' (%)' : ''),
    $arrA,
    array( 'Serie1'=>$arrT[$y] ),
    array( 'Serie1'=>$y ),
    $ch,
    $tt.'3'.$y.implode('',$ch).$lang,
    3);
  $strChart4 = QTpchart(
    $L['Backlog_cumul'].($ch['value']=='p' ? ' (%)' : ''),
    $arrA,
    array( 'Serie1'=>$arrT[$y] ),
    array( 'Serie1'=>$y ),
    $ch,
    $tt.'4'.$y.implode('',$ch).$lang,
    3,true); //cumul

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

  echo '<p class="small" style="text-align:right">',implode(' &middot; ',$arrMenuType),'</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'].'/qtf_main2.css') )
{
    
  echo '<p class="small" style="text-align:right">',implode(' &middot; ',$arrMenuValue),'</p>';
  
  echo '<table class="data_t" cellspacing="0">',N;

  echo '<tr class="data_t">',N;
  echo '<td class="colhd" style="width:355px">',N;

  if ( $ch['value']=='p' ) 
  {
  QTbarchart(QTarraymerge($arrA,QTpercent($arrN[$y])),350,100,QTroof(QTpercent($arrN[$y])),2,'P',$L['New_topics'].' (%)');
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,$arrN[$y]),320,100,QTroof($arrN[$y]),2,true,$L['New_topics']);
  }
  
  echo '</td>',N;  
  echo '<td class="colhd">&nbsp;</td>',N;
  echo '<td class="colhd" style="width:355px">',N;

  if ( $ch['value']=='p' ) 
  {
  QTbarchart(QTarraymerge($arrA,QTpercent($arrC[$y])),350,100,QTroof(QTpercent($arrC[$y])),2,'P',$L['Closed_topics'].' (%)','','2');
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,$arrC[$y]),320,100,QTroof($arrC[$y]),2,true,$L['Closed_topics'],'','2');
  }
  
  echo '</td>',N;
  echo '</tr>',N;  

  echo '<tr class="data_o">',N;
  echo '<td class="colhd" style="width:355px">',N;

  if ( $ch['value']=='p' ) 
  {
  QTbarchart(QTarraymerge($arrA,QTpercent($arrT[$y])),350,100,100,2,'P',$L['Backlog'].' (%)','','3');
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,$arrT[$y]),320,100,QTroof($arrT[$y]),2,true,$L['Backlog'],'','3');
  }
  
  echo '</td>',N;
  echo '<td class="colhd">&nbsp;</td>',N;
  echo '<td class="colhd" style="width:355px">',N;

  if ( $ch['value']=='p' ) 
  {
  QTbarchart(QTarraymerge($arrA,QTcumul(QTpercent($arrT[$y]))),350,100,100,2,'P',$L['Backlog_cumul'].' (%)','','3');
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,QTcumul($arrT[$y])),320,100,QTroof(QTcumul($arrT[$y])),2,true,$L['Backlog_cumul'],'','3');
  }

  echo '</td>',N;
  echo '</tr>',N;
  echo '</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'].'/qtf_main2.css</p>';
}

break;

//--------
case 'dt':
//--------

foreach($arrYears as $y)
{
$arrSeries[$L['New_topics']] = GetSerie($arrN,$arrNs,$y,$intMaxBt);
$arrSeries[$L['Closed_topics']] = GetSerie($arrC,$arrCs,$y,$intMaxBt);
$arrSeriesColor = array($L['New_topics']=>($y==$intCurrentYear ? '#000066' : '#00AFFF'),$L['Closed_topics']=>($y==$intCurrentYear ? '#990099' : '#F1B8FF'));
QTtablechart($arrHeader,$arrSeries,$arrSeriesColor,array('th'=>'colhd','td'=>'colct'),$y);
}

echo '<p class="small" style="text-align:right">',implode(' &middot; ',$arrMenuTrend),'</p>';

$arrSeries[$L['New_topics']] = GetSerieDelta($arrN,$arrNs,$y,$intMaxBt,$ch['trend']=='p');
$arrSeries[$L['Closed_topics']] = GetSerieDelta($arrC,$arrCs,$y,$intMaxBt,$ch['trend']=='p');
$arrSeriesColor = array($L['New_topics']=>'',$L['Closed_topics']=>'');
QTtablechart($arrHeader,$arrSeries,$arrSeriesColor,array('th'=>'colhd','td'=>'colct'),$L['Trends']);

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

foreach($arrYears as $intYear)
{
$arrN[$intYear] = QTarrayzero($arrN[$intYear]);
$arrC[$intYear] = QTarrayzero($arrC[$intYear]);
}

// GRAPH

if ( file_exists('pChart/pChart.class') && file_exists('pChart/pData.class') )
{
  // abscise Label (2 characters)
  $arrA = GetAbscise($ch['time'],$intMaxBt,$strTendaysago);

  // Standard inclusions and prepare CACHE
  include('pChart/pData.class');
  include('pChart/pChart.class');
  if ( file_exists('pChart/pCache.class') )
  {
  include('pChart/pCache.class');
  $Cache = new pCache('pChart/Cache/'); // variable must be created here (re-used as global in QTpchart function)
  CheckChartCache($Cache);
  }
  
  // QTpchart(charttitle,abscise,dataset,datasetname,graphoptions,filename,color,cumul)
  // note: language code is added to the filename to enable refreshing cached-graph when user change language.
  $strChart1 = QTpchart(
    $L['Topics_per_'.$ch['time']].($ch['value']=='p' ? ' (%)' : ''),
    $arrA,
    array( 'Serie1'=>$arrN[$y-1],'Serie2'=>$arrN[$y] ),
    array( 'Serie1'=>$y-1,'Serie2'=>$y ),
    $ch,
    $tt.'1'.$y.implode('',$ch).$lang,
    1);
  $strChart2 = QTpchart(
    $L['Replies_per_'.$ch['time']].($ch['value']=='p' ? ' (%)' : ''),
    $arrA,
    array( 'Serie1'=>$arrC[$y-1],'Serie2'=>$arrC[$y] ),
    array( 'Serie1'=>$y-1,'Serie2'=>$y ),
    $ch,
    $tt.'2'.$y.implode('',$ch).$lang,
    2);

  // DISPLAY

  echo '<div style="margin:0 auto; width:600px">',N;
  echo '<p class="small" style="text-align:right">',implode(' &middot; ',$arrMenuType),'</p>';
  echo '<img src="'.$strChart1.'"/><br/>';
  echo '<img src="'.$strChart2.'"/><br/>';
  echo '</div>',N;

}
elseif ( file_exists('bin/qt_lib_graph.php') && file_exists($_SESSION[QT]['skin_dir'].'/qtf_main2.css') )
{
  
  echo '<p class="small" style="text-align:right">',implode(' &middot; ',$arrMenuValue),'</p>';

  echo '<table class="data_t" cellspacing="0">',N;

  // first serie
  
  $intTopY = QTroof( array(max($arrN[$y-1]),max($arrN[$y])) );
  
  echo '<tr class="data_o">',N;
  echo '<td class="hidden" style="width:355px">',N;
  
  if ( $ch['value']=='a' ) 
  {
  QTbarchart(QTarraymerge($arrA,$arrN[$y-1]),320,100,$intTopY,2,true,$L['New_topics'].' '.($y-1));
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,QTpercent($arrN[$y-1])),350,100,100,2,'P',$L['New_topics'].' (%) '.($y-1));
  }

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

  // second serie

  if ( $ch['value']=='a' ) 
  {
  QTbarchart(QTarraymerge($arrA,$arrN[$y]),320,100,$intTopY,2,true,$L['New_topics'].' '.$y);
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,QTpercent($arrN[$y])),350,100,100,2,'P',$L['New_topics'].' (%) '.$y);
  }

  echo '</td>',N;  
  echo '</tr>',N;

  // 3d serie
  
  $intTopY = QTroof( array(max($arrC[$y-1]),max($arrC[$y])) );
  
  echo '<tr class="data_o">',N;
  echo '<td class="hidden" style="width:355px">',N;
  
  if ( $ch['value']=='a' ) 
  {
  QTbarchart(QTarraymerge($arrA,$arrC[$y-1]),320,100,$intTopY,2,true,$L['Closed_topics'].' '.($y-1),'','2');
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,QTpercent($arrC[$y-1])),350,100,100,2,'P',$L['Closed_topics'].' (%) '.($y-1),'','2');
  }

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

  // 4th serie

  if ( $ch['value']=='a' ) 
  {
  QTbarchart(QTarraymerge($arrA,$arrC[$y]),320,100,$intTopY,2,true,$L['Closed_topics'].' '.$y,'','2');
  }
  else
  {
  QTbarchart(QTarraymerge($arrA,QTpercent($arrC[$y])),350,100,$intTopY,2,'P',$L['Closed_topics'].' (%) '.$y,'','2');
  }

  echo '</td>',N;  
  echo '</tr>',N;
    
  echo '</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'].'/qtf_main2.css</p>';
}

break;

//--------
default:
//--------
die('Invalid tab');
}

?>
Return current item: QuickTalk Forum