From 8815ddc76262d4e27ba0831ed18c9050626bc64e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20G=C3=B6tzinger?= Date: Wed, 4 Feb 2015 22:26:32 +0100 Subject: [PATCH] Initialer Commit --- classes/RateItNews4ward.php | 56 +++++++++ config/autoload.ini | 19 +++ config/autoload.php | 40 ++++++ config/config.php | 3 + dca/tl_news4ward_article.php | 58 +++++++++ languages/de/modules.php | 6 + languages/de/tl_news4ward_article.php | 9 ++ languages/en/modules.php | 6 + languages/en/tl_news4ward_article.php | 9 ++ templates/mod_news4ward_reader_rateit.html5 | 87 +++++++++++++ ...od_news4ward_reader_rateit_microdata.html5 | 119 ++++++++++++++++++ templates/news4ward_list_item_rateit.html5 | 58 +++++++++ ...news4ward_list_item_rateit_microdata.html5 | 74 +++++++++++ 13 files changed, 544 insertions(+) create mode 100644 classes/RateItNews4ward.php create mode 100644 config/autoload.ini create mode 100644 config/autoload.php create mode 100644 config/config.php create mode 100644 dca/tl_news4ward_article.php create mode 100644 languages/de/modules.php create mode 100644 languages/de/tl_news4ward_article.php create mode 100644 languages/en/modules.php create mode 100644 languages/en/tl_news4ward_article.php create mode 100644 templates/mod_news4ward_reader_rateit.html5 create mode 100644 templates/mod_news4ward_reader_rateit_microdata.html5 create mode 100644 templates/news4ward_list_item_rateit.html5 create mode 100644 templates/news4ward_list_item_rateit_microdata.html5 diff --git a/classes/RateItNews4ward.php b/classes/RateItNews4ward.php new file mode 100644 index 0000000..6b9054a --- /dev/null +++ b/classes/RateItNews4ward.php @@ -0,0 +1,56 @@ +id; + $rating = $this->loadRating($ratingId, 'news4ward'); + $stars = !$rating ? 0 : $this->percentToStars($rating['rating']); + $percent = round($rating['rating'], 0)."%"; + + $objTemplate->descriptionId = 'rateItRating-'.$ratingId.'-description'; + $objTemplate->description = $this->getStarMessage($rating); + $objTemplate->id = 'rateItRating-'.$ratingId.'-news4ward-'.$stars.'_'.$this->intStars; + $objTemplate->rateit_class = 'rateItRating'; + $objTemplate->itemreviewed = $rating['title']; + $objTemplate->actRating = $this->percentToStars($rating['rating']); + $objTemplate->maxRating = $this->intStars; + $objTemplate->votes = $rating[totalRatings]; + + if ($this->strTextPosition == "before") { + $objTemplate->showBefore = true; + } + else if ($this->strTextPosition == "after") { + $objTemplate->showAfter = true; + } + + if ($objArticle['rateit_position'] == 'before') { + $objTemplate->rateit_rating_before = true; + } else if ($objArticle['rateit_position'] == 'after') { + $objTemplate->rateit_rating_after = true; + } + + $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static'; + $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit-uncompressed.js'; + $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.css||static'; + switch ($GLOBALS['TL_CONFIG']['rating_type']) { + case 'hearts' : + $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.css||static'; + break; + default: + $GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.css||static'; + } + } + } +} +?> \ No newline at end of file diff --git a/config/autoload.ini b/config/autoload.ini new file mode 100644 index 0000000..cc8452d --- /dev/null +++ b/config/autoload.ini @@ -0,0 +1,19 @@ +;; +; List modules which are required to be loaded beforehand +;; +requires[] = "core" + +;; +; Configure what you want the autoload creator to register +;; +register_namespaces = true +register_classes = true +register_templates = true + +;; +; Override the default configuration for certain sub directories +;; +[vendor/*] +register_namespaces = false +register_classes = false +register_templates = false diff --git a/config/autoload.php b/config/autoload.php new file mode 100644 index 0000000..c1cca36 --- /dev/null +++ b/config/autoload.php @@ -0,0 +1,40 @@ + 'system/modules/news4ward_rateit/classes/RateItNews4ward.php', +)); + + +/** + * Register the templates + */ +TemplateLoader::addFiles(array +( + 'mod_news4ward_reader_rateit' => 'system/modules/news4ward_rateit/templates', + 'mod_news4ward_reader_rateit_microdata' => 'system/modules/news4ward_rateit/templates', + 'news4ward_list_item_rateit' => 'system/modules/news4ward_rateit/templates', + 'news4ward_list_item_rateit_microdata' => 'system/modules/news4ward_rateit/templates', +)); diff --git a/config/config.php b/config/config.php new file mode 100644 index 0000000..efef4b5 --- /dev/null +++ b/config/config.php @@ -0,0 +1,3 @@ + &$GLOBALS['TL_LANG']['tl_news4ward_article']['addRating'], + 'exclude' => true, + 'inputType' => 'checkbox', + 'sql' => "char(1) NOT NULL default ''", + 'eval' => array('tl_class'=>'w50 m12', 'submitOnChange'=>true) +); + +$GLOBALS['TL_DCA']['tl_news4ward_article']['fields']['rateit_position'] = array +( + 'label' => &$GLOBALS['TL_LANG']['tl_news4ward_article']['rateit_position'], + 'default' => 'before', + 'exclude' => true, + 'inputType' => 'select', + 'options' => array('after', 'before'), + 'reference' => &$GLOBALS['TL_LANG']['tl_news4ward_article'], + 'sql' => "varchar(6) NOT NULL default ''", + 'eval' => array('mandatory'=>true, 'tl_class'=>'w50') +); + +class tl_news4ward_article_rating extends rateit\DcaHelper { + /** + * Constructor + */ + public function __construct() { + parent::__construct(); + } + + public function insert(\DC_Table $dc) { + return $this->insertOrUpdateRatingKey($dc, 'news4ward', $dc->activeRecord->title); + } + + public function delete(\DC_Table $dc) + { + return $this->deleteRatingKey($dc, 'news4ward'); + } +} diff --git a/languages/de/modules.php b/languages/de/modules.php new file mode 100644 index 0000000..2b170ed --- /dev/null +++ b/languages/de/modules.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/languages/de/tl_news4ward_article.php b/languages/de/tl_news4ward_article.php new file mode 100644 index 0000000..2f12081 --- /dev/null +++ b/languages/de/tl_news4ward_article.php @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/languages/en/tl_news4ward_article.php b/languages/en/tl_news4ward_article.php new file mode 100644 index 0000000..e11e96e --- /dev/null +++ b/languages/en/tl_news4ward_article.php @@ -0,0 +1,9 @@ +class; ?> block"cssID; ?>style): ?> style="style; ?>"> + +rateit_rating_before): ?> + +
+ showBefore) : ?> +
description; ?>
+ +
+
+
+
+ showAfter) : ?> +
description; ?>
+ +
+ + + +headline): ?> +<hl; ?>>headline; ?>hl; ?>> + + +hasMetaFields): ?> +

