Skip to content

Commit

Permalink
API : get question properties to return default value
Browse files Browse the repository at this point in the history
Function `get_question_properties` in RemoteControl 2 API now can be able to return `defaultvalue` upon request.

Users must add `defaultvalue` to `$aQuestionSettings` in order to get this value.
However, the default value is an _answer code_ in case users need assessment value they need to match the default value to data in `answeroptions` with this one. Because `answeroptions` also return `assessment_value`.
  • Loading branch information
sitawit committed Sep 10, 2014
1 parent 94e6011 commit ae4400e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion application/helpers/remotecontrol/remotecontrol_handle.php
Expand Up @@ -1348,6 +1348,7 @@ public function get_question_properties($sSessionKey, $iQuestionID, $aQuestionSe
array_push($aBasicDestinationFields,'attributes') ;
array_push($aBasicDestinationFields,'attributes_lang') ;
array_push($aBasicDestinationFields,'answeroptions') ;
array_push($aBasicDestinationFields,'defaultvalue');
$aQuestionSettings=array_intersect($aQuestionSettings,$aBasicDestinationFields);

if (empty($aQuestionSettings))
Expand Down Expand Up @@ -1424,7 +1425,11 @@ public function get_question_properties($sSessionKey, $iQuestionID, $aQuestionSe
else
$aResult['answeroptions']='No available answer options';
}
else
else if ($sPropertyName == 'defaultvalue')
{
$aResult['defaultvalue'] = DefaultValue::model()->findByAttributes(array('qid' => $iQuestionID, 'language'=> $sLanguage))->defaultvalue;
}
else
{
$aResult[$sPropertyName]=$oQuestion->$sPropertyName;
}
Expand Down

0 comments on commit ae4400e

Please sign in to comment.