public function executeDocumentation($request) { $browser = new sfWebBrowser(); $this->prefix = $request->getUriPrefix(); if ($extraPrefix = $request->getParameter('prefix')) { $this->prefix .= $extraPrefix; } if (!($apiKey = sfConfig::get('app_documentation_admin_key'))) { return $this->renderText("Something's broken! Can't display API documentation."); } $orgId = 1; $personId = 1164; $relationshipId = 23; $listId = 23; $this->uris = array('entity_basic' => $this->prefix . '/entity/' . $orgId . '.xml', 'entity_details' => $this->prefix . '/entity/' . $orgId . '/details.xml', 'entity_batch' => $this->prefix . '/batch/entities.xml?ids=1,2,3,1201,28219,35306&details=1', 'entity_aliases' => $this->prefix . '/entity/' . $orgId . '/aliases.xml', 'entity_relationships' => $this->prefix . '/entity/' . $orgId . '/relationships.xml?cat_ids=1,7', 'entity_related' => $this->prefix . '/entity/' . $orgId . '/related.xml?cat_ids=1&order=2&is_current=1', 'entity_leadership' => $this->prefix . '/entity/' . $orgId . '/leadership.xml?is_current=1', 'entity_orgs' => $this->prefix . '/entity/' . $personId . '/orgs.xml', 'entity_degree2' => $this->prefix . '/entity/' . $orgId . '/related/degree2.xml?cat1_ids=1&cat2_ids=1&order1=2&order2=1', 'entity_lists' => $this->prefix . '/entity/' . $orgId . '/lists.xml', 'entity_childorgs' => $this->prefix . '/entity/' . $orgId . '/child-orgs.xml', 'entity_images' => $this->prefix . '/entity/' . $orgId . '/images.xml', 'entity_references' => $this->prefix . '/entity/' . $orgId . '/references.xml', 'entity_rel_references' => $this->prefix . '/entity/' . $orgId . '/relationships/references.xml?cat_ids=1,7', 'relationship_basic' => $this->prefix . '/relationship/' . $relationshipId . '.xml', 'relationship_details' => $this->prefix . '/relationship/' . $relationshipId . '/details.xml', 'relationship_batch' => $this->prefix . '/batch/relationships.xml?ids=' . implode(',', range(74, 95)) . '&details=1', 'relationship_references' => $this->prefix . '/relationship/' . $relationshipId . '/references.xml', 'list_basic' => $this->prefix . '/list/' . $listId . '.xml', 'list_entities' => $this->prefix . '/list/' . $listId . '/entities.xml?type_ids=29', 'entity_search' => $this->prefix . '/entities.xml?q=treasury&type_ids=35', 'entity_lookup' => $this->prefix . '/entities/bioguide_id/O000167.xml', 'entity_chains' => $this->prefix . '/entities/chains/1;2.xml', 'relationship_search' => $this->prefix . '/relationships/1026;1.xml?cat_ids=1', 'list_search' => $this->prefix . '/lists.xml?q=forbes'); $this->responses = array(); foreach ($this->uris as $key => $uri) { $uri = $this->addKeyToUri($uri, $apiKey); if ($browser->get($uri)->responseIsError()) { throw new Exception("Couldn't get example URI: " . $uri); } $text = $browser->getResponseText(); $this->responses[$key] = LsDataFormat::formatXmlString($text); } }
<?php echo LsDataFormat::toXml($entity, 'Entity'); ?> <ChildOrgs> <?php foreach ($child_orgs as $child) { ?> <?php echo LsDataFormat::toXml($child, 'ChildOrg'); } ?> </ChildOrgs> <?php slot('num_results', array('ChildOrgs' => count($child_orgs)));
<?php $orgs = $entityAry['orgs']; ?> <?php unset($entityAry['orgs']); ?> <?php echo LsDataFormat::toXml($entityAry['entity']); ?> <Orgs> <?php foreach ($orgs as $org) { ?> <?php echo LsDataFormat::toXml($org, 'Entity'); ?> <?php $orgAry[$org['id']] = true; ?> <?php } ?> </Orgs> </Entity> <?php } ?> </Entities> <?php
<Entity> <?php echo LsDataFormat::toXml($entity); ?> <Aliases> <?php foreach ($aliases as $alias) { ?> <Alias><?php echo LsDataFormat::toXml($alias); ?> </Alias> <?php } ?> </Aliases> </Entity>
<?php echo LsDataFormat::toXml($entity, 'Entity'); ?> <Lists> <?php foreach ($lists as $list) { ?> <?php echo LsDataFormat::toXml($list, 'List'); } ?> </Lists> <?php slot('num_results', array('Lists' => count($lists)));
<?php echo LsDataFormat::toXml($entity, 'Entity'); ?> <Relationships> <?php foreach ($rels as $rel) { ?> <?php echo LsDataFormat::toXml($rel, 'Relationship'); } ?> </Relationships> <?php slot('num_results', array('Relationships' => count($rels)));
<?php $refs = $rel['References']; ?> <?php unset($rel['References']); ?> <Relationship> <?php echo LsDataFormat::toXml($rel); ?> <References> <?php foreach ($refs as $ref) { ?> <?php echo LsDataFormat::toXml($ref, 'Reference'); ?> <?php $refCount++; ?> <?php } ?> </References> </Relationship> <?php } ?> </Relationships> <?php
<?php echo LsDataFormat::toXml($entity, 'Entity'); ?> <Images> <?php foreach ($images as $image) { ?> <?php echo LsDataFormat::toXml($image, 'Image'); } ?> </Images> <?php slot('num_results', array('Images' => count($images)));
<RelationshipCategories> <?php foreach ($categories as $category) { ?> <?php echo LsDataFormat::toXml($category, 'RelationshipCategory'); } ?> </RelationshipCategories>
<?php echo LsDataFormat::toXml($list, 'List'); ?> <Entities> <?php foreach ($entities as $entity) { ?> <?php echo LsDataFormat::toXml($entity, 'Entity'); } ?> </Entities> <?php slot('num_results', array('Entities' => count($entities)));
?> <Relationship> <?php $relatedEntity = $rel['entity1_id'] == $entity['id'] ? $rel['Entity2'] : $rel['Entity1']; ?> <?php unset($rel['Entity1']); ?> <?php unset($rel['Entity2']); ?> <?php echo LsDataFormat::toXml($rel); ?> <?php echo LsDataFormat::toXml($relatedEntity, 'RelatedEntity'); ?> <?php $entities[$relatedEntity['id']] = 1; ?> <?php $categories[$rel['category_id']] = 1; ?> </Relationship> <?php } ?> </Relationships> <?php slot('num_results', array('RelatedEntities' => count($entities), 'Relationships' => count($relationships), 'RelationshipCategories' => count($categories)));
<Entities> <?php foreach ($entities as $entity) { ?> <?php echo LsDataFormat::toXml(LsApi::filterResponseFields($entity, 'Entity'), 'Entity'); } ?> </Entities> <?php slot('num_results', array('Entities' => count($entities)));
<EntityTypes> <?php foreach ($types as $type) { ?> <?php echo LsDataFormat::toXml($type, 'EntityType'); } ?> </EntityTypes>
<Relationship> <?php echo LsDataFormat::toXml($relationship); ?> <?php echo LsDataFormat::toXml($entity1, 'Entity1'); ?> <?php echo LsDataFormat::toXml($entity2, 'Entity2'); ?> </Relationship>
<Lists> <?php foreach ($lists as $list) { ?> <List> <?php $num = $list['num_entities']; ?> <?php echo LsDataFormat::toXml(LsApi::filterResponseFields($list, 'LsList')); ?> <num_entities><?php echo $num; ?> </num_entities> </List> <?php } ?> </Lists> <?php slot('num_results', array('Lists' => count($lists)));
<List> <?php echo LsDataFormat::toXml($list); ?> </List>