date; ?> author; ?>

+ + +

title;?>

+ +subheadline)): ?> +

subheadline; ?>

+ + +content; ?> + +socialButtons)): ?> +
+ socialButtons)): ?> + + + socialButtons)): ?> + + + socialButtons)): ?> + + Google+ + + + socialButtons)): ?> + + +
+ + +rateit_rating_after): ?> + +
+ showBefore) : ?> +
description; ?>
+ +
+
+
+
+ showAfter) : ?> +
description; ?>
+ +
+ + + +prevArticle): ?> +« prevArticle['title']; ?> + +nextArticle): ?> +nextArticle['title']; ?> » + + + + diff --git a/templates/mod_news4ward_reader_rateit_microdata.html5 b/templates/mod_news4ward_reader_rateit_microdata.html5 new file mode 100644 index 0000000..ce58942 --- /dev/null +++ b/templates/mod_news4ward_reader_rateit_microdata.html5 @@ -0,0 +1,119 @@ + +
cssID; ?>style): ?> style="style; ?>"> + +rateit_rating_before): ?> + +
+
+ showBefore) : ?> +
description; ?>
+ +
+
+
+
+ showAfter) : ?> +
description; ?>
+ +
+ itemreviewed; ?> + + actRating; ?> + maxRating; ?> + + votes; ?> +
+ + + +rateit_rating_before): ?> + +
+ showBefore) : ?> +
description; ?>
+ +
+
+
+
+ showAfter) : ?> +
description; ?>
+ +
+ + +headline): ?> +<hl; ?>>headline; ?>hl; ?>> + + +hasMetaFields): ?> +

