3 if (!class_exists(
"report_searchstrings")) {
 
    9     class Report_searchstrings 
extends report_base
 
   17         protected $_sThisTemplate = 
"report_searchstrings.tpl";
 
   24         public function render()
 
   31             $oSmarty = $this->getSmarty();
 
   32             $sTimeFrom = $oDb->quote(date(
"Y-m-d H:i:s", strtotime($oSmarty->_tpl_vars[
'time_from'])));
 
   33             $sTimeTo = $oDb->quote(date(
"Y-m-d H:i:s", strtotime($oSmarty->_tpl_vars[
'time_to'])));
 
   35             $sSQL = 
"select count(*) as nrof, oxparameter from oxlogs where oxclass = 'search' and " .
 
   36                     "oxtime >= $sTimeFrom and oxtime <= $sTimeTo group by oxparameter order by nrof desc";
 
   37             $rs = $oDb->execute($sSQL);
 
   38             if ($rs != 
false && $rs->recordCount() > 0) {
 
   41                         $aDataX[] = $rs->fields[0];
 
   42                         $aDataY[] = $rs->fields[1];
 
   48             for ($iCtr = 0; $iCtr < count($aDataX); $iCtr++) {
 
   49                 if ($iMax < $aDataX[$iCtr]) {
 
   50                     $iMax = $aDataX[$iCtr];
 
   56             $aAligns[
"0"] = 
'report_searchstrings_scale_aligns_left"';
 
   57             $iTenth = strlen($iMax) - 1;
 
   60                 $aPoints[
"" . (round(($iMax / 2))) . 
""] = $iMax / 2;
 
   61                 $aAligns[
"" . (round(($iMax / 2))) . 
""] = 
'report_searchstrings_scale_aligns_center" width="' . (720 / 3) . 
'"';
 
   62                 $aPoints[
"" . $iMax . 
""] = $iMax;
 
   63                 $aAligns[
"" . $iMax . 
""] = 
'report_searchstrings_scale_aligns_right" width="' . (720 / 3) . 
'"';
 
   65                 $iDeg = bcpow(10, $iTenth);
 
   69                 for ($iCtr = 10; $iCtr > 0; $iCtr--) {
 
   70                     $aPoints[
"" . (round(($ctr))) . 
""] = $ctr += $iScaleMax / 10;
 
   71                     $aAligns[
"" . (round(($ctr))) . 
""] = 
'report_searchstrings_scale_aligns_center" width="' . (720 / 10) . 
'"';
 
   73                 $aAligns[
"" . (round(($ctr))) . 
""] = 
'report_searchstrings_scale_aligns_right" width="' . (720 / 10) . 
'"';
 
   76             $aAligns[
"0"] .= 
' width="' . (720 / count($aAligns)) . 
'"';
 
   78             for ($iCtr = 0; $iCtr < count($aDataY); $iCtr++) {
 
   79                 $aDataVals[$aDataY[$iCtr]] = round($aDataX[$iCtr] / $iMax * 100);
 
   82             if (count($aDataY) > 0) {
 
   83                 $oSmarty->assign(
"drawStat", 
true);
 
   85                 $oSmarty->assign(
"drawStat", 
false);
 
   88             $oSmarty->assign(
"classes", array($aAligns));
 
   89             $oSmarty->assign(
"allCols", count($aAligns));
 
   90             $oSmarty->assign(
"cols", count($aAligns));
 
   91             $oSmarty->assign(
"percents", array($aDataVals));
 
   92             $oSmarty->assign(
"y", $aDataY);
 
   94             return parent::render();
 
  100         public function graph1()
 
  108             $sTimeFrom = $oDb->quote(date(
"Y-m-d H:i:s", strtotime(
oxRegistry::getConfig()->getRequestParameter(
"time_from"))));
 
  109             $sTimeTo = $oDb->quote(date(
"Y-m-d H:i:s", strtotime(
oxRegistry::getConfig()->getRequestParameter(
"time_to"))));
 
  111             $sSQL = 
"select count(*) as nrof, oxparameter from oxlogs where oxclass = 'search' and oxtime >= $sTimeFrom and oxtime <= $sTimeTo group by oxparameter order by nrof desc";
 
  112             $rs = $oDb->execute($sSQL);
 
  113             if ($rs != 
false && $rs->recordCount() > 0) {
 
  115                     if ($rs->fields[1]) {
 
  116                         $aDataX[] = $rs->fields[0];
 
  117                         $aDataY[] = $rs->fields[1];
 
  123             header(
"Content-type: image/png");
 
  126             $graph = 
new Graph(800, max(640, 20 * count($aDataX)));
 
  127             $graph->setBackgroundImage(
$myConfig->getImageDir(
true) . 
"/reportbgrnd.jpg", BGIMG_FILLFRAME);
 
  130             $graph->setScale(
"textlin");
 
  136             $graph->set90AndMargin($left, $right, $top, $bottom);
 
  139             $graph->xaxis->setLabelAlign(
'right', 
'center', 
'right');
 
  142             $graph->yaxis->setLabelAlign(
'center', 
'bottom');
 
  146             $graph->xaxis->setTickLabels($aDataY);
 
  149             $graph->title->set(
"Suchw�rter");
 
  152             $graph->title->setFont(FF_FONT1, FS_BOLD);
 
  155             $bplot = 
new BarPlot($aDataX);
 
  156             $bplot->setFillGradient(
"navy", 
"lightsteelblue", GRAD_VER);
 
  157             $bplot->setLegend(
"Hits");