mirror of
https://github.com/wiosna-dev/limesurvey-api-client.git
synced 2026-03-12 02:11:45 +01:00
survey answers prototype
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user