Add configuration setting to hide the Survey Reporting button - refs BT#13203

pull/2487/head
Angel Fernando Quiroz Campos 8 years ago
parent 333a822b5b
commit 69d16ada0f
  1. 4
      main/gradebook/lib/be/surveylink.class.php
  2. 2
      main/install/configuration.dist.php
  3. 9
      main/survey/survey.php
  4. 12
      main/survey/surveyUtil.class.php
  5. 2
      main/survey/survey_invitation.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();

@ -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:

@ -137,7 +137,14 @@ $survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.p
//$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/create_survey_in_another_language.php?id_survey='.$survey_id.'">'.Display::return_icon('copy.gif', get_lang('Copy')).'</a>';
$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_MEDIUM).'</a>';
$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('mail_send.png', get_lang('Publish'), '', ICON_SIZE_MEDIUM).'</a>';
$survey_actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_MEDIUM).'</a>';
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 '<div class="actions">'.$survey_actions.'</div>';
if ($survey_data['survey_type'] == 0) {

@ -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 '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.
Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_SMALL).'</a>';
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).'</a>&nbsp;';
$return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.
Display::return_icon('mail_send.png', get_lang('Publish'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
$return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.
Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_SMALL).'</a>';
$return .= $hideReportingButton ? '' : $reportingLink;
if (api_is_allowed_to_edit() ||
api_is_element_in_the_session(TOOL_SURVEY, $survey_id)

@ -114,7 +114,7 @@ while ($row = Database::fetch_assoc($res)) {
echo ' <td>'.$row['invitation_date'].'</td>';
echo ' <td>';
if (in_array($row['user'], $answered_data)) {
if (in_array($row['user'], $answered_data) && !api_get_configuration_value('hide_survey_reporting_button')) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&amp;survey_id='.$survey_id.'&amp;user='.$row['user'].'">'.get_lang('ViewAnswers').'</a>';
} else {
echo '-';

Loading…
Cancel
Save