public function getCWRConceptbyTaxonName($taxonName) { global $db; $cwrConcept = new CWRConcept(); $taxon = TaxonMySQL::getInstance()->getTaxonbyName($taxonName); if ($taxon != null) { $cwrConcept->setTaxon($taxon); $query = "SELECT Concept_Level, Concept_Type FROM concepts WHERE Taxon_ID = " . $taxon->getId() . " and Concept_Level not in ('Crop taxa')"; $result = $db->getAll($query); if (!empty($result)) { foreach ($result as $r) { $cwrConcept->setConceptLevel($r['Concept_Level']); $cwrConcept->setConceptType($r['Concept_Type']); } } else { $query = "SELECT Concept_Level, Concept_Type FROM concepts WHERE Taxon_ID IN (SELECT Taxon_ID from species where Valid_Taxon_ID = " . $taxon->getId() . " and Valid_Taxon_ID not in (Taxon_ID)) and Concept_Level not in ('Crop taxa')"; if (!empty($result)) { foreach ($result as $r) { $cwrConcept->setConceptLevel($r['Concept_Level']); $cwrConcept->setConceptType($r['Concept_Type']); } } } return $cwrConcept; } else { return null; } }
public function getCWRConcept($taxonID) { global $db; $cwrConcept = new CWRConcept($taxonID); $taxon = TaxonMySQL::getInstance()->getTaxon($taxonID); if ($taxon != null) { $cwrConcept->setTaxon($taxon); $query = "SELECT Concept_Level, Concept_Type FROM concepts WHERE Taxon_ID = {$taxonID} and Concept_Level not in ('Crop taxa')"; $result = $db->getAll($query); if (!empty($result)) { foreach ($result as $r) { $cwrConcept->setConceptLevel($r['Concept_Level']); $cwrConcept->setConceptType($r['Concept_Type']); } } $query = "SELECT Pot_Conf, Description FROM Breeding_data WHERE Taxon_ID = {$taxonID} AND Description = 'Graftstock'"; $result = $db->getAll($query); if (!empty($result)) { foreach ($result as $r) { $cwrConcept->setConceptLevel($r['Pot_Conf']); $cwrConcept->setConceptType($r['Description']); } } return $cwrConcept; } else { return null; } }