8 Commits

Author SHA1 Message Date
Piotr Marynczak
a61c52fe1c [WZUW-194] adding function to get uplodaed files info 2023-08-01 12:46:16 +02:00
Piotr Marynczak
06fcaf07a8 [WZUW-194] survey answers prototype 2023-07-28 13:45:59 +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
Michał Frankiewicz
f0c213fb53 Merge pull request #3 from wiosna-dev/bugfix/UW-2538
[UW-2538] fixes method
2021-07-02 09:02:33 +02:00
Michał Frankiewicz
81ea8e748f Merge pull request #2 from wiosna-dev/bugfix/UW-2538
Bugfix/uw 2538
2021-06-30 08:36:41 +02:00
4 changed files with 57 additions and 2 deletions

View File

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

View File

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

View File

@@ -458,4 +458,45 @@ class SurveyService
return false; 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);
}
public function exportUploadedFilesByToken($surveyId, $token)
{
$arguments = [
$surveyId,
'json',
$token,
];
return $this
->client
->run('get_uploaded_files', $arguments)
->getData(true);
}
} }

View File

@@ -93,6 +93,12 @@ class MethodType extends BaseType
*/ */
const LIST_USERS = 'list_users'; const LIST_USERS = 'list_users';
const EXPORT_RESPONSES_BY_TOKEN = 'export_responses_by_token';
const GET_RESPONSE_IDS = 'get_response_ids';
const EXPORT_UPLOADED_FILES_BY_TOKEN = 'get_uploaded_files';
/** /**
* Returns validated name of method to call or throws an exception (if method is incorrect) * Returns validated name of method to call or throws an exception (if method is incorrect)
* *
@@ -126,6 +132,9 @@ class MethodType extends BaseType
static::LIST_QUESTIONS, static::LIST_QUESTIONS,
static::LIST_SURVEYS, static::LIST_SURVEYS,
static::LIST_USERS, static::LIST_USERS,
static::EXPORT_RESPONSES_BY_TOKEN,
static::GET_RESPONSE_IDS,
static::EXPORT_UPLOADED_FILES_BY_TOKEN
]); ]);
} }
} }