3 if ( !class_exists( 
"report_searchstrings")) {
 
    7 class Report_searchstrings 
extends report_base
 
   14     protected $_sThisTemplate = 
"report_searchstrings.tpl";
 
   21     public function render()
 
   28         $oSmarty    = $this->getSmarty();
 
   29         $sTimeFrom = $oDb->quote( date( 
"Y-m-d H:i:s", strtotime( $oSmarty->_tpl_vars[
'time_from'] ) ) );
 
   30         $sTimeTo   = $oDb->quote( date( 
"Y-m-d H:i:s", strtotime( $oSmarty->_tpl_vars[
'time_to'] ) ) );
 
   32         $sSQL = 
"select count(*) as nrof, oxparameter from oxlogs where oxclass = 'search' and oxtime >= $sTimeFrom and oxtime <= $sTimeTo group by oxparameter order by nrof desc";
 
   33         $rs = $oDb->execute( $sSQL);
 
   34         if ($rs != 
false && $rs->recordCount() > 0) {
 
   36                 if ( $rs->fields[1]) {
 
   37                     $aDataX[] = $rs->fields[0];
 
   38                     $aDataY[] = $rs->fields[1];
 
   44         for ($iCtr = 0; $iCtr < count($aDataX); $iCtr++) {
 
   45             if ($iMax < $aDataX[$iCtr])
 
   46                 $iMax = $aDataX[$iCtr];
 
   51         $aAligns[
"0"] = 
'report_searchstrings_scale_aligns_left"';
 
   52         $iTenth = strlen($iMax) - 1;
 
   55             $aPoints[
"".(round(($iMax/2))).
""] = $iMax/2;
 
   56             $aAligns[
"".(round(($iMax/2))).
""] = 
'report_searchstrings_scale_aligns_center" width="'.(720/3).
'"';
 
   57             $aPoints[
"".$iMax.
""] = $iMax;
 
   58             $aAligns[
"".$iMax.
""] = 
'report_searchstrings_scale_aligns_right" width="'.(720/3).
'"';
 
   60             $iDeg = bcpow(10, $iTenth);
 
   64             for ($iCtr = 10; $iCtr>0; $iCtr-- ) {
 
   65                 $aPoints[
"".(round(($ctr))).
""] = $ctr += $iScaleMax / 10;
 
   66                 $aAligns[
"".(round(($ctr))).
""] = 
'report_searchstrings_scale_aligns_center" width="'.(720/10).
'"';
 
   68             $aAligns[
"".(round(($ctr))).
""] = 
'report_searchstrings_scale_aligns_right" width="'.(720/10).
'"';
 
   71         $aAligns[
"0"] .= 
' width="'.(720/count($aAligns)).
'"';
 
   73         for ($iCtr = 0; $iCtr < count($aDataY); $iCtr++) {
 
   74             $aDataVals[$aDataY[$iCtr]] = round($aDataX[$iCtr]/$iMax*100);
 
   77         if (count($aDataY) > 0 )
 
   78             $oSmarty->assign( 
"drawStat", 
true);
 
   80             $oSmarty->assign( 
"drawStat", 
false);
 
   82         $oSmarty->assign( 
"classes", array ( $aAligns ));
 
   83         $oSmarty->assign( 
"allCols", count( $aAligns ) );
 
   84         $oSmarty->assign( 
"cols", count( $aAligns ) );
 
   85         $oSmarty->assign( 
"percents", array ( $aDataVals ));
 
   86         $oSmarty->assign( 
"y", $aDataY);
 
   88         return parent::render();
 
   96     public function graph1()
 
  107         $sSQL = 
"select count(*) as nrof, oxparameter from oxlogs where oxclass = 'search' and oxtime >= $sTimeFrom and oxtime <= $sTimeTo group by oxparameter order by nrof desc";
 
  108         $rs = $oDb->execute( $sSQL);
 
  109         if ($rs != 
false && $rs->recordCount() > 0) {
 
  111                 if ( $rs->fields[1]) {
 
  112                      $aDataX[] = $rs->fields[0];
 
  113                     $aDataY[] = $rs->fields[1];
 
  119         header (
"Content-type: image/png" );
 
  122         $graph = 
new Graph(800, max( 640, 20*count($aDataX)));
 
  123         $graph->setBackgroundImage( 
$myConfig->getImageDir(
true).
"/reportbgrnd.jpg", BGIMG_FILLFRAME);
 
  126         $graph->setScale(
"textlin");
 
  132         $graph->set90AndMargin($left, $right, $top, $bottom);
 
  135         $graph->xaxis->setLabelAlign(
'right', 
'center', 
'right');
 
  138         $graph->yaxis->setLabelAlign(
'center', 
'bottom');
 
  142         $graph->xaxis->setTickLabels( $aDataY);
 
  145         $graph->title->set(
"Suchw�rter");
 
  148         $graph->title->setFont(FF_FONT1, FS_BOLD);
 
  151         $bplot = 
new BarPlot( $aDataX);
 
  152         $bplot->setFillGradient(
"navy", 
"lightsteelblue", GRAD_VER);
 
  153         $bplot->setLegend(
"Hits");