<table cellspacing="0" class="sf_admin_list"> <?php $skosProps = SkosPropertyPeer::getResourceProperties(); foreach ($properties as $property) { ?> <tr> <td> <?php echo link_to($property->getSkosProperty()->getLabel(), 'conceptprop/show?id=' . $property->getId()); ?> </td> <td> <?php $skos = $property->getSkosPropertyId(); if (in_array($skos, $skosProps)) { ?> <?php $relatedConcept = $property->getConceptRelatedByRelatedConceptId(); ?> <?php echo $relatedConcept ? link_to($relatedConcept->getPrefLabel(), 'concept/show?id=' . $relatedConcept->getId()) : $property->getObject(); } else { ?> <?php echo $property->getObject(); } ?> </td> <td><?php $value = format_language($property->getLanguage()); echo $value ? $value : ' ';
public function executeShowConcept() { //build the complete URI $rootUri = $this->getRequest()->getUriPrefix() . '/'; $conceptUri = $rootUri . 'uri/' . $this->getRequestParameter('scheme', '') . '/' . $this->getRequestParameter('concept', ''); $type = $this->getRequestParameter('type'); $ts = strtotime($this->getRequestParameter('ts')); $this->timestamp = $ts; //$_SERVER['HTTP_ACCEPT'] = ''; //$_SERVER['HTTP_USER_AGENT'] = ''; switch ($type) { case 'rdf': //this URI HAS an 'id', HAS an 'rdf' suffix, and does NOT have a 'uri' action $id = $this->getRequestParameter('id'); $concept = ConceptPeer::retrieveByPK($id); $this->getContext()->getResponse()->setStatusCode(200); break; case 'html': //this URI does NOT have an 'id', HAS an 'html' suffix, and HAS a 'uri' action //redirect to the base registry using the correct id for the scheme: // http://metadataregistry.org/concept/list/vocabulary_id/16.html $concept = ConceptPeer::getConceptByUri($conceptUri); $this->forward404Unless($concept); //redirect $this->getContext()->getResponse()->setStatusCode(303); $this->redirect($this->getRequest()->getUriPrefix() . '/concept/show/id/' . $concept->getId() . '.html'); break; case 'uri': //this URI does NOT have an 'id', HAS an 'rdf' suffix, and HAS a 'uri' action $concept = ConceptPeer::getConceptByUri($conceptUri); break; case 'api_uri': //this URI does NOT have an 'id', does NOT have an 'rdf' suffix, and comes from the API $uri = $this->getRequestParameter('uri', ''); $concept = ConceptPeer::getConceptByUri($uri); break; default: //covers case of 'unknown' too //this URI does NOT have an 'id', does NOT have a suffix, and HAS a 'uri' action //do content negotiation if (true === strpos($_SERVER['HTTP_ACCEPT'], 'text/html') || true === strpos($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml') || 0 === strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla')) { //we redirect to html $concept = ConceptPeer::getConceptByUri($conceptUri); $this->forward404Unless($concept); //redirect $this->getContext()->getResponse()->setStatusCode(303); $this->redirect($this->getRequest()->getUriPrefix() . '/concept/show/id/' . $concept->getId() . '.html'); } else { $concept = ConceptPeer::getConceptByUri($conceptUri); $this->forward404Unless($concept); //we redirect to rdf $redirectUri = $_SERVER['REDIRECT_URL'] ? $_SERVER['REDIRECT_URL'] : $_SERVER['REQUEST_URI']; $this->redirect($this->getRequest()->getUriPrefix() . $redirectUri . '.rdf'); } break; } $this->forward404Unless($concept); $vocabulary = $concept->getVocabulary(); //get the property data $properties = $concept->getConceptPropertysRelatedByConceptId(); $this->properties = $properties; $this->vocabulary = $vocabulary; $this->concept = $concept; // get the list of skos properties that reference resources $this->skosProps = SkosPropertyPeer::getResourceProperties(); $this->namespaces = $vocabulary->getNamespaces(); //get top concepts for vocabulary $this->getTopConcepts($vocabulary); }