5 Commits

Author SHA1 Message Date
Michał Frankiewicz
3c08515918 survey answers prototype 2023-07-27 12:02:18 +02:00
xevolic
e025b71059 Merge pull request #4 from wiosna-dev/fix/UW-2934_Add_support_for_PHP_8.2
[UW-2934] add support for PHP 8.2
2023-03-09 16:57:33 +01:00
Tomasz Kuter
b658e04445 [UW-2934] chore(composer): updated base version of "wiosna-dev/common-library" 2023-03-09 15:29:22 +01:00
Tomasz Kuter
d4e74bc270 [UW-2934] chore(composer): restored previous repository for wiosna-dev/common-library 2023-02-16 16:39:25 +01:00
Tomasz Kuter
8127330642 [UW-2934] chore(composer): temporarily switched to clone of repo wiosna-dev/common-library 2023-02-15 11:04:55 +01:00
4 changed files with 38 additions and 2 deletions

View File

@@ -12,7 +12,7 @@
"require": {
"php": ">=5.6",
"fguillot/json-rpc": "^1.2",
"wiosna-dev/common-library": "^0.1.0"
"wiosna-dev/common-library": "^0.1.9"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.6",

View File

@@ -57,9 +57,14 @@ class Result
* class constants.
* @param array $rawData Raw data returned by the LimeSurvey's API
*/
public function __construct($method, array $rawData)
public function __construct($method, $rawData)
{
$this->method = MethodType::getValidatedMethod($method);
if (true === is_string($rawData)) {
$rawData = base64_decode($rawData);
$rawData = json_decode($rawData, true);
}
$this->setRawDataAndStatus($rawData);
}

View File

@@ -458,4 +458,31 @@ class SurveyService
return false;
}
public function getResponseIds($surveyId, $token)
{
$arguments = [
$surveyId,
$token,
];
return $this
->client
->run('get_response_ids', $arguments)
->getData(true);
}
public function exportResponsesByToken($surveyId, $token)
{
$arguments = [
$surveyId,
'json',
$token,
];
return $this
->client
->run('export_responses_by_token', $arguments)
->getData(true);
}
}

View File

@@ -93,6 +93,10 @@ class MethodType extends BaseType
*/
const LIST_USERS = 'list_users';
const EXPORT_RESPONSES_BY_TOKEN = 'export_responses_by_token';
const GET_RESPONSE_IDS = 'get_response_ids';
/**
* Returns validated name of method to call or throws an exception (if method is incorrect)
*