diff --git a/Sources/UsersOnline-Installation.docx b/Sources/UsersOnline-Installation.docx index 9763618..b3b8428 100644 Binary files a/Sources/UsersOnline-Installation.docx and b/Sources/UsersOnline-Installation.docx differ diff --git a/copy_this/modules/d3/d3usersonline/controllers/admin/d3_cfg_usersonline_licence.php b/copy_this/modules/d3/d3usersonline/controllers/admin/d3_cfg_usersonline_licence.php index aded1eb..5969a1e 100644 --- a/copy_this/modules/d3/d3usersonline/controllers/admin/d3_cfg_usersonline_licence.php +++ b/copy_this/modules/d3/d3usersonline/controllers/admin/d3_cfg_usersonline_licence.php @@ -20,6 +20,4 @@ class d3_cfg_usersonline_licence extends d3_cfg_mod_licence protected $_hasNewsletterForm = false; protected $_sLogType = 2; - - //protected $_sBlogFeed = "http://blog.oxidmodule.com/feeds/categories/46-Angebotsanfrage.rss"; } diff --git a/copy_this/modules/d3/d3usersonline/controllers/admin/d3_cfg_usersonline_main.php b/copy_this/modules/d3/d3usersonline/controllers/admin/d3_cfg_usersonline_main.php index 3f64ebf..8f94d21 100644 --- a/copy_this/modules/d3/d3usersonline/controllers/admin/d3_cfg_usersonline_main.php +++ b/copy_this/modules/d3/d3usersonline/controllers/admin/d3_cfg_usersonline_main.php @@ -25,5 +25,9 @@ class d3_cfg_usersonline_Main extends d3_cfg_mod_main protected $_blHasTestModeSwitch = false; + protected $_sMenuItemTitle = 'd3mxusersonline'; + + protected $_sMenuSubItemTitle = 'd3mxusersonline_settings'; + //protected $_sDebugHelpTextIdent = 'D3_INQUIRY_MAIN_DEBUGACTIVE_DESC'; } diff --git a/copy_this/modules/d3/d3usersonline/controllers/admin/d3_usersonline_statistic.php b/copy_this/modules/d3/d3usersonline/controllers/admin/d3_usersonline_statistic.php index 234a961..5671239 100644 --- a/copy_this/modules/d3/d3usersonline/controllers/admin/d3_usersonline_statistic.php +++ b/copy_this/modules/d3/d3usersonline/controllers/admin/d3_usersonline_statistic.php @@ -14,9 +14,21 @@ class d3_usersonline_statistic extends d3_cfg_mod_main { protected $_blUseOwnOxid = false; - protected $_iExpTime = 600; // (in seconds) protected $_sThisTemplate = 'd3_usersonline_statistic.tpl'; + protected $_sMenuItemTitle = 'd3mxusersonline'; + + 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 */ @@ -24,7 +36,34 @@ class d3_usersonline_statistic extends d3_cfg_mod_main { /** @var d3usersonline $oUsersOnline */ $oUsersOnline = oxNew('d3usersonline'); - $oUsersOnline->clearOldItems($this->_iExpTime); - return $oUsersOnline->getUserCount(); + $oUsersOnline->clearOldItems(); + return $oUsersOnline->getUserCount($this->blGroupByClass); + } + + 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); } } diff --git a/copy_this/modules/d3/d3usersonline/metadata.php b/copy_this/modules/d3/d3usersonline/metadata.php index 25323f7..7bf91ee 100644 --- a/copy_this/modules/d3/d3usersonline/metadata.php +++ b/copy_this/modules/d3/d3usersonline/metadata.php @@ -36,7 +36,7 @@ $aModule = array( 'en' => '', ), 'thumbnail' => 'picture.png', - 'version' => '2.0.1.1', + 'version' => '2.1.0.0', 'author' => 'D³ Data Development (Inh.: Thomas Dartsch)', 'email' => 'support@shopmodule.com', 'url' => 'http://www.oxidmodule.com/', @@ -61,13 +61,6 @@ $aModule = array( 'events' => array( 'onActivate' => 'd3install::checkUpdateStart', ), - 'blocks' => array( - array( - 'template' => 'layout/sidebar.tpl', - 'block' => 'sidebar_categoriestree', - 'file' => 'views/blocks/layout/d3usersonline_sidebar.tpl' - ), - ), 'd3FileRegister' => array( 'd3/d3usersonline/IntelliSenseHelper.php', 'd3/d3usersonline/metadata.php', diff --git a/copy_this/modules/d3/d3usersonline/models/d3usersonline.php b/copy_this/modules/d3/d3usersonline/models/d3usersonline.php index e4b8e8f..e7a83d2 100644 --- a/copy_this/modules/d3/d3usersonline/models/d3usersonline.php +++ b/copy_this/modules/d3/d3usersonline/models/d3usersonline.php @@ -32,6 +32,9 @@ class d3usersonline extends oxbase protected $_httpXComingFrom = null; protected $_httpComingFrom = null; + protected $_iDeleteThreshold = 30; // Zeitdifferenz zwischen 2 Löschaufträgen + protected $_iExpTime = 600; // Ablaufzeit für inaktive Benutzer + /** * constructor */ @@ -44,12 +47,19 @@ class d3usersonline extends oxbase /** * @param $iExpTime */ - public function clearOldItems($iExpTime) + public function clearOldItems() { startProfile(__METHOD__); - $iExptime = time() - $iExpTime; - oxDb::getDb()->Execute("delete from ".$this->getViewName()." where timevisit < $iExptime"); + $iTime = time(); + $iLastDeleteTime = oxRegistry::getConfig()->getShopConfVar('iLastDeleteTime', null, 'd3usersonline'); + + if ($iTime > $iLastDeleteTime + $this->_iDeleteThreshold) { + $iExptime = $iTime - $this->_iExpTime; + oxDb::getDb()->Execute("delete from " . $this->getViewName() . " where timevisit < $iExptime"); + + oxRegistry::getConfig()->saveShopConfVar('int', 'iLastDeleteTime', $iTime, null, 'd3usersonline'); + } stopProfile(__METHOD__); } @@ -57,13 +67,18 @@ class d3usersonline extends oxbase /** * @return array */ - public function getUserCount() + public function getUserCount($blGroupByClass = false) { startProfile(__METHOD__); - $sSelect = "select count(oxid) AS counter, oxclass from ". - $this->getViewName()." GROUP BY oxclass ORDER BY counter desc"; - $aRecords = oxDb::getDb(oxDb::FETCH_MODE_ASSOC)->getArray($sSelect); + 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; $aUserClasses = array(); @@ -73,6 +88,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; @@ -94,7 +110,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); @@ -103,6 +120,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 */ diff --git a/copy_this/modules/d3/d3usersonline/modules/components/d3_oxcmp_utils_usersonline.php b/copy_this/modules/d3/d3usersonline/modules/components/d3_oxcmp_utils_usersonline.php index e706c4a..4ed9fdb 100644 --- a/copy_this/modules/d3/d3usersonline/modules/components/d3_oxcmp_utils_usersonline.php +++ b/copy_this/modules/d3/d3usersonline/modules/components/d3_oxcmp_utils_usersonline.php @@ -20,7 +20,6 @@ class d3_oxcmp_utils_usersonline extends d3_oxcmp_utils_usersonline_parent { protected $_blIsComponent = true; - protected $_iExpTime = 600; // (in seconds) protected $_sD3UsersOnlineModId = 'd3usersonline'; /** @@ -33,7 +32,7 @@ class d3_oxcmp_utils_usersonline extends d3_oxcmp_utils_usersonline_parent if (d3_cfg_mod::get($this->_sD3UsersOnlineModId)->isActive()) { /** @var d3usersonline $oUsersOnline */ $oUsersOnline = oxNew('d3usersonline'); - $oUsersOnline->clearOldItems($this->_iExpTime); + $oUsersOnline->clearOldItems(); $oUsersOnline->setActTimeVisit(); $oUser = $this->getUser(); diff --git a/copy_this/modules/d3/d3usersonline/setup/d3usersonline_update.php b/copy_this/modules/d3/d3usersonline/setup/d3usersonline_update.php index 47327b9..5ba8c80 100644 --- a/copy_this/modules/d3/d3usersonline/setup/d3usersonline_update.php +++ b/copy_this/modules/d3/d3usersonline/setup/d3usersonline_update.php @@ -22,20 +22,24 @@ class d3usersonline_update extends d3install_updatebase { public $sModKey = 'd3usersonline'; public $sModName = 'Users Online'; - public $sModVersion = '2.0.1.1'; - public $sModRevision = '43'; - public $sBaseConf = 'Nv6RXZkcTl5NmIybDdzQldqUWo5dURBTXB4Tld3aHN3N2pmNmZacUljL0R4WUg2a1o4QUxLeVUrdjBSZ -WFud2VjRFJDa2ZvTHVaS2tpczAyZ0NGOGxwV3ZISHB3c0xRLzQ4Ny9kcTdDSjVQZDBYZ3VUMHFNaVg1R -3ZudGMzOGhsb01Sd1dTRG4xd0xscCtORC93VXJsWngrV200YktMSk93UENWNzJuT2NaT0U0UkJaQWdqa -nVKT0RwVFFzclYrT2JnckNGZjNieVRDSzcyV2Z2QktDR3RqNWJsemd6WURVMm1tbWl5cEJNMDFvR3JiS -2F5OHIvb0VoMUw1Nm9XdWdTc2FwVWpCVWFkZEllT1lGTzdiY2I0YUdNMmV3K3kyakZQMVRuUVJyUjhKO -DQ9'; + public $sModVersion = '2.1.0.0'; + public $sModRevision = '2100'; + public $sBaseConf = 'qWOv2==Y0dBTjQ4SGQ5Z0wwRVduakMxL01XL1c2dWlpK0p0bEJQeGZEcldMN3hINm5jOTJCWmV6MWhyV +FVDVS9KQ3hwWUtUQmM3d1RVLzBVNGZISCsxVG0wWmVlNTlYOUNGQ0g2b2Z0NGlYQWZXZGprUXdZTzE0c +zRHbGJKaEx0aWZNc3ZSTC9FdU10eHhadDA1c3NZdFlaNmZGQWF0VzUzVWxRQllhTFYxdmQyQTBLekRRM +jhrdDB5M0RnWWJQM3NMSVhBQ2RkS1l2WWJPV3lTNlNWOEwrSGxHdElTMmhoZ2FPYUhQN0lVOEpDZmVwY +0JLWndPRjVidU4rQzM3V29lcXBuaFFGdEdQZGxZZUFyWjFIZkVXVnZpT0NzTkhjV2drRzJCVStIOHVRb +0xLMGJvTTN5Z2ZYV0ZMY2NtY1dCVGkra0M='; public $sRequirements = ''; public $sBaseValue = ''; + public $sMinModCfgVersion = '4.4.0.0'; + protected $_aUpdateMethods = array( array('check' => 'checkUsersOnlineTableExist', 'do' => 'updateUsersOnlineTableExist'), + array('check' => 'checkUsersOnlineTableEngine', + 'do' => 'updateUsersOnlineTableEngine'), array('check' => 'checkRenameFields', 'do' => 'fixRenameFields'), array('check' => 'checkDeleteFields', @@ -89,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( @@ -107,6 +121,23 @@ DQ9'; 'OXCLASS' => 'OXCLASS', ), ), + 'CLASSPAGE' => array( + 'sTableName' => 'd3usersonline', + 'sType' => '', + 'sName' => 'CLASSPAGE', + 'aFields' => array( + 'OXCLASS' => 'OXCLASS', + 'OXPAGE' => 'OXPAGE', + ), + ), + 'TIMEVISIT' => array( + 'sTableName' => 'd3usersonline', + 'sType' => '', + 'sName' => 'TIMEVISIT', + 'aFields' => array( + 'TIMEVISIT' => 'TIMEVISIT', + ), + ), ); public $aRenameFields = array( @@ -162,12 +193,39 @@ DQ9'; $blRet = true; if ($this->checkUsersOnlineTableExist()) { - $blRet = $this->_addTable2('d3usersonline', $this->aFields, $this->aIndizes, 'users online', 'MyISAM'); + $blRet = $this->_addTable2('d3usersonline', $this->aFields, $this->aIndizes, 'users online', 'InnoDB'); } return $blRet; } + /** + * @return bool true, if table has wrong engine + */ + public function checkUsersOnlineTableEngine() + { + /** @var d3installdbtable $oDbTable */ + $oDbTable = oxNew('d3installdbtable', $this); + $aData = $oDbTable->getTableData('d3usersonline'); + + if (isset($aData) && count($aData) && isset($aData['ENGINE']) && $aData['ENGINE'] == 'InnoDB') { + return false; + } + + return true; + } + + /** + * @return bool + */ + public function updateUsersOnlineTableEngine() + { + /** @var d3installdbtable $oDbTable */ + $oDbTable = oxNew('d3installdbtable', $this); + $blRet = $oDbTable->changeTableEngine('d3usersonline', 'InnoDB'); + return $blRet; + } + /** * @return bool */ diff --git a/copy_this/modules/d3/d3usersonline/views/admin/de/d3usersonline_lang.php b/copy_this/modules/d3/d3usersonline/views/admin/de/d3usersonline_lang.php index f67ea15..e45bb8c 100644 --- a/copy_this/modules/d3/d3usersonline/views/admin/de/d3usersonline_lang.php +++ b/copy_this/modules/d3/d3usersonline/views/admin/de/d3usersonline_lang.php @@ -25,14 +25,24 @@ $iLangNr = 0; $aLang = array( 'charset' => 'ISO-8859-15', - 'd3mxusersonline' => 'Benutzer online', + 'd3mxusersonline' => ' Benutzer online', 'd3mxusersonline_settings' => 'Einstellungen', 'd3tbclussersonline_settings_main' => 'Grundeinstellungen', 'd3mxusersonline_analysis' => 'Auswertungen', 'd3tbclusersonline_currvisitors' => 'aktuelle Besucher', 'D3USERSONLINE_NOTACTIVE' => 'Modul ist nicht aktiv', + 'D3_USERSONLINE_GROUPBYCLASS' => 'Besuche nur nach Shopseiten gruppieren', 'D3_USERSONLINE_USERSONLINE' => 'Benutzer online', 'D3_USERSONLINE_USER' => 'Benutzer', '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', ); diff --git a/copy_this/modules/d3/d3usersonline/views/admin/en/d3usersonline_lang.php b/copy_this/modules/d3/d3usersonline/views/admin/en/d3usersonline_lang.php index a5a3c60..abbdbb5 100644 --- a/copy_this/modules/d3/d3usersonline/views/admin/en/d3usersonline_lang.php +++ b/copy_this/modules/d3/d3usersonline/views/admin/en/d3usersonline_lang.php @@ -25,14 +25,24 @@ $iLangNr = 0; $aLang = array( 'charset' => 'ISO-8859-15', - 'd3mxusersonline' => 'Users Online', + 'd3mxusersonline' => ' Users online', 'd3mxusersonline_settings' => 'Settings', 'd3tbclussersonline_settings_main' => 'Main Settings', 'd3mxusersonline_analysis' => 'Analysis', 'd3tbclusersonline_currvisitors' => 'current visitors', 'D3USERSONLINE_NOTACTIVE' => "Module isn't active", + 'D3_USERSONLINE_GROUPBYCLASS' => 'group visitors by shop pages only', 'D3_USERSONLINE_USERSONLINE' => 'Users online', 'D3_USERSONLINE_USER' => 'user', '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', ); diff --git a/copy_this/modules/d3/d3usersonline/views/admin/tpl/d3_cfg_usersonline_main.tpl b/copy_this/modules/d3/d3usersonline/views/admin/tpl/d3_cfg_usersonline_main.tpl index 3574879..2c23747 100644 --- a/copy_this/modules/d3/d3usersonline/views/admin/tpl/d3_cfg_usersonline_main.tpl +++ b/copy_this/modules/d3/d3usersonline/views/admin/tpl/d3_cfg_usersonline_main.tpl @@ -128,7 +128,7 @@
' . $this->translate('ExecNotice') . '
' . PHP_EOL; @@ -777,6 +923,14 @@ EOT; $sScriptName = $_SERVER['SCRIPT_NAME']; $sTranslShopPhpInfo = $this->translate('showPhpInfo'); $sTranslDependent = $this->translate('dependentoffurther'); + + if (count($this->oBase->getMessages())) { + echo ' '; + } if ($this->oBase->blGlobalResult) { echo '' . $this->translate('globalSuccess') . '' . @@ -806,6 +960,29 @@ EOT; return; } + /** + * @param $aResult + * + * @return bool + */ + protected function hasRemoteVersionDiff($aResult) + { + $blDiff = false; + + if (is_array($aResult) + && isset($aResult[$this->oBase->sVersionTag]) + && is_array($aResult[$this->oBase->sVersionTag]) + ) { + foreach ($aResult[$this->oBase->sVersionTag] as $sRemoteVersion) { + if (version_compare($sRemoteVersion, $this->oBase->getVersion(), '!=')) { + $blDiff = true; + } + } + } + + return $blDiff; + } + /** * @param $aResult * @param $sElementId @@ -814,12 +991,19 @@ EOT; */ public function getNoSuccessItem($aResult, $sElementId, $sCheckType, $aConfiguration) { - echo "
" . + $sText = ''; + $sDesc = ''; + if ($this->hasRemoteVersionDiff($aResult)) { + $sText = '!'; + $sDesc = strip_tags($this->translate('RemoteVersionDiff')); + } + + echo '