Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
e2a1ac4dbf | |||
19feefda83 | |||
90a65bcc43 |
@ -115,7 +115,7 @@ class RateItFrontend extends \Hybrid
|
|||||||
$this->loadLanguageFile('default');
|
$this->loadLanguageFile('default');
|
||||||
$stars = $this->percentToStars($rating['rating']);
|
$stars = $this->percentToStars($rating['rating']);
|
||||||
preg_match('/^.*\[(.+)\|(.+)\].*$/i', $GLOBALS['TL_CONFIG']['rating_description'], $labels);
|
preg_match('/^.*\[(.+)\|(.+)\].*$/i', $GLOBALS['TL_CONFIG']['rating_description'], $labels);
|
||||||
if (!is_array($labels) || !count($labels) == 2 || !count($labels) == 3) {
|
if (!is_array($labels) && (!count($labels) == 2 || !count($labels) == 3)) {
|
||||||
$label = ($rating[totalRatings] > 1 || $rating[totalRatings] == 0) || !$rating ? $GLOBALS['TL_LANG']['rateit']['rating_label'][1] : $GLOBALS['TL_LANG']['rateit']['rating_label'][0];
|
$label = ($rating[totalRatings] > 1 || $rating[totalRatings] == 0) || !$rating ? $GLOBALS['TL_LANG']['rateit']['rating_label'][1] : $GLOBALS['TL_LANG']['rateit']['rating_label'][0];
|
||||||
$description = '%current%/%max% %type% (%count% ['.$GLOBALS['TL_LANG']['tl_rateit']['vote'][0].'|'.$GLOBALS['TL_LANG']['tl_rateit']['vote'][1].'])';
|
$description = '%current%/%max% %type% (%count% ['.$GLOBALS['TL_LANG']['tl_rateit']['vote'][0].'|'.$GLOBALS['TL_LANG']['tl_rateit']['vote'][1].'])';
|
||||||
} else {
|
} else {
|
||||||
|
41
composer.json
Normal file
41
composer.json
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"name":"cgo-it/rate-it",
|
||||||
|
"description":"RateIt extension for the Contao Open Source CMS",
|
||||||
|
"keywords":["contao", "rating", "rateit", "bewertung"],
|
||||||
|
"type":"contao-module",
|
||||||
|
"license":"LGPL-3.0+",
|
||||||
|
"authors":[
|
||||||
|
{
|
||||||
|
"name":"cgo IT",
|
||||||
|
"email":"info@cgo-it.de",
|
||||||
|
"homepage":"https://cgo-it.de",
|
||||||
|
"role":"Developer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"email": "info@cgo-it.de",
|
||||||
|
"issues": "https://bitbucket.org/cgo-it/contao-rate-it/issues?status=new&status=open",
|
||||||
|
"forum": "https://community.contao.org/de/showthread.php?38471-Rate-It",
|
||||||
|
"source": "https://bitbucket.org/cgo-it/contao-rate-it/src"
|
||||||
|
},
|
||||||
|
"require":{
|
||||||
|
"php":">=5.3",
|
||||||
|
"contao/core":">=3.0",
|
||||||
|
"contao-community-alliance/composer-plugin": "~2.0",
|
||||||
|
"cgo-it/simple_ajax":"1.0.1",
|
||||||
|
"cgo-it/xls_export":"3.0.0"
|
||||||
|
},
|
||||||
|
"replace": {
|
||||||
|
"cgo-it/rate-it": "self.version"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"contao/core": "2.11.*"
|
||||||
|
},
|
||||||
|
"extra":{
|
||||||
|
"contao": {
|
||||||
|
"sources":{
|
||||||
|
"":"system/modules/rateit"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -67,6 +67,7 @@ $GLOBALS['TL_LANG']['tl_rateit_type_options']['faq'] = 'FAQ';
|
|||||||
$GLOBALS['TL_LANG']['tl_rateit_type_options']['ce'] = 'Inhaltselement';
|
$GLOBALS['TL_LANG']['tl_rateit_type_options']['ce'] = 'Inhaltselement';
|
||||||
$GLOBALS['TL_LANG']['tl_rateit_type_options']['module'] = 'Modul';
|
$GLOBALS['TL_LANG']['tl_rateit_type_options']['module'] = 'Modul';
|
||||||
$GLOBALS['TL_LANG']['tl_rateit_type_options']['galpic'] = 'Galerie-Bild';
|
$GLOBALS['TL_LANG']['tl_rateit_type_options']['galpic'] = 'Galerie-Bild';
|
||||||
|
$GLOBALS['TL_LANG']['tl_rateit_type_options']['news4ward'] = 'Beitrag';
|
||||||
$GLOBALS['TL_LANG']['tl_rateit_order_options']['rating desc'] = 'Bewertung';
|
$GLOBALS['TL_LANG']['tl_rateit_order_options']['rating desc'] = 'Bewertung';
|
||||||
$GLOBALS['TL_LANG']['tl_rateit_order_options']['title'] = 'Titel';
|
$GLOBALS['TL_LANG']['tl_rateit_order_options']['title'] = 'Titel';
|
||||||
$GLOBALS['TL_LANG']['tl_rateit_order_options']['typ'] = 'Typ';
|
$GLOBALS['TL_LANG']['tl_rateit_order_options']['typ'] = 'Typ';
|
||||||
|
@ -67,6 +67,7 @@ $GLOBALS['TL_LANG']['tl_rateit_type_options']['faq'] = 'FAQ';
|
|||||||
$GLOBALS['TL_LANG']['tl_rateit_type_options']['ce'] = 'Content element';
|
$GLOBALS['TL_LANG']['tl_rateit_type_options']['ce'] = 'Content element';
|
||||||
$GLOBALS['TL_LANG']['tl_rateit_type_options']['module'] = 'Module';
|
$GLOBALS['TL_LANG']['tl_rateit_type_options']['module'] = 'Module';
|
||||||
$GLOBALS['TL_LANG']['tl_rateit_type_options']['galpic'] = 'Gallery picture';
|
$GLOBALS['TL_LANG']['tl_rateit_type_options']['galpic'] = 'Gallery picture';
|
||||||
|
$GLOBALS['TL_LANG']['tl_rateit_type_options']['news4ward'] = 'Blog entry';
|
||||||
$GLOBALS['TL_LANG']['tl_rateit_order_options']['rating desc'] = 'Rating';
|
$GLOBALS['TL_LANG']['tl_rateit_order_options']['rating desc'] = 'Rating';
|
||||||
$GLOBALS['TL_LANG']['tl_rateit_order_options']['title'] = 'Title';
|
$GLOBALS['TL_LANG']['tl_rateit_order_options']['title'] = 'Title';
|
||||||
$GLOBALS['TL_LANG']['tl_rateit_order_options']['typ'] = 'Type';
|
$GLOBALS['TL_LANG']['tl_rateit_order_options']['typ'] = 'Type';
|
||||||
|
@ -90,6 +90,7 @@
|
|||||||
.mod_rateit table.rating td.type-faq { background-color:#ffe0aa; }
|
.mod_rateit table.rating td.type-faq { background-color:#ffe0aa; }
|
||||||
.mod_rateit table.rating td.type-article { background-color:#ffcce0; }
|
.mod_rateit table.rating td.type-article { background-color:#ffcce0; }
|
||||||
.mod_rateit table.rating td.type-galpic { background-color:#ffe066; }
|
.mod_rateit table.rating td.type-galpic { background-color:#ffe066; }
|
||||||
|
.mod_rateit table.rating td.type-news4ward { background-color:#ffe011; }
|
||||||
.mod_rateit table.rating td.active-1, .mod_rateit table.rating td.type-page { background-color:#e0ffe0; }
|
.mod_rateit table.rating td.active-1, .mod_rateit table.rating td.type-page { background-color:#e0ffe0; }
|
||||||
.mod_rateit table.rating td.
|
.mod_rateit table.rating td.
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ function doRateIt() {
|
|||||||
getStarPercent: function(id) {
|
getStarPercent: function(id) {
|
||||||
/* Format = anyStringHere-<id>-<float(currentStars)>_(scale);
|
/* Format = anyStringHere-<id>-<float(currentStars)>_(scale);
|
||||||
* Example: RateItRatings-5-3_5 //Primary key id = 5, 3/5 stars. */
|
* Example: RateItRatings-5-3_5 //Primary key id = 5, 3/5 stars. */
|
||||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||||
if (stars != null) {
|
if (stars != null) {
|
||||||
var score = stars[3].toFloat();
|
var score = stars[3].toFloat();
|
||||||
var scale = stars[4].toFloat();
|
var scale = stars[4].toFloat();
|
||||||
@ -236,17 +236,17 @@ function doRateIt() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getRatableId: function(id) {
|
getRatableId: function(id) {
|
||||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||||
return stars != null ? stars[1] : '';
|
return stars != null ? stars[1] : '';
|
||||||
},
|
},
|
||||||
|
|
||||||
getRatableType: function(id) {
|
getRatableType: function(id) {
|
||||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||||
return stars != null ? stars[2] : '';
|
return stars != null ? stars[2] : '';
|
||||||
},
|
},
|
||||||
|
|
||||||
getRatableMaxValue: function(id) {
|
getRatableMaxValue: function(id) {
|
||||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||||
return stars != null ? stars[4].toInt() : 0;
|
return stars != null ? stars[4].toInt() : 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ function doRateIt() {
|
|||||||
getStarPercent: function(id) {
|
getStarPercent: function(id) {
|
||||||
/* Format = anyStringHere-<id>-<float(currentStars)>_(scale);
|
/* Format = anyStringHere-<id>-<float(currentStars)>_(scale);
|
||||||
* Example: RateItRatings-5-3_5 //Primary key id = 5, 3/5 stars. */
|
* Example: RateItRatings-5-3_5 //Primary key id = 5, 3/5 stars. */
|
||||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||||
if (stars != null) {
|
if (stars != null) {
|
||||||
var score = parseFloat(stars[3]);
|
var score = parseFloat(stars[3]);
|
||||||
var scale = parseFloat(stars[4]);
|
var scale = parseFloat(stars[4]);
|
||||||
@ -475,17 +475,17 @@ function doRateIt() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getRatableId: function(id) {
|
getRatableId: function(id) {
|
||||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||||
return stars != null ? stars[1] : '';
|
return stars != null ? stars[1] : '';
|
||||||
},
|
},
|
||||||
|
|
||||||
getRatableType: function(id) {
|
getRatableType: function(id) {
|
||||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||||
return stars != null ? stars[2] : '';
|
return stars != null ? stars[2] : '';
|
||||||
},
|
},
|
||||||
|
|
||||||
getRatableMaxValue: function(id) {
|
getRatableMaxValue: function(id) {
|
||||||
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
|
||||||
return stars != null ? parseInt(stars[4]) : 0;
|
return stars != null ? parseInt(stars[4]) : 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -98,7 +98,7 @@ class RateIt extends \Frontend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Make sure that the ratable type is 'page' or 'ce' or 'module'
|
//Make sure that the ratable type is 'page' or 'ce' or 'module'
|
||||||
if (!($type === 'page' || $type === 'article' || $type === 'ce' || $type === 'module' || $type === 'news' || $type === 'faq' || $type === 'galpic')) {
|
if (!($type === 'page' || $type === 'article' || $type === 'ce' || $type === 'module' || $type === 'news' || $type === 'faq' || $type === 'galpic' || $type === 'news4ward')) {
|
||||||
header(RETURN_AJAX_HEADER);
|
header(RETURN_AJAX_HEADER);
|
||||||
echo $GLOBALS['TL_LANG']['rateit']['error']['invalid_type'];
|
echo $GLOBALS['TL_LANG']['rateit']['error']['invalid_type'];
|
||||||
exit;
|
exit;
|
||||||
|
@ -66,8 +66,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php if ($this->rateit_rating_after): ?>
|
<?php if ($this->rateit_rating_after): ?>
|
||||||
<!-- indexer::stop -->
|
<!-- indexer::stop -->
|
||||||
<div itemtype="http://data-vocabulary.org/Review-aggregate" itemscope="" class="rating-microdata">
|
<div id="<?php echo $this->id; ?>" class="<?php echo $this->class; ?> <?php echo $this->rateit_class; ?>">
|
||||||
<div id="<?php echo $this->id; ?>" class="<?php echo $this->class; ?> <?php echo $this->rateit_class; ?>">
|
|
||||||
<?php if ($this->showBefore) : ?>
|
<?php if ($this->showBefore) : ?>
|
||||||
<div id="<?php echo $this->descriptionId; ?>" class="ratingText"><?php echo $this->description; ?></div>
|
<div id="<?php echo $this->descriptionId; ?>" class="ratingText"><?php echo $this->description; ?></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
@ -78,13 +77,6 @@
|
|||||||
<?php if ($this->showAfter) : ?>
|
<?php if ($this->showAfter) : ?>
|
||||||
<div id="<?php echo $this->descriptionId; ?>" class="ratingText"><?php echo $this->description; ?></div>
|
<div id="<?php echo $this->descriptionId; ?>" class="ratingText"><?php echo $this->description; ?></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
|
||||||
<span class="rating-microdata" itemprop="itemreviewed"><?php echo $this->itemreviewed; ?></span>
|
|
||||||
<span class="rating-microdata" itemtype="http://data-vocabulary.org/Rating" itemscope="" itemprop="rating">
|
|
||||||
<span itemprop="average"><?php echo $this->actRating; ?></span>
|
|
||||||
<span itemprop="best"><?php echo $this->maxRating; ?></span>
|
|
||||||
</span>
|
|
||||||
<span class="rating-microdata" itemprop="votes"><?php echo $this->votes; ?></span>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- indexer::continue -->
|
<!-- indexer::continue -->
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
Reference in New Issue
Block a user