use of uk.ac.ed.ph.jqtiplus.value.Cardinality in project OpenOLAT by OpenOLAT.
the class AssessmentItemBuilder method appendAdditionalFeedback.
protected void appendAdditionalFeedback(ModalFeedbackBuilder feedback, List<ModalFeedback> modalFeedbacks, List<ResponseRule> responseRules) {
Identifier feedbackIdentifier = feedback.getIdentifier();
ModalFeedback modalFeedback = AssessmentItemFactory.createModalFeedback(assessmentItem, feedbackIdentifier, feedback.getTitle(), feedback.getText());
modalFeedbacks.add(modalFeedback);
Cardinality cardinality = null;
Identifier responseIdentifier = null;
if (this instanceof ResponseIdentifierForFeedback) {
responseIdentifier = ((ResponseIdentifierForFeedback) this).getResponseIdentifier();
cardinality = assessmentItem.getResponseDeclaration(responseIdentifier).getCardinality();
}
ResponseCondition feedbackCondition = AssessmentItemFactory.createModalFeedbackRuleWithConditions(assessmentItem.getResponseProcessing(), feedbackIdentifier, responseIdentifier, cardinality, feedback.getFeedbackConditons());
responseRules.add(feedbackCondition);
}
use of uk.ac.ed.ph.jqtiplus.value.Cardinality in project OpenOLAT by OpenOLAT.
the class AssessmentObjectComponentRenderer method renderExtendedTextBox.
protected void renderExtendedTextBox(AssessmentRenderer renderer, StringOutput sb, AssessmentObjectComponent component, AssessmentItem assessmentItem, ItemSessionState itemSessionState, ExtendedTextInteraction interaction) {
ResponseData responseInput = getResponseInput(itemSessionState, interaction.getResponseIdentifier());
ResponseDeclaration responseDeclaration = getResponseDeclaration(assessmentItem, interaction.getResponseIdentifier());
Cardinality cardinality = responseDeclaration == null ? null : responseDeclaration.getCardinality();
if (cardinality != null && (cardinality.isRecord() || cardinality.isSingle())) {
String responseInputString = extractSingleCardinalityResponseInput(responseInput);
renderExtendedTextBox(renderer, sb, component, assessmentItem, itemSessionState, interaction, responseInputString);
} else {
if (interaction.getMaxStrings() != null) {
int maxStrings = interaction.getMaxStrings().intValue();
for (int i = 0; i < maxStrings; i++) {
String responseInputString = extractResponseInputAt(responseInput, i);
renderExtendedTextBox(renderer, sb, component, assessmentItem, itemSessionState, interaction, responseInputString);
}
} else {
// <xsl:with-param name="stringsCount" select="if (exists($responseValue)) then max(($minStrings, qw:get-cardinality-size($responseValue))) else $minStrings"/>
int stringCounts = interaction.getMinStrings();
Value responseValue = AssessmentRenderFunctions.getResponseValue(assessmentItem, itemSessionState, interaction.getResponseIdentifier(), renderer.isSolutionMode());
if (exists(responseValue)) {
stringCounts = java.lang.Math.max(interaction.getMinStrings(), getCardinalitySize(responseValue));
}
for (int i = 0; i < stringCounts; i++) {
String responseInputString = extractResponseInputAt(responseInput, i);
renderExtendedTextBox(renderer, sb, component, assessmentItem, itemSessionState, interaction, responseInputString);
}
}
}
}
use of uk.ac.ed.ph.jqtiplus.value.Cardinality in project openolat by klemens.
the class AssessmentItemBuilder method appendAdditionalFeedback.
protected void appendAdditionalFeedback(ModalFeedbackBuilder feedback, List<ModalFeedback> modalFeedbacks, List<ResponseRule> responseRules) {
Identifier feedbackIdentifier = feedback.getIdentifier();
ModalFeedback modalFeedback = AssessmentItemFactory.createModalFeedback(assessmentItem, feedbackIdentifier, feedback.getTitle(), feedback.getText());
modalFeedbacks.add(modalFeedback);
Cardinality cardinality = null;
Identifier responseIdentifier = null;
if (this instanceof ResponseIdentifierForFeedback) {
responseIdentifier = ((ResponseIdentifierForFeedback) this).getResponseIdentifier();
cardinality = assessmentItem.getResponseDeclaration(responseIdentifier).getCardinality();
}
ResponseCondition feedbackCondition = AssessmentItemFactory.createModalFeedbackRuleWithConditions(assessmentItem.getResponseProcessing(), feedbackIdentifier, responseIdentifier, cardinality, feedback.getFeedbackConditons());
responseRules.add(feedbackCondition);
}
use of uk.ac.ed.ph.jqtiplus.value.Cardinality in project openolat by klemens.
the class AssessmentObjectComponentRenderer method renderExtendedTextBox.
protected void renderExtendedTextBox(AssessmentRenderer renderer, StringOutput sb, AssessmentObjectComponent component, AssessmentItem assessmentItem, ItemSessionState itemSessionState, ExtendedTextInteraction interaction) {
ResponseData responseInput = getResponseInput(itemSessionState, interaction.getResponseIdentifier());
ResponseDeclaration responseDeclaration = getResponseDeclaration(assessmentItem, interaction.getResponseIdentifier());
Cardinality cardinality = responseDeclaration == null ? null : responseDeclaration.getCardinality();
if (cardinality != null && (cardinality.isRecord() || cardinality.isSingle())) {
String responseInputString = extractSingleCardinalityResponseInput(responseInput);
renderExtendedTextBox(renderer, sb, component, assessmentItem, itemSessionState, interaction, responseInputString);
} else {
if (interaction.getMaxStrings() != null) {
int maxStrings = interaction.getMaxStrings().intValue();
for (int i = 0; i < maxStrings; i++) {
String responseInputString = extractResponseInputAt(responseInput, i);
renderExtendedTextBox(renderer, sb, component, assessmentItem, itemSessionState, interaction, responseInputString);
}
} else {
// <xsl:with-param name="stringsCount" select="if (exists($responseValue)) then max(($minStrings, qw:get-cardinality-size($responseValue))) else $minStrings"/>
int stringCounts = interaction.getMinStrings();
Value responseValue = AssessmentRenderFunctions.getResponseValue(assessmentItem, itemSessionState, interaction.getResponseIdentifier(), renderer.isSolutionMode());
if (exists(responseValue)) {
stringCounts = java.lang.Math.max(interaction.getMinStrings(), getCardinalitySize(responseValue));
}
for (int i = 0; i < stringCounts; i++) {
String responseInputString = extractResponseInputAt(responseInput, i);
renderExtendedTextBox(renderer, sb, component, assessmentItem, itemSessionState, interaction, responseInputString);
}
}
}
}
Aggregations