Compare commits
No commits in common. "master" and "dev-contao3" have entirely different histories.
master
...
dev-contao
3
.gitignore
vendored
@ -1,3 +0,0 @@
|
|||||||
/.project
|
|
||||||
|
|
||||||
/vendor
|
|
@ -57,6 +57,12 @@ class RateItArticle extends RateItFrontend {
|
|||||||
->fetchAssoc();
|
->fetchAssoc();
|
||||||
|
|
||||||
if ($arrArticle['addRating']) {
|
if ($arrArticle['addRating']) {
|
||||||
|
if ($objTemplate->multiMode && $objTemplate->showTeaser) {
|
||||||
|
$objTemplate->setName('mod_'.$arrArticle['rateit_template'].'_teaser');
|
||||||
|
} else {
|
||||||
|
$objTemplate->setName($arrArticle['rateit_template']);
|
||||||
|
}
|
||||||
|
|
||||||
$ratingId = $arrArticle['id'];
|
$ratingId = $arrArticle['id'];
|
||||||
$rating = $this->loadRating($ratingId, 'article');
|
$rating = $this->loadRating($ratingId, 'article');
|
||||||
$stars = !$rating ? 0 : $this->percentToStars($rating['rating']);
|
$stars = !$rating ? 0 : $this->percentToStars($rating['rating']);
|
||||||
@ -84,15 +90,15 @@ class RateItArticle extends RateItFrontend {
|
|||||||
$objTemplate->rateit_rating_after = true;
|
$objTemplate->rateit_rating_after = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/js/onReadyRateIt.js|static';
|
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static';
|
||||||
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/js/rateit.js|static';
|
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static';
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/rateit.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static';
|
||||||
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
|
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
|
||||||
case 'hearts' :
|
case 'hearts' :
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/heart.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/star.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,15 +148,15 @@ class RateItArticle extends RateItFrontend {
|
|||||||
$article['rateit_rating_after'] = true;
|
$article['rateit_rating_after'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/js/onReadyRateIt.js|static';
|
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static';
|
||||||
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/js/rateit.js|static';
|
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static';
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/rateit.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static';
|
||||||
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
|
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
|
||||||
case 'hearts' :
|
case 'hearts' :
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/heart.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/star.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,15 +232,15 @@ class RateItArticle extends RateItFrontend {
|
|||||||
|
|
||||||
$objTemplate->arrRating = $arrRating;
|
$objTemplate->arrRating = $arrRating;
|
||||||
|
|
||||||
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/js/onReadyRateIt.js|static';
|
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static';
|
||||||
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/js/rateit.js|static';
|
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static';
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/rateit.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static';
|
||||||
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
|
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
|
||||||
case 'hearts' :
|
case 'hearts' :
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/heart.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/star.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -32,7 +32,7 @@ namespace cgoIT\rateit;
|
|||||||
|
|
||||||
class RateItBackend
|
class RateItBackend
|
||||||
{
|
{
|
||||||
const path = 'bundles/cgoitrateit/';
|
const path = 'system/modules/rateit/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a css file.
|
* Get a css file.
|
||||||
@ -41,7 +41,7 @@ class RateItBackend
|
|||||||
*/
|
*/
|
||||||
public static function css($file)
|
public static function css($file)
|
||||||
{
|
{
|
||||||
return self::path.'css/'. $file.'.css';
|
return self::path.'public/css/'. $file.'.css';
|
||||||
} // file
|
} // file
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,7 +51,7 @@ class RateItBackend
|
|||||||
*/
|
*/
|
||||||
public static function js($file)
|
public static function js($file)
|
||||||
{
|
{
|
||||||
return self::path.'js/'. $file.'.js';
|
return self::path.'public/js/'. $file.'.js';
|
||||||
} // file
|
} // file
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,7 +61,7 @@ class RateItBackend
|
|||||||
*/
|
*/
|
||||||
public static function image($file)
|
public static function image($file)
|
||||||
{
|
{
|
||||||
$url = self::path.'images/';
|
$url = self::path.'public/images/';
|
||||||
if (is_file(TL_ROOT.'/'.$url.$file.'.png')) return $url.$file.'.png';
|
if (is_file(TL_ROOT.'/'.$url.$file.'.png')) return $url.$file.'.png';
|
||||||
if (is_file(TL_ROOT.'/'.$url.$file.'.gif')) return $url.$file.'.gif';
|
if (is_file(TL_ROOT.'/'.$url.$file.'.gif')) return $url.$file.'.gif';
|
||||||
return $url.'default.png';
|
return $url.'default.png';
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
namespace cgoIT\rateit;
|
namespace cgoIT\rateit;
|
||||||
|
|
||||||
class RateItBackendModule extends \BackendModule
|
class rateitBackendModule extends \BackendModule
|
||||||
{
|
{
|
||||||
protected $strTemplate;
|
protected $strTemplate;
|
||||||
protected $actions = array();
|
protected $actions = array();
|
||||||
@ -235,7 +235,7 @@ class RateItBackendModule extends \BackendModule
|
|||||||
*/
|
*/
|
||||||
protected function exportRatings()
|
protected function exportRatings()
|
||||||
{
|
{
|
||||||
$this->import('StringUtil');
|
$this->import('String');
|
||||||
$rateit = &$this->Template->rateit;
|
$rateit = &$this->Template->rateit;
|
||||||
|
|
||||||
$options['order'] = 'rating desc';
|
$options['order'] = 'rating desc';
|
||||||
@ -268,7 +268,7 @@ class RateItBackendModule extends \BackendModule
|
|||||||
$intColCounter = 0;
|
$intColCounter = 0;
|
||||||
foreach(array_keys($this->arrExportHeader) as $key) {
|
foreach(array_keys($this->arrExportHeader) as $key) {
|
||||||
$strVal = $arrItem[$key];
|
$strVal = $arrItem[$key];
|
||||||
$strVal = $this->StringUtil->decodeEntities($strVal);
|
$strVal = $this->String->decodeEntities($strVal);
|
||||||
$strVal = preg_replace(array('/<br.*\/*>/si'), array("\n"), $strVal);
|
$strVal = preg_replace(array('/<br.*\/*>/si'), array("\n"), $strVal);
|
||||||
$strVal = $this->convertEncoding($strVal, $GLOBALS['TL_CONFIG']['characterSet'], 'CP1252');
|
$strVal = $this->convertEncoding($strVal, $GLOBALS['TL_CONFIG']['characterSet'], 'CP1252');
|
||||||
|
|
||||||
@ -449,7 +449,7 @@ class RateItBackendModule extends \BackendModule
|
|||||||
'typ' => $typ
|
'typ' => $typ
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->import('StringUtil');
|
$this->import('String');
|
||||||
$rateit = &$this->Template->rateit;
|
$rateit = &$this->Template->rateit;
|
||||||
|
|
||||||
// query ratings
|
// query ratings
|
||||||
@ -484,7 +484,7 @@ class RateItBackendModule extends \BackendModule
|
|||||||
$intColCounter = 0;
|
$intColCounter = 0;
|
||||||
foreach(array_keys($this->arrExportHeaderDetails) as $key) {
|
foreach(array_keys($this->arrExportHeaderDetails) as $key) {
|
||||||
$strVal = $arrItem[$key];
|
$strVal = $arrItem[$key];
|
||||||
$strVal = $this->StringUtil->decodeEntities($strVal);
|
$strVal = $this->String->decodeEntities($strVal);
|
||||||
$strVal = preg_replace(array('/<br.*\/*>/si'), array("\n"), $strVal);
|
$strVal = preg_replace(array('/<br.*\/*>/si'), array("\n"), $strVal);
|
||||||
$strVal = $this->convertEncoding($strVal, $GLOBALS['TL_CONFIG']['characterSet'], 'CP1252');
|
$strVal = $this->convertEncoding($strVal, $GLOBALS['TL_CONFIG']['characterSet'], 'CP1252');
|
||||||
|
|
||||||
@ -535,7 +535,7 @@ class RateItBackendModule extends \BackendModule
|
|||||||
*/
|
*/
|
||||||
protected function createPageUrl($aPage, $aParams = null)
|
protected function createPageUrl($aPage, $aParams = null)
|
||||||
{
|
{
|
||||||
$url = 'contao?do='.$aPage;
|
$url = \Environment::get('script') . '?do='.$aPage;
|
||||||
if (is_array($aParams)) {
|
if (is_array($aParams)) {
|
||||||
foreach ($aParams as $key => $val)
|
foreach ($aParams as $key => $val)
|
||||||
if ($val!='')
|
if ($val!='')
|
@ -30,18 +30,13 @@
|
|||||||
|
|
||||||
namespace cgoIT\rateit;
|
namespace cgoIT\rateit;
|
||||||
|
|
||||||
use cgoIT\rateit\RateItRating;
|
|
||||||
|
|
||||||
class RateItFaq extends RateItFrontend {
|
class RateItFaq extends RateItFrontend {
|
||||||
|
|
||||||
var $rateItRating;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the controller
|
* Initialize the controller
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->rateItRating = new RateItRating();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getContentElementRateIt($objRow, $strBuffer) {
|
public function getContentElementRateIt($objRow, $strBuffer) {
|
||||||
@ -59,15 +54,15 @@ class RateItFaq extends RateItFrontend {
|
|||||||
$strBuffer = $this->generateForFaqPage($objModule, $strBuffer);
|
$strBuffer = $this->generateForFaqPage($objModule, $strBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/js/onReadyRateIt.js|static';
|
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static';
|
||||||
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/js/rateit.js|static';
|
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static';
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/rateit.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static';
|
||||||
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
|
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
|
||||||
case 'hearts' :
|
case 'hearts' :
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/heart.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/star.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,11 +144,12 @@ class RateItFaq extends RateItFrontend {
|
|||||||
->fetchAssoc();
|
->fetchAssoc();
|
||||||
|
|
||||||
if ($actRecord['active']) {
|
if ($actRecord['active']) {
|
||||||
$this->rateItRating->rkey = $arrFaq['id'];
|
$this->import('rateit\\RateItRating', 'RateItRating');
|
||||||
$this->rateItRating->ratingType = 'faq';
|
$this->RateItRating->rkey = $arrFaq['id'];
|
||||||
$this->rateItRating->generate();
|
$this->RateItRating->ratingType = 'faq';
|
||||||
|
$this->RateItRating->generate();
|
||||||
|
|
||||||
$rating = $this->rateItRating->output();
|
$rating = $this->RateItRating->output();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -141,7 +141,7 @@ class RateItFrontend extends \Hybrid
|
|||||||
FROM tl_rateit_items i
|
FROM tl_rateit_items i
|
||||||
LEFT OUTER JOIN tl_rateit_ratings r
|
LEFT OUTER JOIN tl_rateit_ratings r
|
||||||
ON ( i.id = r.pid ) WHERE i.rkey = ? and typ=? and active='1'
|
ON ( i.id = r.pid ) WHERE i.rkey = ? and typ=? and active='1'
|
||||||
GROUP BY i.rkey, i.title;";
|
GROUP BY i.rkey;";
|
||||||
$result = $this->Database->prepare($SQL_GET_RATINGS)
|
$result = $this->Database->prepare($SQL_GET_RATINGS)
|
||||||
->execute($rkey, $typ)
|
->execute($rkey, $typ)
|
||||||
->fetchAssoc();
|
->fetchAssoc();
|
@ -66,15 +66,15 @@ abstract class RateItHybrid extends RateItFrontend
|
|||||||
$this->strType = $GLOBALS['TL_CONFIG']['rating_type'];
|
$this->strType = $GLOBALS['TL_CONFIG']['rating_type'];
|
||||||
$this->strTextPosition = $GLOBALS['TL_CONFIG']['rating_textposition'];
|
$this->strTextPosition = $GLOBALS['TL_CONFIG']['rating_textposition'];
|
||||||
|
|
||||||
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/js/onReadyRateIt.js|static';
|
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static';
|
||||||
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/js/rateit.js|static';
|
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static';
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/rateit.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static';
|
||||||
switch ($this->strType) {
|
switch ($this->strType) {
|
||||||
case 'hearts' :
|
case 'hearts' :
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/heart.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/star.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static';
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::generate();
|
return parent::generate();
|
@ -69,15 +69,15 @@ class RateItNews extends RateItFrontend {
|
|||||||
$objTemplate->rateit_rating_after = true;
|
$objTemplate->rateit_rating_after = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/js/onReadyRateIt.js|static';
|
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static';
|
||||||
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/js/rateit.js|static';
|
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static';
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/rateit.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static';
|
||||||
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
|
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
|
||||||
case 'hearts' :
|
case 'hearts' :
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/heart.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/star.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -29,19 +29,14 @@
|
|||||||
|
|
||||||
namespace cgoIT\rateit;
|
namespace cgoIT\rateit;
|
||||||
|
|
||||||
use cgoIT\rateit\RateItRating;
|
|
||||||
|
|
||||||
class RateItPage extends \Frontend {
|
class RateItPage extends \Frontend {
|
||||||
|
|
||||||
var $rateItRating;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the controller
|
* Initialize the controller
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->rateItRating = new RateItRating();
|
|
||||||
$this->loadDataContainer('settings');
|
$this->loadDataContainer('settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,10 +47,11 @@ class RateItPage extends \Frontend {
|
|||||||
->fetchAssoc();
|
->fetchAssoc();
|
||||||
|
|
||||||
if ($actRecord['active']) {
|
if ($actRecord['active']) {
|
||||||
$this->rateItRating->rkey = $objPage->id;
|
$this->import('rateit\\RateItRating', 'RateItRating');
|
||||||
$this->rateItRating->generate();
|
$this->RateItRating->rkey = $objPage->id;
|
||||||
|
$this->RateItRating->generate();
|
||||||
|
|
||||||
$rating = $this->rateItRating->output();
|
$rating = $this->RateItRating->output();
|
||||||
$rating .= $this->includeJs();
|
$rating .= $this->includeJs();
|
||||||
$rating .= $this->includeCss();
|
$rating .= $this->includeCss();
|
||||||
|
|
||||||
@ -76,7 +72,7 @@ class RateItPage extends \Frontend {
|
|||||||
$strHeadTags = '';
|
$strHeadTags = '';
|
||||||
if (is_array($GLOBALS['TL_CSS'])) {
|
if (is_array($GLOBALS['TL_CSS'])) {
|
||||||
foreach ($GLOBALS['TL_CSS'] as $script) {
|
foreach ($GLOBALS['TL_CSS'] as $script) {
|
||||||
if ($this->startsWith($script, 'bundles/cgoitrateit/css/rateit') === true) {
|
if ($this->startsWith($script, 'system/modules/rateit/public/css/rateit') === true) {
|
||||||
$included = true;
|
$included = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -84,13 +80,13 @@ class RateItPage extends \Frontend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$included) {
|
if (!$included) {
|
||||||
$strHeadTags = '<link rel="stylesheet" href="'.$this->addStaticUrlTo('bundles/cgoitrateit/css/rateit.min.css').'">';
|
$strHeadTags = '<link rel="stylesheet" href="'.$this->addStaticUrlTo('system/modules/rateit/public/css/rateit.min.css').'">';
|
||||||
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
|
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
|
||||||
case 'hearts' :
|
case 'hearts' :
|
||||||
$strHeadTags .= '<link rel="stylesheet" href="'.$this->addStaticUrlTo('bundles/cgoitrateit/css/heart.min.css').'">';
|
$strHeadTags .= '<link rel="stylesheet" href="'.$this->addStaticUrlTo('system/modules/rateit/public/css/heart.min.css').'">';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$strHeadTags .= '<link rel="stylesheet" href="'.$this->addStaticUrlTo('bundles/cgoitrateit/css/star.min.css').'">';
|
$strHeadTags .= '<link rel="stylesheet" href="'.$this->addStaticUrlTo('system/modules/rateit/public/css/star.min.css').'">';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $strHeadTags;
|
return $strHeadTags;
|
||||||
@ -101,7 +97,7 @@ class RateItPage extends \Frontend {
|
|||||||
$strHeadTags = '';
|
$strHeadTags = '';
|
||||||
if (is_array($GLOBALS['TL_JAVASCRIPT'])) {
|
if (is_array($GLOBALS['TL_JAVASCRIPT'])) {
|
||||||
foreach ($GLOBALS['TL_JAVASCRIPT'] as $script) {
|
foreach ($GLOBALS['TL_JAVASCRIPT'] as $script) {
|
||||||
if ($this->startsWith($script, 'bundles/cgoitrateit/js/rateit') === true) {
|
if ($this->startsWith($script, 'system/modules/rateit/public/js/rateit') === true) {
|
||||||
$included = true;
|
$included = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -109,8 +105,8 @@ class RateItPage extends \Frontend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$included) {
|
if (!$included) {
|
||||||
$strHeadTags = '<script' . (($objPage->outputFormat == 'xhtml') ? ' type="text/javascript"' : '') . ' src="' . $this->addStaticUrlTo('bundles/cgoitrateit/js/onReadyRateIt.js') . '"></script>' . "\n";
|
$strHeadTags = '<script' . (($objPage->outputFormat == 'xhtml') ? ' type="text/javascript"' : '') . ' src="' . $this->addStaticUrlTo('system/modules/rateit/public/js/onReadyRateIt.js') . '"></script>' . "\n";
|
||||||
$strHeadTags .= '<script' . (($objPage->outputFormat == 'xhtml') ? ' type="text/javascript"' : '') . ' src="' . $this->addStaticUrlTo('bundles/cgoitrateit/js/rateit.js') . '"></script>' . "\n";
|
$strHeadTags .= '<script' . (($objPage->outputFormat == 'xhtml') ? ' type="text/javascript"' : '') . ' src="' . $this->addStaticUrlTo('system/modules/rateit/public/js/rateit.js') . '"></script>' . "\n";
|
||||||
}
|
}
|
||||||
return $strHeadTags;
|
return $strHeadTags;
|
||||||
}
|
}
|
@ -67,15 +67,15 @@ class RateItTopRatingsModule extends RateItFrontend
|
|||||||
|
|
||||||
$this->arrTypes = deserialize($this->rateit_types);
|
$this->arrTypes = deserialize($this->rateit_types);
|
||||||
|
|
||||||
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/js/onReadyRateIt.js|static';
|
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static';
|
||||||
$GLOBALS['TL_JAVASCRIPT'][] = 'bundles/cgoitrateit/js/rateit.js|static';
|
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static';
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/rateit.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static';
|
||||||
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
|
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
|
||||||
case 'hearts' :
|
case 'hearts' :
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/heart.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$GLOBALS['TL_CSS'][] = 'bundles/cgoitrateit/css/star.min.css||static';
|
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static';
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::generate();
|
return parent::generate();
|
@ -1,18 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name":"cgo-it/contao-rate-it-bundle",
|
"name":"cgo-it/rate-it",
|
||||||
"description":"RateIt extension for the Contao Open Source CMS as contao 4 bundle",
|
"description":"RateIt extension for the Contao Open Source CMS",
|
||||||
"keywords":["contao", "rating", "rateit", "bewertung", "bundle"],
|
"keywords":["contao", "rating", "rateit", "bewertung"],
|
||||||
"type":"contao-bundle",
|
"type":"contao-module",
|
||||||
"homepage":"https://cgo-it.de",
|
|
||||||
"license":"LGPL-3.0+",
|
"license":"LGPL-3.0+",
|
||||||
"prefer-stable": true,
|
|
||||||
"config": {
|
|
||||||
"preferred-install": {
|
|
||||||
"cgo-it/*": "dist",
|
|
||||||
"*": "dist"
|
|
||||||
},
|
|
||||||
"gitlab-domains": [ "git.cgo-it.de" ]
|
|
||||||
},
|
|
||||||
"authors":[
|
"authors":[
|
||||||
{
|
{
|
||||||
"name":"cgo IT",
|
"name":"cgo IT",
|
||||||
@ -22,46 +13,34 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://git.cgo-it.de/contao/rate-it/issues",
|
"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",
|
"forum": "https://community.contao.org/de/showthread.php?38471-Rate-It",
|
||||||
"source": "https://git.cgo-it.de/contao/rate-it.git"
|
"source": "https://bitbucket.org/cgo-it/contao-rate-it/src"
|
||||||
},
|
},
|
||||||
"require":{
|
"require":{
|
||||||
"php":">=7.0",
|
"php":">=5.3",
|
||||||
"contao/core-bundle": "^4.4",
|
"contao/core":">=3.0",
|
||||||
"cgo-it/contao-xls_export-bundle": "^4.0"
|
"contao-community-alliance/composer-plugin": "~2.0",
|
||||||
|
"cgo-it/xls_export":"3.0.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"replace": {
|
||||||
"contao/manager-plugin": "^2.0"
|
"cgo-it/rate-it": "<3.5.4"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"contao/core": "*",
|
"contao/core": "2.11.*"
|
||||||
"contao/manager-plugin": "<2.0 || >=3.0"
|
|
||||||
},
|
},
|
||||||
"repositories": [
|
"extra":{
|
||||||
{
|
|
||||||
"type": "gitlab",
|
|
||||||
"url": "https://git.cgo-it.de/contao/rate-it.git"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"cgoIT\\rateit\\": "src/"
|
|
||||||
},
|
|
||||||
"classmap": [
|
|
||||||
"src/Resources/contao/"
|
|
||||||
],
|
|
||||||
"exclude-from-classmap": [
|
|
||||||
"src/Resources/contao/config/",
|
|
||||||
"src/Resources/contao/dca/",
|
|
||||||
"src/Resources/contao/languages/",
|
|
||||||
"src/Resources/contao/templates/"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"extra": {
|
|
||||||
"contao": {
|
"contao": {
|
||||||
"runonce": ["src/Resources/contao/runonce/create-initial-data.php"]
|
"sources":{
|
||||||
|
"":"system/modules/rateit"
|
||||||
},
|
},
|
||||||
"contao-manager-plugin": "cgoIT\\rateit\\ContaoManagerPlugin"
|
"transifex":{
|
||||||
|
"project": "rateit",
|
||||||
|
"prefix": "core-",
|
||||||
|
"languages_cto": "languages",
|
||||||
|
"languages_tx": "languages"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
7
config/autoload.ini
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
;;
|
||||||
|
; Configure what you want the autoload creator to register
|
||||||
|
;;
|
||||||
|
register_namespaces = true
|
||||||
|
register_classes = true
|
||||||
|
register_templates = true
|
73
config/autoload.php
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contao Open Source CMS
|
||||||
|
*
|
||||||
|
* Copyright (c) 2005-2014 Leo Feyer
|
||||||
|
*
|
||||||
|
* @package Rateit
|
||||||
|
* @link https://contao.org
|
||||||
|
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the namespaces
|
||||||
|
*/
|
||||||
|
ClassLoader::addNamespaces(array
|
||||||
|
(
|
||||||
|
'cgoIT',
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the classes
|
||||||
|
*/
|
||||||
|
ClassLoader::addClasses(array
|
||||||
|
(
|
||||||
|
// Classes
|
||||||
|
'cgoIT\rateit\DcaHelper' => 'system/modules/rateit/classes/DcaHelper.php',
|
||||||
|
'cgoIT\rateit\RateItArticle' => 'system/modules/rateit/classes/RateItArticle.php',
|
||||||
|
'cgoIT\rateit\RateItBackend' => 'system/modules/rateit/classes/RateItBackend.php',
|
||||||
|
'cgoIT\rateit\RateItCE' => 'system/modules/rateit/classes/RateItCE.php',
|
||||||
|
'cgoIT\rateit\RateItFaq' => 'system/modules/rateit/classes/RateItFaq.php',
|
||||||
|
'cgoIT\rateit\RateItFrontend' => 'system/modules/rateit/classes/RateItFrontend.php',
|
||||||
|
'cgoIT\rateit\RateItHybrid' => 'system/modules/rateit/classes/RateItHybrid.php',
|
||||||
|
'cgoIT\rateit\RateItModule' => 'system/modules/rateit/classes/RateItModule.php',
|
||||||
|
'cgoIT\rateit\RateItNews' => 'system/modules/rateit/classes/RateItNews.php',
|
||||||
|
'cgoIT\rateit\RateItPage' => 'system/modules/rateit/classes/RateItPage.php',
|
||||||
|
'cgoIT\rateit\RateItRating' => 'system/modules/rateit/classes/RateItRating.php',
|
||||||
|
'cgoIT\rateit\RateItBackendModule' => 'system/modules/rateit/classes/RateItBackendModule.php',
|
||||||
|
'cgoIT\rateit\RateItTopRatingsModule' => 'system/modules/rateit/classes/RateItTopRatingsModule.php',
|
||||||
|
'cgoIT\rateit\RateIt' => 'system/modules/rateit/public/php/rateit.php',
|
||||||
|
'simple_html_dom' => 'system/modules/rateit/classes/extern/simple_html_dom.php',
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the templates
|
||||||
|
*/
|
||||||
|
TemplateLoader::addFiles(array
|
||||||
|
(
|
||||||
|
'article_rateit_default' => 'system/modules/rateit/templates',
|
||||||
|
'article_rateit_default_microdata' => 'system/modules/rateit/templates',
|
||||||
|
'gallery_rateit_default' => 'system/modules/rateit/templates',
|
||||||
|
'j_colorbox_rateit' => 'system/modules/rateit/templates',
|
||||||
|
'mod_article_list_rateit' => 'system/modules/rateit/templates',
|
||||||
|
'mod_article_rateit_default_microdata_teaser' => 'system/modules/rateit/templates',
|
||||||
|
'mod_article_rateit_default_teaser' => 'system/modules/rateit/templates',
|
||||||
|
'mod_rateit_top_ratings' => 'system/modules/rateit/templates',
|
||||||
|
'moo_mediabox_rateit' => 'system/modules/rateit/templates',
|
||||||
|
'news_full_rateit' => 'system/modules/rateit/templates',
|
||||||
|
'news_full_rateit_microdata' => 'system/modules/rateit/templates',
|
||||||
|
'news_latest_rateit' => 'system/modules/rateit/templates',
|
||||||
|
'news_latest_rateit_microdata' => 'system/modules/rateit/templates',
|
||||||
|
'news_short_rateit' => 'system/modules/rateit/templates',
|
||||||
|
'news_short_rateit_microdata' => 'system/modules/rateit/templates',
|
||||||
|
'news_simple_rateit' => 'system/modules/rateit/templates',
|
||||||
|
'news_simple_rateit_microdata' => 'system/modules/rateit/templates',
|
||||||
|
'rateitbe_ratinglist' => 'system/modules/rateit/templates',
|
||||||
|
'rateitbe_ratingview' => 'system/modules/rateit/templates',
|
||||||
|
'rateit_default' => 'system/modules/rateit/templates',
|
||||||
|
'rateit_microdata' => 'system/modules/rateit/templates',
|
||||||
|
));
|
@ -33,32 +33,33 @@ use cgoIT\rateit\RateItBackend;
|
|||||||
/**
|
/**
|
||||||
* Hooks
|
* Hooks
|
||||||
*/
|
*/
|
||||||
$GLOBALS['TL_HOOKS']['generatePage'][] = array('cgoIT\rateit\RateItPage', 'generatePage');
|
$GLOBALS['TL_HOOKS']['generatePage'][] = array('rateit\\RateItPage', 'generatePage');
|
||||||
$GLOBALS['TL_HOOKS']['parseArticles'][] = array('cgoIT\rateit\RateItNews', 'parseArticle');
|
$GLOBALS['TL_HOOKS']['rateitAjax'][] = array('rateit\\RateIt', 'doVote');
|
||||||
$GLOBALS['TL_HOOKS']['getContentElement'][] = array('cgoIT\rateit\RateItFaq', 'getContentElementRateIt');
|
$GLOBALS['TL_HOOKS']['parseArticles'][] = array('rateit\\RateItNews', 'parseArticle');
|
||||||
$GLOBALS['TL_HOOKS']['parseTemplate'][] = array('cgoIT\rateit\RateItArticle', 'parseTemplateRateIt');
|
$GLOBALS['TL_HOOKS']['getContentElement'][] = array('rateit\\RateItFaq', 'getContentElementRateIt');
|
||||||
|
$GLOBALS['TL_HOOKS']['parseTemplate'][] = array('rateit\\RateItArticle', 'parseTemplateRateIt');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Back end modules
|
* Back end modules
|
||||||
*/
|
*/
|
||||||
array_insert($GLOBALS['BE_MOD']['content'], -1,
|
array_insert($GLOBALS['BE_MOD']['content'], count($GLOBALS['BE_MOD']['content']),
|
||||||
array('rateit' => array (
|
array('rateit' => array (
|
||||||
'callback' => 'cgoIT\rateit\RateItBackendModule',
|
'callback' => 'rateit\\RateItBackendModule',
|
||||||
'icon' => RateItBackend::image('icon'),
|
'icon' => rateit\RateItBackend::image('icon'),
|
||||||
'stylesheet' => RateItBackend::css('backend'),
|
'stylesheet' => rateit\RateItBackend::css('backend'),
|
||||||
'javascript' => RateItBackend::js('RateItBackend')
|
'javascript' => rateit\RateItBackend::js('RateItBackend')
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* frontend moduls
|
* frontend moduls
|
||||||
*/
|
*/
|
||||||
$GLOBALS['FE_MOD']['application']['rateit'] = 'cgoIT\rateit\RateItModule';
|
$GLOBALS['FE_MOD']['application']['rateit'] = 'rateit\\RateItModule';
|
||||||
$GLOBALS['FE_MOD']['application']['rateit_top_ratings'] = 'cgoIT\rateit\RateItTopRatingsModule';
|
$GLOBALS['FE_MOD']['application']['rateit_top_ratings'] = 'rateit\\RateItTopRatingsModule';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* content elements
|
* content elements
|
||||||
*/
|
*/
|
||||||
$GLOBALS['TL_CTE']['includes']['rateit'] = 'cgoIT\rateit\RateItCE';
|
$GLOBALS['TL_CTE']['includes']['rateit'] = 'rateit\\RateItCE';
|
||||||
|
|
||||||
?>
|
?>
|
@ -28,7 +28,6 @@
|
|||||||
* @filesource
|
* @filesource
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use cgoIT\rateit\DcaHelper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend tl_article
|
* Extend tl_article
|
||||||
@ -70,7 +69,18 @@ $GLOBALS['TL_DCA']['tl_article']['fields']['rateit_position'] = array
|
|||||||
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
|
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
|
||||||
);
|
);
|
||||||
|
|
||||||
class tl_article_rating extends DcaHelper {
|
$GLOBALS['TL_DCA']['tl_article']['fields']['rateit_template'] = array
|
||||||
|
(
|
||||||
|
'label' => &$GLOBALS['TL_LANG']['tl_article']['rateit_template'],
|
||||||
|
'default' => 'rateit_default',
|
||||||
|
'exclude' => true,
|
||||||
|
'inputType' => 'select',
|
||||||
|
'options_callback' => array('tl_article_rating', 'getRateItArticleTemplates'),
|
||||||
|
'sql' => "varchar(255) NOT NULL default ''",
|
||||||
|
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
|
||||||
|
);
|
||||||
|
|
||||||
|
class tl_article_rating extends rateit\DcaHelper {
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
@ -78,6 +88,22 @@ class tl_article_rating extends DcaHelper {
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all navigation templates as array
|
||||||
|
* @param DataContainer
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getRateItArticleTemplates(\DataContainer $dc) {
|
||||||
|
$intPid = $dc->activeRecord->pid;
|
||||||
|
|
||||||
|
if ($this->Input->get('act') == 'overrideAll')
|
||||||
|
{
|
||||||
|
$intPid = $this->Input->get('id');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->getTemplateGroup('article_rateit_', $intPid);
|
||||||
|
}
|
||||||
|
|
||||||
public function insert(\DC_Table $dc) {
|
public function insert(\DC_Table $dc) {
|
||||||
return $this->insertOrUpdateRatingKey($dc, 'article', $dc->activeRecord->title);
|
return $this->insertOrUpdateRatingKey($dc, 'article', $dc->activeRecord->title);
|
||||||
}
|
}
|
@ -28,8 +28,6 @@
|
|||||||
* @filesource
|
* @filesource
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use cgoIT\rateit\DcaHelper;
|
|
||||||
|
|
||||||
$GLOBALS['TL_DCA']['tl_content']['config']['onsubmit_callback'][] = array('tl_content_rateit','insert');
|
$GLOBALS['TL_DCA']['tl_content']['config']['onsubmit_callback'][] = array('tl_content_rateit','insert');
|
||||||
$GLOBALS['TL_DCA']['tl_content']['config']['ondelete_callback'][] = array('tl_content_rateit','delete');
|
$GLOBALS['TL_DCA']['tl_content']['config']['ondelete_callback'][] = array('tl_content_rateit','delete');
|
||||||
|
|
||||||
@ -64,7 +62,7 @@ $GLOBALS['TL_DCA']['tl_content']['fields']['rateit_active'] = array
|
|||||||
/**
|
/**
|
||||||
* Class tl_content_rateit
|
* Class tl_content_rateit
|
||||||
*/
|
*/
|
||||||
class tl_content_rateit extends DcaHelper {
|
class tl_content_rateit extends rateit\DcaHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
@ -28,7 +28,6 @@
|
|||||||
* @filesource
|
* @filesource
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use cgoIT\rateit\DcaHelper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend tl_article
|
* Extend tl_article
|
||||||
@ -70,7 +69,7 @@ $GLOBALS['TL_DCA']['tl_faq']['fields']['rateit_position'] = array
|
|||||||
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
|
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
|
||||||
);
|
);
|
||||||
|
|
||||||
class tl_faq_rating extends DcaHelper {
|
class tl_faq_rating extends rateit\DcaHelper {
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
@ -28,8 +28,6 @@
|
|||||||
* @filesource
|
* @filesource
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use cgoIT\rateit\DcaHelper;
|
|
||||||
|
|
||||||
$GLOBALS['TL_DCA']['tl_module']['config']['onsubmit_callback'][] = array('tl_module_rateit','insert');
|
$GLOBALS['TL_DCA']['tl_module']['config']['onsubmit_callback'][] = array('tl_module_rateit','insert');
|
||||||
$GLOBALS['TL_DCA']['tl_module']['config']['ondelete_callback'][] = array('tl_module_rateit','delete');
|
$GLOBALS['TL_DCA']['tl_module']['config']['ondelete_callback'][] = array('tl_module_rateit','delete');
|
||||||
|
|
||||||
@ -109,7 +107,7 @@ $GLOBALS['TL_DCA']['tl_module']['fields']['rateit_template'] = array
|
|||||||
/**
|
/**
|
||||||
* Class tl_module_rateit
|
* Class tl_module_rateit
|
||||||
*/
|
*/
|
||||||
class tl_module_rateit extends DcaHelper {
|
class tl_module_rateit extends rateit\DcaHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
@ -28,7 +28,6 @@
|
|||||||
* @filesource
|
* @filesource
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use cgoIT\rateit\DcaHelper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend tl_article
|
* Extend tl_article
|
||||||
@ -70,7 +69,7 @@ $GLOBALS['TL_DCA']['tl_news']['fields']['rateit_position'] = array
|
|||||||
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
|
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
|
||||||
);
|
);
|
||||||
|
|
||||||
class tl_news_rating extends DcaHelper {
|
class tl_news_rating extends rateit\DcaHelper {
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
@ -29,8 +29,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
use cgoIT\rateit\DcaHelper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend tl_page
|
* Extend tl_page
|
||||||
*/
|
*/
|
||||||
@ -83,7 +81,7 @@ $GLOBALS['TL_DCA']['tl_page']['fields']['rateit_position'] = array
|
|||||||
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
|
'eval' => array('mandatory'=>true, 'tl_class'=>'w50')
|
||||||
);
|
);
|
||||||
|
|
||||||
class tl_page_rateit extends DcaHelper {
|
class tl_page_rateit extends rateit\DcaHelper {
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
@ -28,8 +28,6 @@
|
|||||||
* @filesource
|
* @filesource
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use cgoIT\rateit\DcaHelper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* palettes
|
* palettes
|
||||||
*/
|
*/
|
||||||
@ -115,7 +113,21 @@ $GLOBALS['TL_DCA']['tl_settings']['fields']['rating_description'] = array
|
|||||||
'eval' => array('mandatory'=>true, 'allowHtml'=>true, 'tl_class'=>'w50')
|
'eval' => array('mandatory'=>true, 'allowHtml'=>true, 'tl_class'=>'w50')
|
||||||
);
|
);
|
||||||
|
|
||||||
class tl_settings_rateit extends DcaHelper
|
class tl_settings_rateit extends rateit\DcaHelper
|
||||||
{
|
{
|
||||||
|
public function getUserFullName() {
|
||||||
|
$this->import('jicw\\JICWHelper', 'JICWHelper');
|
||||||
|
return $this->JICWHelper->getUserFullName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUserEmail() {
|
||||||
|
$this->import('jicw\\JICWHelper', 'JICWHelper');
|
||||||
|
return $this->JICWHelper->getUserEmail();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getInstalledModules() {
|
||||||
|
$this->import('jicw\\JICWHelper', 'JICWHelper');
|
||||||
|
return $this->JICWHelper->getInstalledModules();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
@ -118,8 +118,7 @@
|
|||||||
|
|
||||||
.mod_rateit a.header_export_excel{
|
.mod_rateit a.header_export_excel{
|
||||||
padding:2px 0 3px 20px;
|
padding:2px 0 3px 20px;
|
||||||
background-image:url("../images/exportEXCEL.svg");
|
background-image:url("../images/exportEXCEL.gif");
|
||||||
background-size: 16px 16px;
|
|
||||||
background-position:left center;
|
background-position:left center;
|
||||||
background-repeat:no-repeat;
|
background-repeat:no-repeat;
|
||||||
}
|
}
|
Before Width: | Height: | Size: 847 B After Width: | Height: | Size: 847 B |
Before Width: | Height: | Size: 392 B After Width: | Height: | Size: 392 B |
BIN
public/images/exportEXCEL.gif
Normal file
After Width: | Height: | Size: 282 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 722 B After Width: | Height: | Size: 722 B |
Before Width: | Height: | Size: 354 B After Width: | Height: | Size: 354 B |
Before Width: | Height: | Size: 625 B After Width: | Height: | Size: 625 B |
Before Width: | Height: | Size: 815 B After Width: | Height: | Size: 815 B |
@ -271,7 +271,7 @@ function doRateIt() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
window.addEvent('domready', function(e) {
|
window.addEvent('domready', function(e) {
|
||||||
RateItRating = new RateItRatings({url:'rateit'});
|
RateItRating = new RateItRatings({url:'system/modules/rateit/public/php/rateit-ajax.php?do=rateit'});
|
||||||
});
|
});
|
||||||
} else if (window.jQuery) {
|
} else if (window.jQuery) {
|
||||||
// the rateit plugin as an Object
|
// the rateit plugin as an Object
|
||||||
@ -567,19 +567,19 @@ function doRateIt() {
|
|||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: "bundles/cgoitrateit/js/jquery-ui-effects.custom.min.js",
|
url: "system/modules/rateit/public/js/jquery-ui-effects.custom.min.js",
|
||||||
dataType: "script",
|
dataType: "script",
|
||||||
async: false,
|
async: false,
|
||||||
cache: true
|
cache: true
|
||||||
});
|
});
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: "bundles/cgoitrateit/js/helper.min.js",
|
url: "system/modules/rateit/public/js/helper.min.js",
|
||||||
dataType: "script",
|
dataType: "script",
|
||||||
async: false,
|
async: false,
|
||||||
cache: true
|
cache: true
|
||||||
});
|
});
|
||||||
RateItRating = Object.create(RateItRatings).initialize({url:'rateit'});
|
RateItRating = Object.create(RateItRatings).initialize({url:'system/modules/rateit/public/php/rateit-ajax.php?do=rateit'});
|
||||||
});
|
});
|
||||||
|
|
||||||
var jEscape = function(jquery) {
|
var jEscape = function(jquery) {
|
@ -9,7 +9,7 @@ var votePercent=this.getVotePercent(el.newFill);if(this.options.url!=null){new R
|
|||||||
el.textEl.set('text',text);if(typeof($('.mbrateItRating'))!='undefined'&&el.id.indexOf('mb')==0){var mbid=el.getAttribute('id');mbid=mbid.replace('mb','');if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==mbid){arrRatings[ri].description=text;break;}}}
|
el.textEl.set('text',text);if(typeof($('.mbrateItRating'))!='undefined'&&el.id.indexOf('mb')==0){var mbid=el.getAttribute('id');mbid=mbid.replace('mb','');if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==mbid){arrRatings[ri].description=text;break;}}}
|
||||||
if(typeof($(mbid))!='undefined'){$(mbid).getElement('.ratingText').set('text',text);}}else{if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==el.id){arrRatings[ri].description=text;break;}}}}};}
|
if(typeof($(mbid))!='undefined'){$(mbid).getElement('.ratingText').set('text',text);}}else{if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==el.id){arrRatings[ri].description=text;break;}}}}};}
|
||||||
el.showError=function(error){el.textEl.addClass('ratingError');el.textEl.set('text',error);(function(){el.textEl.set('text',el.textEl.oldTxt);el.textEl.removeClass('ratingError');}).delay(2000);};}else{el.getElement('.ratingText').inject(el,'before');el.remove();}},fillVote:function(percent,el){el.newFill=this.getFillPercent(percent);if(this.getVotePercent(el.newFill)>100){el.newFill=this.getFillPercent(100);}
|
el.showError=function(error){el.textEl.addClass('ratingError');el.textEl.set('text',error);(function(){el.textEl.set('text',el.textEl.oldTxt);el.textEl.removeClass('ratingError');}).delay(2000);};}else{el.getElement('.ratingText').inject(el,'before');el.remove();}},fillVote:function(percent,el){el.newFill=this.getFillPercent(percent);if(this.getVotePercent(el.newFill)>100){el.newFill=this.getFillPercent(100);}
|
||||||
el.selected.setStyle('width',el.newFill);},getStarPercent:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);if(stars!=null){var score=stars[3].toFloat();var scale=stars[4].toFloat();var percent=(score/scale)*100;return percent;}else{return 0;}},getFillPercent:function(starPercent){return(starPercent/100)*(this.options.starwidth*this.options.max);},getVotePercent:function(actVote){var starsWidth=this.options.starwidth*this.options.max;var percent=(actVote/starsWidth*100).round(2);return percent;},getRatableId:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?stars[1]:'';},getRatableType:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?stars[2]:'';},getRatableMaxValue:function(id){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;},setBackgroundPosition:function(el,pos){el.setStyle('background-position','0% '+pos+'px');},getBackgroundImagePath:function(el){return el.getStyle('background-image');},getBackgroundImage:function(el){var reg_imgFile=/url\s*\(["']?(.*)["']?\)/i;var dummy=document.createElement('img');var string=this.getBackgroundImagePath(el);string=string.match(reg_imgFile)[1];string=string.replace('\"','');dummy.src=string;return dummy;}});window.addEvent('domready',function(e){RateItRating=new RateItRatings({url:'rateit'});});}else if(window.jQuery){(function(){RateItRatings={options:{step:0.1,readonly:false,resetable:false},initialize:function(options){if(typeof options=='object'&&typeof options['url']!='undefined')
|
el.selected.setStyle('width',el.newFill);},getStarPercent:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);if(stars!=null){var score=stars[3].toFloat();var scale=stars[4].toFloat();var percent=(score/scale)*100;return percent;}else{return 0;}},getFillPercent:function(starPercent){return(starPercent/100)*(this.options.starwidth*this.options.max);},getVotePercent:function(actVote){var starsWidth=this.options.starwidth*this.options.max;var percent=(actVote/starsWidth*100).round(2);return percent;},getRatableId:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?stars[1]:'';},getRatableType:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?stars[2]:'';},getRatableMaxValue:function(id){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;},setBackgroundPosition:function(el,pos){el.setStyle('background-position','0% '+pos+'px');},getBackgroundImagePath:function(el){return el.getStyle('background-image');},getBackgroundImage:function(el){var reg_imgFile=/url\s*\(["']?(.*)["']?\)/i;var dummy=document.createElement('img');var string=this.getBackgroundImagePath(el);string=string.match(reg_imgFile)[1];string=string.replace('\"','');dummy.src=string;return dummy;}});window.addEvent('domready',function(e){RateItRating=new RateItRatings({url:'system/modules/rateit/public/php/rateit-ajax.php?do=rateit'});});}else if(window.jQuery){(function(){RateItRatings={options:{step:0.1,readonly:false,resetable:false},initialize:function(options){if(typeof options=='object'&&typeof options['url']!='undefined')
|
||||||
this.options.url=options['url'];var self=this;jQuery('.rateItRating').each(function(i,element){self.initMe(element);});return this;},initMe:function(element){var self=this;if(!Browser.Engine.trident4){var el=jQuery(element);el.data('id',el.attr('id'));el.data('rateable',el.attr('rel')=='not-rateable'?false:true);el.data('wrapper',el.find('.wrapper'));el.data('textEl',el.find('.ratingText'));el.data('selected',el.find('.rateItRating-selected'));el.data('hover',el.find('.rateItRating-hover'));jQuery.when(self.getBackgroundImage(el.data('wrapper'))).done(function(backgroundImageSize){self.options.starwidth=backgroundImageSize[0];self.options.starheight=backgroundImageSize[1]/3;});if(self.options.starwidth===undefined||self.options.starwidth<16){self.options.starwidth=16;}
|
this.options.url=options['url'];var self=this;jQuery('.rateItRating').each(function(i,element){self.initMe(element);});return this;},initMe:function(element){var self=this;if(!Browser.Engine.trident4){var el=jQuery(element);el.data('id',el.attr('id'));el.data('rateable',el.attr('rel')=='not-rateable'?false:true);el.data('wrapper',el.find('.wrapper'));el.data('textEl',el.find('.ratingText'));el.data('selected',el.find('.rateItRating-selected'));el.data('hover',el.find('.rateItRating-hover'));jQuery.when(self.getBackgroundImage(el.data('wrapper'))).done(function(backgroundImageSize){self.options.starwidth=backgroundImageSize[0];self.options.starheight=backgroundImageSize[1]/3;});if(self.options.starwidth===undefined||self.options.starwidth<16){self.options.starwidth=16;}
|
||||||
if(self.options.starheight===undefined||self.options.starheight<16){self.options.starheight=16;}
|
if(self.options.starheight===undefined||self.options.starheight<16){self.options.starheight=16;}
|
||||||
self.setBackgroundPosition(el.data('selected'),-1*self.options.starheight);self.setBackgroundPosition(el.data('hover'),-1*2*self.options.starheight);el.data('starPercent',self.getStarPercent(el.data('id')));el.data('ratableId',self.getRatableId(el.data('id')));el.data('ratableType',self.getRatableType(el.data('id')));self.options.max=self.getRatableMaxValue(el.data('id'));el.data('selected').css('height',self.options.starheight);el.data('hover').css('height',self.options.starheight);el.data('wrapper').css('width',self.options.starwidth*self.options.max);el.data('wrapper').css('height',self.options.starheight);self.fillVote(el.data('starPercent'),el);el.data('currentFill',self.getFillPercent(el.data('starPercent')));if(el.data('rateable')){el.data('wrapper').mouseenter(function(event){el.data('selected').hide(500,"easeInOutQuad");el.data('hover').show();el.data('wrapper').mousemove({'el':el,'self':self},self.mouseCrap);});el.data('wrapper').mouseleave(function(event){el.data('wrapper').unbind('mousemove');el.data('hover').hide();el.data('selected').show();el.data('selected').animate({width:el.data('currentFill')},500);});el.data('wrapper').click(function(event){el.data('currentFill',el.data('newFill'));el.data('wrapper').unbind();el.data('oldTxt',el.data('textEl').text());el.data('textEl').html(' ');el.data('textEl').addClass('loading');if(typeof(jQuery('.mbrateItRating'))!='undefined'&&el.data('id').indexOf('mb')==0){var mbid=el.data('id');mbid=mbid.replace('mb','');if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==mbid){arrRatings[ri].rated=true;arrRatings[ri].width=el.data('hover').css('width');break;}}}
|
self.setBackgroundPosition(el.data('selected'),-1*self.options.starheight);self.setBackgroundPosition(el.data('hover'),-1*2*self.options.starheight);el.data('starPercent',self.getStarPercent(el.data('id')));el.data('ratableId',self.getRatableId(el.data('id')));el.data('ratableType',self.getRatableType(el.data('id')));self.options.max=self.getRatableMaxValue(el.data('id'));el.data('selected').css('height',self.options.starheight);el.data('hover').css('height',self.options.starheight);el.data('wrapper').css('width',self.options.starwidth*self.options.max);el.data('wrapper').css('height',self.options.starheight);self.fillVote(el.data('starPercent'),el);el.data('currentFill',self.getFillPercent(el.data('starPercent')));if(el.data('rateable')){el.data('wrapper').mouseenter(function(event){el.data('selected').hide(500,"easeInOutQuad");el.data('hover').show();el.data('wrapper').mousemove({'el':el,'self':self},self.mouseCrap);});el.data('wrapper').mouseleave(function(event){el.data('wrapper').unbind('mousemove');el.data('hover').hide();el.data('selected').show();el.data('selected').animate({width:el.data('currentFill')},500);});el.data('wrapper').click(function(event){el.data('currentFill',el.data('newFill'));el.data('wrapper').unbind();el.data('oldTxt',el.data('textEl').text());el.data('textEl').html(' ');el.data('textEl').addClass('loading');if(typeof(jQuery('.mbrateItRating'))!='undefined'&&el.data('id').indexOf('mb')==0){var mbid=el.data('id');mbid=mbid.replace('mb','');if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==mbid){arrRatings[ri].rated=true;arrRatings[ri].width=el.data('hover').css('width');break;}}}
|
||||||
@ -20,5 +20,5 @@ el.data('selected').css('width',el.data('newFill'));},mouseCrap:function(event){
|
|||||||
var fillPercent=self.getVotePercent(fill);var nextStep=Math.ceil((fillPercent/100)*self.options.max);var w=nextStep*self.options.starwidth;if(parseInt(el.data('hover').css('width'))!=w){el.data('selected').css('display','none');el.data('hover').css('width',Math.min(w,self.options.starwidth*self.options.max));el.data('hover').css('display','block');}
|
var fillPercent=self.getVotePercent(fill);var nextStep=Math.ceil((fillPercent/100)*self.options.max);var w=nextStep*self.options.starwidth;if(parseInt(el.data('hover').css('width'))!=w){el.data('selected').css('display','none');el.data('hover').css('width',Math.min(w,self.options.starwidth*self.options.max));el.data('hover').css('display','block');}
|
||||||
var newFill=nextStep/self.options.max*100;self.fillVote(newFill,el);},getStarPercent:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);if(stars!=null){var score=parseFloat(stars[3]);var scale=parseFloat(stars[4]);var percent=(score/scale)*100;return percent;}else{return 0;}},getFillPercent:function(starPercent){return(starPercent/100)*(this.options.starwidth*this.options.max);},getVotePercent:function(actVote){var starsWidth=this.options.starwidth*this.options.max;var percent=(actVote/starsWidth*100).toFixed(2);return percent;},getRatableId:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?stars[1]:'';},getRatableType:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?stars[2]:'';},getRatableMaxValue:function(id){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;},setBackgroundPosition:function(el,pos){el.css('background-position','0% '+pos+'px');},getBackgroundImagePath:function(el){return el.css("background-image");},getBackgroundImage:function(el){var dfd=jQuery.Deferred();var backgroundImageSize=new Array();var reg_imgFile=/url\s*\(["']?(.*)["']?\)/i;var string=this.getBackgroundImagePath(el);string=string.match(reg_imgFile)[1];string=string.replace('\"','');jQuery('<img/>').attr('src',string).load(function(){backgroundImageSize.push(this.width);backgroundImageSize.push(this.height);dfd.resolve(backgroundImageSize);});return dfd.promise();},updateText:function(el,text){error=text.split('ERROR:')[1];el.data('textEl').removeClass('loading');if(error){this.RateItRating.showError(el,error);return false;}
|
var newFill=nextStep/self.options.max*100;self.fillVote(newFill,el);},getStarPercent:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);if(stars!=null){var score=parseFloat(stars[3]);var scale=parseFloat(stars[4]);var percent=(score/scale)*100;return percent;}else{return 0;}},getFillPercent:function(starPercent){return(starPercent/100)*(this.options.starwidth*this.options.max);},getVotePercent:function(actVote){var starsWidth=this.options.starwidth*this.options.max;var percent=(actVote/starsWidth*100).toFixed(2);return percent;},getRatableId:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?stars[1]:'';},getRatableType:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?stars[2]:'';},getRatableMaxValue:function(id){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;},setBackgroundPosition:function(el,pos){el.css('background-position','0% '+pos+'px');},getBackgroundImagePath:function(el){return el.css("background-image");},getBackgroundImage:function(el){var dfd=jQuery.Deferred();var backgroundImageSize=new Array();var reg_imgFile=/url\s*\(["']?(.*)["']?\)/i;var string=this.getBackgroundImagePath(el);string=string.match(reg_imgFile)[1];string=string.replace('\"','');jQuery('<img/>').attr('src',string).load(function(){backgroundImageSize.push(this.width);backgroundImageSize.push(this.height);dfd.resolve(backgroundImageSize);});return dfd.promise();},updateText:function(el,text){error=text.split('ERROR:')[1];el.data('textEl').removeClass('loading');if(error){this.RateItRating.showError(el,error);return false;}
|
||||||
el.data('textEl').text(text);if(typeof(jQuery('.mbrateItRating'))!='undefined'&&el.data('id').indexOf('mb')==0){var mbid=el.attr('id');mbid=mbid.replace('mb','');if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==mbid){arrRatings[ri].description=text;break;}}}
|
el.data('textEl').text(text);if(typeof(jQuery('.mbrateItRating'))!='undefined'&&el.data('id').indexOf('mb')==0){var mbid=el.attr('id');mbid=mbid.replace('mb','');if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==mbid){arrRatings[ri].description=text;break;}}}
|
||||||
if(typeof(jQuery('#'+jEscape(mbid)))!='undefined'){jQuery('#'+jEscape(mbid)).find('.ratingText').text(text);}}else{if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==el.data('id')){arrRatings[ri].description=text;break;}}}}},showError:function(el,error){el.data('textEl').addClass('ratingError');el.data('textEl').text(error);setTimeout(function(){el.data('textEl').text(el.data('oldTxt'));el.data('textEl').removeClass('ratingError');},2000);}};})(jQuery);jQuery(document).ready(function(){jQuery.ajax({type:"GET",url:"bundles/cgoitrateit/js/jquery-ui-effects.custom.min.js",dataType:"script",async:false,cache:true});jQuery.ajax({type:"GET",url:"bundles/cgoitrateit/js/helper.min.js",dataType:"script",async:false,cache:true});RateItRating=Object.create(RateItRatings).initialize({url:'rateit'});});var jEscape=function(jquery){jquery=jquery.replace(new RegExp("\\$","g"),"\\$");jquery=jquery.replace(new RegExp("\~","g"),"\\~");jquery=jquery.replace(new RegExp("\\[","g"),"\\[");jquery=jquery.replace(new RegExp("\\]","g"),"\\]");jquery=jquery.replace(new RegExp("\\|","g"),"\\|");jquery=jquery.replace(new RegExp("\\.","g"),"\\.");jquery=jquery.replace(new RegExp("#","g"),"\\#");return jquery;};}}
|
if(typeof(jQuery('#'+jEscape(mbid)))!='undefined'){jQuery('#'+jEscape(mbid)).find('.ratingText').text(text);}}else{if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==el.data('id')){arrRatings[ri].description=text;break;}}}}},showError:function(el,error){el.data('textEl').addClass('ratingError');el.data('textEl').text(error);setTimeout(function(){el.data('textEl').text(el.data('oldTxt'));el.data('textEl').removeClass('ratingError');},2000);}};})(jQuery);jQuery(document).ready(function(){jQuery.ajax({type:"GET",url:"system/modules/rateit/public/js/jquery-ui-effects.custom.min.js",dataType:"script",async:false,cache:true});jQuery.ajax({type:"GET",url:"system/modules/rateit/public/js/helper.min.js",dataType:"script",async:false,cache:true});RateItRating=Object.create(RateItRatings).initialize({url:'system/modules/rateit/public/php/rateit-ajax.php?do=rateit'});});var jEscape=function(jquery){jquery=jquery.replace(new RegExp("\\$","g"),"\\$");jquery=jquery.replace(new RegExp("\~","g"),"\\~");jquery=jquery.replace(new RegExp("\\[","g"),"\\[");jquery=jquery.replace(new RegExp("\\]","g"),"\\]");jquery=jquery.replace(new RegExp("\\|","g"),"\\|");jquery=jquery.replace(new RegExp("\\.","g"),"\\.");jquery=jquery.replace(new RegExp("#","g"),"\\#");return jquery;};}}
|
||||||
onReadyRateIt(function(){doRateIt();});
|
onReadyRateIt(function(){doRateIt();});
|
139
public/php/rateit-ajax.php
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contao Open Source CMS
|
||||||
|
* Copyright (C) 2005-2011 Leo Feyer
|
||||||
|
*
|
||||||
|
* Formerly known as TYPOlight Open Source CMS.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this program. If not, please visit the Free
|
||||||
|
* Software Foundation website at <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* PHP version 5
|
||||||
|
* @copyright Leo Unglaub 2012
|
||||||
|
* @author Leo Unglaub <leo@leo-unglaub.net>
|
||||||
|
* @package simple_ajax
|
||||||
|
* @license LGPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// simple trick for Contao < 2.10
|
||||||
|
$arrPost = $_POST;
|
||||||
|
unset($_POST);
|
||||||
|
|
||||||
|
|
||||||
|
// inizialize the contao framework
|
||||||
|
define('TL_MODE', 'FE');
|
||||||
|
require('../../../../initialize.php');
|
||||||
|
|
||||||
|
|
||||||
|
// write the post data back into the array
|
||||||
|
$_POST = $arrPost;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class RateitAjax
|
||||||
|
* Contain methods to catch ajax requests and send responses back to the client.
|
||||||
|
*
|
||||||
|
* Description
|
||||||
|
* ```````````
|
||||||
|
*
|
||||||
|
* The usage of the RateitAjax extensions is very easy. The extension provides
|
||||||
|
* the hook $GLOBALS['TL_HOOKS']['rateitAjax'] for extension developers. You
|
||||||
|
* simply have to register your class/method and the extension will call
|
||||||
|
* your class if there is an incomming ajax request.
|
||||||
|
*
|
||||||
|
* You simply have to deside if it's an ajax request for your module and return
|
||||||
|
* the data you want.
|
||||||
|
*
|
||||||
|
* There are a few thinks you should know about the extension:
|
||||||
|
* * YOU have the full controll over the response. That also means
|
||||||
|
* that you have to set the correct header.
|
||||||
|
* * YOU have to terminate the request after you have send the response.
|
||||||
|
* * If the ajax request is not for your method you simply have nothing to
|
||||||
|
* * return.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Usage
|
||||||
|
* `````
|
||||||
|
* // config.php
|
||||||
|
* $GLOBALS['TL_HOOKS']['rateitAjax'][] = array('MyClass', 'myMethod');
|
||||||
|
*
|
||||||
|
* // MyClass.php
|
||||||
|
* class MyClass extends System
|
||||||
|
* {
|
||||||
|
* public function myMethod()
|
||||||
|
* {
|
||||||
|
* if ($this->Input->get('acid') == 'myrequest')
|
||||||
|
* {
|
||||||
|
* $arrReturn = array('foo', 'bar', 'foobar');
|
||||||
|
*
|
||||||
|
* header('Content-Type: application/json');
|
||||||
|
* echo json_encode($arrReturn);
|
||||||
|
* exit;
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
class RateitAjax extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Call the parent constructor.
|
||||||
|
*
|
||||||
|
* !!! DON'T REMOVE THIS !!!
|
||||||
|
*
|
||||||
|
* If you remove this you get the following error message:
|
||||||
|
* Fatal error: Call to protected System::__construct() from invalid
|
||||||
|
* context
|
||||||
|
*
|
||||||
|
* @param void
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the ajax request and call all hooks
|
||||||
|
*
|
||||||
|
* @param void
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
// check if a hook is registered
|
||||||
|
if (is_array($GLOBALS['TL_HOOKS']['rateitAjax']) && count($GLOBALS['TL_HOOKS']['rateitAjax']) > 0)
|
||||||
|
{
|
||||||
|
// execute every registered callback
|
||||||
|
foreach ($GLOBALS['TL_HOOKS']['rateitAjax'] as $callback)
|
||||||
|
{
|
||||||
|
$this->import($callback[0]);
|
||||||
|
$this->{$callback[0]}->{$callback[1]}();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if there is no other output, we generate a 412 error response
|
||||||
|
header('HTTP/1.1 412 Precondition Failed');
|
||||||
|
die('Rateit Ajax: Invalid AJAX call.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create a rateit-ajax instance and run it
|
||||||
|
$objRateitAjax = new RateitAjax();
|
||||||
|
$objRateitAjax->run();
|
||||||
|
|
||||||
|
?>
|
177
public/php/rateit.php
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contao Open Source CMS
|
||||||
|
* Copyright (C) 2005-2011 Leo Feyer
|
||||||
|
*
|
||||||
|
* Formerly known as TYPOlight Open Source CMS.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation, either
|
||||||
|
* version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this program. If not, please visit the Free
|
||||||
|
* Software Foundation website at <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* PHP version 5
|
||||||
|
* @copyright cgo IT, 2013
|
||||||
|
* @author Carsten Götzinger (info@cgo-it.de)
|
||||||
|
* @package rateit
|
||||||
|
* @license GNU/LGPL
|
||||||
|
* @filesource
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace cgoIT\rateit;
|
||||||
|
|
||||||
|
define(RETURN_AJAX_HEADER, 'Content-Type: text/html');
|
||||||
|
|
||||||
|
class RateIt extends \Frontend {
|
||||||
|
|
||||||
|
var $allowDuplicates = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the controller
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
$this->loadLanguageFile('default');
|
||||||
|
$this->allowDuplicates = $GLOBALS['TL_CONFIG']['rating_allow_duplicate_ratings'];
|
||||||
|
$this->allowDuplicatesForMembers = $GLOBALS['TL_CONFIG']['rating_allow_duplicate_ratings_for_members'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* doVote
|
||||||
|
*
|
||||||
|
* This is the function in charge of handling a vote and saving it to the
|
||||||
|
* database.
|
||||||
|
*
|
||||||
|
* NOTE: This method is meant to be called as part of an AJAX request. As
|
||||||
|
* such, it unitlizes the die() function to display its errors. THIS
|
||||||
|
* WOULD BE A VERY BAD FUNCTION TO CALL FROM WITHIN ANOTHER PAGE.
|
||||||
|
*
|
||||||
|
* @param integer id - The id of key to register a rating for.
|
||||||
|
* @param integer percent - The rating in percentages.
|
||||||
|
*/
|
||||||
|
function doVote() {
|
||||||
|
if ($this->Input->get('do') == 'rateit') {
|
||||||
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
|
|
||||||
|
$rkey = $this->Input->post('id');
|
||||||
|
$percent = $this->Input->post('vote');
|
||||||
|
$type = $this->Input->post('type');
|
||||||
|
|
||||||
|
//Make sure that the ratable ID is a number and not something crazy.
|
||||||
|
if (strstr($rkey, '|')) {
|
||||||
|
$arrRkey = explode('|', $rkey);
|
||||||
|
foreach ($arrRkey as $key) {
|
||||||
|
if (!is_numeric($key)) {
|
||||||
|
header(RETURN_AJAX_HEADER);
|
||||||
|
echo $GLOBALS['TL_LANG']['rateit']['error']['invalid_rating'];
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$id = $rkey;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (is_numeric($rkey)) {
|
||||||
|
$id = $rkey;
|
||||||
|
} else {
|
||||||
|
header(RETURN_AJAX_HEADER);
|
||||||
|
echo $GLOBALS['TL_LANG']['rateit']['error']['invalid_rating'];
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Make sure the percent is a number and under 100.
|
||||||
|
if (is_numeric($percent) && $percent < 101) {
|
||||||
|
$rating = $percent;
|
||||||
|
} else {
|
||||||
|
header(RETURN_AJAX_HEADER);
|
||||||
|
echo $GLOBALS['TL_LANG']['rateit']['error']['invalid_rating'];
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//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' || $type === 'news4ward')) {
|
||||||
|
header(RETURN_AJAX_HEADER);
|
||||||
|
echo $GLOBALS['TL_LANG']['rateit']['error']['invalid_type'];
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$strHash = sha1(session_id() . (!$GLOBALS['TL_CONFIG']['disableIpCheck'] ? \Environment::get('ip') : '') . 'FE_USER_AUTH');
|
||||||
|
|
||||||
|
// FrontendUser auslesen
|
||||||
|
if (FE_USER_LOGGED_IN) {
|
||||||
|
$objUser = $this->Database->prepare("SELECT pid FROM tl_session WHERE hash=?")
|
||||||
|
->limit(1)
|
||||||
|
->execute($strHash);
|
||||||
|
|
||||||
|
if ($objUser->numRows) {
|
||||||
|
$userId = $objUser->pid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$ratableKeyId = $this->Database->prepare('SELECT id FROM tl_rateit_items WHERE rkey=? and typ=?')
|
||||||
|
->execute($id, $type)
|
||||||
|
->fetchAssoc();
|
||||||
|
|
||||||
|
$canVote = false;
|
||||||
|
if (isset($userId)) {
|
||||||
|
$countUser = $this->Database->prepare('SELECT * FROM tl_rateit_ratings WHERE pid=? and memberid=?')
|
||||||
|
->execute($ratableKeyId['id'], $userId)
|
||||||
|
->count();
|
||||||
|
}
|
||||||
|
$countIp = $this->Database->prepare('SELECT * FROM tl_rateit_ratings WHERE pid=? and ip_address=?')
|
||||||
|
->execute($ratableKeyId['id'], $ip)
|
||||||
|
->count();
|
||||||
|
|
||||||
|
// Die with an error if the insert fails (duplicate IP or duplicate member id for a vote).
|
||||||
|
if ((!$this->allowDuplicatesForMembers && (isset($countUser) ? $countUser == 0 : false)) || ($this->allowDuplicatesForMembers && isset($userId))) {
|
||||||
|
// Insert the data.
|
||||||
|
$arrSet = array('pid' => $ratableKeyId['id'],
|
||||||
|
'tstamp' => time(),
|
||||||
|
'ip_address' => $ip,
|
||||||
|
'memberid' => isset($userId) ? $userId : null,
|
||||||
|
'rating' => $rating,
|
||||||
|
'createdat'=> time()
|
||||||
|
);
|
||||||
|
$this->Database->prepare('INSERT INTO tl_rateit_ratings %s')
|
||||||
|
->set($arrSet)
|
||||||
|
->execute();
|
||||||
|
} elseif (!isset($countUser) && ((!$this->allowDuplicates && $countIp == 0) || $this->allowDuplicates)) {
|
||||||
|
// Insert the data.
|
||||||
|
$arrSet = array('pid' => $ratableKeyId['id'],
|
||||||
|
'tstamp' => time(),
|
||||||
|
'ip_address' => $ip,
|
||||||
|
'memberid' => isset($userId) ? $userId : null,
|
||||||
|
'rating' => $rating,
|
||||||
|
'createdat'=> time()
|
||||||
|
);
|
||||||
|
$this->Database->prepare('INSERT INTO tl_rateit_ratings %s')
|
||||||
|
->set($arrSet)
|
||||||
|
->execute();
|
||||||
|
} else {
|
||||||
|
header(RETURN_AJAX_HEADER);
|
||||||
|
echo $GLOBALS['TL_LANG']['rateit']['error']['duplicate_vote'];
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->import('rateit\\RateItFrontend', 'RateItFrontend');
|
||||||
|
$rating = $this->RateItFrontend->loadRating($id, $type);
|
||||||
|
|
||||||
|
header(RETURN_AJAX_HEADER);
|
||||||
|
echo $this->RateItFrontend->getStarMessage($rating);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
@ -1,14 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace cgoIT\rateit;
|
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configures the Contao aeo bundle.
|
|
||||||
*
|
|
||||||
* @author Carsten Götzinger
|
|
||||||
*/
|
|
||||||
class CgoITRateItBundle extends Bundle
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace cgoIT\rateit;
|
|
||||||
|
|
||||||
use Contao\CoreBundle\ContaoCoreBundle;
|
|
||||||
use Contao\ManagerPlugin\Bundle\Config\BundleConfig;
|
|
||||||
use Contao\ManagerPlugin\Bundle\BundlePluginInterface;
|
|
||||||
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
|
|
||||||
use Contao\ManagerPlugin\Routing\RoutingPluginInterface;
|
|
||||||
use Symfony\Component\Config\Loader\LoaderResolverInterface;
|
|
||||||
use Symfony\Component\HttpKernel\KernelInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Plugin for the Contao Manager.
|
|
||||||
*
|
|
||||||
* @author Carsten Götzinger
|
|
||||||
*/
|
|
||||||
class ContaoManagerPlugin implements BundlePluginInterface, RoutingPluginInterface
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getBundles(ParserInterface $parser)
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
BundleConfig::create(CgoITRateItBundle::class)
|
|
||||||
->setLoadAfter([ContaoCoreBundle::class])
|
|
||||||
->setReplace(['rate-it']),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getRouteCollection(LoaderResolverInterface $resolver, KernelInterface $kernel)
|
|
||||||
{
|
|
||||||
return $resolver
|
|
||||||
->resolve(__DIR__.'/Resources/config/routing.yml')
|
|
||||||
->load(__DIR__.'/Resources/config/routing.yml')
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Created by PhpStorm.
|
|
||||||
* User: darko
|
|
||||||
* Date: 23.10.17
|
|
||||||
* Time: 23:55
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace cgoIT\rateit\Controller;
|
|
||||||
|
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use cgoIT\rateit\RateIt;
|
|
||||||
|
|
||||||
class AjaxRateItController extends Controller {
|
|
||||||
/**
|
|
||||||
* Handles rating requests.
|
|
||||||
*
|
|
||||||
* @return JsonResponse
|
|
||||||
*
|
|
||||||
* @Route("/rateit", name="ajax_rateit", defaults={"_scope" = "frontend", "_token_check" = false})
|
|
||||||
*/
|
|
||||||
public function ajaxAction() {
|
|
||||||
|
|
||||||
$this->container->get('contao.framework')->initialize();
|
|
||||||
|
|
||||||
$controller = new RateIt();
|
|
||||||
|
|
||||||
$response = $controller->doVote();
|
|
||||||
$response->send();
|
|
||||||
|
|
||||||
return new Response(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
ajax_rateit:
|
|
||||||
resource: "@CgoITRateItBundle/Controller/"
|
|
||||||
type: annotation
|
|
@ -1,175 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contao Open Source CMS
|
|
||||||
* Copyright (C) 2005-2011 Leo Feyer
|
|
||||||
*
|
|
||||||
* Formerly known as TYPOlight Open Source CMS.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation, either
|
|
||||||
* version 3 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this program. If not, please visit the Free
|
|
||||||
* Software Foundation website at <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* PHP version 5
|
|
||||||
* @copyright cgo IT, 2013
|
|
||||||
* @author Carsten Götzinger (info@cgo-it.de)
|
|
||||||
* @package rateit
|
|
||||||
* @license GNU/LGPL
|
|
||||||
* @filesource
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace cgoIT\rateit;
|
|
||||||
|
|
||||||
use cgoIT\rateit\RateItFrontend;
|
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
||||||
|
|
||||||
class RateIt extends \Frontend {
|
|
||||||
|
|
||||||
var $allowDuplicates = false;
|
|
||||||
var $rateItFrontend;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the controller
|
|
||||||
*/
|
|
||||||
public function __construct() {
|
|
||||||
parent::__construct();
|
|
||||||
|
|
||||||
// See #4099
|
|
||||||
if (!defined('BE_USER_LOGGED_IN'))
|
|
||||||
{
|
|
||||||
define('BE_USER_LOGGED_IN', false);
|
|
||||||
}
|
|
||||||
if (!defined('FE_USER_LOGGED_IN'))
|
|
||||||
{
|
|
||||||
define('FE_USER_LOGGED_IN', false);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->rateItFrontend = new RateItFrontend();
|
|
||||||
|
|
||||||
$this->loadLanguageFile('default');
|
|
||||||
$this->allowDuplicates = $GLOBALS['TL_CONFIG']['rating_allow_duplicate_ratings'];
|
|
||||||
$this->allowDuplicatesForMembers = $GLOBALS['TL_CONFIG']['rating_allow_duplicate_ratings_for_members'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* doVote
|
|
||||||
*
|
|
||||||
* This is the function in charge of handling a vote and saving it to the
|
|
||||||
* database.
|
|
||||||
*
|
|
||||||
* NOTE: This method is meant to be called as part of an AJAX request. As
|
|
||||||
* such, it unitlizes the die() function to display its errors. THIS
|
|
||||||
* WOULD BE A VERY BAD FUNCTION TO CALL FROM WITHIN ANOTHER PAGE.
|
|
||||||
*
|
|
||||||
* @param integer id - The id of key to register a rating for.
|
|
||||||
* @param integer percent - The rating in percentages.
|
|
||||||
*/
|
|
||||||
public function doVote() {
|
|
||||||
$ip = $_SERVER['REMOTE_ADDR'];
|
|
||||||
|
|
||||||
$rkey = $this->Input->post('id');
|
|
||||||
$percent = $this->Input->post('vote');
|
|
||||||
$type = $this->Input->post('type');
|
|
||||||
|
|
||||||
//Make sure that the ratable ID is a number and not something crazy.
|
|
||||||
if (strstr($rkey, '|')) {
|
|
||||||
$arrRkey = explode('|', $rkey);
|
|
||||||
foreach ($arrRkey as $key) {
|
|
||||||
if (!is_numeric($key)) {
|
|
||||||
return new JsonResponse($GLOBALS['TL_LANG']['rateit']['error']['invalid_rating']);
|
|
||||||
}
|
|
||||||
$id = $rkey;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (is_numeric($rkey)) {
|
|
||||||
$id = $rkey;
|
|
||||||
} else {
|
|
||||||
return new JsonResponse($GLOBALS['TL_LANG']['rateit']['error']['invalid_rating']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Make sure the percent is a number and under 100.
|
|
||||||
if (is_numeric($percent) && $percent < 101) {
|
|
||||||
$rating = $percent;
|
|
||||||
} else {
|
|
||||||
return new JsonResponse($GLOBALS['TL_LANG']['rateit']['error']['invalid_rating']);
|
|
||||||
}
|
|
||||||
|
|
||||||
//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' || $type === 'news4ward')) {
|
|
||||||
return new JsonResponse($GLOBALS['TL_LANG']['rateit']['error']['invalid_type']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$strHash = sha1(session_id() . (!$GLOBALS['TL_CONFIG']['disableIpCheck'] ? \Environment::get('ip') : '') . 'FE_USER_AUTH');
|
|
||||||
|
|
||||||
// FrontendUser auslesen
|
|
||||||
if (FE_USER_LOGGED_IN) {
|
|
||||||
$objUser = $this->Database->prepare("SELECT pid FROM tl_session WHERE hash=?")
|
|
||||||
->limit(1)
|
|
||||||
->execute($strHash);
|
|
||||||
|
|
||||||
if ($objUser->numRows) {
|
|
||||||
$userId = $objUser->pid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$ratableKeyId = $this->Database->prepare('SELECT id FROM tl_rateit_items WHERE rkey=? and typ=?')
|
|
||||||
->execute($id, $type)
|
|
||||||
->fetchAssoc();
|
|
||||||
|
|
||||||
$canVote = false;
|
|
||||||
if (isset($userId)) {
|
|
||||||
$countUser = $this->Database->prepare('SELECT * FROM tl_rateit_ratings WHERE pid=? and memberid=?')
|
|
||||||
->execute($ratableKeyId['id'], $userId)
|
|
||||||
->count();
|
|
||||||
}
|
|
||||||
$countIp = $this->Database->prepare('SELECT * FROM tl_rateit_ratings WHERE pid=? and ip_address=?')
|
|
||||||
->execute($ratableKeyId['id'], $ip)
|
|
||||||
->count();
|
|
||||||
|
|
||||||
// Die with an error if the insert fails (duplicate IP or duplicate member id for a vote).
|
|
||||||
if ((!$this->allowDuplicatesForMembers && (isset($countUser) ? $countUser == 0 : false)) || ($this->allowDuplicatesForMembers && isset($userId))) {
|
|
||||||
// Insert the data.
|
|
||||||
$arrSet = array('pid' => $ratableKeyId['id'],
|
|
||||||
'tstamp' => time(),
|
|
||||||
'ip_address' => $ip,
|
|
||||||
'memberid' => isset($userId) ? $userId : null,
|
|
||||||
'rating' => $rating,
|
|
||||||
'createdat'=> time()
|
|
||||||
);
|
|
||||||
$this->Database->prepare('INSERT INTO tl_rateit_ratings %s')
|
|
||||||
->set($arrSet)
|
|
||||||
->execute();
|
|
||||||
} elseif (!isset($countUser) && ((!$this->allowDuplicates && $countIp == 0) || $this->allowDuplicates)) {
|
|
||||||
// Insert the data.
|
|
||||||
$arrSet = array('pid' => $ratableKeyId['id'],
|
|
||||||
'tstamp' => time(),
|
|
||||||
'ip_address' => $ip,
|
|
||||||
'memberid' => isset($userId) ? $userId : null,
|
|
||||||
'rating' => $rating,
|
|
||||||
'createdat'=> time()
|
|
||||||
);
|
|
||||||
$this->Database->prepare('INSERT INTO tl_rateit_ratings %s')
|
|
||||||
->set($arrSet)
|
|
||||||
->execute();
|
|
||||||
} else {
|
|
||||||
return new JsonResponse($GLOBALS['TL_LANG']['rateit']['error']['duplicate_vote']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$rating = $this->rateItFrontend->loadRating($id, $type);
|
|
||||||
|
|
||||||
return new JsonResponse($this->rateItFrontend->getStarMessage($rating));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
@ -1,37 +0,0 @@
|
|||||||
<?php $this->extend('mod_article'); ?>
|
|
||||||
|
|
||||||
<?php $this->block('content'); ?>
|
|
||||||
<?php if ($this->rateit_rating_before): ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<div id="<?= $this->rateItID ?>" class="<?= $this->class ?> <?= $this->rateit_class ?>">
|
|
||||||
<?php if ($this->showBefore) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="rateItRating-selected" style="display: block;"></div>
|
|
||||||
<div class="rateItRating-hover"></div>
|
|
||||||
</div>
|
|
||||||
<?php if ($this->showAfter) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php $this->parent(); ?>
|
|
||||||
<?php if ($this->rateit_rating_after): ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<div id="<?= $this->rateItID ?>" class="<?= $this->class ?> <?= $this->rateit_class ?>">
|
|
||||||
<?php if ($this->showBefore) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="rateItRating-selected" style="display: block;"></div>
|
|
||||||
<div class="rateItRating-hover"></div>
|
|
||||||
</div>
|
|
||||||
<?php if ($this->showAfter) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php $this->endblock(); ?>
|
|
@ -1,55 +0,0 @@
|
|||||||
<?php $this->extend('mod_article'); ?>
|
|
||||||
|
|
||||||
<?php $this->block('content'); ?>
|
|
||||||
<?php if ($this->rateit_rating_before): ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<div itemtype="http://schema.org/CreativeWork" itemscope class="rating-microdata">
|
|
||||||
<div id="<?= $this->rateItID ?>" class="<?= $this->class ?> <?= $this->rateit_class ?>">
|
|
||||||
<?php if ($this->showBefore) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="rateItRating-selected" style="display: block;"></div>
|
|
||||||
<div class="rateItRating-hover"></div>
|
|
||||||
</div>
|
|
||||||
<?php if ($this->showAfter) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<span class="rating-microdata" itemprop="name"><?php echo $this->itemreviewed; ?></span>
|
|
||||||
<span class="rating-microdata" itemtype="http://schema.org/AggregateRating" itemscope itemprop="aggregateRating">
|
|
||||||
<span itemprop="ratingValue"><?php echo $this->actRating; ?></span>
|
|
||||||
<span itemprop="worstRating">0</span>
|
|
||||||
<span itemprop="bestRating"><?php echo $this->maxRating; ?></span>
|
|
||||||
<span itemprop="ratingCount"><?php echo $this->votes; ?></span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php $this->parent(); ?>
|
|
||||||
<?php if ($this->rateit_rating_after): ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<div itemtype="http://schema.org/CreativeWork" itemscope class="rating-microdata">
|
|
||||||
<div id="<?= $this->rateItID ?>" class="<?= $this->class ?> <?= $this->rateit_class ?>">
|
|
||||||
<?php if ($this->showBefore) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="rateItRating-selected" style="display: block;"></div>
|
|
||||||
<div class="rateItRating-hover"></div>
|
|
||||||
</div>
|
|
||||||
<?php if ($this->showAfter) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<span class="rating-microdata" itemprop="name"><?php echo $this->itemreviewed; ?></span>
|
|
||||||
<span class="rating-microdata" itemtype="http://schema.org/AggregateRating" itemscope itemprop="aggregateRating">
|
|
||||||
<span itemprop="ratingValue"><?php echo $this->actRating; ?></span>
|
|
||||||
<span itemprop="worstRating">0</span>
|
|
||||||
<span itemprop="bestRating"><?php echo $this->maxRating; ?></span>
|
|
||||||
<span itemprop="ratingCount"><?php echo $this->votes; ?></span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php $this->endblock(); ?>
|
|
@ -1,47 +0,0 @@
|
|||||||
<?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(); ?>
|
|
@ -1,16 +0,0 @@
|
|||||||
<?php $this->extend('mod_articlelist_rateit'); ?>
|
|
||||||
|
|
||||||
<?php $this->block('rating'); ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<div itemtype="http://schema.org/CreativeWork" itemscope class="rating-microdata">
|
|
||||||
<?php $this->parent(); ?>
|
|
||||||
<span class="rating-microdata" itemprop="name"><?= $article['itemreviewed'] ?></span>
|
|
||||||
<span class="rating-microdata" itemtype="http://schema.org/AggregateRating" itemscope itemprop="aggregateRating">
|
|
||||||
<span itemprop="ratingValue"><?= $article['actRating'] ?></span>
|
|
||||||
<span itemprop="worstRating">0</span>
|
|
||||||
<span itemprop="bestRating"><?= $article['maxRating'] ?></span>
|
|
||||||
<span itemprop="ratingCount"><?= $article['votes'] ?></span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
<?php $this->endblock(); ?>
|
|
@ -1,40 +0,0 @@
|
|||||||
|
|
||||||
<?php if ($this->rateit_rating_before): ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<?php $this->block('rating'); ?>
|
|
||||||
<div id="<?= $this->ratingId ?>" class="<?= $this->class ?> <?= $this->rateit_class ?>">
|
|
||||||
<?php if ($this->showBefore) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="rateItRating-selected" style="display: block;"></div>
|
|
||||||
<div class="rateItRating-hover"></div>
|
|
||||||
</div>
|
|
||||||
<?php if ($this->showAfter) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php $this->endblock(); ?>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php $this->insert('news_full', $this->arrData); ?>
|
|
||||||
|
|
||||||
<?php if ($this->rateit_rating_after): ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<?php $this->block('rating'); ?>
|
|
||||||
<div id="<?= $this->ratingId ?>" class="<?= $this->class ?> <?= $this->rateit_class ?>">
|
|
||||||
<?php if ($this->showBefore) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="rateItRating-selected" style="display: block;"></div>
|
|
||||||
<div class="rateItRating-hover"></div>
|
|
||||||
</div>
|
|
||||||
<?php if ($this->showAfter) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php $this->endblock(); ?>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
<?php endif; ?>
|
|
@ -1,17 +0,0 @@
|
|||||||
<?php $this->extend('news_full_rateit'); ?>
|
|
||||||
|
|
||||||
<?php $this->block('rating'); ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<div itemtype="http://schema.org/CreativeWork" itemscope class="rating-microdata">
|
|
||||||
<?php $this->parent(); ?>
|
|
||||||
<span class="rating-microdata" itemprop="name"><?php echo $this->itemreviewed; ?></span>
|
|
||||||
<span class="rating-microdata" itemtype="http://schema.org/AggregateRating" itemscope itemprop="aggregateRating">
|
|
||||||
<span itemprop="ratingValue"><?php echo $this->actRating; ?></span>
|
|
||||||
<span itemprop="worstRating">0</span>
|
|
||||||
<span itemprop="bestRating"><?php echo $this->maxRating; ?></span>
|
|
||||||
<span itemprop="ratingCount"><?php echo $this->votes; ?></span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
|
|
||||||
<?php $this->endblock(); ?>
|
|
@ -1,40 +0,0 @@
|
|||||||
|
|
||||||
<?php if ($this->rateit_rating_before): ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<?php $this->block('rating'); ?>
|
|
||||||
<div id="<?= $this->ratingId ?>" class="<?= $this->class ?> <?= $this->rateit_class ?>">
|
|
||||||
<?php if ($this->showBefore) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="rateItRating-selected" style="display: block;"></div>
|
|
||||||
<div class="rateItRating-hover"></div>
|
|
||||||
</div>
|
|
||||||
<?php if ($this->showAfter) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php $this->endblock(); ?>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php $this->insert('news_latest', $this->arrData); ?>
|
|
||||||
|
|
||||||
<?php if ($this->rateit_rating_after): ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<?php $this->block('rating'); ?>
|
|
||||||
<div id="<?= $this->ratingId ?>" class="<?= $this->class ?> <?= $this->rateit_class ?>">
|
|
||||||
<?php if ($this->showBefore) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="rateItRating-selected" style="display: block;"></div>
|
|
||||||
<div class="rateItRating-hover"></div>
|
|
||||||
</div>
|
|
||||||
<?php if ($this->showAfter) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php $this->endblock(); ?>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
<?php endif; ?>
|
|
@ -1,17 +0,0 @@
|
|||||||
<?php $this->extend('news_latest_rateit'); ?>
|
|
||||||
|
|
||||||
<?php $this->block('rating'); ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<div itemtype="http://schema.org/CreativeWork" itemscope class="rating-microdata">
|
|
||||||
<?php $this->parent(); ?>
|
|
||||||
<span class="rating-microdata" itemprop="name"><?php echo $this->itemreviewed; ?></span>
|
|
||||||
<span class="rating-microdata" itemtype="http://schema.org/AggregateRating" itemscope itemprop="aggregateRating">
|
|
||||||
<span itemprop="ratingValue"><?php echo $this->actRating; ?></span>
|
|
||||||
<span itemprop="worstRating">0</span>
|
|
||||||
<span itemprop="bestRating"><?php echo $this->maxRating; ?></span>
|
|
||||||
<span itemprop="ratingCount"><?php echo $this->votes; ?></span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
|
|
||||||
<?php $this->endblock(); ?>
|
|
@ -1,40 +0,0 @@
|
|||||||
|
|
||||||
<?php if ($this->rateit_rating_before): ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<?php $this->block('rating'); ?>
|
|
||||||
<div id="<?= $this->ratingId ?>" class="<?= $this->class ?> <?= $this->rateit_class ?>">
|
|
||||||
<?php if ($this->showBefore) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="rateItRating-selected" style="display: block;"></div>
|
|
||||||
<div class="rateItRating-hover"></div>
|
|
||||||
</div>
|
|
||||||
<?php if ($this->showAfter) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php $this->endblock(); ?>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php $this->insert('news_short', $this->arrData); ?>
|
|
||||||
|
|
||||||
<?php if ($this->rateit_rating_after): ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<?php $this->block('rating'); ?>
|
|
||||||
<div id="<?= $this->ratingId ?>" class="<?= $this->class ?> <?= $this->rateit_class ?>">
|
|
||||||
<?php if ($this->showBefore) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="rateItRating-selected" style="display: block;"></div>
|
|
||||||
<div class="rateItRating-hover"></div>
|
|
||||||
</div>
|
|
||||||
<?php if ($this->showAfter) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php $this->endblock(); ?>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
<?php endif; ?>
|
|
@ -1,17 +0,0 @@
|
|||||||
<?php $this->extend('news_short_rateit'); ?>
|
|
||||||
|
|
||||||
<?php $this->block('rating'); ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<div itemtype="http://schema.org/CreativeWork" itemscope class="rating-microdata">
|
|
||||||
<?php $this->parent(); ?>
|
|
||||||
<span class="rating-microdata" itemprop="name"><?php echo $this->itemreviewed; ?></span>
|
|
||||||
<span class="rating-microdata" itemtype="http://schema.org/AggregateRating" itemscope itemprop="aggregateRating">
|
|
||||||
<span itemprop="ratingValue"><?php echo $this->actRating; ?></span>
|
|
||||||
<span itemprop="worstRating">0</span>
|
|
||||||
<span itemprop="bestRating"><?php echo $this->maxRating; ?></span>
|
|
||||||
<span itemprop="ratingCount"><?php echo $this->votes; ?></span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
|
|
||||||
<?php $this->endblock(); ?>
|
|
@ -1,40 +0,0 @@
|
|||||||
|
|
||||||
<?php if ($this->rateit_rating_before): ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<?php $this->block('rating'); ?>
|
|
||||||
<div id="<?= $this->ratingId ?>" class="<?= $this->class ?> <?= $this->rateit_class ?>">
|
|
||||||
<?php if ($this->showBefore) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="rateItRating-selected" style="display: block;"></div>
|
|
||||||
<div class="rateItRating-hover"></div>
|
|
||||||
</div>
|
|
||||||
<?php if ($this->showAfter) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php $this->endblock(); ?>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php $this->insert('news_simple', $this->arrData); ?>
|
|
||||||
|
|
||||||
<?php if ($this->rateit_rating_after): ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<?php $this->block('rating'); ?>
|
|
||||||
<div id="<?= $this->ratingId ?>" class="<?= $this->class ?> <?= $this->rateit_class ?>">
|
|
||||||
<?php if ($this->showBefore) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="rateItRating-selected" style="display: block;"></div>
|
|
||||||
<div class="rateItRating-hover"></div>
|
|
||||||
</div>
|
|
||||||
<?php if ($this->showAfter) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php $this->endblock(); ?>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
<?php endif; ?>
|
|
@ -1,17 +0,0 @@
|
|||||||
<?php $this->extend('news_simple_rateit'); ?>
|
|
||||||
|
|
||||||
<?php $this->block('rating'); ?>
|
|
||||||
<!-- indexer::stop -->
|
|
||||||
<div itemtype="http://schema.org/CreativeWork" itemscope class="rating-microdata">
|
|
||||||
<?php $this->parent(); ?>
|
|
||||||
<span class="rating-microdata" itemprop="name"><?php echo $this->itemreviewed; ?></span>
|
|
||||||
<span class="rating-microdata" itemtype="http://schema.org/AggregateRating" itemscope itemprop="aggregateRating">
|
|
||||||
<span itemprop="ratingValue"><?php echo $this->actRating; ?></span>
|
|
||||||
<span itemprop="worstRating">0</span>
|
|
||||||
<span itemprop="bestRating"><?php echo $this->maxRating; ?></span>
|
|
||||||
<span itemprop="ratingCount"><?php echo $this->votes; ?></span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<!-- indexer::continue -->
|
|
||||||
|
|
||||||
<?php $this->endblock(); ?>
|
|
@ -1,14 +0,0 @@
|
|||||||
<!-- indexer::stop -->
|
|
||||||
<div id="<?= $this->id ?>" class="<?= $this->class ?> <?= $this->rateit_class ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>>
|
|
||||||
<?php if ($this->showBefore) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="rateItRating-selected" style="display: block;"></div>
|
|
||||||
<div class="rateItRating-hover"></div>
|
|
||||||
</div>
|
|
||||||
<?php if ($this->showAfter) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<!-- indexer::continue -->
|
|
@ -1,23 +0,0 @@
|
|||||||
<!-- indexer::stop -->
|
|
||||||
<div itemtype="http://schema.org/CreativeWork" itemscope class="rating-microdata">
|
|
||||||
<div id="<?= $this->id ?>" class="<?= $this->class ?> <?= $this->rateit_class ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>>
|
|
||||||
<?php if ($this->showBefore) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="rateItRating-selected" style="display: block;"></div>
|
|
||||||
<div class="rateItRating-hover"></div>
|
|
||||||
</div>
|
|
||||||
<?php if ($this->showAfter) : ?>
|
|
||||||
<div id="<?= $this->descriptionId ?>" class="ratingText"><?= $this->description ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<span class="rating-microdata" itemprop="name"><?php echo $this->itemreviewed; ?></span>
|
|
||||||
<span class="rating-microdata" itemtype="http://schema.org/AggregateRating" itemscope itemprop="aggregateRating">
|
|
||||||
<span itemprop="ratingValue"><?php echo $this->actRating; ?></span>
|
|
||||||
<span itemprop="worstRating">0</span>
|
|
||||||
<span itemprop="bestRating"><?php echo $this->maxRating; ?></span>
|
|
||||||
<span itemprop="ratingCount"><?php echo $this->votes; ?></span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<!-- indexer::continue -->
|
|
@ -1,95 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
width="110.03758"
|
|
||||||
height="107.5"
|
|
||||||
viewBox="0 0 88.030066 86"
|
|
||||||
version="1.1"
|
|
||||||
id="svg2"
|
|
||||||
inkscape:version="0.48.3.1 r9886"
|
|
||||||
sodipodi:docname="word.svg">
|
|
||||||
<metadata
|
|
||||||
id="metadata126">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
<dc:title></dc:title>
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<defs
|
|
||||||
id="defs124" />
|
|
||||||
<sodipodi:namedview
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
bordercolor="#666666"
|
|
||||||
borderopacity="1"
|
|
||||||
objecttolerance="10"
|
|
||||||
gridtolerance="10"
|
|
||||||
guidetolerance="10"
|
|
||||||
inkscape:pageopacity="0"
|
|
||||||
inkscape:pageshadow="2"
|
|
||||||
inkscape:window-width="1280"
|
|
||||||
inkscape:window-height="960"
|
|
||||||
id="namedview122"
|
|
||||||
showgrid="false"
|
|
||||||
inkscape:zoom="1.0905983"
|
|
||||||
inkscape:cx="344.89442"
|
|
||||||
inkscape:cy="53.75"
|
|
||||||
inkscape:window-x="0"
|
|
||||||
inkscape:window-y="0"
|
|
||||||
inkscape:window-maximized="1"
|
|
||||||
inkscape:current-layer="svg2"
|
|
||||||
fit-margin-top="0"
|
|
||||||
fit-margin-left="0"
|
|
||||||
fit-margin-right="0"
|
|
||||||
fit-margin-bottom="0" />
|
|
||||||
<path
|
|
||||||
d="m 46.04,0 5.94,0 c 0,2.67 0,5.33 0,8 10.01,0 20.02,0.02 30.03,-0.03 1.69,0.07 3.55,-0.05 5.02,0.96 1.03,1.48 0.91,3.36 0.98,5.06 -0.05,17.36 -0.03,34.71 -0.02,52.06 -0.05,2.91 0.27,5.88 -0.34,8.75 -0.4,2.08 -2.9,2.13 -4.57,2.2 -10.36,0.03 -20.73,-0.02 -31.1,0 0,3 0,6 0,9 l -6.21,0 C 30.53,83.23 15.26,80.67 0,78 0,54.67 0,31.34 0,8.01 15.35,5.34 30.7,2.71 46.04,0 z"
|
|
||||||
id="path10"
|
|
||||||
inkscape:connector-curvature="0"
|
|
||||||
style="fill:#207245" />
|
|
||||||
<path
|
|
||||||
d="m 51.98,11 c 11,0 22,0 33,0 0,21 0,42 0,63 -11,0 -22,0 -33,0 0,-2 0,-4 0,-6 2.67,0 5.33,0 8,0 0,-2.33 0,-4.67 0,-7 -2.67,0 -5.33,0 -8,0 0,-1.33 0,-2.67 0,-4 2.67,0 5.33,0 8,0 0,-2.33 0,-4.67 0,-7 -2.67,0 -5.33,0 -8,0 0,-1.33 0,-2.67 0,-4 2.67,0 5.33,0 8,0 0,-2.33 0,-4.67 0,-7 -2.67,0 -5.33,0 -8,0 0,-1.33 0,-2.67 0,-4 2.67,0 5.33,0 8,0 0,-2.33 0,-4.67 0,-7 -2.67,0 -5.33,0 -8,0 0,-1.33 0,-2.67 0,-4 2.67,0 5.33,0 8,0 0,-2.33 0,-4.67 0,-7 -2.67,0 -5.33,0 -8,0 0,-2 0,-4 0,-6 z"
|
|
||||||
id="path48"
|
|
||||||
inkscape:connector-curvature="0"
|
|
||||||
style="fill:#ffffff" />
|
|
||||||
<path
|
|
||||||
d="m 63.98,17 c 4.67,0 9.33,0 14,0 0,2.33 0,4.67 0,7 -4.67,0 -9.33,0 -14,0 0,-2.33 0,-4.67 0,-7 z"
|
|
||||||
id="path58"
|
|
||||||
inkscape:connector-curvature="0"
|
|
||||||
style="fill:#207245" />
|
|
||||||
<path
|
|
||||||
d="m 29.62,26.37 c 2.26,-0.16 4.53,-0.3 6.8,-0.41 -2.67,5.47 -5.35,10.94 -8.07,16.39 2.75,5.6 5.56,11.16 8.32,16.76 -2.41,-0.14 -4.81,-0.29 -7.22,-0.46 -1.7,-4.17 -3.77,-8.2 -4.99,-12.56 -1.36,4.06 -3.3,7.89 -4.86,11.87 -2.19,-0.03 -4.38,-0.12 -6.57,-0.21 2.57,-5.03 5.05,-10.1 7.7,-15.1 -2.25,-5.15 -4.72,-10.2 -7.04,-15.32 2.2,-0.13 4.4,-0.26 6.6,-0.38 1.49,3.91 3.12,7.77 4.35,11.78 1.32,-4.25 3.29,-8.25 4.98,-12.36 z"
|
|
||||||
id="path72"
|
|
||||||
inkscape:connector-curvature="0"
|
|
||||||
style="fill:#ffffff" />
|
|
||||||
<path
|
|
||||||
d="m 63.98,28 c 4.67,0 9.33,0 14,0 0,2.33 0,4.67 0,7 -4.67,0 -9.33,0 -14,0 0,-2.33 0,-4.67 0,-7 z"
|
|
||||||
id="path90"
|
|
||||||
inkscape:connector-curvature="0"
|
|
||||||
style="fill:#207245" />
|
|
||||||
<path
|
|
||||||
d="m 63.98,39 c 4.67,0 9.33,0 14,0 0,2.33 0,4.67 0,7 -4.67,0 -9.33,0 -14,0 0,-2.33 0,-4.67 0,-7 z"
|
|
||||||
id="path108"
|
|
||||||
inkscape:connector-curvature="0"
|
|
||||||
style="fill:#207245" />
|
|
||||||
<path
|
|
||||||
d="m 63.98,50 c 4.67,0 9.33,0 14,0 0,2.33 0,4.67 0,7 -4.67,0 -9.33,0 -14,0 0,-2.33 0,-4.67 0,-7 z"
|
|
||||||
id="path114"
|
|
||||||
inkscape:connector-curvature="0"
|
|
||||||
style="fill:#207245" />
|
|
||||||
<path
|
|
||||||
d="m 63.98,61 c 4.67,0 9.33,0 14,0 0,2.33 0,4.67 0,7 -4.67,0 -9.33,0 -14,0 0,-2.33 0,-4.67 0,-7 z"
|
|
||||||
id="path120"
|
|
||||||
inkscape:connector-curvature="0"
|
|
||||||
style="fill:#207245" />
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 4.0 KiB |