diff --git a/EvasysPlugin.class.php b/EvasysPlugin.class.php index 384d739..2a368e5 100644 --- a/EvasysPlugin.class.php +++ b/EvasysPlugin.class.php @@ -326,13 +326,15 @@ public function getIconNavigation($course_id, $last_visit, $user_id = null) if (Config::get()->EVASYS_RED_ICONS_STOP_UNTIL > time()) { $tab->setImage(Icon::create("evaluation", "new"), array('title' => _("Neue Evaluation"))); } else { - $number = 0; - foreach ($evasys_seminars as $evasys_seminar) { - $number += $evasys_seminar->getEvaluationStatus(); - } - if ($number > 0) { - $tab->setImage(Icon::create("evaluation", "new"), ['title' => sprintf(_("%s neue Evaluation"), $number)]); - } + + $icon_link = PluginEngine::getLink($this, array(), "icon/get/" . $course_id); + $tab->setImage( + Icon::create("evaluation", "inactive"), + [ + 'onload' => 'if(this.src != \'' . $icon_link .'\'){ this.src = \'' . $icon_link .'\';}', + 'title' => _("Evaluationen") + ]); + } } return $tab; diff --git a/controllers/icon.php b/controllers/icon.php new file mode 100644 index 0000000..4563b17 --- /dev/null +++ b/controllers/icon.php @@ -0,0 +1,23 @@ +getEvaluationStatus(); + + if ($number > 0) break; + } + + $icon_url = Icon::create("evaluation", ($number > 0)?"new":"inactive")->asImagePath(); + $icon_path = $GLOBALS['STUDIP_BASE_PATH'] . '/public' . parse_url($icon_url, PHP_URL_PATH); + + header("Content-Type: image/svg+xml"); + readfile($icon_path); + + exit; + } + +}