From aad13df5ccaed3b0380a3484098126562f2d073a Mon Sep 17 00:00:00 2001
From: Astor Bizard <astor.bizard@grenoble-inp.fr>
Date: Fri, 6 Mar 2020 09:23:22 +0100
Subject: [PATCH] Limited submissions graphs visibility to teachers

---
 views/previoussubmissionslist.php | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/views/previoussubmissionslist.php b/views/previoussubmissionslist.php
index c08d9d85..46296648 100644
--- a/views/previoussubmissionslist.php
+++ b/views/previoussubmissionslist.php
@@ -58,11 +58,13 @@ if ($detailed) {
 $vpl->print_header( get_string( 'previoussubmissionslist', VPL ) );
 $vpl->print_view_tabs( basename( __FILE__ ) );
 
-$grapher = new vpl_grapher($vpl, $userid);
-$grapher->draw_files_evolution_graph();
-$grapher->draw_working_periods_graph();
-$grapher->draw_files_evolution_graph(true);
-$grapher->draw_daily_activity_graph();
+if ($vpl->has_capability(VPL_GRADE_CAPABILITY)) {
+    $grapher = new vpl_grapher($vpl, $userid);
+    $grapher->draw_files_evolution_graph();
+    $grapher->draw_working_periods_graph();
+    $grapher->draw_files_evolution_graph(true);
+    $grapher->draw_daily_activity_graph();
+}
 
 $table = new html_table();
 $table->head = array (
-- 
GitLab