3 if (!class_exists(
"report_searchstrings")) {
 
    7     class Report_searchstrings 
extends report_base
 
   15         protected $_sThisTemplate = 
"report_searchstrings.tpl";
 
   22         public function render()
 
   29             $oSmarty = $this->getSmarty();
 
   30             $sTimeFrom = $oDb->quote(date(
"Y-m-d H:i:s", strtotime($oSmarty->_tpl_vars[
'time_from'])));
 
   31             $sTimeTo = $oDb->quote(date(
"Y-m-d H:i:s", strtotime($oSmarty->_tpl_vars[
'time_to'])));
 
   33             $sSQL = 
"select count(*) as nrof, oxparameter from oxlogs where oxclass = 'search' and " .
 
   34                     "oxtime >= $sTimeFrom and oxtime <= $sTimeTo group by oxparameter order by nrof desc";
 
   35             $rs = $oDb->execute($sSQL);
 
   36             if ($rs != 
false && $rs->recordCount() > 0) {
 
   39                         $aDataX[] = $rs->fields[0];
 
   40                         $aDataY[] = $rs->fields[1];
 
   46             for ($iCtr = 0; $iCtr < count($aDataX); $iCtr++) {
 
   47                 if ($iMax < $aDataX[$iCtr]) {
 
   48                     $iMax = $aDataX[$iCtr];
 
   54             $aAligns[
"0"] = 
'report_searchstrings_scale_aligns_left"';
 
   55             $iTenth = strlen($iMax) - 1;
 
   58                 $aPoints[
"" . (round(($iMax / 2))) . 
""] = $iMax / 2;
 
   59                 $aAligns[
"" . (round(($iMax / 2))) . 
""] = 
'report_searchstrings_scale_aligns_center" width="' . (720 / 3) . 
'"';
 
   60                 $aPoints[
"" . $iMax . 
""] = $iMax;
 
   61                 $aAligns[
"" . $iMax . 
""] = 
'report_searchstrings_scale_aligns_right" width="' . (720 / 3) . 
'"';
 
   63                 $iDeg = bcpow(10, $iTenth);
 
   67                 for ($iCtr = 10; $iCtr > 0; $iCtr--) {
 
   68                     $aPoints[
"" . (round(($ctr))) . 
""] = $ctr += $iScaleMax / 10;
 
   69                     $aAligns[
"" . (round(($ctr))) . 
""] = 
'report_searchstrings_scale_aligns_center" width="' . (720 / 10) . 
'"';
 
   71                 $aAligns[
"" . (round(($ctr))) . 
""] = 
'report_searchstrings_scale_aligns_right" width="' . (720 / 10) . 
'"';
 
   74             $aAligns[
"0"] .= 
' width="' . (720 / count($aAligns)) . 
'"';
 
   76             for ($iCtr = 0; $iCtr < count($aDataY); $iCtr++) {
 
   77                 $aDataVals[$aDataY[$iCtr]] = round($aDataX[$iCtr] / $iMax * 100);
 
   80             if (count($aDataY) > 0) {
 
   81                 $oSmarty->assign(
"drawStat", 
true);
 
   83                 $oSmarty->assign(
"drawStat", 
false);
 
   86             $oSmarty->assign(
"classes", array($aAligns));
 
   87             $oSmarty->assign(
"allCols", count($aAligns));
 
   88             $oSmarty->assign(
"cols", count($aAligns));
 
   89             $oSmarty->assign(
"percents", array($aDataVals));
 
   90             $oSmarty->assign(
"y", $aDataY);
 
   92             return parent::render();
 
   98         public function graph1()
 
  106             $sTimeFrom = $oDb->quote(date(
"Y-m-d H:i:s", strtotime(
oxRegistry::getConfig()->getRequestParameter(
"time_from"))));
 
  107             $sTimeTo = $oDb->quote(date(
"Y-m-d H:i:s", strtotime(
oxRegistry::getConfig()->getRequestParameter(
"time_to"))));
 
  109             $sSQL = 
"select count(*) as nrof, oxparameter from oxlogs where oxclass = 'search' and oxtime >= $sTimeFrom and oxtime <= $sTimeTo group by oxparameter order by nrof desc";
 
  110             $rs = $oDb->execute($sSQL);
 
  111             if ($rs != 
false && $rs->recordCount() > 0) {
 
  113                     if ($rs->fields[1]) {
 
  114                         $aDataX[] = $rs->fields[0];
 
  115                         $aDataY[] = $rs->fields[1];
 
  121             header(
"Content-type: image/png");
 
  124             $graph = 
new Graph(800, max(640, 20 * count($aDataX)));
 
  125             $graph->setBackgroundImage(
$myConfig->getImageDir(
true) . 
"/reportbgrnd.jpg", BGIMG_FILLFRAME);
 
  128             $graph->setScale(
"textlin");
 
  134             $graph->set90AndMargin($left, $right, $top, $bottom);
 
  137             $graph->xaxis->setLabelAlign(
'right', 
'center', 
'right');
 
  140             $graph->yaxis->setLabelAlign(
'center', 
'bottom');
 
  144             $graph->xaxis->setTickLabels($aDataY);
 
  147             $graph->title->set(
"Suchw�rter");
 
  150             $graph->title->setFont(FF_FONT1, FS_BOLD);
 
  153             $bplot = 
new BarPlot($aDataX);
 
  154             $bplot->setFillGradient(
"navy", 
"lightsteelblue", GRAD_VER);
 
  155             $bplot->setLegend(
"Hits");