/** * 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() . '".'); } }
function updateGroup($sid, $ref_id, $grp_xml) { $this->initAuth($sid); $this->initIlias(); if (!$this->__checkSession($sid)) { return $this->__raiseError($this->__getMessage(), $this->__getMessageCode()); } if (!is_numeric($ref_id)) { return $this->__raiseError('No valid target id given. Please choose an existing reference id of an ILIAS category or group', 'Client'); } global $rbacsystem; if (!$rbacsystem->checkAccess('write', $ref_id, 'grp')) { return $this->__raiseError('Check access failed. No permission to edit groups', 'Server'); } // Start import include_once "./Modules/Group/classes/class.ilObjGroup.php"; if (!($grp = ilObjectFactory::getInstanceByRefId($ref_id, false))) { return $this->__raiseError('Cannot create group instance!', 'CLIENT_OBJECT_NOT_FOUND'); } if (ilObject::_isInTrash($ref_id)) { return $this->__raiseError("Object with ID {$ref_id} has been deleted.", 'CLIENT_OBJECT_DELETED'); } if (ilObjectFactory::getTypeByRefId($ref_id, false) != "grp") { return $this->__raiseError('Reference id does not point to a group!', 'CLIENT_WRONG_TYPE'); } include_once 'Modules/Group/classes/class.ilGroupXMLParser.php'; $xml_parser = new ilGroupXMLParser($grp_xml, -1); $xml_parser->setMode(ilGroupXMLParser::$UPDATE); $xml_parser->setGroup($grp); $new_ref_id = $xml_parser->startParsing(); return $new_ref_id ? $new_ref_id : "0"; }