Skip to content
GitLab
About GitLab
GitLab: the DevOps platform
Explore GitLab
Install GitLab
How GitLab compares
Get started
GitLab docs
GitLab Learn
Pricing
Talk to an expert
/
Help
What's new
2
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Projects
Groups
Snippets
Sign up now
Login
Sign in / Register
Toggle navigation
Menu
Open sidebar
SondagesPro
coreAndTools
getQuestionInformation
Commits
16103e78
Commit
16103e78
authored
Jan 24, 2023
by
Chenu Denis
Browse files
[fix] Management of compat of language in getAnswers
parent
ed10f652
Changes
3
Hide whitespace changes
Inline
Side-by-side
config.xml
View file @
16103e78
...
...
@@ -7,7 +7,7 @@
<lastUpdate>
2022-02-07
</lastUpdate>
<author>
Denis Chenu
</author>
<authorUrl>
https://sondages.pro
</authorUrl>
<version>
1.13.
2
-RC
5
</version>
<version>
1.13.
3
-RC
6
</version>
<license>
GPL
</license>
<description>
<![CDATA[A tool for other plugins]]>
</description>
</metadata>
...
...
helpers/surveyAnswers.php
View file @
16103e78
...
...
@@ -5,7 +5,7 @@
* @author Denis Chenu <denis@sondages.pro>
* @copyright 2020-2022 Denis Chenu <http://www.sondages.pro>
* @license AGPL v3
* @version 1.1
2.2
* @version 1.1
3.3
*
* 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
...
...
@@ -396,6 +396,9 @@ class surveyAnswers
if
(
!
$oSurvey
)
{
throw
new
\
CHttpException
(
404
);
}
$language
=
App
()
->
getLanguage
();
}
if
(
!
in_array
(
$language
,
$oSurvey
->
getAllLanguages
())
{
$language
=
$oSurvey
->
language
;
}
$questionClass
=
Question
::
getQuestionClass
(
$oQuestion
->
type
);
...
...
legacy/helpers/surveyAnswers.php
View file @
16103e78
...
...
@@ -3,9 +3,9 @@
* An helper to return answer type and list for a survey
*
* @author Denis Chenu <denis@sondages.pro>
* @copyright 2020-202
1
Denis Chenu <http://www.sondages.pro>
* @copyright 2020-202
3
Denis Chenu <http://www.sondages.pro>
* @license AGPL v3
* @version
0
.1.3
* @version
1
.1
3
.3
*
* 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
...
...
@@ -385,12 +385,18 @@ class surveyAnswers
/**
* Get answer list in language, key are code
* @param \Question
* @param string|integer $language or scale, here for compat with 5.X version
* @param integer $scale
* @param boolean striped;
* return array|false|null
*/
public
static
function
getAnswers
(
$oQuestion
,
$scale
=
0
,
$strip
=
true
)
public
static
function
getAnswers
(
$oQuestion
,
$language
=
0
,
$scale
=
true
,
$strip
=
true
)
{
/* Fix the params according to 5.X version */
if
(
!
is_string
(
$language
)
||
ctype_digit
(
$language
))
{
$scale
=
$language
;
$strip
=
$scale
;
}
Yii
::
import
(
'application.helpers.viewHelper'
);
$questionClass
=
Question
::
getQuestionClass
(
$oQuestion
->
type
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment