public String extractTimeLimitFromDocument() { if (isNullDocument()) { return ""; } String timeLimit = "-"; final Element el_assess = (Element) document.selectSingleNode("questestinterop/assessment"); final Element el_duration = (Element) el_assess.selectSingleNode("duration"); if (el_duration != null) { final long dur = QTIHelper.parseISODuration(el_duration.getTextTrim()); final long min = dur / 1024 / 60; final long sec = (dur - (min * 60 * 1024)) / 1024; timeLimit = "" + min + "' " + sec + "''"; } return timeLimit; }
/** * Method setUp. * * @param assessInstance */ public void setUp(AssessmentInstance assessInstance) { this.assessInstance = assessInstance; init(); Document el_questestinterop = assessInstance.getResolver().getQTIDocument(); el_assessment = (Element) el_questestinterop.selectSingleNode("questestinterop/assessment"); ident = el_assessment.attributeValue("ident"); title = el_assessment.attributeValue("title"); Element dur = (Element) el_assessment.selectSingleNode("duration"); if (dur == null) { durationLimit = -1; // no limit } else { String sdur = dur.getText(); durationLimit = QTIHelper.parseISODuration(sdur); if (durationLimit == 0) durationLimit = -1; // Assesst Designer fix } // get objectives Element el_objectives = (Element) el_assessment.selectSingleNode("objectives"); if (el_objectives != null) objectives = new Objectives(el_objectives); // set feedback, hint, and solutions switches // <!ENTITY % I_FeedbackSwitch " feedbackswitch (Yes | No ) 'Yes'"> // <!ENTITY % I_HintSwitch " hintswitch (Yes | No ) 'Yes'"> // <!ENTITY % I_SolutionSwitch " solutionswitch (Yes | No ) 'Yes'"> // <!ELEMENT assessment (qticomment? , duration? , qtimetadata* , // objectives* , assessmentcontrol* , rubric* , presentation_material? , // outcomes_processing* , assessproc_extension? , assessfeedback* , // selection_ordering? , reference? , (sectionref | section)+)> // <!ELEMENT assessmentcontrol (qticomment?)> Element el_control = (Element) el_assessment.selectSingleNode("assessmentcontrol"); if (el_control != null) { String feedbackswitch = el_control.attributeValue("feedbackswitch"); String hintswitch = el_control.attributeValue("hintswitch"); String solutionswitch = el_control.attributeValue("solutionswitch"); boolean feedback = (feedbackswitch == null) ? true : feedbackswitch.equals("Yes"); boolean hints = (hintswitch == null) ? true : hintswitch.equals("Yes"); boolean solutions = (solutionswitch == null) ? true : solutionswitch.equals("Yes"); switches = new Switches(feedback, hints, solutions); } // scoring model and outcomes processing Element el_outpro = (Element) el_assessment.selectSingleNode("outcomes_processing"); if (el_outpro != null) { // get the scoring model: we need it later for calculating the score // <!ENTITY % I_ScoreModel " scoremodel CDATA #IMPLIED"> scoremodel = el_outpro.attributeValue("scoremodel"); // may be null -> then assume SumOfScores // set the cutvalue if given (only variable score) cutvalue = QTIHelper.getFloatAttribute(el_outpro, "outcomes/decvar[@varname='SCORE']", "cutvalue"); List<?> el_oft = el_outpro.selectNodes("outcomes_feedback_test"); if (el_oft.size() != 0) { feedbacktesting = true; } } initSections(el_assessment, switches); init(); }