From 4e5365ea52c6108f6d7479778e46448feabc652e Mon Sep 17 00:00:00 2001
From: Rasmus Fuhse <fuhse@data-quest.de>
Date: Wed, 26 Oct 2016 14:35:37 +0200
Subject: [PATCH] re #68

---
 assets/blue_star.svg                     |  6 ++++++
 assets/blue_star2.svg                    |  6 ++++++
 assets/blue_star3.svg                    |  6 ++++++
 migrations/04_add_rating_to_database.php |  2 ++
 views/presenting/details.php             | 27 ++++++++++++++----------
 5 files changed, 36 insertions(+), 11 deletions(-)
 create mode 100644 assets/blue_star.svg
 create mode 100644 assets/blue_star2.svg
 create mode 100644 assets/blue_star3.svg

diff --git a/assets/blue_star.svg b/assets/blue_star.svg
new file mode 100644
index 0000000..410fa41
--- /dev/null
+++ b/assets/blue_star.svg
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="100%" height="100%" viewBox="0 0 64 64" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;">
+    <path id="line5" d="M0,0" style="fill-rule:nonzero;stroke:rgb(68,159,219);stroke-width:1px;"/>
+    <path id="path7" d="M64,24.816L41.889,21.603L32,1.567L22.111,21.603L0,24.816L16,40.412L12.223,62.434L32,52.037L51.777,62.434L48,40.412L64,24.816ZM32,47.094L18.034,54.437L20.701,38.885L9.402,27.871L25.017,25.602L32,11.452L38.983,25.602L54.598,27.871L43.299,38.885L45.966,54.437L32,47.094L32,47.094Z" style="fill:rgb(15,70,126);fill-rule:nonzero;"/>
+</svg>
diff --git a/assets/blue_star2.svg b/assets/blue_star2.svg
new file mode 100644
index 0000000..8449efd
--- /dev/null
+++ b/assets/blue_star2.svg
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="100%" height="100%" viewBox="0 0 64 64" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;">
+    <path id="line5" d="M0,0" style="fill-rule:nonzero;stroke:rgb(68,159,219);stroke-width:1px;"/>
+    <path id="path7" d="M64,24.816L41.889,21.603L32,1.567L22.111,21.603L0,24.816L16,40.412L12.223,62.434L32,52.037L51.777,62.434L48,40.412L64,24.816ZM32,47.094L31.941,47.125L32,11.452L38.983,25.602L54.598,27.871L43.299,38.885L45.966,54.437L32,47.094L32,47.094Z" style="fill:rgb(15,70,126);fill-rule:nonzero;"/>
+</svg>
diff --git a/assets/blue_star3.svg b/assets/blue_star3.svg
new file mode 100644
index 0000000..411fc40
--- /dev/null
+++ b/assets/blue_star3.svg
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="100%" height="100%" viewBox="0 0 64 64" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;">
+    <path id="line5" d="M0,0" style="fill-rule:nonzero;stroke:rgb(68,159,219);stroke-width:1px;"/>
+    <path id="path7" d="M64,24.816L41.889,21.603L32,1.567L22.111,21.603L0,24.816L16,40.412L12.223,62.434L32,52.037L51.777,62.434L48,40.412L64,24.816Z" style="fill:rgb(15,70,126);fill-rule:nonzero;"/>
+</svg>
diff --git a/migrations/04_add_rating_to_database.php b/migrations/04_add_rating_to_database.php
index efb0817..26ea37f 100755
--- a/migrations/04_add_rating_to_database.php
+++ b/migrations/04_add_rating_to_database.php
@@ -1,5 +1,7 @@
 <?php
 