date; ?> author; ?>

+ + +

title;?>

+ +subheadline)): ?> +

subheadline; ?>

+ + +content; ?> + +socialButtons)): ?> + + + +rateit_rating_after): ?> + +
+
+ showBefore) : ?> +
description; ?>
+ +
+
+
+
+ showAfter) : ?> +
description; ?>
+ +
+ itemreviewed; ?> + + actRating; ?> + maxRating; ?> + + votes; ?> +
+ + + +prevArticle): ?> +« prevArticle['title']; ?> + +nextArticle): ?> +nextArticle['title']; ?> » + + + +
diff --git a/templates/news4ward_list_item_rateit.html5 b/templates/news4ward_list_item_rateit.html5 new file mode 100644 index 0000000..f691dbd --- /dev/null +++ b/templates/news4ward_list_item_rateit.html5 @@ -0,0 +1,58 @@ + +
cssID; ?>> + +rateit_rating_before): ?> + +
+ showBefore) : ?> +
description; ?>
+ +
+
+
+
+ showAfter) : ?> +
description; ?>
+ +
+ + + +hasMetaFields): ?> +

date; ?> author; ?>

+ +

title; ?>

+subheadline)): ?> +

subheadline; ?>

+ +
teaserCssID; ?>> + teaserImage)): ?> +
+ <?php echo $this->title; ?> + teaserImageCaption): ?> +
teaserImageCaption; ?>
+ +
+ + teaser; ?> +
+ +rateit_rating_after): ?> + +
+ showBefore) : ?> +
description; ?>
+ +
+
+
+
+ showAfter) : ?> +
description; ?>
+ +
+ + + + +
diff --git a/templates/news4ward_list_item_rateit_microdata.html5 b/templates/news4ward_list_item_rateit_microdata.html5 new file mode 100644 index 0000000..361b674 --- /dev/null +++ b/templates/news4ward_list_item_rateit_microdata.html5 @@ -0,0 +1,74 @@ + +
cssID; ?>> + +rateit_rating_before): ?> + +
+
+ showBefore) : ?> +
description; ?>
+ +
+
+
+
+ showAfter) : ?> +
description; ?>
+ +
+ itemreviewed; ?> + + actRating; ?> + maxRating; ?> + + votes; ?> +
+ + + +hasMetaFields): ?> +

date; ?> author; ?>

+ +

title; ?>

+subheadline)): ?> +

subheadline; ?>

+ +
teaserCssID; ?>> + teaserImage)): ?> +
+ <?php echo $this->title; ?> + teaserImageCaption): ?> +
teaserImageCaption; ?>
+ +
+ + teaser; ?> +
+ +rateit_rating_after): ?> + +
+
+ showBefore) : ?> +
description; ?>
+ +
+
+
+
+ showAfter) : ?> +
description; ?>
+ +
+ itemreviewed; ?> + + actRating; ?> + maxRating; ?> + + votes; ?> +
+ + + + +