diff --git a/main/gradebook/lib/be/surveylink.class.php b/main/gradebook/lib/be/surveylink.class.php index 9783b73119..d44ff82217 100755 --- a/main/gradebook/lib/be/surveylink.class.php +++ b/main/gradebook/lib/be/surveylink.class.php @@ -258,6 +258,10 @@ class SurveyLink extends AbstractLink public function get_link() { + if (api_get_configuration_value('hide_survey_reporting_button')) { + return null; + } + if (api_is_allowed_to_edit()) { // Let students make access only through "Surveys" tool. $tbl_name = $this->get_survey_table(); $session_id = api_get_session_id(); diff --git a/main/install/configuration.dist.php b/main/install/configuration.dist.php index db1c0203e4..9f343d5a6e 100755 --- a/main/install/configuration.dist.php +++ b/main/install/configuration.dist.php @@ -465,6 +465,8 @@ VALUES (12, 13, 'is_mandatory', 'IsMandatory', 1, 1, NOW()); ALTER TABLE c_survey_question ADD is_required TINYINT(1) DEFAULT 0 NOT NULL; */ //$_configuration['allow_required_survey_questions'] = false; +// Hide Survey Reporting button +//$_configuration['hide_survey_reporting_button'] = false; // ------ // Allow career diagram, requires a DB change: diff --git a/main/survey/survey.php b/main/survey/survey.php index e2e36c026d..c76bc397b8 100755 --- a/main/survey/survey.php +++ b/main/survey/survey.php @@ -137,7 +137,14 @@ $survey_actions .= ''.Display::return_icon('copy.gif', get_lang('Copy')).''; $survey_actions .= ''.Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_MEDIUM).''; $survey_actions .= ''.Display::return_icon('mail_send.png', get_lang('Publish'), '', ICON_SIZE_MEDIUM).''; -$survey_actions .= ''.Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_MEDIUM).''; + +if (!api_get_configuration_value('hide_survey_reporting_button')) { + $survey_actions .= Display::url( + Display::return_icon('stats.png', get_lang('Reporting'), [], ICON_SIZE_MEDIUM), + api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id + ); +} + echo '
'.$survey_actions.'
'; if ($survey_data['survey_type'] == 0) { diff --git a/main/survey/surveyUtil.class.php b/main/survey/surveyUtil.class.php index 4b09ec23ff..42eadc9fd7 100755 --- a/main/survey/surveyUtil.class.php +++ b/main/survey/surveyUtil.class.php @@ -2664,10 +2664,15 @@ class SurveyUtil { $survey_id = Security::remove_XSS($survey_id); $return = ''; + $hideReportingButton = api_get_configuration_value('hide_survey_reporting_button'); + + $reportingLink = Display::url( + Display::return_icon('stats.png', get_lang('Reporting'), [], ICON_SIZE_SMALL), + api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id + ); if ($drh) { - return ''. - Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_SMALL).''; + return $hideReportingButton ? '-' : $reportingLink; } // Coach can see that only if the survey is in his session @@ -2693,8 +2698,7 @@ class SurveyUtil Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_SMALL).' '; $return .= ''. Display::return_icon('mail_send.png', get_lang('Publish'), '', ICON_SIZE_SMALL).' '; - $return .= ''. - Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_SMALL).''; + $return .= $hideReportingButton ? '' : $reportingLink; if (api_is_allowed_to_edit() || api_is_element_in_the_session(TOOL_SURVEY, $survey_id) diff --git a/main/survey/survey_invitation.php b/main/survey/survey_invitation.php index d79a7718c8..8452565c50 100755 --- a/main/survey/survey_invitation.php +++ b/main/survey/survey_invitation.php @@ -114,7 +114,7 @@ while ($row = Database::fetch_assoc($res)) { echo ' '.$row['invitation_date'].''; echo ' '; - if (in_array($row['user'], $answered_data)) { + if (in_array($row['user'], $answered_data) && !api_get_configuration_value('hide_survey_reporting_button')) { echo ''.get_lang('ViewAnswers').''; } else { echo '-';