00001 <?php
00002
00003 if ( !class_exists( "report_visitor_absolute") ) {
00008 class Report_visitor_absolute extends report_base
00009 {
00015 protected $_sThisTemplate = "report_visitor_absolute.tpl";
00016
00022 public function visitor_month()
00023 {
00024 $myConfig = $this->getConfig();
00025
00026 $aDataX = array();
00027 $aDataY = array();
00028
00029 $dTimeTo = strtotime( oxConfig::getParameter( "time_to"));
00030 $sTime_to = date( "Y-m-d H:i:s", $dTimeTo);
00031 $dTimeFrom = mktime( 23, 59, 59, date( "m", $dTimeTo)-12, date( "d", $dTimeTo), date( "Y", $dTimeTo));
00032 $sTime_from = date( "Y-m-d H:i:s", $dTimeFrom);
00033
00034 $sSQL = "select oxtime, count(*) as nrof from oxlogs where oxtime >= '$sTime_from' and oxtime <= '$sTime_to' group by oxsessid";
00035 $aTemp = array();
00036 for ( $i = 1; $i <= 12; $i++)
00037 $aTemp[date( "m/Y", mktime( 23, 59, 59, date( "m", $dTimeFrom)+$i, date( "d", $dTimeFrom), date( "Y", $dTimeFrom)) )] = 0;
00038
00039 $rs = oxDb::getDb()->execute( $sSQL);
00040 if ($rs != false && $rs->recordCount() > 0) {
00041 while (!$rs->EOF) {
00042 $aTemp[date( "m/Y", strtotime( $rs->fields[0]))]++;
00043 $rs->moveNext();
00044 }
00045 }
00046
00047 foreach ( $aTemp as $key => $value) {
00048 $aDataX[$key] = $value;
00049 $aDataX2[$key] = 0;
00050 $aDataX3[$key] = 0;
00051 $aDataY[] = $key;
00052 }
00053
00054
00055 $sSQL = "select oxorderdate from oxorder where oxorderdate >= '$sTime_from' and oxorderdate <= '$sTime_to' order by oxorderdate";
00056 $aTemp = array();
00057 $rs = oxDb::getDb()->execute( $sSQL);
00058 if ($rs != false && $rs->recordCount() > 0) {
00059 while (!$rs->EOF) {
00060 $aTemp[date( "m/Y", strtotime( $rs->fields[0]))]++;
00061 $rs->moveNext();
00062 }
00063 }
00064
00065 foreach ( $aTemp as $key => $value) {
00066 $aDataX2[$key] = $value;
00067 }
00068
00069
00070 $sSQL = "select oxcreate from oxuser where oxcreate >= '$sTime_from' and oxcreate <= '$sTime_to' order by oxcreate";
00071 $aTemp = array();
00072 $rs = oxDb::getDb()->execute( $sSQL);
00073 if ($rs != false && $rs->recordCount() > 0) {
00074 while (!$rs->EOF) {
00075 $aTemp[date( "m/Y", strtotime( $rs->fields[0]))]++;
00076 $rs->moveNext();
00077 }
00078 }
00079
00080 foreach ( $aTemp as $key => $value) {
00081 $aDataX3[$key] = $value;
00082 }
00083
00084
00085 header ("Content-type: image/png" );
00086
00087
00088 $graph = new Graph(800, 600);
00089
00090 $graph->setBackgroundImage( $myConfig->getAbsAdminImageDir()."/reportbgrnd.jpg", BGIMG_FILLFRAME);
00091
00092
00093 $graph->setScale("textlin");
00094
00095
00096 $graph->xaxis->setLabelAlign('center', 'top', 'right');
00097
00098
00099 $graph->yaxis->setLabelAlign('right', 'bottom');
00100
00101 $graph->setShadow();
00102
00103 $graph->xaxis->setTickLabels( $aDataY);
00104
00105
00106
00107 $graph->title->set("Monat");
00108
00109
00110 $graph->title->setFont(FF_FONT1, FS_BOLD);
00111
00112 $aDataFinalX = array();
00113 foreach ( $aDataX as $dData)
00114 $aDataFinalX[] = $dData;
00115
00116 $bplot = new BarPlot( $aDataFinalX);
00117 $bplot->setFillGradient("navy", "lightsteelblue", GRAD_VER);
00118 $bplot->setLegend("Besucher");
00119
00120 $aDataFinalX2 = array();
00121 foreach ( $aDataX2 as $dData)
00122 $aDataFinalX2[] = $dData;
00123
00124 $bplot2 = new BarPlot( $aDataFinalX2);
00125 $bplot2->setFillColor ("orange");
00126 $bplot2->setLegend("Kaeufer");
00127
00128 $aDataFinalX3 = array();
00129 foreach ( $aDataX3 as $dData)
00130 $aDataFinalX3[] = $dData;
00131
00132 $bplot3 = new BarPlot( $aDataFinalX3);
00133 $bplot3->setFillColor ("silver");
00134 $bplot3->setLegend("Neukunden");
00135
00136
00137 $gbplot = new groupBarPlot (array($bplot, $bplot2, $bplot3));
00138 $graph->add( $gbplot);
00139
00140
00141 $graph->stroke();
00142
00143 }
00144
00150 public function visitor_week()
00151 {
00152 $myConfig = $this->getConfig();
00153
00154 $aDataX = array();
00155 $aDataY = array();
00156
00157 $dTimeTo = strtotime( oxConfig::getParameter( "time_to"));
00158 $sTime_to = date( "Y-m-d H:i:s", $dTimeTo);
00159 $dTimeFrom = strtotime( oxConfig::getParameter( "time_from"));
00160 $sTime_from = date( "Y-m-d H:i:s", $dTimeFrom);
00161
00162 $sSQL = "select oxtime, count(*) as nrof from oxlogs where oxtime >= '$sTime_from' and oxtime <= '$sTime_to' group by oxsessid order by oxtime";
00163 $aTemp = array();
00164 $rs = oxDb::getDb()->execute( $sSQL);
00165 if ($rs != false && $rs->recordCount() > 0) {
00166 while (!$rs->EOF) {
00167
00168 $aTemp[oxUtilsDate::getInstance()->getWeekNumber($myConfig->getConfigParam( 'iFirstWeekDay' ), strtotime( $rs->fields[0]))]++;
00169 $rs->moveNext();
00170 }
00171 }
00172
00173 foreach ( $aTemp as $key => $value) {
00174 $aDataX[$key] = $value;
00175 $aDataX2[$key] = 0;
00176 $aDataX3[$key] = 0;
00177 $aDataY[] = "KW ".$key;
00178 }
00179
00180
00181 $sSQL = "select oxorderdate from oxorder where oxorderdate >= '$sTime_from' and oxorderdate <= '$sTime_to' order by oxorderdate";
00182 $aTemp = array();
00183 $rs = oxDb::getDb()->execute( $sSQL);
00184 if ($rs != false && $rs->recordCount() > 0) {
00185 while (!$rs->EOF) {
00186
00187 $aTemp[oxUtilsDate::getInstance()->getWeekNumber($myConfig->getConfigParam( 'iFirstWeekDay' ), strtotime( $rs->fields[0]))]++;
00188 $rs->moveNext();
00189 }
00190 }
00191
00192 foreach ( $aTemp as $key => $value) {
00193 $aDataX2[$key] = $value;
00194 }
00195
00196
00197 $sSQL = "select oxcreate from oxuser where oxcreate >= '$sTime_from' and oxcreate <= '$sTime_to' order by oxcreate";
00198 $aTemp = array();
00199 $rs = oxDb::getDb()->execute( $sSQL);
00200 if ($rs != false && $rs->recordCount() > 0) {
00201 while (!$rs->EOF) {
00202
00203 $aTemp[oxUtilsDate::getInstance()->getWeekNumber($myConfig->getConfigParam( 'iFirstWeekDay' ), strtotime( $rs->fields[0]))]++;
00204 $rs->moveNext();
00205 }
00206 }
00207
00208 foreach ( $aTemp as $key => $value) {
00209 $aDataX3[$key] = $value;
00210 }
00211
00212 header ("Content-type: image/png" );
00213
00214
00215 $graph = new Graph( max( 800, count( $aDataX) * 80), 600);
00216
00217 $graph->setBackgroundImage( $myConfig->getAbsAdminImageDir()."/reportbgrnd.jpg", BGIMG_FILLFRAME);
00218
00219
00220 $graph->setScale("textlin");
00221
00222
00223 $graph->xaxis->setLabelAlign('center', 'top', 'right');
00224
00225
00226 $graph->yaxis->setLabelAlign('right', 'bottom');
00227
00228 $graph->setShadow();
00229
00230 $graph->xaxis->setTickLabels( $aDataY);
00231
00232
00233
00234 $graph->title->set("Woche");
00235
00236
00237 $graph->title->setFont(FF_FONT1, FS_BOLD);
00238
00239 $aDataFinalX = array();
00240 foreach ( $aDataX as $dData)
00241 $aDataFinalX[] = $dData;
00242
00243 $bplot = new BarPlot( $aDataFinalX);
00244 $bplot->setFillGradient("navy", "lightsteelblue", GRAD_VER);
00245 $bplot->setLegend("Besucher");
00246
00247 $aDataFinalX2 = array();
00248 foreach ( $aDataX2 as $dData)
00249 $aDataFinalX2[] = $dData;
00250
00251 $bplot2 = new BarPlot( $aDataFinalX2);
00252 $bplot2->setFillColor ("orange");
00253 $bplot2->setLegend("Kaeufer");
00254
00255 $aDataFinalX3 = array();
00256 foreach ( $aDataX3 as $dData)
00257 $aDataFinalX3[] = $dData;
00258
00259 $bplot3 = new BarPlot( $aDataFinalX3);
00260 $bplot3->setFillColor ("silver");
00261 $bplot3->setLegend("Neukunden");
00262
00263
00264 $gbplot = new groupBarPlot (array($bplot, $bplot2, $bplot3));
00265 $graph->add( $gbplot);
00266
00267
00268 $graph->stroke();
00269 }
00270 }
00271 }