/** * handler for begin of element * * @param resource $a_xml_parser xml parser * @param string $a_name element name * @param array $a_attribs element attributes array */ function handlerBeginTag($a_xml_parser, $a_name, $a_attribs) { global $objDefinition, $ilAccess, $tree; switch ($a_name) { case 'Settings': $this->options = array(); $this->source_id = (int) $a_attribs["source_id"]; if (ilObject::_isInTrash($this->source_id)) { throw new ilSaxParserException("Source id " . $this->source_id . " is in trash"); } $this->target_id = (int) $a_attribs["target_id"]; if (ilObject::_isInTrash($this->target_id)) { throw new ilSaxParserException("target id" . $this->target_id . " is in trash"); } $this->default_action = ilCopyWizardSettingsXMLParser::getActionForString($a_attribs["default_action"]); break; case 'Option': $id = (int) $a_attribs["id"]; if (ilObject::_isInTrash($id)) { throw new ilSaxParserException("Id {$id} is in trash"); } if (!$tree->isInTree($id)) { throw new ilSaxParserException("Id {$id} does not exist"); } $action = ilCopyWizardSettingsXMLParser::getActionForString($a_attribs["action"]); $type = ilObjectFactory::getTypeByRefId($id); switch ($action) { case ilCopyWizardOptions::COPY_WIZARD_COPY: $perm_copy = $ilAccess->checkAccess('copy', '', $id); $copy = $objDefinition->allowCopy($type); if ($perm_copy && $copy) { $this->options[$id] = array("type" => $action); } elseif ($copy && !$perm_copy) { throw new ilSaxParserException("Missing copy permission for object " . $id); } elseif (!$copy) { throw new ilSaxParserException("Copy for object " . $id . " of type " . $type . " is not supported"); } break; case ilCopyWizardOptions::COPY_WIZARD_LINK: $perm_link = $ilAccess->checkAccess('write', '', $id); $link = $objDefinition->allowLink($type); if ($perm_link && $link) { $this->options[$id] = array("type" => $action); } elseif ($copy && !$perm_link) { throw new ilSaxParserException("Missing write permission for object " . $id); } elseif (!$link) { throw new ilSaxParserException("Link for object " . $id . " of type " . $type . " is not supported"); } break; } } }