3 if (!class_exists(
"report_top_clicked_categories")) {
 
    9     class Report_top_clicked_categories 
extends report_base
 
   17         protected $_sThisTemplate = 
"report_top_clicked_categories.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, oxcategories.oxtitle from oxlogs, oxcategories " .
 
   36                     "where oxlogs.oxclass = 'alist' and oxlogs.oxcnid = oxcategories.oxid  " .
 
   37                     "and oxlogs.oxtime >= $sTimeFrom and oxlogs.oxtime <= $sTimeTo " .
 
   38                     "group by oxcategories.oxtitle order by nrof desc limit 0, 25";
 
   39             $rs = $oDb->execute($sSQL);
 
   40             if ($rs != 
false && $rs->recordCount() > 0) {
 
   43                         $aDataX[] = $rs->fields[0];
 
   44                         $aDataY[] = $rs->fields[1];
 
   50             for ($iCtr = 0; $iCtr < count($aDataX); $iCtr++) {
 
   51                 if ($iMax < $aDataX[$iCtr]) {
 
   52                     $iMax = $aDataX[$iCtr];
 
   58             $aAligns[
"0"] = 
'report_searchstrings_scale_aligns_left"';
 
   59             $sAlignsCenterPart = 
'report_searchstrings_scale_aligns_center" width="';
 
   60             $sAlignsRightPart = 
'report_searchstrings_scale_aligns_right" width="';
 
   61             $iTenth = strlen($iMax) - 1;
 
   64                 $aPoints[
"" . (round(($iMax / 2))) . 
""] = $iMax / 2;
 
   65                 $aAligns[
"" . (round(($iMax / 2))) . 
""] = $sAlignsCenterPart . (720 / 3) . 
'"';
 
   66                 $aPoints[
"" . $iMax . 
""] = $iMax;
 
   67                 $aAligns[
"" . $iMax . 
""] = $sAlignsRightPart . (720 / 3) . 
'"';
 
   69                 $iDeg = bcpow(10, $iTenth);
 
   73                 for ($iCtr = 10; $iCtr > 0; $iCtr--) {
 
   74                     $aPoints[
"" . (round(($ctr))) . 
""] = $ctr += $iScaleMax / 10;
 
   75                     $aAligns[
"" . (round(($ctr))) . 
""] = $sAlignsCenterPart . (720 / 10) . 
'"';
 
   77                 $aAligns[
"" . (round(($ctr))) . 
""] = $sAlignsRightPart . (720 / 10) . 
'"';
 
   80             $aAligns[
"0"] .= 
' width="' . (720 / count($aAligns)) . 
'"';
 
   82             for ($iCtr = 0; $iCtr < count($aDataY); $iCtr++) {
 
   83                 $aDataVals[$aDataY[$iCtr]] = round($aDataX[$iCtr] / $iMax * 100);
 
   86             if (count($aDataY) > 0) {
 
   87                 $oSmarty->assign(
"drawStat", 
true);
 
   89                 $oSmarty->assign(
"drawStat", 
false);
 
   92             $oSmarty->assign(
"classes", array($aAligns));
 
   93             $oSmarty->assign(
"allCols", count($aAligns));
 
   94             $oSmarty->assign(
"cols", count($aAligns));
 
   95             $oSmarty->assign(
"percents", array($aDataVals));
 
   96             $oSmarty->assign(
"y", $aDataY);
 
   98             return parent::render();
 
  104         public function graph1()
 
  114             $sTimeFrom = $oDb->quote(date(
"Y-m-d H:i:s", strtotime($sTimeFromParameter)));
 
  115             $sTimeTo = $oDb->quote(date(
"Y-m-d H:i:s", strtotime($sTimeToParameter)));
 
  117             $sSQL = 
"select count(*) as nrof, oxparameter from oxlogs where oxclass = 'search' " .
 
  118                     "and oxtime >= $sTimeFrom and oxtime <= $sTimeTo group by oxparameter order by nrof desc";
 
  119             $rs = $oDb->execute($sSQL);
 
  120             if ($rs != 
false && $rs->recordCount() > 0) {
 
  122                     if ($rs->fields[1]) {
 
  123                         $aDataX[] = $rs->fields[0];
 
  124                         $aDataY[] = $rs->fields[1];
 
  130             header(
"Content-type: image/png");
 
  133             $graph = 
new Graph(800, max(640, 20 * count($aDataX)));
 
  134             $graph->setBackgroundImage(
$myConfig->getImageDir(
true) . 
"/reportbgrnd.jpg", BGIMG_FILLFRAME);
 
  137             $graph->setScale(
"textlin");
 
  143             $graph->set90AndMargin($left, $right, $top, $bottom);
 
  146             $graph->xaxis->setLabelAlign(
'right', 
'center', 
'right');
 
  149             $graph->yaxis->setLabelAlign(
'center', 
'bottom');
 
  153             $graph->xaxis->setTickLabels($aDataY);
 
  156             $graph->title->set(
"Suchw�rter");
 
  159             $graph->title->setFont(FF_FONT1, FS_BOLD);
 
  162             $bplot = 
new BarPlot($aDataX);
 
  163             $bplot->setFillGradient(
"navy", 
"lightsteelblue", GRAD_VER);
 
  164             $bplot->setLegend(
"Hits");