7 Commits
3.4.2 ... 3.4.3

6 changed files with 16 additions and 62 deletions

View File

@ -633,13 +633,9 @@ class rateitBackendModule extends \BackendModule
$cntSql = str_replace('%s', $where, $cntSql);
$count = $this->Database->prepare($cntSql)
->execute()
->fetchRow();
$count = $this->Database->query($cntSql)->fetchRow();
$arrRatingItems = $this->Database->prepare($sql)
->execute()
->fetchAllAssoc();
$arrRatingItems = $this->Database->query($sql)->fetchAllAssoc();
$arrReturn = array();
foreach ($arrRatingItems as $rating) {
if ($rating['active'] != '1') $rating['active'] = '0';

View File

@ -22,11 +22,11 @@
"php":">=5.3",
"contao/core":">=3.0",
"contao-community-alliance/composer-plugin": "~2.0",
"cgo-it/simple_ajax":"1.0.1",
"leounglaub/contao-simple-ajax":"3.2.x-dev",
"cgo-it/xls_export":"3.0.0"
},
"replace": {
"cgo-it/rate-it": "self.version"
"cgo-it/rate-it": "<3.4.3"
},
"conflict": {
"contao/core": "2.11.*"

View File

@ -75,6 +75,9 @@ class tl_content_rateit extends rateit\DcaHelper {
if ($dc->activeRecord->type == "gallery") {
$type = 'galpic';
// Alle vorherigen Bilder erst mal auf inaktiv setzen
$this->Database->prepare("UPDATE tl_rateit_items SET active='' WHERE rkey LIKE ? AND typ=?")->execute($dc->activeRecord->id.'|%', $type);
if (version_compare(VERSION, '3.2', '>=')) {
$objFiles = \FilesModel::findMultipleByUuids(deserialize($dc->activeRecord->multiSRC));
} else {
@ -131,56 +134,9 @@ class tl_content_rateit extends rateit\DcaHelper {
public function delete(\DC_Table $dc) {
if ($dc->activeRecord->type == "gallery") {
if (version_compare(VERSION, '3.2', '>=')) {
$objFiles = \FilesModel::findMultipleByUuids(deserialize($dc->activeRecord->multiSRC));
} else {
$objFiles = \FilesModel::findMultipleByIds(deserialize($dc->activeRecord->multiSRC));
}
// Get all images
while ($objFiles->next()) {
// Single files
if ($objFiles->type == 'file') {
$objFile = new \File($objFiles->path, true);
if (!$objFile->isGdImage) {
continue;
}
$rkey = $dc->activeRecord->id.'_'.$objFiles->id;
$this->Database->prepare("DELETE FROM tl_rateit_items WHERE rkey=? and typ=?")
->execute($rkey, 'galpic');
}
// Folders
else {
if (version_compare(VERSION, '3.2', '>=')) {
$objSubfiles = \FilesModel::findByPid($objFiles->uuid);
} else {
$objSubfiles = \FilesModel::findByPid($objFiles->id);
}
if ($objSubfiles === null) {
continue;
}
while ($objSubfiles->next()) {
// Skip subfolders
if ($objSubfiles->type == 'folder') {
continue;
}
$objFile = new \File($objSubfiles->path, true);
if (!$objFile->isGdImage) {
continue;
}
$rkey = $dc->activeRecord->id.'_'.$objSubfiles->id;
$this->Database->prepare("DELETE FROM tl_rateit_items WHERE rkey=? and typ=?")
->execute($rkey, 'galpic');
}
}
}
$this->Database->prepare("DELETE FROM tl_rateit_ratings WHERE pid IN (SELECT `id` FROM tl_rateit_items WHERE rkey LIKE ? AND typ=?)")
->execute($dc->activeRecord->id.'|%', 'galpic');
$this->Database->prepare("DELETE FROM tl_rateit_items WHERE rkey LIKE ? AND typ=?")->execute($dc->activeRecord->id.'|%', 'galpic');
return true;
} else {
return $this->deleteRatingKey($dc, 'ce');

View File

@ -65,7 +65,7 @@ $GLOBALS['TL_DCA']['tl_module']['fields']['rateit_types'] = array
'label' => &$GLOBALS['TL_LANG']['tl_module']['rateit_types'],
'exclude' => true,
'inputType' => 'checkboxWizard',
'options' => array('page', 'article', 'ce', 'module', 'news', 'faq', 'galpic'),
'options' => array('page', 'article', 'ce', 'module', 'news', 'faq', 'galpic', 'news4ward'),
'eval' => array('multiple'=>true, 'mandatory'=>true),
'reference' => &$GLOBALS['TL_LANG']['tl_module']['rateit_types'],
'sql' => "varchar(255) NOT NULL default ''"

View File

@ -38,7 +38,7 @@ $GLOBALS['TL_LANG']['tl_module']['rateit_legend'] = 'Rate It-Einstellungen';
*/
$GLOBALS['TL_LANG']['tl_module']['rateit_title'] = array('Titel der Bewertung', 'Titel der Bewertung (wird im Backend angezeigt).');
$GLOBALS['TL_LANG']['tl_module']['rateit_active'] = array('Aktiv', 'Aktiv bedeutet, dass die Bewertung sichtbar für den Frontend-Nutzer ist.');
$GLOBALS['TL_LANG']['tl_module']['rateit_types'] = array('Seite', 'Artikel', 'Inhaltselement', 'Modul', 'Nachrichten', 'FAQ', 'Galeriebild');
$GLOBALS['TL_LANG']['tl_module']['rateit_types'] = array('Typen', 'Art der Bewertung');
$GLOBALS['TL_LANG']['tl_module']['rateit_count'] = array('Max. Anzahl', 'Max. Anzahl anzuzeigender Einträge.');
$GLOBALS['TL_LANG']['tl_module']['rateit_toptype'] = array('Art der Liste', 'Die x bestbewerteten Einträge oder die x meistbewerteten Einträge.');
$GLOBALS['TL_LANG']['tl_module']['rateit_template'] = array('Template', 'Hier können Sie das Template für die Bewertung des Artikels auswählen.');
@ -50,6 +50,7 @@ $GLOBALS['TL_LANG']['tl_module']['rateit_types']['module'] = 'Modul';
$GLOBALS['TL_LANG']['tl_module']['rateit_types']['news'] = 'Nachrichten';
$GLOBALS['TL_LANG']['tl_module']['rateit_types']['faq'] = 'FAQ';
$GLOBALS['TL_LANG']['tl_module']['rateit_types']['galpic'] = 'Galeriebild';
$GLOBALS['TL_LANG']['tl_module']['rateit_types']['news4ward'] = 'Beitrag';
$GLOBALS['TL_LANG']['tl_module']['rateit_toptype']['best'] = 'Beste Bewertungen';
$GLOBALS['TL_LANG']['tl_module']['rateit_toptype']['most'] = 'Meiste Bewertungen';

View File

@ -50,6 +50,7 @@ $GLOBALS['TL_LANG']['tl_module']['rateit_types']['module'] = 'Module';
$GLOBALS['TL_LANG']['tl_module']['rateit_types']['news'] = 'News';
$GLOBALS['TL_LANG']['tl_module']['rateit_types']['faq'] = 'FAQ';
$GLOBALS['TL_LANG']['tl_module']['rateit_types']['galpic'] = 'Gallery Picture';
$GLOBALS['TL_LANG']['tl_module']['rateit_types']['news4ward'] = 'Blog entry';
$GLOBALS['TL_LANG']['tl_module']['rateit_toptype']['best'] = 'Best votes';
$GLOBALS['TL_LANG']['tl_module']['rateit_toptype']['most'] = 'Most votes';