/** * Load the Map Source definitions from the passed concept dictionary * definition. * @param ConceptSearchSource $css_dict ConceptSearchSource of type MCL_SOURCE_TYPE_DICTIONARY * @return Array of ConceptSearchSource objects */ public function loadMapSourceDefinitions(ConceptSearchSource $css_dict) { // Make sure the passed source is a dictionary if ($css_dict->type != MCL_SOURCE_TYPE_DICTIONARY) { trigger_error('Parameter $css_dict must be of type MCL_SOURCE_TYPE_DICTIONARY', E_USER_ERROR); } // Connect to the database $cxn = $css_dict->getConnection(); mysql_select_db($css_dict->dict_db, $cxn); // Build the sql $sql_cs = 'select cs.concept_source_id, cs.name, cs.description, cs.retired ' . 'from concept_source cs ' . 'order by cs.name'; if ($this->debug) { echo '<p><b>Loading map source definitions for ' . $css_dict->dict_db . ':</b><br> ' . $sql_cs . '</p>'; } // Execute the query $rsc_cs = mysql_query($sql_cs, $cxn); if (!$rsc_cs) { trigger_error('Could not load map source definitions: ' . mysql_error(), E_USER_ERROR); } // put the data into an array $arr_source = array(); while ($row = mysql_fetch_assoc($rsc_cs)) { $css = new ConceptSearchSource(); $css->setSourceMap($css_dict->dict_id, $css_dict->dict_db, $css_dict->dict_name, $row['concept_source_id'], $row['name']); $css->addDictionarySource($css_dict); $arr_source[] = $css; } return $arr_source; }