当前位置: 首页>>代码示例>>PHP>>正文


PHP ilObjectFactory::getInstanceByRefId方法代码示例

本文整理汇总了PHP中ilObjectFactory::getInstanceByRefId方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjectFactory::getInstanceByRefId方法的具体用法?PHP ilObjectFactory::getInstanceByRefId怎么用?PHP ilObjectFactory::getInstanceByRefId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilObjectFactory的用法示例。


在下文中一共展示了ilObjectFactory::getInstanceByRefId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getStructureObjects

 function getStructureObjects($sid, $ref_id)
 {
     $this->initAuth($sid);
     $this->initIlias();
     if (!$this->__checkSession($sid)) {
         return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
     }
     if (!($target_obj =& ilObjectFactory::getInstanceByRefId($ref_id, false))) {
         return $this->__raiseError('No valid reference id given.', 'Client');
     }
     $structureReaderClassname = "ilSoap" . strtoupper($target_obj->getType()) . "StructureReader";
     $filename = "./webservice/soap/classes/class." . $structureReaderClassname . ".php";
     if (!file_exists($filename)) {
         return $this->__raiseError("Object type '" . $target_obj->getType() . "'is not supported.", 'Client');
     }
     include_once $filename;
     $structureReader = new $structureReaderClassname($target_obj);
     include_once './webservice/soap/classes/class.ilSoapStructureObjectXMLWriter.php';
     $xml_writer = new ilSoapStructureObjectXMLWriter();
     $structureObject =& $structureReader->getStructureObject();
     $xml_writer->setStructureObject($structureObject);
     if (!$xml_writer->start()) {
         return $this->__raiseError('Cannot create object xml !', 'Server');
     }
     return $xml_writer->getXML();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:26,代码来源:class.ilSoapStructureObjectAdministration.php

示例2: importXmlRepresentation

 /**
  * Import XML
  *
  * @param
  * @return
  */
 function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
 {
     include_once './Modules/Category/classes/class.ilObjCategory.php';
     if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
         $refs = ilObject::_getAllReferences($new_id);
         $this->category = ilObjectFactory::getInstanceByRefId(end($refs), false);
     } elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', 0)) {
         $this->category = ilObjectFactory::getInstanceByRefId($new_id, false);
     } elseif (!$this->category instanceof ilObjCategory) {
         $this->category = new ilObjCategory();
         $this->category->create(true);
     }
     include_once './Modules/Category/classes/class.ilCategoryXmlParser.php';
     try {
         $parser = new ilCategoryXmlParser($a_xml, 0);
         $parser->setCategory($this->category);
         $parser->setMode(ilCategoryXmlParser::MODE_UPDATE);
         $parser->startParsing();
         $a_mapping->addMapping('Modules/Category', 'cat', $a_id, $this->category->getId());
     } catch (ilSaxParserException $e) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
     } catch (Excpetion $e) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
     }
     foreach ($a_mapping->getMappingsOfEntity('Services/Container', 'objs') as $old => $new) {
         $type = ilObject::_lookupType($new);
         // see ilGlossaryImporter::importXmlRepresentation()
         // see ilTaxonomyDataSet::importRecord()
         $a_mapping->addMapping("Services/Taxonomy", "tax_item", $type . ":obj:" . $old, $new);
         // this is since 4.3 does not export these ids but 4.4 tax node assignment needs it
         $a_mapping->addMapping("Services/Taxonomy", "tax_item_obj_id", $type . ":obj:" . $old, $new);
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:39,代码来源:class.ilCategoryImporter.php

示例3: importXmlRepresentation

 /**
  * Import XML
  *
  * @param
  * @return
  */
 function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
 {
     include_once './Modules/Group/classes/class.ilObjGroup.php';
     if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
         $refs = ilObject::_getAllReferences($new_id);
         $this->group = ilObjectFactory::getInstanceByRefId(end($refs), false);
         #$this->group = ilObjectFactory::getInstanceByObjId($new_id,false);
     } elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', 0)) {
         $this->group = ilObjectFactory::getInstanceByRefId($new_id, false);
     } elseif (!$this->group instanceof ilObjGroup) {
         $this->group = new ilObjGroup();
         $this->group->create(true);
     }
     include_once './Modules/Group/classes/class.ilGroupXMLParser.php';
     #$GLOBALS['ilLog']->write($a_xml);
     try {
         $parser = new ilGroupXMLParser($a_xml, 0);
         $parser->setGroup($this->group);
         $parser->setMode(ilGroupXMLParser::$UPDATE);
         $parser->startParsing();
         $a_mapping->addMapping('Modules/Group', 'grp', $a_id, $this->group->getId());
     } catch (ilSaxParserException $e) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
     } catch (ilWebLinkXMLParserException $e) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:33,代码来源:class.ilGroupImporter.php

