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); } if ($idType !== 'import_id') { $vocabulary = myActionTools::findCurrentVocabulary(); $this->vocabulary = $vocabulary; if (in_array($idType, array('concept_id', 'property_id'))) { $this->concept = myActionTools::findCurrentConcept(); $this->setFlash('hasConcept', true); } } else { $import = FileImportHistoryPeer::retrieveByPK($id); if ($import) { $vocabulary = $import->getVocabulary(); $this->vocabulary = $vocabulary; } } //get the versions array $c = new Criteria(); $c->add(VocabularyHasVersionPeer::VOCABULARY_ID, $vocabulary->getId()); $versions = VocabularyHasVersionPeer::doSelect($c); $this->setFlash('versions', $versions); parent::executeList(); }
/** * description * * @return return_type * @param var_type $var */ public static function getConceptsByCurrentVocabID() { $conceptProperty = sfContext::getInstance()->getActionStack()->getLastEntry()->getActionInstance()->concept_property; if ($conceptProperty) { $vocabId = $conceptProperty->getSchemeId(); } else { $vocabId = sfContext::getInstance()->getUser()->getAttribute('vocabulary')->getId(); } $concept = myActionTools::findCurrentConcept(); if ($concept) { $conceptId = $concept->getId(); } return self::getConceptsByVocabID($vocabId, $conceptId); }
/** * gets the current vocabulary object * * @return vocabulary current vocabulary object */ public function getCurrentConcept() { //TODO: Redo this temporary fix to retrieving the current concept and vocabulary //$concept = myActionTools::findCurrentConcept(); //if (!$concept) //we have to do it the hard way //{ $this->conceptProperty = ConceptPropertyPeer::retrieveByPk($this->getRequestParameter('id')); /* @var Concept */ if (isset($this->conceptProperty)) { $concept = $this->conceptProperty->getConceptRelatedByConceptId(); } else { $concept = myActionTools::findCurrentConcept(); } //} //and let's just do the vocabulary while we're at it //if ($concept && !isset($this->vocabulary)) if ($concept) { $vocabulary = $concept->getVocabulary(); $this->vocabulary = $vocabulary; } $this->forward404Unless($concept, 'No concept has been selected.'); $this->forward404Unless($vocabulary, 'No vocabulary has been selected.'); $this->concept = $concept; $this->conceptID = $concept->getId(); return $concept; }