public function executeList() { $idType = $this->getRequestParameter('IdType', null); $id = $this->getRequestParameter('id', null); if (!$idType) { //a current vocabulary is required to be in the request URL myActionTools::requireVocabularyFilter(); } else { $this->getRequest()->getParameterHolder()->set($idType, $id); } $vocabulary = myActionTools::findCurrentVocabulary(); if ($vocabulary) { $this->vocabulary = $vocabulary; if (in_array($idType, array('concept_id', 'property_id'))) { $this->concept = myActionTools::findCurrentConcept(); $this->setFlash('hasConcept', true); } //get the versions array $c = new Criteria(); $c->add(VocabularyHasVersionPeer::VOCABULARY_ID, $vocabulary->getId()); $versions = VocabularyHasVersionPeer::doSelect($c); $this->setFlash('versions', $versions); } parent::executeList(); }
/** * Executes show action * */ public function executeShowScheme() { //build the complete URI $rootUri = $this->getRequest()->getUriPrefix() . '/'; $schemeUri = $rootUri . 'uri/' . $this->getRequestParameter('scheme', ''); $type = $this->getRequestParameter('type'); $ts = strtotime($this->getRequestParameter('ts')); $this->timestamp = $ts; $version = $this->getRequestParameter('version'); //$_SERVER['HTTP_ACCEPT'] = ''; //$_SERVER['HTTP_USER_AGENT'] = ''; switch ($type) { case 'xmlschema': //this URI HAS an 'id', HAS an 'rdf' suffix, and does NOT have a 'uri' action $id = $this->getRequestParameter('id'); $vocabulary = VocabularyPeer::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 $vocabulary = VocabularyPeer::retrieveByUri($schemeUri); $this->forward404Unless($vocabulary); //redirect $this->getContext()->getResponse()->setStatusCode(303); $this->redirect($this->getRequest()->getUriPrefix() . '/concept/list/vocabulary_id/' . $vocabulary->getId() . '.html'); break; case 'uri': //this URI does NOT have an 'id', HAS an 'rdf' suffix, and HAS a 'uri' action //$this->getContext()->getResponse()->setStatusCode(303); $vocabulary = VocabularyPeer::retrieveByUri($schemeUri); break; case 'api_uri': //this URI does NOT have an 'id', does NOT have an 'html' suffix, and comes from the API $uri = $this->getRequestParameter('uri', ''); $vocabulary = VocabularyPeer::retrieveByUri($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 $vocabulary = VocabularyPeer::retrieveByUri($schemeUri); $this->forward404Unless($vocabulary); //redirect $this->redirect($this->getRequest()->getUriPrefix() . '/concept/list/vocabulary_id/' . $vocabulary->getId() . '.html'); } else { $vocabulary = VocabularyPeer::retrieveByUri($schemeUri); } break; } $this->forward404Unless($vocabulary); $this->vocabulary = $vocabulary; //forward to the timeslice if there's a version if ($version && !$ts) { $c = new Criteria(); $c->add(VocabularyHasVersionPeer::NAME, $version); $version = VocabularyHasVersionPeer::doSelectOne($c); $this->forward404Unless($version, 'Unknown version!'); $ts = $version->getTimeslice('YmdHis'); $this->getRequest()->getParameterHolder()->set('ts', $ts); $this->forward('xml', 'showScheme'); } if (!$ts) { $this->concepts = $vocabulary->getConcepts(); } else { $this->concepts = ConceptPeer::doSelectConceptByHistoryTimestamp($vocabulary->getid(), $ts); } }
if ($id) { $user = UserPeer::retrieveByPK($id); } } if ($user) { $objectId = $user->getID(); } break; case 'version': $showBc = true; $showVocabularyBc = true; $showVersionBc = true; if (!isset($vocabulary_has_version)) { $id = 'show' == $action ? $sf_params->get('id') : $paramId; if ($id) { $vocabulary_has_version = VocabularyHasVersionPeer::retrieveByPK($id); } } $objectId = $vocabulary_has_version->getID(); if (!isset($vocabulary)) { $vocabulary = $vocabulary_has_version->getVocabulary(); } $tab = false; break; //these top-level 'list tabs' don't show any breadcrumb or tab //setting $tab to false at this point turns off tab display //these top-level 'list tabs' don't show any breadcrumb or tab //setting $tab to false at this point turns off tab display case 'vocabularylist': $title = __('Vocabularies'); $tab = false;
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param Connection $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(VocabularyHasVersionPeer::ID, $pks, Criteria::IN); $objs = VocabularyHasVersionPeer::doSelect($criteria, $con); } return $objs; }
/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this User is new, it will return * an empty collection; or if this User has previously * been saved, it will retrieve related VocabularyHasVersions from storage. * * This method is protected by default in order to keep the public * api reasonable. You can provide public methods for those you * actually need in User. */ public function getVocabularyHasVersionsJoinVocabulary($criteria = null, $con = null) { // include the Peer class include_once 'lib/model/om/BaseVocabularyHasVersionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collVocabularyHasVersions === null) { if ($this->isNew()) { $this->collVocabularyHasVersions = array(); } else { $criteria->add(VocabularyHasVersionPeer::CREATED_USER_ID, $this->getId()); $this->collVocabularyHasVersions = VocabularyHasVersionPeer::doSelectJoinVocabulary($criteria, $con); } } else { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return the collection. $criteria->add(VocabularyHasVersionPeer::CREATED_USER_ID, $this->getId()); if (!isset($this->lastVocabularyHasVersionCriteria) || !$this->lastVocabularyHasVersionCriteria->equals($criteria)) { $this->collVocabularyHasVersions = VocabularyHasVersionPeer::doSelectJoinVocabulary($criteria, $con); } } $this->lastVocabularyHasVersionCriteria = $criteria; return $this->collVocabularyHasVersions; }
/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = VocabularyHasVersionPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setName($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setCreatedAt($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setDeletedAt($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setUpdatedAt($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setCreatedUserId($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setVocabularyId($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setTimeslice($arr[$keys[7]]); } }