diff --git a/main/admin/statistics/index.php b/main/admin/statistics/index.php index 2d17d6d9e3..9cf301e90e 100755 --- a/main/admin/statistics/index.php +++ b/main/admin/statistics/index.php @@ -15,6 +15,7 @@ $interbreadcrumb[] = ['url' => '../index.php', 'name' => get_lang('PlatformAdmin $report = isset($_REQUEST['report']) ? $_REQUEST['report'] : ''; $sessionDuration = isset($_GET['session_duration']) ? (int) $_GET['session_duration'] : ''; $validated = false; +$sessionStatusAllowed = api_get_configuration_value('allow_session_status'); if ( in_array( @@ -199,8 +200,12 @@ in_array( true, ['format' => 'YYYY-MM-DD', 'timePicker' => 'false', 'validate_format' => 'Y-m-d'] ); - $options = SessionManager::getStatusList(); - $form->addSelect('status_id', get_lang('SessionStatus'), $options, ['placeholder' => get_lang('All')]); + + if ($sessionStatusAllowed) { + $options = SessionManager::getStatusList(); + $form->addSelect('status_id', get_lang('SessionStatus'), $options, ['placeholder' => get_lang('All')]); + } + $form->addHidden('report', 'session_by_date'); $form->addButtonSearch(get_lang('Search')); @@ -267,12 +272,15 @@ in_array( $reportOptions2, 'canvas2' ); - $htmlHeadXtra[] = Statistics::getJSChartTemplate( - $url3, - $reportType, - $reportOptions3, - 'canvas3' - ); + + if ($sessionStatusAllowed) { + $htmlHeadXtra[] = Statistics::getJSChartTemplate( + $url3, + $reportType, + $reportOptions3, + 'canvas3' + ); + } $reportOptions = ' legend: { @@ -361,7 +369,6 @@ $tools = [ $course_categories = Statistics::getCourseCategories(); $content = ''; -$sessionStatusAllowed = api_get_configuration_value('allow_session_status'); switch ($report) { case 'session_by_date': diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php index ff77855bcb..165378bc85 100644 --- a/main/inc/lib/api.lib.php +++ b/main/inc/lib/api.lib.php @@ -9686,7 +9686,8 @@ function api_find_template($template) /** * Returns an array of languages (English names like "english", "french", etc) * to ISO 639-1 codes (fr, es, etc) for use (for example) to show flags - * Note: 'english' is returned as 'gb' + * Note: 'english' is returned as 'gb'. + * * @return array */ function api_get_language_list_for_flag() @@ -9708,9 +9709,11 @@ function api_get_language_list_for_flag() /** * Generate the Javascript required for the on-page translation of - * multi-language strings - * @return string + * multi-language strings. + * * @throws Exception + * + * @return string */ function api_get_language_translate_html() { @@ -9792,11 +9795,14 @@ function api_get_language_translate_html() /** * Filter a multi-language HTML string (for the multi-language HTML - * feature) into the given language (strip the rest) + * feature) into the given language (strip the rest). + * * @param string $htmlString The HTML string to "translate". Usually
Some string
Une chaƮne
- * @param string $language The language in which we want to get the - * @return string The filtered string in the given language, or the full string if no translated string was identified + * @param string $language The language in which we want to get the + * * @throws Exception + * + * @return string The filtered string in the given language, or the full string if no translated string was identified */ function api_get_filtered_multilingual_HTML_string($htmlString, $language = null) { diff --git a/main/survey/reporting.php b/main/survey/reporting.php index bd1a66f1b1..0292bf74cf 100755 --- a/main/survey/reporting.php +++ b/main/survey/reporting.php @@ -72,7 +72,7 @@ if (!empty($exportReport) && !empty($format)) { case 'csv': default: $data = SurveyUtil::export_complete_report($survey_data, $userId, $compact); - $filename = 'survey_results_'.$survey_id.($compact?'_compact':'').'.csv'; + $filename = 'survey_results_'.$survey_id.($compact ? '_compact' : '').'.csv'; header('Content-type: application/octet-stream'); header('Content-Type: application/force-download'); diff --git a/main/survey/surveyUtil.class.php b/main/survey/surveyUtil.class.php index f88378dcbd..264d6841b4 100755 --- a/main/survey/surveyUtil.class.php +++ b/main/survey/surveyUtil.class.php @@ -1312,18 +1312,20 @@ class SurveyUtil /** * Quite similar to display_complete_report(), returns an HTML string * that can be used in a csv file. + * * @param array $survey_data The basic survey data as initially obtained by SurveyManager::get_survey() * @param int $user_id The ID of the user asking for the report * @param bool $compact Whether to present the long (v marks with multiple columns per question) or compact (one column per question) answers format * * @todo consider merging this function with display_complete_report * + * @throws Exception + * * @return string The contents of a csv file * * @author Patrick Cool