/** * Meta data update listener * * Important note: Do never call create() or update() * method of ilObject here. It would result in an * endless loop: update object -> update meta -> update * object -> ... * Use static _writeTitle() ... methods instead. * * @param string $a_element */ function MDUpdateListener($a_element) { include_once 'Services/MetaData/classes/class.ilMD.php'; switch ($a_element) { case 'General': // Update Title and description $md = new ilMD($this->getSLMId(), $this->getId(), $this->getType()); $md_gen = $md->getGeneral(); ilSCORM2004Node::_writeTitle($this->getId(), $md_gen->getTitle()); foreach ($md_gen->getDescriptionIds() as $id) { $md_des = $md_gen->getDescription($id); // ilLMObject::_writeDescription($this->getId(),$md_des->getDescription()); break; } break; default: } return true; }
/** * Save all titles of chapters/scos/pages */ function saveAllTitles($a_redirect = true) { global $ilCtrl; if (is_array($_POST["title"])) { include_once "./Services/MetaData/classes/class.ilMD.php"; include_once "./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php"; foreach ($_POST["title"] as $id => $title) { $node_obj = ilSCORM2004NodeFactory::getInstance($this->object, $id, false); if (is_object($node_obj)) { // Update Title and description $md = new ilMD($this->object->getId(), $id, $node_obj->getType()); $md_gen = $md->getGeneral(); $md_gen->setTitle(ilUtil::stripSlashes($title)); $md_gen->update(); $md->update(); ilSCORM2004Node::_writeTitle($id, ilUtil::stripSlashes($title)); } } } if ($a_redirect) { $ilCtrl->redirect($this, "showOrganization"); } }