3 if ( !class_exists(
"report_top_clicked_categories" ) ) {
8 class Report_top_clicked_categories
extends report_base
15 protected $_sThisTemplate =
"report_top_clicked_categories.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, oxcategories.oxtitle from oxlogs, oxcategories where oxlogs.oxclass = 'alist' and oxlogs.oxcnid = oxcategories.oxid and oxlogs.oxtime >= $sTimeFrom and oxlogs.oxtime <= $sTimeTo group by oxcategories.oxtitle order by nrof desc limit 0, 25";
34 $rs = $oDb->execute( $sSQL);
35 if ($rs !=
false && $rs->recordCount() > 0) {
37 if ( $rs->fields[1]) {
38 $aDataX[] = $rs->fields[0];
39 $aDataY[] = $rs->fields[1];
45 for ($iCtr = 0; $iCtr < count($aDataX); $iCtr++) {
46 if ($iMax < $aDataX[$iCtr])
47 $iMax = $aDataX[$iCtr];
52 $aAligns[
"0"] =
'report_searchstrings_scale_aligns_left"';
53 $iTenth = strlen($iMax) - 1;
56 $aPoints[
"".(round(($iMax/2))).
""] = $iMax/2;
57 $aAligns[
"".(round(($iMax/2))).
""] =
'report_searchstrings_scale_aligns_center" width="'.(720/3).
'"';
58 $aPoints[
"".$iMax.
""] = $iMax;
59 $aAligns[
"".$iMax.
""] =
'report_searchstrings_scale_aligns_right" width="'.(720/3).
'"';
61 $iDeg = bcpow(10, $iTenth);
65 for ($iCtr = 10; $iCtr>0; $iCtr-- ) {
66 $aPoints[
"".(round(($ctr))).
""] = $ctr += $iScaleMax / 10;
67 $aAligns[
"".(round(($ctr))).
""] =
'report_searchstrings_scale_aligns_center" width="'.(720/10).
'"';
69 $aAligns[
"".(round(($ctr))).
""] =
'report_searchstrings_scale_aligns_right" width="'.(720/10).
'"';
72 $aAligns[
"0"] .=
' width="'.(720/count($aAligns)).
'"';
74 for ($iCtr = 0; $iCtr < count($aDataY); $iCtr++) {
75 $aDataVals[$aDataY[$iCtr]] = round($aDataX[$iCtr]/$iMax*100);
78 if ( count($aDataY) > 0 )
79 $oSmarty->assign(
"drawStat",
true);
81 $oSmarty->assign(
"drawStat",
false);
83 $oSmarty->assign(
"classes", array ( $aAligns ));
84 $oSmarty->assign(
"allCols", count( $aAligns ));
85 $oSmarty->assign(
"cols", count( $aAligns ) );
86 $oSmarty->assign(
"percents", array ( $aDataVals ) );
87 $oSmarty->assign(
"y", $aDataY );
89 return parent::render();
97 public function graph1()
108 $sSQL =
"select count(*) as nrof, oxparameter from oxlogs where oxclass = 'search' and oxtime >= $sTimeFrom and oxtime <= $sTimeTo group by oxparameter order by nrof desc";
109 $rs = $oDb->execute( $sSQL);
110 if ($rs !=
false && $rs->recordCount() > 0) {
112 if ( $rs->fields[1]) {
113 $aDataX[] = $rs->fields[0];
114 $aDataY[] = $rs->fields[1];
120 header (
"Content-type: image/png" );
123 $graph =
new Graph(800, max( 640, 20*count($aDataX)));
124 $graph->setBackgroundImage(
$myConfig->getImageDir(
true).
"/reportbgrnd.jpg", BGIMG_FILLFRAME);
127 $graph->setScale(
"textlin");
133 $graph->set90AndMargin($left, $right, $top, $bottom);
136 $graph->xaxis->setLabelAlign(
'right',
'center',
'right');
139 $graph->yaxis->setLabelAlign(
'center',
'bottom');
143 $graph->xaxis->setTickLabels( $aDataY);
146 $graph->title->set(
"Suchw�rter");
149 $graph->title->setFont(FF_FONT1, FS_BOLD);
152 $bplot =
new BarPlot( $aDataX);
153 $bplot->setFillGradient(
"navy",
"lightsteelblue", GRAD_VER);
154 $bplot->setLegend(
"Hits");