3 if (!class_exists(
"report_top_clicked_categories")) {
8 class Report_top_clicked_categories
extends report_base
16 protected $_sThisTemplate =
"report_top_clicked_categories.tpl";
23 public function render()
30 $oSmarty = $this->getSmarty();
31 $sTimeFrom = $oDb->quote(date(
"Y-m-d H:i:s", strtotime($oSmarty->_tpl_vars[
'time_from'])));
32 $sTimeTo = $oDb->quote(date(
"Y-m-d H:i:s", strtotime($oSmarty->_tpl_vars[
'time_to'])));
34 $sSQL =
"select count(*) as nrof, oxcategories.oxtitle from oxlogs, oxcategories " .
35 "where oxlogs.oxclass = 'alist' and oxlogs.oxcnid = oxcategories.oxid " .
36 "and oxlogs.oxtime >= $sTimeFrom and oxlogs.oxtime <= $sTimeTo " .
37 "group by oxcategories.oxtitle order by nrof desc limit 0, 25";
38 $rs = $oDb->execute($sSQL);
39 if ($rs !=
false && $rs->recordCount() > 0) {
42 $aDataX[] = $rs->fields[0];
43 $aDataY[] = $rs->fields[1];
49 for ($iCtr = 0; $iCtr < count($aDataX); $iCtr++) {
50 if ($iMax < $aDataX[$iCtr]) {
51 $iMax = $aDataX[$iCtr];
57 $aAligns[
"0"] =
'report_searchstrings_scale_aligns_left"';
58 $sAlignsCenterPart =
'report_searchstrings_scale_aligns_center" width="';
59 $sAlignsRightPart =
'report_searchstrings_scale_aligns_right" width="';
60 $iTenth = strlen($iMax) - 1;
63 $aPoints[
"" . (round(($iMax / 2))) .
""] = $iMax / 2;
64 $aAligns[
"" . (round(($iMax / 2))) .
""] = $sAlignsCenterPart . (720 / 3) .
'"';
65 $aPoints[
"" . $iMax .
""] = $iMax;
66 $aAligns[
"" . $iMax .
""] = $sAlignsRightPart . (720 / 3) .
'"';
68 $iDeg = bcpow(10, $iTenth);
72 for ($iCtr = 10; $iCtr > 0; $iCtr--) {
73 $aPoints[
"" . (round(($ctr))) .
""] = $ctr += $iScaleMax / 10;
74 $aAligns[
"" . (round(($ctr))) .
""] = $sAlignsCenterPart . (720 / 10) .
'"';
76 $aAligns[
"" . (round(($ctr))) .
""] = $sAlignsRightPart . (720 / 10) .
'"';
79 $aAligns[
"0"] .=
' width="' . (720 / count($aAligns)) .
'"';
81 for ($iCtr = 0; $iCtr < count($aDataY); $iCtr++) {
82 $aDataVals[$aDataY[$iCtr]] = round($aDataX[$iCtr] / $iMax * 100);
85 if (count($aDataY) > 0) {
86 $oSmarty->assign(
"drawStat",
true);
88 $oSmarty->assign(
"drawStat",
false);
91 $oSmarty->assign(
"classes", array($aAligns));
92 $oSmarty->assign(
"allCols", count($aAligns));
93 $oSmarty->assign(
"cols", count($aAligns));
94 $oSmarty->assign(
"percents", array($aDataVals));
95 $oSmarty->assign(
"y", $aDataY);
97 return parent::render();
103 public function graph1()
113 $sTimeFrom = $oDb->quote(date(
"Y-m-d H:i:s", strtotime($sTimeFromParameter)));
114 $sTimeTo = $oDb->quote(date(
"Y-m-d H:i:s", strtotime($sTimeToParameter)));
116 $sSQL =
"select count(*) as nrof, oxparameter from oxlogs where oxclass = 'search' " .
117 "and oxtime >= $sTimeFrom and oxtime <= $sTimeTo group by oxparameter order by nrof desc";
118 $rs = $oDb->execute($sSQL);
119 if ($rs !=
false && $rs->recordCount() > 0) {
121 if ($rs->fields[1]) {
122 $aDataX[] = $rs->fields[0];
123 $aDataY[] = $rs->fields[1];
129 header(
"Content-type: image/png");
132 $graph =
new Graph(800, max(640, 20 * count($aDataX)));
133 $graph->setBackgroundImage(
$myConfig->getImageDir(
true) .
"/reportbgrnd.jpg", BGIMG_FILLFRAME);
136 $graph->setScale(
"textlin");
142 $graph->set90AndMargin($left, $right, $top, $bottom);
145 $graph->xaxis->setLabelAlign(
'right',
'center',
'right');
148 $graph->yaxis->setLabelAlign(
'center',
'bottom');
152 $graph->xaxis->setTickLabels($aDataY);
155 $graph->title->set(
"Suchw�rter");
158 $graph->title->setFont(FF_FONT1, FS_BOLD);
161 $bplot =
new BarPlot($aDataX);
162 $bplot->setFillGradient(
"navy",
"lightsteelblue", GRAD_VER);
163 $bplot->setLegend(
"Hits");