Verzicht auf article_rateit_*

This commit is contained in:
Carsten Götzinger 2018-02-15 12:39:33 +01:00
parent f4a1ff3c73
commit 129146a92c
4 changed files with 114 additions and 5 deletions

View File

@ -57,11 +57,11 @@ class RateItArticle extends RateItFrontend {
->fetchAssoc();
if ($arrArticle['addRating']) {
if ($objTemplate->multiMode && $objTemplate->showTeaser) {
/*if ($objTemplate->multiMode && $objTemplate->showTeaser) {
$objTemplate->setName('mod_'.$arrArticle['rateit_template'].'_teaser');
} else {
$objTemplate->setName($arrArticle['rateit_template']);
}
}*/
$ratingId = $arrArticle['id'];
$rating = $this->loadRating($ratingId, 'article');
@ -77,12 +77,12 @@ class RateItArticle extends RateItFrontend {
$objTemplate->maxRating = $this->intStars;
$objTemplate->votes = $rating[totalRatings];
if ($this->strTextPosition == "before") {
/*if ($this->strTextPosition == "before") {
$objTemplate->showBefore = true;
}
else if ($this->strTextPosition == "after") {
$objTemplate->showAfter = true;
}
}*/
if ($arrArticle['rateit_position'] == 'before') {
$objTemplate->rateit_rating_before = true;

View File

@ -78,7 +78,7 @@ $GLOBALS['TL_DCA']['tl_article']['fields']['rateit_template'] = array
'inputType' => 'select',
'options_callback' => array('tl_article_rating', 'getRateItArticleTemplates'),
'sql' => "varchar(255) NOT NULL default ''",
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
'eval' => array('mandatory'=>false, 'tl_class'=>'w50')
);
class tl_article_rating extends DcaHelper {

View File

@ -0,0 +1,62 @@
<?php if ($this->teaserOnly): ?>
<?php $this->block('alias'); ?>
<article class="<?= $this->class ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>>
<div class="ce_text block">
<h2><?= $this->headline ?></h2>
<div class="teaser">
<?= $this->teaser ?>
<p class="more"><a href="<?= $this->href ?>" title="<?= $this->readMore ?>"><?= $this->more ?> <span class="invisible"><?= $this->headline ?></span></a></p>
</div>
</div>
</article>
<?php $this->endblock(); ?>
<?php elseif ($this->noMarkup): ?>
<?php $this->block('content'); ?>
<?= implode('', $this->elements) ?>
<?php $this->endblock(); ?>
<?php else: ?>
<div class="<?= $this->class ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>>
<?php if ($this->printable): ?>
<?php $this->block('syndication'); ?>
<!-- indexer::stop -->
<div class="syndication">
<?php if ($this->printButton): ?>
<a href="<?= $this->print ?>" class="print" rel="nofollow" title="<?= $this->printTitle ?>" onclick="window.print();return false"><?= Image::getHtml('assets/contao/images/print.svg') ?></a>
<?php endif; ?>
<?php if ($this->pdfButton): ?>
<a href="<?= $this->href ?>" class="pdf" rel="nofollow" title="<?= $this->pdfTitle ?>"><?= Image::getHtml('assets/contao/images/pdf.svg') ?></a>
<?php endif; ?>
<?php if ($this->facebookButton): ?>
<a href="<?= $this->route('contao_frontend_share', array('p'=>'facebook', 'u'=>$this->encUrl)) ?>" class="facebook" rel="nofollow" title="<?= $this->facebookTitle ?>" onclick="window.open(this.href,'','width=640,height=380,modal=yes,left=100,top=50,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');return false"><?= Image::getHtml('assets/contao/images/facebook.svg') ?></a>
<?php endif; ?>
<?php if ($this->twitterButton): ?>
<a href="<?= $this->route('contao_frontend_share', array('p'=>'twitter', 'u'=> $this->encUrl, 't'=>$this->encTitle)) ?>" class="twitter" rel="nofollow" title="<?= $this->twitterTitle ?>" onclick="window.open(this.href,'','width=640,height=380,modal=yes,left=100,top=50,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');return false"><?= Image::getHtml('assets/contao/images/twitter.svg') ?></a>
<?php endif; ?>
<?php if ($this->gplusButton): ?>
<a href="<?= $this->route('contao_frontend_share', array('p'=>'gplus', 'u'=> $this->encUrl)) ?>" class="gplus" rel="nofollow" title="<?= $this->gplusTitle ?>" onclick="window.open(this.href,'','width=600,height=200,modal=yes,left=100,top=50,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');return false"><?= Image::getHtml('assets/contao/images/gplus.svg') ?></a>
<?php endif; ?>
</div>
<!-- indexer::continue -->
<?php $this->endblock(); ?>
<?php endif; ?>
<?php $this->block('content'); ?>
<?= implode('', $this->elements) ?>
<?php $this->endblock(); ?>
<?php if ($this->backlink): ?>
<?php $this->block('backlink'); ?>
<!-- indexer::stop -->
<p class="back"><a href="<?= $this->backlink ?>" title="<?= $this->back ?>"><?= $this->back ?></a></p>
<!-- indexer::continue -->
<?php $this->endblock(); ?>
<?php endif; ?>
</div>
<?php endif; ?>

View File

@ -0,0 +1,47 @@
<?php $this->extend('block_unsearchable'); ?>
<?php $this->block('content'); ?>
<ul>
<?php foreach ($this->articles as $article): ?>
<?php if ($article['rateit_rating_before']): ?>
<!-- indexer::stop -->
<?php $this->block('rating'); ?>
<div id="<?= $article['rateItID'] ?>" class="<?= $article['rateit_class'] ?>">
<?php if ($article['showBefore']) : ?>
<div id="<?= $article['descriptionId'] ?>" class="ratingText"><?= $article['description'] ?></div>
<?php endif; ?>
<div class="wrapper">
<div class="rateItRating-selected" style="display: block;"></div>
<div class="rateItRating-hover"></div>
</div>
<?php if ($article['showAfter']) : ?>
<div id="<?= $article['descriptionId'] ?>" class="ratingText"><?= $article['description'] ?></div>
<?php endif; ?>
</div>
<?php $this->endblock(); ?>
<!-- indexer::continue -->
<?php endif; ?>
<?php $this->parent(); ?>
<?php if ($article['rateit_rating_after']): ?>
<!-- indexer::stop -->
<?php $this->block('rating'); ?>
<div id="<?= $article['rateItID'] ?>" class="<?= $article['rateit_class'] ?>">
<?php if ($article['showBefore']) : ?>
<div id="<?= $article['descriptionId'] ?>" class="ratingText"><?= $article['description'] ?></div>
<?php endif; ?>
<div class="wrapper">
<div class="rateItRating-selected" style="display: block;"></div>
<div class="rateItRating-hover"></div>
</div>
<?php if ($article['showAfter']) : ?>
<div id="<?= $article['descriptionId'] ?>" class="ratingText"><?= $article['description'] ?></div>
<?php endif; ?>
</div>
<?php $this->endblock(); ?>
<!-- indexer::continue -->
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php $this->endblock(); ?>