3.3.1. Items

class pyslet.qtiv2.items.AssessmentItem(parent)

Bases: pyslet.qtiv2.core.QTIElement, pyslet.qtiv2.core.DeclarationContainer

An assessment item encompasses the information that is presented to a candidate and information about how to score the item:

<xsd:attributeGroup name="assessmentItem.AttrGroup">
        <xsd:attribute name="identifier" type="string.Type"
                        use="required"/>
        <xsd:attribute name="title" type="string.Type"
                        use="required"/>
        <xsd:attribute name="label" type="string256.Type"
                        use="optional"/>
        <xsd:attribute ref="xml:lang"/>
        <xsd:attribute name="adaptive" type="boolean.Type"
                        use="required"/>
        <xsd:attribute name="timeDependent" type="boolean.Type"
                        use="required"/>
        <xsd:attribute name="toolName" type="string256.Type"
                        use="optional"/>
        <xsd:attribute name="toolVersion" type="string256.Type"
                        use="optional"/>
</xsd:attributeGroup>

<xsd:group name="assessmentItem.ContentGroup">
        <xsd:sequence>
                <xsd:element ref="responseDeclaration"
                                minOccurs="0"
                                maxOccurs="unbounded"/>
                <xsd:element ref="outcomeDeclaration"
                                minOccurs="0"
                                maxOccurs="unbounded"/>
                <xsd:element ref="templateDeclaration"
                                minOccurs="0"
                                maxOccurs="unbounded"/>
                <xsd:element ref="templateProcessing"
                                minOccurs="0"
                                maxOccurs="1"/>
                <xsd:element ref="stylesheet"
                                minOccurs="0"
                                maxOccurs="unbounded"/>
                <xsd:element ref="itemBody"
                                minOccurs="0"
                                maxOccurs="1"/>
                <xsd:element ref="responseProcessing"
                                minOccurs="0"
                                maxOccurs="1"/>
                <xsd:element ref="modalFeedback"
                                minOccurs="0"
                                maxOccurs="unbounded"/>
        </xsd:sequence>
</xsd:group>
sort_declarations()

Sort each of the variable declaration lists so that they are in identifier order. This is not essential but it does help ensure that output is predictable. This method is called automatically when reading items from XML files.

render_html(item_state, html_parent=None)

Renders this item in html, adding nodes to html_parent. The state of the item (e.g., the values of any controls and template variables), is taken from item_state, a variables.ItemSessionState instance.

The result is the top-level div containing the item added to the html_parent. If html_parent is None then a parentless div is created. If the item has no itemBody then an empty Div is returned.

add_to_content_package(cp, lom, dname=None)

Adds a resource and associated files to the content package.

AddToContentPackage(*args, **kwargs)

Deprecated equivalent to add_to_content_package()