示例4: showMoveCopyQuestion

 function showMoveCopyQuestion()
 {
     $tempobj = ilObjectFactory::getInstanceByRefId($_GET["ref_id"]);
     $source_obj = ilLMObjectFactory::getInstance($tempobj, $_GET["sourceId"], true);
     $source_obj->setLMId($tempobj->getId());
     $target_obj = ilLMObjectFactory::getInstance($tempobj, $_GET["targetId"], true);
     $target_obj->setLMId($tempobj->getId());
     //vd($source_obj->getType());
     //vd($target_obj->getType());
     $this->tpl = new ilTemplate("tpl.wysiwyg_popup_movecopyquestion.html", false, true, "Services/COPage");
     $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
     if ($source_obj->getType() == "st" && $target_obj->getType() == "pg") {
         $this->tpl->setVariable("TXT_ST_ON_PG", $this->lng->txt("cont_st_on_pg"));
         $this->tpl->setVariable("BTN_CLOSE2", $this->lng->txt("close"));
     } else {
         if ($source_obj->getType() == "pg" && $target_obj->getType() == "pg" || $source_obj->getType() == "st" && $target_obj->getType() == "st") {
             $this->tpl->setVariable("TXT_SET_AFTER", $this->lng->txt("cont_set_after"));
             $this->tpl->setVariable("TXT_SET_BEFORE", $this->lng->txt("cont_set_before"));
         }
         if ($source_obj->getType() == "st" && $target_obj->getType() == "st") {
             $this->tpl->setVariable("TXT_SET_INTO", $this->lng->txt("cont_set_into"));
         }
         $this->tpl->setVariable("TXT_MOVE_OBJECT", $this->lng->txt("cont_move_object"));
         $this->tpl->setVariable("TXT_COPY_OBJECT", $this->lng->txt("cont_copy_object"));
         $this->tpl->setVariable("BTN_SUBMIT", $this->lng->txt("save"));
         $this->tpl->setVariable("BTN_CLOSE", $this->lng->txt("close"));
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:28,代码来源:class.ilWysiwygUtil.php

示例5: importXmlRepresentation

 /**
  * Import XML
  *
  * @param
  * @return
  */
 function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
 {
     include_once './Modules/Category/classes/class.ilObjCategory.php';
     if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
         $refs = ilObject::_getAllReferences($new_id);
         $this->category = ilObjectFactory::getInstanceByRefId(end($refs), false);
     } elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', 0)) {
         $this->category = ilObjectFactory::getInstanceByRefId($new_id, false);
     } elseif (!$this->category instanceof ilObjCategory) {
         $this->category = new ilObjCategory();
         $this->category->create(true);
     }
     include_once './Modules/Category/classes/class.ilCategoryXmlParser.php';
     try {
         $parser = new ilCategoryXmlParser($a_xml, 0);
         $parser->setCategory($this->category);
         $parser->setMode(ilCategoryXmlParser::MODE_UPDATE);
         $parser->startParsing();
         $a_mapping->addMapping('Modules/Category', 'cat', $a_id, $this->category->getId());
     } catch (ilSaxParserException $e) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
     } catch (Excpetion $e) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:31,代码来源:class.ilCategoryImporter.php

示例6: importXmlRepresentation

 /**
  * Import XML
  *
  * @param
  * @return
  */
 function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
 {
     include_once './Modules/Course/classes/class.ilCourseXMLParser.php';
     include_once './Modules/Course/classes/class.ilObjCourse.php';
     if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
         $refs = ilObject::_getAllReferences($new_id);
         $this->course = ilObjectFactory::getInstanceByRefId(end($refs), false);
         #$this->course = ilObjectFactory::getInstanceByObjId($new_id,false);
     } elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', 0)) {
         $this->course = ilObjectFactory::getInstanceByRefId($new_id, false);
     } elseif (!$this->course instanceof ilObjCourse) {
         $this->course = new ilObjCourse();
         $this->course->create(true);
     }
     try {
         $parser = new ilCourseXMLParser($this->course);
         $parser->setXMLContent($a_xml);
         $parser->startParsing();
         $a_mapping->addMapping('Modules/Course', 'crs', $a_id, $this->course->getId());
     } catch (ilSaxParserException $e) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
     } catch (Exception $e) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:31,代码来源:class.ilCourseImporter.php

