DataWizardTasks/Application/Model/Exports/DestroyedWysiwygSpecialChars.php

70 lines
2.3 KiB
PHP
Raw Normal View History

2021-07-28 17:39:15 +02:00
<?php
/**
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
namespace D3\DataWizardTasks\Application\Model\Exports;
use D3\DataWizard\Application\Model\ExportBase;
use OxidEsales\Eshop\Application\Model\Content;
use OxidEsales\Eshop\Core\Registry;
class DestroyedWysiwygSpecialChars extends ExportBase
{
/**
* @return string
*/
public function getTitle() : string
{
2021-10-31 23:18:45 +01:00
return Registry::getLang()->translateString('D3_DATAWIZARDTASKS_EXPORTS_DESTROYEDWYSIWYGSPECIALCHARS', null, true);
2021-07-28 17:39:15 +02:00
}
public function getDescription() : string
{
2021-10-31 23:18:45 +01:00
return Registry::getLang()->translateString('D3_DATAWIZARDTASKS_EXPORTS_DESTROYEDWYSIWYGSPECIALCHARS_DESC', null, true);
2021-07-28 17:39:15 +02:00
}
/**
* @return array
*/
public function getQuery() : array
{
$content = oxNew(Content::class);
$contentTableName = $content->getCoreTableName();
2021-10-31 23:18:45 +01:00
$titleTitle = Registry::getLang()->translateString('D3_DATAWIZARDTASKS_EXPORTS_DESTROYEDWYSIWYGSPECIALCHARS_TITLE', null, true);
$loadIdTitle = Registry::getLang()->translateString('D3_DATAWIZARDTASKS_EXPORTS_DESTROYEDWYSIWYGSPECIALCHARS_LOADID', null, true);
2021-07-28 17:39:15 +02:00
$currentLanguage = $content->getLanguage();
$whereFields = [];
foreach (array_keys(Registry::getLang()->getAllShopLanguageIds()) as $langId) {
$content->setLanguage($langId);
$whereFields[] = $content->getUpdateSqlFieldName('oxcontent').' LIKE :specialChars';
}
$content->setLanguage($currentLanguage);
return [
"SELECT
oc.OXID,
oc.OXSHOPID,
oc.OXLOADID as :loadId,
oc.OXTITLE as :titleTitle
FROM ".$contentTableName." oc
WHERE ".implode(' OR ', $whereFields)."
GROUP BY oc.oxloadid",
[
'specialChars' => '%-&gt;%',
'loadId' => $loadIdTitle,
'titleTitle' => $titleTitle
]
];
}
}