add page details

This commit is contained in:
Daniel Seifert 2017-11-21 11:02:32 +01:00
parent dac3ae9b23
commit 759b22b764
6 changed files with 118 additions and 5 deletions

View File

@ -31,4 +31,31 @@ class d3_usersonline_statistic extends d3_cfg_mod_main
$oUsersOnline->clearOldItems($this->_iExpTime);
return $oUsersOnline->getUserCount();
}
public function getControllerTitle($sControllerIdent)
{
$oLang = oxRegistry::getLang();
$sTranslationIdent = 'D3_USERSONLINE_CLASS_'.strtoupper($sControllerIdent);
$sTranslation = $oLang->translateString(
$sTranslationIdent,
null,
false
);
if ($sTranslation !== $sTranslationIdent) {
return $sTranslation;
} else {
$sTranslationIdent = 'PAGE_TITLE_'.strtoupper($sControllerIdent);
$sTranslation = $oLang->translateString(
$sTranslationIdent,
null,
true
);
if ($sTranslation !== $sTranslationIdent) {
return $sTranslation;
}
}
return ucfirst($sControllerIdent);
}
}

View File

@ -70,8 +70,8 @@ class d3usersonline extends oxbase
{
startProfile(__METHOD__);
$sSelect = "select count(oxid) AS counter, oxclass from ".
$this->getViewName()." GROUP BY oxclass ORDER BY counter desc";
$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;
@ -82,6 +82,7 @@ class d3usersonline extends oxbase
$oTmp = new stdClass;
$oTmp->classname = $aRecord['OXCLASS'];
$oTmp->page = $aRecord['OXPAGE'];
$oTmp->counter = $aRecord['COUNTER'];
$iAllCounter += $aRecord['COUNTER'];
$aUserClasses['classes'][] = $oTmp;
@ -103,7 +104,8 @@ class d3usersonline extends oxbase
$aValues = array(
'timevisit' => time(),
'oxclass' => oxRegistry::getConfig()->getActiveView()->getClassName()
'oxclass' => oxRegistry::getConfig()->getActiveView()->getClassName(),
'oxpage' => $this->getPageIdent(),
);
$this->assign($aValues);
@ -112,6 +114,51 @@ class d3usersonline extends oxbase
stopProfile(__METHOD__);
}
/**
* @return null|string
*/
public function getPageIdent()
{
switch (strtolower(oxRegistry::getConfig()->getActiveView()->getClassName()))
{
case 'details':
case 'oxwarticledetails':
if (($oView = oxRegistry::getConfig()->getActiveView())
&& method_exists($oView, 'getProduct')
) {
return $oView->getProduct()->getFieldData('oxtitle');
}
return null;
case 'alist':
case 'manufacturerlist':
case 'vendorlist':
if (($oView = oxRegistry::getConfig()->getActiveView())
&& method_exists($oView, 'getTitle')
) {
return $oView->getTitle();
}
return null;
case 'search':
return oxRegistry::getConfig()->getRequestParameter('searchparam');
case 'content':
if (($oView = oxRegistry::getConfig()->getActiveView())
&& method_exists($oView, 'getContent')
) {
return $oView->getContent()->getFieldData('oxtitle');
}
return null;
case 'tag':
if (($oView = oxRegistry::getConfig()->getActiveView())
&& method_exists($oView, 'getTag')
) {
return $oView->getTag();
}
return null;
}
return null;
}
/**
* @return string
*/

View File

@ -93,6 +93,16 @@ DQ9';
'sExtra' => '',
'blMultilang' => false,
),
'OXPAGE' => array(
'sTableName' => 'd3usersonline',
'sFieldName' => 'OXPAGE',
'sType' => 'VARCHAR(32)',
'blNull' => false,
'sDefault' => false,
'sComment' => '',
'sExtra' => '',
'blMultilang' => false,
),
);
public $aIndizes = array(
@ -111,6 +121,15 @@ DQ9';
'OXCLASS' => 'OXCLASS',
),
),
'CLASSPAGE' => array(
'sTableName' => 'd3usersonline',
'sType' => '',
'sName' => 'CLASSPAGE',
'aFields' => array(
'OXCLASS' => 'OXCLASS',
'OXPAGE' => 'OXPAGE',
),
),
'TIMEVISIT' => array(
'sTableName' => 'd3usersonline',
'sType' => '',

View File

@ -36,4 +36,12 @@ $aLang = array(
'D3_USERSONLINE_USERS' => 'Benutzer',
'D3_USERSONLINE_ALL' => 'gesamt',
'D3_USERSONLINE_SAVE' => 'Speichern',
'D3_USERSONLINE_CLASS_ALIST' => 'Artikelliste aus Kategorie',
'D3_USERSONLINE_CLASS_MANUFACTURERLIST' => 'Artikelliste aus Hersteller',
'D3_USERSONLINE_CLASS_VENDORLIST' => 'Artikelliste aus Lieferant',
'D3_USERSONLINE_CLASS_CONTENT' => 'Informationstext',
'D3_USERSONLINE_CLASS_OXWARTICLEDETAILS' => 'Detailseite',
'D3_USERSONLINE_CLASS_DETAILS' => 'Detailseite',
'D3_USERSONLINE_CLASS_START' => 'Startseite',
'D3_USERSONLINE_CLASS_TAGS' => 'Stichwort',
);

View File

@ -36,4 +36,12 @@ $aLang = array(
'D3_USERSONLINE_USERS' => 'users',
'D3_USERSONLINE_ALL' => 'all',
'D3_USERSONLINE_SAVE' => 'save',
'D3_USERSONLINE_CLASS_ALIST' => 'article list from category',
'D3_USERSONLINE_CLASS_MANUFACTURERLIST' => 'article list from manufacturer',
'D3_USERSONLINE_CLASS_VENDORLIST' => 'article list from vendor',
'D3_USERSONLINE_CLASS_CONTENT' => 'information text',
'D3_USERSONLINE_CLASS_OXWARTICLEDETAILS' => 'details page',
'D3_USERSONLINE_CLASS_DETAILS' => 'details page',
'D3_USERSONLINE_CLASS_START' => 'start page',
'D3_USERSONLINE_CLASS_TAGS' => 'tag',
);

View File

@ -125,10 +125,14 @@
<tr>
<td>
[{if $aClassUser->classname}]
[{$aClassUser->classname|ucfirst}]:
[{$oView->getControllerTitle($aClassUser->classname)}]
[{else}]
undefined:
undefined
[{/if}]
[{if $aClassUser->page}]
"[{$aClassUser->page}]"
[{/if}]
:
</td>
<td style="text-align: right; font-weight: bold;">
[{$aClassUser->counter}]&nbsp;