示例7: ilClone

 /**
  * clone objectives
  *
  * @access public
  * @param int target id
  * @param int copy id
  * 
  */
 public function ilClone($a_target_id, $a_copy_id)
 {
     global $ilLog;
     $ilLog->write(__METHOD__ . ': Start cloning learning objectives...');
     $query = "SELECT * FROM crs_objectives " . "WHERE crs_id  = " . $this->db->quote($this->course_obj->getId(), 'integer') . ' ' . "ORDER BY position ";
     $res = $this->db->query($query);
     if (!$res->numRows()) {
         $ilLog->write(__METHOD__ . ': ... no objectives found.');
         return true;
     }
     if (!is_object($new_course = ilObjectFactory::getInstanceByRefId($a_target_id, false))) {
         $ilLog->write(__METHOD__ . ': Cannot init new course object.');
         return true;
     }
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         $new_objective = new ilCourseObjective($new_course);
         $new_objective->setTitle($row->title);
         $new_objective->setDescription($row->description);
         $objective_id = $new_objective->add();
         $ilLog->write(__METHOD__ . ': Added new objective nr: ' . $objective_id);
         // Clone crs_objective_tst entries
         include_once 'Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
         $objective_qst = new ilCourseObjectiveQuestion($row->objective_id);
         $objective_qst->cloneDependencies($objective_id, $a_copy_id);
         $ilLog->write(__METHOD__ . ': Finished objective question dependencies: ' . $objective_id);
         // Clone crs_objective_lm entries (assigned course materials)
         include_once 'Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
         $objective_material = new ilCourseObjectiveMaterials($row->objective_id);
         $objective_material->cloneDependencies($objective_id, $a_copy_id);
     }
     $ilLog->write(__METHOD__ . ': Finished cloning objectives.');
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:40,代码来源:class.ilCourseObjective.php

示例8: __construct

 function __construct($ref_id)
 {
     $this->courseObject = ilObjectFactory::getInstanceByRefId($ref_id);
     $this->courseParticipants = new ilCourseParticipants($this->courseObject->getId());
     $this->emailsFound = array();
     $this->emailsNotFound = array();
 }
开发者ID:any333,项目名称:courseEmailsSubscriptionPlugin,代码行数:7,代码来源:class.ilEmailSubscriber.php

