add group switch

This commit is contained in:
Daniel Seifert 2017-11-21 11:32:40 +01:00
parent 759b22b764
commit 3e287f888a
3 changed files with 25 additions and 5 deletions

View File

@ -21,6 +21,15 @@ class d3_usersonline_statistic extends d3_cfg_mod_main
protected $_sMenuSubItemTitle = 'd3mxusersonline_analysis';
public $blGroupByClass = false;
public function render()
{
$this->blGroupByClass = oxRegistry::getConfig()->getRequestParameter('groupbyclass') == 'true';
$this->addTplParam('blGroupByClass', $this->blGroupByClass);
return parent::render();
}
/**
* @return array
*/
@ -29,7 +38,7 @@ class d3_usersonline_statistic extends d3_cfg_mod_main
/** @var d3usersonline $oUsersOnline */
$oUsersOnline = oxNew('d3usersonline');
$oUsersOnline->clearOldItems($this->_iExpTime);
return $oUsersOnline->getUserCount();
return $oUsersOnline->getUserCount($this->blGroupByClass);
}
public function getControllerTitle($sControllerIdent)

View File

@ -66,12 +66,17 @@ class d3usersonline extends oxbase
/**
* @return array
*/
public function getUserCount()
public function getUserCount($blGroupByClass = false)
{
startProfile(__METHOD__);
$sSelect = "select count(oxid) AS counter, oxclass, oxpage from ".
$this->getViewName()." GROUP BY oxclass, oxpage ORDER BY counter desc";
if ($blGroupByClass) {
$sSelect = "SELECT count(oxid) AS counter, oxclass FROM " .
$this->getViewName() . " GROUP BY oxclass ORDER BY counter DESC";
} else {
$sSelect = "select count(oxid) AS counter, oxclass, oxpage from ".
$this->getViewName()." GROUP BY oxclass, oxpage ORDER BY counter desc";
}
$aRecords = oxDb::getDb(oxDb::FETCH_MODE_ASSOC)->getAll($sSelect);
$iAllCounter = 0;

View File

@ -39,6 +39,10 @@
<style type="text/css">
<!--
div.box h3 {
margin-top: 20px;
}
fieldset {
border: 1px inset black;
background-color: #F0F0F0;
@ -98,12 +102,14 @@
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
<input type="hidden" name="actshop" value="[{$shop->id}]">
<input type="hidden" name="editlanguage" value="[{$editlanguage}]">
<input type="hidden" id="groupbyclass" name="groupbyclass" value="false">
</form>
[{d3modcfgcheck modid="d3usersonline"}][{/d3modcfgcheck}]
[{if $mod_d3usersonline}]
[{assign var="aUsersOnline" value=$oView->getUserCount()}]
<h3>[{oxmultilang ident="D3_USERSONLINE_USERSONLINE"}]</h3>
<input id="groupbyclasscheckbox" value="1" type="checkbox" [{if $blGroupByClass}]checked[{/if}] onchange="document.getElementById('groupbyclass').value = this.checked; document.getElementById('transfer').submit();"> <label for="groupbyclasscheckbox">Besuche nach Shopseiten gruppieren</label>
<h3>[{oxmultilang ident="D3_USERSONLINE_USERSONLINE"}]</h3>
<div class="content">
<table style="border-style: none; width: 100%;">
<tr>