/** * Get an array of all concept classes formatted for an HTML select dropdown. * This method automatically combines datatypes of the same name across dictionaries * into a single select box. * @return array */ public function getHtmlChecklistArray(ConceptDatatypeCollection $coll_selected = null) { /** * $arr_display has 3 fields: value, display, source. Source is another array of * dictionary sources in which the object is present. */ $arr_display = array(); // Combine foreach ($this->getKeys() as $key) { $o = $this->Get($key); if (!isset($arr_display[strtolower($o->name)])) { $arr_display[strtolower($o->name)] = array('value' => strtolower($o->name), 'display' => $o->name, 'hint' => '', 'selected' => false, 'source' => array()); } if ($arr_display[strtolower($o->name)]['selected'] === false && $coll_selected->IsMember($key)) { $arr_display[strtolower($o->name)]['selected'] = true; } $arr_display[strtolower($o->name)]['source'][] = $o->getSourceDictionary()->dict_db; } // Set hint column to indicate the list of dictionaries foreach (array_keys($arr_display) as $key) { $hint = ''; foreach ($arr_display[$key]['source'] as $source_text) { if ($hint) { $hint .= ', '; } $hint .= $source_text; } if ($hint) { $hint = '"' . $arr_display[$key]['display'] . '" is in the following dictionaries: ' . $hint; } $arr_display[$key]['hint'] = $hint; } return $arr_display; }