Exemplo n.º 1
0
 private function buildUpdateClientInfoXml(Resource $resource, $providerAgb = null)
 {
     $clientNode = new SimpleXMLElement('<client />');
     $clientNode->addChild('bsn', $resource->getPropertyValue('bsn'));
     $clientNode->addChild('birthdate', $resource->getPropertyValue('birthdate'));
     $clientNode->addChild('zisnummer', $resource->getPropertyValue('zisnummer'));
     $clientNode->addChild('firstname', $resource->getPropertyValue('firstname'));
     $clientNode->addChild('lastname', $resource->getPropertyValue('lastname'));
     $eocsNode = $clientNode->addChild('eocs');
     $eocNode = $eocsNode->addChild('eoc');
     $eocNode->addChild('reference', $resource->getPropertyValue('reference'));
     $eocNode->addChild('gravida', $resource->getPropertyValue('gravida'));
     $eocNode->addChild('para', $resource->getPropertyValue('para'));
     $eocNode->addChild('starttimestamp', $resource->getPropertyValue('starttimestamp'));
     $eocNode->addChild('edd', $resource->getPropertyValue('edd'));
     foreach ($resource->getShares() as $share) {
         $shareNode = $eocNode->addChild('teammember');
         $shareNode->addChild('name', $share->getName());
         if ($share->getIdentifierType() != 'agb') {
             throw new RuntimeException('Identifier types other than AGB not supported in v1 api');
         }
         $shareNode->addChild('agb', $share->getIdentifier());
         $shareNode->addChild('permission', $share->getPermission());
     }
     $providersNode = $eocsNode->addChild('providers');
     $providerNode = $providersNode->addChild('provider');
     $providerNode->addChild('uuid', $this->username);
     if ($providerAgb) {
         $providerNode->addChild('agb', $providerAgb);
     }
     //echo $clientNode->asXML();
     $dom = dom_import_simplexml($clientNode)->ownerDocument;
     $dom->formatOutput = true;
     return $dom->saveXML();
 }
Exemplo n.º 2
0
 private function buildRegisterXml(Resource $resource)
 {
     $resourceNode = new SimpleXMLElement('<resource type="' . $resource->getType() . '" />');
     foreach ($resource->getProperties() as $property) {
         $resourceNode->addChild('property', $property->getValue())->addAttribute('name', $property->getName());
     }
     foreach ($resource->getShares() as $share) {
         $shareNode = $resourceNode->addChild('share');
         $shareNode->addChild('name', $share->getName());
         $shareNode->addChild('identifier', $share->getIdentifier())->addAttribute('type', $share->getIdentifierType());
         $shareNode->addChild('permission', $share->getPermission());
     }
     //echo $clientNode->asXML();
     $dom = dom_import_simplexml($resourceNode)->ownerDocument;
     $dom->formatOutput = true;
     return $dom->saveXML();
 }