Example #1
0
 /**
  * Save a QTI_Item into an RDF Item, by exporting the QTI_Item to QTI xml
  * and saving it in the itemContent property of the RDF Item
  *
  * @param \oat\taoQtiItem\model\qti\Item $qtiItem
  * @param core_kernel_classes_Resource $rdfItem
  * @return bool
  * @throws \common_exception_Error
  * @throws \common_exception_NotFound
  * @throws common_Exception
  * @throws exception\QtiModelException
  */
 public function saveDataItemToRdfItem(Item $qtiItem, core_kernel_classes_Resource $rdfItem)
 {
     $label = mb_substr($rdfItem->getLabel(), 0, 256, 'UTF-8');
     //set the current data lang in the item content to keep the integrity
     $qtiItem->setAttribute('xml:lang', \common_session_SessionManager::getSession()->getDataLanguage());
     $qtiItem->setAttribute('label', $label);
     $directory = taoItems_models_classes_ItemsService::singleton()->getItemDirectory($rdfItem);
     $success = $directory->getFile(self::QTI_ITEM_FILE)->put($qtiItem->toXML());
     if ($success) {
         $this->getEventManager()->trigger(new ItemUpdatedEvent($rdfItem->getUri()));
     }
     return $success;
 }