示例#1
0
 /**
  * Does export ID exist in lm?
  *
  * @param
  * @return
  */
 function getExportIDInfo($a_lm_id, $a_exp_id, $a_type = "pg")
 {
     include_once "./Services/MetaData/classes/class.ilMDIdentifier.php";
     $data = ilMDIdentifier::readIdData($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
     return $data;
 }
 function toXML(&$writer)
 {
     if ($this->getMetaDataScheme()) {
         $attr['MetadataScheme'] = $this->getMetaDataScheme();
     }
     if ($this->getLanguageCode()) {
         $attr['Language'] = $this->getLanguageCode();
     }
     $writer->xmlStartTag('Meta-Metadata', $attr ? $attr : null);
     // ELEMENT IDENTIFIER
     $identifiers = $this->getIdentifierIds();
     foreach ($identifiers as $id) {
         $ide =& $this->getIdentifier($id);
         $ide->toXML($writer);
     }
     if (!count($identifiers)) {
         include_once 'Services/Metadata/classes/class.ilMDIdentifier.php';
         $ide = new ilMDIdentifier($this->getRBACId(), $this->getObjId());
         $ide->toXML($writer);
     }
     // ELEMETN Contribute
     $contributes = $this->getContributeIds();
     foreach ($contributes as $id) {
         $con =& $this->getContribute($id);
         $con->toXML($writer);
     }
     if (!count($contributes)) {
         include_once 'Services/MetaData/classes/class.ilMDContribute.php';
         $con = new ilMDContribute($this->getRBACId(), $this->getObjId());
         $con->toXML($writer);
     }
     $writer->xmlEndTag('Meta-Metadata');
 }
 function toXML(&$writer)
 {
     $writer->xmlStartTag('General', array('Structure' => $this->getStructure() ? $this->getStructure() : 'Atomic'));
     // Identifier
     $first = true;
     $identifiers = array();
     $identifiers = $this->getIdentifierIds();
     foreach ($identifiers as $id) {
         $ide =& $this->getIdentifier($id);
         $ide->setExportMode($this->getExportMode());
         $ide->toXML($writer);
         $first = false;
     }
     if (!count($identifiers)) {
         include_once 'Services/MetaData/classes/class.ilMDIdentifier.php';
         $ide = new ilMDIdentifier($this->getRBACId(), $this->getObjId(), $this->getObjType());
         // added type, alex, 31 Oct 2007
         $ide->setExportMode(true);
         $ide->toXML($writer, true);
     }
     // Title
     $writer->xmlElement('Title', array('Language' => $this->getTitleLanguageCode() ? $this->getTitleLanguageCode() : 'en'), $this->getTitle());
     // Language
     $languages = $this->getLanguageIds();
     foreach ($languages as $id) {
         $lan =& $this->getLanguage($id);
         $lan->toXML($writer);
     }
     if (!count($languages)) {
         // Default
         include_once 'Services/MetaData/classes/class.ilMDLanguage.php';
         $lan = new ilMDLanguage($this->getRBACId(), $this->getObjId());
         $lan->toXML($writer);
     }
     // Description
     $descriptions = $this->getDescriptionIds();
     foreach ($descriptions as $id) {
         $des =& $this->getDescription($id);
         $des->toXML($writer);
     }
     if (!count($descriptions)) {
         // Default
         include_once 'Services/MetaData/classes/class.ilMDDescription.php';
         $des = new ilMDDescription($this->getRBACId(), $this->getObjId());
         $des->toXML($writer);
     }
     // Keyword
     $keywords = $this->getKeywordIds();
     foreach ($keywords as $id) {
         $key =& $this->getKeyword($id);
         $key->toXML($writer);
     }
     if (!count($keywords)) {
         // Default
         include_once 'Services/MetaData/classes/class.ilMDKeyword.php';
         $key = new ilMDKeyword($this->getRBACId(), $this->getObjId());
         $key->toXML($writer);
     }
     // Copverage
     if (strlen($this->getCoverage())) {
         $writer->xmlElement('Coverage', array('Language' => $this->getCoverageLanguageCode() ? $this->getCoverageLanguageCode() : 'en'), $this->getCoverage());
     }
     $writer->xmlEndTag('General');
 }
示例#4
0
 /**
  * test Identifier
  * @group IL_Init
  * @return
  */
 public function testIdentifier()
 {
     include_once './Services/MetaData/classes/class.ilMDIdentifier.php';
     include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
     $con = new ilMDIdentifier(1, 2, 'xxx');
     $con->setCatalog('Easy');
     $ret = $con->save();
     $this->assertGreaterThan(0, $ret);
     $con->setCatalog('Medium');
     $con->update();
     $con->read();
     $desc = $con->getCatalog();
     $this->assertEquals('Medium', $desc);
     $con->delete();
 }
 function &getIdentifierIds()
 {
     include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDIdentifier.php';
     return ilMDIdentifier::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_meta_data');
 }