+require_once __DIR__."/../classes/MarketPlugin.class.php";
+
 class AddRatingToDatabase extends Migration {
     
     public function up() {
diff --git a/views/presenting/details.php b/views/presenting/details.php
index d064940..0ff82a0 100755
--- a/views/presenting/details.php
+++ b/views/presenting/details.php
@@ -233,30 +233,32 @@ if ($image) {
         <? if ($marketplugin['rating'] === null) : ?>
             <? if (!$marketplugin->isWritable()) : ?>
                 <a style="opacity: 0.3;" title="<?= $GLOBALS['perm']->have_perm("autor") ? _("Geben Sie die erste Bewertung ab.") : _("Noch keine bewertung abgegeben.") ?>" <?= ($GLOBALS['perm']->have_perm("autor") && !$marketplugin->isWritable()) ? 'href="' . $controller->url_for('presenting/review/' . $marketplugin->getId()) . '" data-dialog' : "" ?>>
+                <? $icon_prefix = "blue_" ?>
             <? endif ?>
-                <?= Assets::img($plugin->getPluginURL()."/assets/star.svg", array('width' => "50px")) ?>
-                <?= Assets::img($plugin->getPluginURL()."/assets/star.svg", array('width' => "50px")) ?>
-                <?= Assets::img($plugin->getPluginURL()."/assets/star.svg", array('width' => "50px")) ?>
-                <?= Assets::img($plugin->getPluginURL()."/assets/star.svg", array('width' => "50px")) ?>
-                <?= Assets::img($plugin->getPluginURL()."/assets/star.svg", array('width' => "50px")) ?>
+                <?= Assets::img($plugin->getPluginURL()."/assets/".$icon_prefix."star.svg", array('width' => "50px")) ?>
+                <?= Assets::img($plugin->getPluginURL()."/assets/".$icon_prefix."star.svg", array('width' => "50px")) ?>
+                <?= Assets::img($plugin->getPluginURL()."/assets/".$icon_prefix."star.svg", array('width' => "50px")) ?>
+                <?= Assets::img($plugin->getPluginURL()."/assets/".$icon_prefix."star.svg", array('width' => "50px")) ?>
+                <?= Assets::img($plugin->getPluginURL()."/assets/".$icon_prefix."star.svg", array('width' => "50px")) ?>
             <? if (!$marketplugin->isWritable()) : ?>
                 </a>
             <? endif ?>
         <? else : ?>
             <? if (!$marketplugin->isWritable()) : ?>
                 <a <?= ($GLOBALS['perm']->have_perm("autor") && !$marketplugin->isWritable()) ? 'href="' . $controller->url_for('presenting/review/' . $marketplugin->getId()) . '" data-dialog' : "" ?> title="<?= sprintf(_("%s von 5 Sternen"), round($marketplugin['rating'] / 2, 1)) ?>">
+                <? $icon_prefix = "blue_" ?>
             <? endif ?>
                 <? $marketplugin['rating'] = round($marketplugin['rating'], 1) / 2 ?>
                 <? $v = $marketplugin['rating'] >= 0.75 ? 3 : ($marketplugin['rating'] >= 0.25 ? 2 : "") ?>
-                <?= Assets::img($plugin->getPluginURL()."/assets/star$v.svg", array('width' => "50px")) ?>
+                <?= Assets::img($plugin->getPluginURL()."/assets/".$icon_prefix."star$v.svg", array('width' => "50px")) ?>
                 <? $v = $marketplugin['rating'] >= 1.75 ? 3 : ($marketplugin['rating'] >= 1.25 ? 2 : "") ?>
-                <?= Assets::img($plugin->getPluginURL()."/assets/star$v.svg", array('width' => "50px")) ?>
+                <?= Assets::img($plugin->getPluginURL()."/assets/".$icon_prefix."star$v.svg", array('width' => "50px")) ?>
                 <? $v = $marketplugin['rating'] >= 2.75 ? 3 : ($marketplugin['rating'] >= 2.25 ? 2 : "") ?>
-                <?= Assets::img($plugin->getPluginURL()."/assets/star$v.svg", array('width' => "50px")) ?>
+                <?= Assets::img($plugin->getPluginURL()."/assets/".$icon_prefix."star$v.svg", array('width' => "50px")) ?>
                 <? $v = $marketplugin['rating'] >= 3.75 ? 3 : ($marketplugin['rating'] >= 3.25 ? 2 : "") ?>
-                <?= Assets::img($plugin->getPluginURL()."/assets/star$v.svg", array('width' => "50px")) ?>
+                <?= Assets::img($plugin->getPluginURL()."/assets/".$icon_prefix."star$v.svg", array('width' => "50px")) ?>
                 <? $v = $marketplugin['rating'] >= 4.75 ? 3 : ($marketplugin['rating'] >= 4.25 ? 2 : "") ?>
-                <?= Assets::img($plugin->getPluginURL()."/assets/star$v.svg", array('width' => "50px")) ?>
+                <?= Assets::img($plugin->getPluginURL()."/assets/".$icon_prefix."star$v.svg", array('width' => "50px")) ?>
             <? if (!$marketplugin->isWritable()) : ?>
                 </a>
             <? endif ?>
@@ -296,9 +298,12 @@ if ($image) {
 <div style="text-align: center">
 <? if ($marketplugin->isWritable()) : ?>
     <?= \Studip\LinkButton::create(_("Plugin löschen"), PluginEngine::getURL($plugin, array(), 'myplugins/delete/' . $marketplugin->getId()), array('data-dialog' => 1)) ?>
-    <?= \Studip\LinkButton::create(_("bearbeiten"), PluginEngine::getURL($plugin, array(), "myplugins/edit/" . $marketplugin->getId()), array('data-dialog' => 1)) ?>
+    <?= \Studip\LinkButton::create(_("Bearbeiten"), PluginEngine::getURL($plugin, array(), "myplugins/edit/" . $marketplugin->getId()), array('data-dialog' => 1)) ?>
     <?= \Studip\LinkButton::create(_("Release hinzufügen"), PluginEngine::getURL($plugin, array(), "myplugins/add_release/" . $marketplugin->getId()), array('data-dialog' => 1)) ?>
 <? endif ?>
+<? if (!$marketplugin->isWritable()) : ?>
+    <?= \Studip\LinkButton::create(_("Bewertung schreiben"), $controller->url_for('presenting/review/' . $marketplugin->getId()), array('data-dialog' => 1)) ?>
+<? endif ?>
 <? if ($marketplugin['user_id'] !== $GLOBALS['user']->id) : ?>
     <?= \Studip\LinkButton::create(_("Plugin abonnieren"), PluginEngine::getURL($plugin, array(), "presenting/register_for_pluginnews/" . $marketplugin->getId()), array('title' => _("Neuigkeiten des Plugins per Nachricht bekommen."), 'data-dialog' => "1")) ?>
 <? endif ?>
-- 
GitLab