コード例 #1
0
 protected function buildJson(ilECSSetting $a_server)
 {
     global $ilLog;
     $json = $this->getJsonCore('application/ecs-course');
     // meta language
     include_once './Services/MetaData/classes/class.ilMDLanguage.php';
     $lang = ilMDLanguage::_lookupFirstLanguage($this->content_obj->getId(), $this->content_obj->getId(), $this->content_obj->getType());
     if (strlen($lang)) {
         $json->lang = $lang . '_' . strtoupper($lang);
     }
     $json->status = $this->content_obj->isActivated() ? 'online' : 'offline';
     include_once './Services/WebServices/ECS/classes/class.ilECSUtils.php';
     $definition = ilECSUtils::getEContentDefinition($this->getECSObjectType());
     $this->addMetadataToJson($json, $a_server, $definition);
     return $json;
 }
コード例 #2
0
ファイル: ilMDTest.php プロジェクト: arlendotcn/ilias
 /**
  * test Language
  * @group IL_Init
  * @return
  */
 public function testLanguage()
 {
     include_once './Services/MetaData/classes/class.ilMDLanguage.php';
     include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
     $con = new ilMDLanguage(1, 2, 'xxx');
     $con->setLanguage(new ilMDLanguageItem('en'));
     $ret = $con->save();
     $this->assertGreaterThan(0, $ret);
     $con->setLanguage(new ilMDLanguageItem('de'));
     $con->update();
     $con->read();
     $desc = $con->getLanguageCode();
     $this->assertEquals('de', $desc);
     $con->delete();
 }
コード例 #3
0
 function &getLanguageIds()
 {
     include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguage.php';
     return ilMDLanguage::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_educational');
 }
コード例 #4
0
 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');
 }