ill still be rec@d, b:||z|(z| $id8zz * @return void @ */ +5||z|z{zzz{z{zEy}zz0z zzzF~z-zzself::getCacheId($idSite)); Cache::regenerateCacheWebsiteAttributes($idSite); } /** * Returns a datatable of Items SKU/name or categories and their metrics * If $abandonedCarts set to 1, will return items abandoned in carts. If set to 0, will return items ordered */ protected function getItems($recordName, $idSite, $period, $date, $abandonedCarts, $segment) { Piwik::checkUserHasViewAccess($idSite); $recordNameFinal = $recordName; if ($abandonedCarts) { $recordNameFinal = Archiver::getItemRecordNameAbandonedCart($recordName); } $archive = Archive::build($idSite, $period, $date, $segment); $dataTable = $archive->getDataTable($recordNameFinal); // ensure to use real column names from here on, as using the index can cause trouble when sorting by columns that don't exist in every row. $dataTable->filter('ReplaceColumnNames'); // Before Matomo 4.0.0 ecommerce views were tracked in custom variables // So if Matomo was installed before try to fetch the views from custom variables and enrich the report if (version_compare(DbHelper::getInstallVersion(), '4.0.0-b2', '<')) { $this->enrichItemsTableWithViewMetrics($dataTable, $recordName, $idSite, $period, $date, $segment); } // use average ecommerce view price if no cart price is available $dataTable->filter(function (DataTable $table) { foreach ($table->getRowsWithoutSummaryRow() as $row) { if (!$row->getColumn('avg_price') && !$row->getColumn('price')) { $row->renameColumn(self::AVG_PRICE_VIEWED, 'avg_price'); } $row->deleteColumn(self::AVG_PRICE_VIEWED); } }); $reportToNotDefinedString = array( 'Goals_ItemsSku' => Piwik::translate('General_NotDefined', Piwik::translate('Goals_ProductSKU')), // Note: this should never happen 'Goals_ItemsName' => Piwik::translate('General_NotDefined', Piwik::translate('Goals_ProductName')), 'Goals_ItemsCategory' => Piwik::translate('General_NotDefined', Piwik::translate('Goals_ProductCategory')) ); $notDefinedStringPretty = $reportToNotDefinedString[$recordName]; $this->renameNotDefinedRow($dataTable, $notDefinedStringPretty); if ($abandonedCarts) { $ordersColumn = 'abandoned_carts'; $dataTable->renameColumn('orders', $ordersColumn); } $dataTable->queueFilter('ReplaceSummaryRowLabel'); $dataTable->queueFilter('ColumnDelete', array('price')); return $dataTable; } protected function renameNotDefinedRow($dataTable, $notDefinedStringPretty) { if ($dataTable instanceof DataTable\Map) { foreach ($dataTable->getDataTables() as $table) { $this->renameNotDefinedRow($table, $notDefinedStringPretty); } return; } $rowNotDefined = $dataTable->getRowFromLabel('Value not defined'); if ($rowNotDefined) { $rowNotDefined->setColumn('label', $notDefinedStringPretty); } } protected function enrichItemsDataTableWithItemsViewMetrics($dataTable, $idSite, $period, $date, $segment, $idSubtable) { if (!Manager::getInstance()->isPluginActivated('CustomVariables') || in_array('nb_visits', $dataTable->getColumns())) { // skip if CustomVariables plugin is not available or table already contains visits return; } $ecommerceViews = \Piwik\Plugins\CustomVariables\API::getInstance()->getCuroup WHERE tstamp > 0 AND pid IN(".implode(',',$objCustomElements->fetchEach('id')).")")->execute(); if($objGroups->numRows > 0) { while($objGroups->next()) { $objGroup = \PCT\CustomElements\Core\GroupFactory::create($objGroups); if($objGroup === null) { continue; } $objCE = \PCT\CustomElements\Core\CustomElementFactory::findById($objGroup->pid); Cache::addGroup($objGroup->id,$objGroup); Cache::addGroup('ce_'.$objCE->id.'_'.$objGroup->alias,$objGroup); Cache::addGroup('ce_'.$objCE->alias.'_'.$objGroup->alias,$objGroup); } } if($objGroups->numRows > 0) { //-- Cache attributes $objAttributes = $objDatabase->prepare("SELECT * FROM tl_pct_customelement_attribute WHERE tstamp > 0 AND pid IN(".implode(',',$objGroups->fetchEach('id')).")")->execute(); if($objAttributes->numRows > 0) { while($objAttributes->next()) { $objAttribute = \PCT\CustomElements\Core\AttributeFactory::create($objAttributes); if($objAttribute === null) { continue; } $objGroup = \PCT\CustomElements\Core\GroupFactory::findById($objAttributes->pid); $objCE = \PCT\CustomElements\Core\CustomElementFactory::findById($objGroup->pid); Cache::addAttribute($objAttribute->id,$objAttribute); Cache::addAttribute('ce_'.$objCE->id.'_'.$objAttribute->alias, $objAttribute ); if( isset($objAttribute->uuid) && !empty($objAttribute->uuid) ) { Cache::addAttribute($objAttribute->uuid,$objAttribute); Cache::addAttribute('ce_'.$objCE->id.'_'.$objAttribute->uuid, $objAttribute ); Cache::addAttribute('ce_'.$objCE->alias.'_'.$objAttribute->uuid, $objAttribute ); } } } } } //-- Cache wizards #if(TL_MODE == 'FE' || $GLOBALS['PCT_CUSTOMELEMENTS']['cacheWizardsInBackend']) #{ # $blnCache = true; # # // do not run caching when not in edit modes # if(TL_MODE == 'BE' && !in_array(\Contao\Input::get('act'), array('edit','editAll','overrideAll')) ) # { # $blnCache = false; # } # # if($blnCache) # { # global $objPage; # $objDatabase = \Contao\Database::getInstance(); # $objWizards = null; # # $arrSource = array_unique(array_diff($GLOBALS['PCT_CUSTOMELEMENTS']['allowedTables'],array('tl_page','tl_article','tl_news_archive'))); # if(TL_MODE == 'BE' && \Contao\Input::get('table')) # { # $arrSource = array(\Contao\Input::get('table')); # } # # $objStmt = $objDatabase->prepare(" # SELECT * FROM tl_pct_customelement_vault # WHERE type=? # AND data_blob IS NOT NULL # AND ".$objDatabase->findInSet('source',$arrSource). # ((int)\Contao\Input::get('id') > 0 && TL_MODE == 'BE' ? " AND pid=".(int)\Contao\Input::get('id') : "") # ); # # if($GLOBALS['PCT_CUSTOMELEMENTS']['cacheLimit']['wizard'] > 0) # { # $objStmt->limit($GLOBALS['PCT_CUSTOMELEMENTS']['cacheLimit']['wizard']); # } # # $objWizards = $objStmt->execute('wizard'); # if($objWizards->numRows > 0) # { # while($objWizards->next()) # { # Cache::addWizard($objWizards->pid,$objWizards->source,$objWizards->attr_id,$objWizards->data_blob); # } # } # } #} } /** * Store the Ids of the generated customelements * @param object * @param boolean * @return boolean */ public function onIsVisibleElement($objElement, $blnIsVisible) { if(!$blnIsVisible) { return $blnIsVisible; } $strTable = $objElement->getTable(); $strType = $objElement->type; // include module if($strType == 'module' && $strTable == 'tl_content') { $objModuleModel = \Contao\ModuleModel::findByPk($objElement->module); return $this->onIsVisibleElement($objModuleModel, $blnIsVisible); } if(!is_array($GLOBALS['PCT_CUSTOMELEMENTS']['CACHE']['ACTIVE'][$strTable]['alias'])) { $GLOBALS['PCT_CUSTOMELEMENTS']['CACHE']['ACTIVE'][$strTable]['alias'] = array(); } // remember the id of the element to laod the wizard data later if(in_array($strType, $GLOBALS['PCT_CUSTOMELEMENTS']['CACHE']['ACTIVE'][$strTable]['alias'])) { $GLOBALS['PCT_CUSTOMELEMENTS']['CACHE']['ACTIVE'][$strTable]['ids'][] = $objElement->id; } return $blnIsVisible; } /** * Checks if the deprected vault sill contains extries and displays a backend info. */ public function showVaultMigrationAlert() { if( TL_MODE != 'BE' ) { return; } $objDatabase = \Contao\Database::getInstance(); if( !$objDatabase->tableExists('tl_pct_customelement_vault') ) { unset( $GLOBALS['PCT_CUSTOMELEMENTS']['MAINTENANCE']['resolveVault'] ); return; } $objUser = System::importStatic('Contao\BackendUser', 'User'); if( $objUser->id === null ) { return; } $objResult = $objDatabase->prepare("SELECT COUNT(*) as count FROM tl_pct_customelement_vault WHERE ".$objDatabase->findInSet('source',$GLOBALS['PCT_CUSTOMELEMENTS']['allowedTables']))->execute(); if( $objResult->count < 1 ) { return; } System::loadLanguageFile('default'); Message::addError(''.$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['migrateVaultAlert'].''); } } Redirecting to https://regional-elbe-elster.de/regional.html Redirecting to https://regional-elbe-elster.de/regional.html.