/**
  * Loads assets from an QTI object element
  * @param QtiObject $object the object
  */
 private function loadObjectAssets(QtiObject $object)
 {
     $type = $object->attr('type');
     if (strpos($type, "image") !== false) {
         $this->addAsset('img', $object->attr('data'));
     } else {
         if (strpos($type, "video") !== false || strpos($type, "ogg") !== false) {
             $this->addAsset('video', $object->attr('data'));
         } else {
             if (strpos($type, "audio") !== false) {
                 $this->addAsset('audio', $object->attr('data'));
             } else {
                 if (strpos($type, "text/html") !== false) {
                     $this->addAsset('html', $object->attr('data'));
                 }
             }
         }
     }
 }
 /**
  * Short description of method buildObject
  *
  * @access private
  * @author Joel Bout, <*****@*****.**>
  * @param  DOMElement data
  * @return oat\taoQtiItem\model\qti\Object
  */
 private function buildObject(DOMElement $data)
 {
     $attributes = $this->extractAttributes($data);
     $returnValue = new Object($attributes);
     if ($data->hasChildNodes()) {
         $nonEmptyChild = $this->getNonEmptyChildren($data);
         if (count($nonEmptyChild) == 1 && reset($nonEmptyChild)->nodeName == 'object') {
             $alt = $this->buildObject(reset($nonEmptyChild));
             $returnValue->setAlt($alt);
         } else {
             //get the node xml content
             $pattern = array("/^<{$data->nodeName}([^>]*)?>/i", "/<\\/{$data->nodeName}([^>]*)?>\$/i");
             $content = preg_replace($pattern, '', trim($this->saveXML($data)));
             $returnValue->setAlt($content);
         }
     } else {
         $alt = trim($data->nodeValue);
         if (!empty($alt)) {
             $returnValue->setAlt($alt);
         }
     }
     return $returnValue;
 }
 protected function getTemplateQtiVariables()
 {
     $variables = parent::getTemplateQtiVariables();
     $variables['object'] = $this->object->toQTI();
     return $variables;
 }
 public function toArray($filterVariableContent = false, &$filtered = array())
 {
     $returnValue = parent::toArray($filterVariableContent, $filtered);
     $returnValue['object'] = $this->object->toArray($filterVariableContent, $filtered);
     return $returnValue;
 }