PKPAuthorNativeXmlFilter::createPKPAuthorNode PHP Method

createPKPAuthorNode() public method

Create and return an author node.
public createPKPAuthorNode ( $doc, $author ) : DOMElement
$doc DOMDocument
$author PKPAuthor
return DOMElement
    function createPKPAuthorNode($doc, $author)
    {
        $deployment = $this->getDeployment();
        $context = $deployment->getContext();
        // Create the author node
        $authorNode = $doc->createElementNS($deployment->getNamespace(), 'author');
        if ($author->getPrimaryContact()) {
            $authorNode->setAttribute('primary_contact', 'true');
        }
        if ($author->getIncludeInBrowse()) {
            $authorNode->setAttribute('include_in_browse', 'true');
        }
        $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
        $userGroup = $userGroupDao->getById($author->getUserGroupId());
        assert(isset($userGroup));
        $authorNode->setAttribute('user_group_ref', $userGroup->getName($context->getPrimaryLocale()));
        // Add metadata
        $authorNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'firstname', htmlspecialchars($author->getFirstName(), ENT_COMPAT, 'UTF-8')));
        $this->createOptionalNode($doc, $authorNode, 'middlename', $author->getMiddleName());
        $authorNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'lastname', htmlspecialchars($author->getLastName(), ENT_COMPAT, 'UTF-8')));
        $this->createLocalizedNodes($doc, $authorNode, 'affiliation', $author->getAffiliation(null));
        $this->createOptionalNode($doc, $authorNode, 'country', $author->getCountry());
        $authorNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'email', htmlspecialchars($author->getEmail(), ENT_COMPAT, 'UTF-8')));
        $this->createOptionalNode($doc, $authorNode, 'url', $author->getUrl());
        $this->createLocalizedNodes($doc, $authorNode, 'biography', $author->getBiography(null));
        return $authorNode;
    }