public function afterElementSet(Element $qtiElement)
 {
     parent::afterElementSet($qtiElement);
     if ($qtiElement instanceof Hottext) {
         $item = $this->getRelatedItem();
         if (isset($item)) {
             $qtiElement->setRelatedItem($item);
         }
     }
 }
 public function afterElementRemove(Element $qtiElement)
 {
     parent::afterElementRemove($qtiElement);
     if ($qtiElement instanceof Interaction) {
         $item = $this->getRelatedItem();
         if (isset($item)) {
             if (!is_null($item->getResponseProcessing())) {
                 //delete interaction response if set:
                 $item->getResponseProcessing()->takeNoticeOfRemovedInteraction($qtiElement, $item);
             }
         }
     }
 }
 protected function loadContainer(Container $container, $data)
 {
     if (is_array($data) && isset($data['body'])) {
         $body = $data['body'];
         $elts = array();
         if (isset($data['elements']) && is_array($data['elements'])) {
             foreach ($data['elements'] as $elementData) {
                 $elt = $this->buildElement($elementData);
                 if (!is_null($elt)) {
                     $elts[$elt->getSerial()] = $elt;
                 }
             }
         }
         $container->setElements($elts, $body);
     } else {
         common_Logger::w($data);
         throw new ParsingException('wrong array model');
     }
 }
 /**
  * Fix erroneously self-closing elements
  *
  * @return string
  */
 public function getBody()
 {
     return $this->fixNonvoidTags(parent::getBody());
 }
 private function parseContainerChoice(DOMElement $data, Container $container, $tag)
 {
     $choices = array();
     $gapNodes = $this->queryXPath(".//*[name(.)='" . $tag . "']", $data);
     foreach ($gapNodes as $gapNode) {
         $gap = $this->buildChoice($gapNode);
         if (!is_null($gap)) {
             $choices[$gap->getSerial()] = $gap;
             $this->replaceNode($gapNode, $gap);
         }
     }
     $bodyData = $this->getBodyData($data);
     $container->setElements($choices, $bodyData);
     $data = $this->parseContainerStatic($data, $container);
     return $data;
 }