示例9: check

 function check()
 {
     global $ilObjDataCache, $ilUser;
     include_once './Services/LinkChecker/classes/class.ilLinkChecker.php';
     foreach (ilUtil::_getObjectsByOperations('webr', 'write', $ilUser->getId(), -1) as $node) {
         if (!is_object($tmp_webr =& ilObjectFactory::getInstanceByRefId($node, false))) {
             continue;
         }
         $tmp_webr->initLinkResourceItemsObject();
         // Set all link to valid. After check invalid links will be set to invalid
         $link_checker =& new ilLinkChecker($this->db);
         $link_checker->setMailStatus(true);
         $link_checker->setCheckPeriod($this->__getCheckPeriod());
         $link_checker->setObjId($tmp_webr->getId());
         $tmp_webr->items_obj->updateValidByCheck($this->__getCheckPeriod());
         foreach ($link_checker->checkWebResourceLinks() as $invalid) {
             $tmp_webr->items_obj->readItem($invalid['page_id']);
             $tmp_webr->items_obj->setActiveStatus(false);
             $tmp_webr->items_obj->setValidStatus(false);
             $tmp_webr->items_obj->setDisableCheckStatus(true);
             $tmp_webr->items_obj->setLastCheckDate(time());
             $tmp_webr->items_obj->update(false);
         }
         $tmp_webr->items_obj->updateLastCheck($this->__getCheckPeriod());
         foreach ($link_checker->getLogMessages() as $message) {
             $this->log->write($message);
         }
     }
     return true;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:30,代码来源:class.ilCronWebResourceCheck.php

示例10: initSettingsWithTestObject

 private function initSettingsWithTestObject()
 {
     $testOBJ = ilObjectFactory::getInstanceByRefId($this->contextRefId);
     $testOBJ->loadFromDb();
     $this->setGenericFeedbackEnabled($testOBJ->getGenericAnswerFeedback());
     $this->setSpecificFeedbackEnabled($testOBJ->getSpecificAnswerFeedback());
     $this->setHintProvidingEnabled($testOBJ->isOfferingQuestionHintsEnabled());
     $this->setBestSolutionEnabled($testOBJ->getInstantFeedbackSolution());
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:9,代码来源:class.ilAssQuestionPreviewSettings.php

示例11: __construct

 function __construct()
 {
     global $tpl, $ilCtrl, $ilTabs;
     $this->ctrl = $ilCtrl;
     $this->tpl = $tpl;
     $tpl->getStandardTemplate();
     $this->course = ilObjectFactory::getInstanceByRefId($_GET['ref_id']);
     $this->ctrl = $ilCtrl;
     $this->tabs = $ilTabs;
 }
开发者ID:prante,项目名称:CoreEmailSubscription,代码行数:10,代码来源:class.ilCourseEmailSubscriptionGUI.php

示例12: useCode

 /**
  * Use a registration code and assign the logged in user
  * to the (parent) course/group that offer the code.
  * 
  * @todo: throw an error if registration fails (max members, availibility...)
  * 
  * @param string $a_code
  * @param int $a_endnode Reference id of node in tree
  * @return 
  */
 protected static function useCode($a_code, $a_endnode)
 {
     global $tree, $ilUser;
     $obj_ids = self::lookupObjectsByCode($a_code);
     foreach ($tree->getPathId($a_endnode) as $ref_id) {
         if (in_array(ilObject::_lookupObjId($ref_id), $obj_ids)) {
             if ($obj = ilObjectFactory::getInstanceByRefId($ref_id, false)) {
                 $obj->register($ilUser->getId());
             }
         }
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:22,代码来源:class.ilMembershipRegistrationCodeUtils.php

示例13: getXmlRepresentation

 /**
  * Get xml
  * @param object $a_entity
  * @param object $a_schema_version
  * @param object $a_id
  * @return 
  */
 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
 {
     $course_ref_id = end(ilObject::_getAllReferences($a_id));
     $course = ilObjectFactory::getInstanceByRefId($course_ref_id, false);
     if (!$course instanceof ilObjCourse) {
         $GLOBALS['ilLog']->write(__METHOD__ . $a_id . ' is not instance of type course');
         return '';
     }
     $this->writer = new ilCourseXMLWriter($course);
     $this->writer->setMode(ilCourseXMLWriter::MODE_EXPORT);
     $this->writer->start();
     return $this->writer->xmlDumpMem(false);
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:20,代码来源:class.ilCourseExporter.php

示例14: getXmlRepresentation

 /**
  * Get xml
  * @param object $a_entity
  * @param object $a_schema_version
  * @param object $a_id
  * @return
  */
 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
 {
     $ref_ref_id = end(ilObject::_getAllReferences($a_id));
     $ref = ilObjectFactory::getInstanceByRefId($ref_ref_id, false);
     if (!$ref instanceof ilContainerReference) {
         $GLOBALS['ilLog']->write(__METHOD__ . $a_id . ' is not instance of type category!');
         return '';
     }
     $writer = $this->initWriter($ref);
     $writer->setMode(ilContainerReferenceXmlWriter::MODE_EXPORT);
     $writer->export(false);
     return $writer->getXml();
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:20,代码来源:class.ilContainerReferenceExporter.php

示例15: getXmlRepresentation

 /**
  * Get xml
  * @param object $a_entity
  * @param object $a_schema_version
  * @param object $a_id
  * @return 
  */
 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
 {
     $group_ref_id = end(ilObject::_getAllReferences($a_id));
     $group = ilObjectFactory::getInstanceByRefId($group_ref_id, false);
     if (!$group instanceof ilObjGroup) {
         $GLOBALS['ilLog']->write(__METHOD__ . $a_id . ' is not instance of type group');
         return '';
     }
     include_once './Modules/Group/classes/class.ilGroupXMLWriter.php';
     $this->writer = new ilGroupXMLWriter($group);
     $this->writer->setMode(ilGroupXMLWriter::MODE_EXPORT);
     $this->writer->start();
     return $this->writer->getXML();
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:21,代码来源:class.ilGroupExporter.php


注:本文中的ilObjectFactory::getInstanceByRefId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。