Commit cce377d2 authored by Chenu Denis's avatar Chenu Denis
Browse files

[fix] Don't break settings if lack of plugins.

parent 9316b27a
......@@ -3,3 +3,14 @@
Allow to use a Spreadsheet (xlsx) template to produce report.
This plugin need [ExportResponseWithRelated](https://gitlab.com/SondagesPro/ExportAndStats/ExportResponseWithRelated).
## Simple usage
The plugin allow to construct an XLSX page with value replaced by current survey. The plugin use [TinyButStrong template engine](https://www.tinybutstrong.com/).
Variable that can be used :
- Current survey questions [survey.QuestionCode], QuestionCode can be any question using Expression Manager code.
- You can force some cell parameter using [ope paramleters](https://www.tinybutstrong.com/opentbs.php?doc#cells), for example for a numeric question type : `[survey.age;ope=tbs:num]`
- Related survey with questionSpreadSheetSurvey or questionExtraSurvey can be used on the same way and are sent as array.
- You must use `[block=tbs:row]`(https://www.tinybutstrong.com/opentbs.php?doc#blockalias) to create a row for each related response.
......@@ -4,7 +4,7 @@
* @copyright 2020-2022 Denis Chenu <http://www.sondages.pro>
* @copyright 2020-2021 OECD (Organisation for Economic Co-operation and Development ) <www.oecd.org>
* @license GPL
* @version 1.4.0
* @version 1.4.1
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
......@@ -140,6 +140,9 @@ class SpreadsheetTemplator extends PluginBase
if (!Permission::model()->hasSurveyPermission($surveyId, 'surveysettings', 'update')) {
throw new CHttpException(403);
}
if (!Yii::getPathOfAlias('ExportResponseWithRelated')) {
return "<div class='alert alert-danger'>" . $this->translate("You need ExportResponseWithRelated plugin") . "</div>";
}
$language = $oSurvey->language;
$aData['pluginClass'] = get_class($this);
$aData['surveyId'] = $surveyId;
......@@ -210,6 +213,7 @@ class SpreadsheetTemplator extends PluginBase
),
);
$aSettings[$this->translate("More settings on data")] = $aThisSurvey;
/* Export survey by type with code */
$aSurveyEportType = array();
$oAvailableRelatedExport = new \ExportResponseWithRelated\AvailableRelatedExport($surveyId);
......
......@@ -8,7 +8,7 @@
<author>Denis Chenu</author>
<authorUrl>https://www.sondages.pro/</authorUrl>
<supportUrl>https://support.sondages.pro/</supportUrl>
<version>1.4.0</version>
<version>1.4.1</version>
<license>GNU Affero General Public License v3.0</license>
<description><![CDATA[Use an excel file for export user response, with or without related surveys.]]></description>
</metadata>
......
# Description of the problem
Please be very descriptive and include as much details as possible.
# Example code
# Informations
* ZipStream-PHP version:
* PHP version:
Please include any supplemental information you deem relevant to this issue.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment