Go to the source code of this file.
Defines some ajax callback functions that TPPS uses often.
Definition in file tpps_ajax.php.
◆ tpps_attribute_autocomplete()
tpps_attribute_autocomplete |
( |
|
$string | ) |
|
Phenotype attribute auto-complete matching.
- Parameters
-
string | $string | The string the user has already entered into the text field. |
Definition at line 290 of file tpps_ajax.php.
292 $attributes = array();
293 $attr_results = chado_select_record(
'phenotype', array(
'distinct attr_id'), array());
295 foreach ($attr_results as $result) {
296 $attributes[] = $result->attr_id;
299 $results = chado_select_record(
'cvterm', array(
'name'), array(
304 'cvterm_id' => $attributes,
307 foreach ($results as $row) {
308 $matches[$row->name] = check_plain($row->name);
311 drupal_json_output($matches);
◆ tpps_author_autocomplete()
tpps_author_autocomplete |
( |
|
$string | ) |
|
Author auto-complete matching.
- Parameters
-
string | $string | The string the user has already entered into the text field. |
Definition at line 30 of file tpps_ajax.php.
33 $results = chado_select_record(
'contact', array(
'name'), array(
37 'regex_columns' => array(
'name'),
40 foreach ($results as $row) {
41 $matches[$row->name] = check_plain($row->name);
44 drupal_json_output($matches);
tpps_load_cvterm($term, array $options=array(), $version=NULL, $refresh_cache=FALSE)
◆ tpps_autocomplete()
tpps_autocomplete |
( |
|
$type, |
|
|
|
$string = "" |
|
) |
| |
Call the correct autocomplete function based on the type provided.
- Parameters
-
string | $type | The type of autocomplete function needed. |
string | $string | The string to be autocompleted. |
Definition at line 16 of file tpps_ajax.php.
17 $function =
"tpps_{$type}_autocomplete";
18 if (function_exists($function)) {
19 $string = preg_replace(
'/\\\\/',
'\\\\\\\\', $string);
◆ tpps_genotype_autocomplete()
tpps_genotype_autocomplete |
( |
|
$string | ) |
|
Genotype name auto-complete matching.
- Parameters
-
string | $string | The string the user has already entered into the text field. |
Definition at line 248 of file tpps_ajax.php.
251 $query = db_select(
'chado.tpps_search_genotype_name',
'g')
252 ->fields(
'g', array(
'name'))
253 ->condition(
'g.name', $string,
'~*')
256 while (($result = $query->fetchObject())) {
257 $matches[$result->name] = check_plain($result->name);
260 drupal_json_output($matches);
◆ tpps_genotype_marker_autocomplete()
tpps_genotype_marker_autocomplete |
( |
|
$string | ) |
|
Genotype marker name auto-complete matching.
- Parameters
-
string | $string | The string the user has already entered into the text field. |
Definition at line 269 of file tpps_ajax.php.
272 $query = db_select(
'chado.tpps_search_genotype_marker',
'g')
273 ->fields(
'g', array(
'name'))
274 ->condition(
'g.name', $string,
'~*')
277 while (($result = $query->fetchObject())) {
278 $matches[$result->name] = check_plain($result->name);
281 drupal_json_output($matches);
◆ tpps_journal_autocomplete()
tpps_journal_autocomplete |
( |
|
$string | ) |
|
Journal auto-complete matching.
- Parameters
-
string | $string | The string the user has already entered into the text field. |
Definition at line 118 of file tpps_ajax.php.
121 $results = chado_select_record(
'pub', array(
'series_name'), array(
122 'series_name' => $string,
124 'regex_columns' => array(
'series_name'),
127 foreach ($results as $row) {
128 $matches[$row->series_name] = check_plain($row->series_name);
131 drupal_json_output($matches);
◆ tpps_ncbi_species_autocomplete()
tpps_ncbi_species_autocomplete |
( |
|
$string | ) |
|
NCBI species auto-complete matching.
- Parameters
-
string | $string | The string the user has already entered into the text field. |
Definition at line 176 of file tpps_ajax.php.
180 $taxons = json_decode(json_encode($taxons))->Id;
182 $fetch =
new EFetch(
'taxonomy');
183 $fetch->addParam(
'id', implode(
',', $taxons));
184 $response = $fetch->get()->xml();
185 $species = json_decode(json_encode($response))->Taxon;
187 foreach ($species as $info) {
188 $name = $info->ScientificName;
189 if (!empty($name) and $info->Rank ==
'species') {
190 $matches[$name] =
"$name (autocomplete from NCBI)";
tpps_ncbi_get_taxon_id($organism, $list=FALSE)
◆ tpps_no_header_callback()
tpps_no_header_callback |
( |
array |
$form, |
|
|
array & |
$form_state |
|
) |
| |
Indicate the managed_file element to be updated.
This function is called after a no_header element is changed, triggering an update of the managed_file element.
- Parameters
-
array | $form | The form that needs to be updated. |
array | $form_state | The state of the form that needs to be updated. |
- Returns
- array The element in the form to be updated.
Definition at line 417 of file tpps_ajax.php.
419 $parents = $form_state[
'triggering_element'][
'#parents'];
422 $element = drupal_array_get_nested_value($form, $parents);
◆ tpps_organization_autocomplete()
tpps_organization_autocomplete |
( |
|
$string | ) |
|
Organization auto-complete matching.
- Parameters
-
string | $string | The string the user has already entered into the text field. |
Definition at line 95 of file tpps_ajax.php.
98 $results = chado_select_record(
'contact', array(
'name'), array(
102 'regex_columns' => array(
'name'),
105 foreach ($results as $row) {
106 $matches[$row->name] = check_plain($row->name);
109 drupal_json_output($matches);
tpps_load_cvterm($term, array $options=array(), $version=NULL, $refresh_cache=FALSE)
◆ tpps_phenotype_autocomplete()
tpps_phenotype_autocomplete |
( |
|
$string | ) |
|
Phenotype name auto-complete matching.
- Parameters
-
string | $string | The string the user has already entered into the text field. |
Definition at line 202 of file tpps_ajax.php.
205 $results = chado_select_record(
'phenotype', array(
'name'), array(
212 foreach ($results as $row) {
213 $matches[$row->name] = check_plain($row->name);
216 drupal_json_output($matches);
◆ tpps_phenotype_ontology_autocomplete()
tpps_phenotype_ontology_autocomplete |
( |
|
$string | ) |
|
Phenotype ontology name auto-complete matching.
- Parameters
-
string | $string | The string the user has already entered into the text field. |
Definition at line 225 of file tpps_ajax.php.
228 $query = db_select(
'chado.phenotype',
'p');
229 $query->join(
'chado.cvterm',
'cvt',
'cvt.cvterm_id = p.attr_id');
230 $query->join(
'chado.cv',
'cv',
'cv.cv_id = cvt.cv_id');
231 $query->fields(
'cv', array(
'name'));
232 $query->condition(
'cv.name', $string,
'~*');
233 $query = $query->execute();
235 while (($result = $query->fetchObject())) {
236 $matches[$result->name] = check_plain($result->name);
239 drupal_json_output($matches);
◆ tpps_project_accession_autocomplete()
tpps_project_accession_autocomplete |
( |
|
$string | ) |
|
Project accession number auto-complete matching.
- Parameters
-
string | $string | The string the user has already entered into the text field. |
Definition at line 74 of file tpps_ajax.php.
77 $query = db_select(
'chado.plusgeno_view',
'p')
78 ->fields(
'p', array(
'accession'))
79 ->condition(
'accession', $string,
'~*')
82 while (($result = $query->fetchObject())) {
83 $matches[$result->accession] = check_plain($result->accession);
86 drupal_json_output($matches);
◆ tpps_project_title_autocomplete()
tpps_project_title_autocomplete |
( |
|
$string | ) |
|
Project title auto-complete matching.
- Parameters
-
string | $string | The string the user has already entered into the text field. |
Definition at line 53 of file tpps_ajax.php.
56 $query = db_select(
'chado.plusgeno_view',
'p')
57 ->fields(
'p', array(
'title'))
58 ->condition(
'title', $string,
'~*')
61 while (($result = $query->fetchObject())) {
62 $matches[$result->title] = check_plain($result->title);
65 drupal_json_output($matches);
◆ tpps_species_autocomplete()
tpps_species_autocomplete |
( |
|
$string | ) |
|
Species auto-complete matching.
- Parameters
-
string | $string | The string the user has already entered into the text field. |
Definition at line 140 of file tpps_ajax.php.
143 $parts = explode(
" ", $string);
144 if (!isset($parts[1])) {
148 $results = chado_select_record(
'organism', array(
'genus',
'species'), array(
159 foreach ($results as $row) {
160 $matches[$row->genus .
" " . $row->species] = check_plain($row->genus .
" " . $row->species);
163 if (empty($matches)) {
167 drupal_json_output($matches);
tpps_ncbi_species_autocomplete($string)
◆ tpps_structure_autocomplete()
tpps_structure_autocomplete |
( |
|
$string | ) |
|
Phenotype structure auto-complete matching.
- Parameters
-
string | $string | The string the user has already entered into the text field. |
Definition at line 344 of file tpps_ajax.php.
346 $structures = array();
347 $struct_results = chado_select_record(
'phenotype', array(
'distinct observable_id'), array());
349 foreach ($struct_results as $result) {
350 $structures[] = $result->observable_id;
353 $results = chado_select_record(
'cvterm', array(
'name'), array(
358 'cvterm_id' => $structures,
361 if (empty($results)) {
362 $results = chado_select_record(
'cvterm', array(
'name'), array(
370 foreach ($results as $row) {
371 $matches[$row->name] = check_plain($row->name);
372 if (!empty($row->definition)) {
373 $matches[$row->name] = check_plain($row->name .
': ' . $row->definition);
377 drupal_json_output($matches);
◆ tpps_units_autocomplete()
tpps_units_autocomplete |
( |
|
$string | ) |
|
Phenotype units auto-complete matching.
- Parameters
-
string | $string | The string the user has already entered into the text field. |
Definition at line 320 of file tpps_ajax.php.
323 $results = chado_select_record(
'phenotypeprop', array(
'value'), array(
331 foreach ($results as $row) {
332 $matches[$row->value] = check_plain($row->value);
335 drupal_json_output($matches);
tpps_load_cvterm($term, array $options=array(), $version=NULL, $refresh_cache=FALSE)
◆ tpps_user_autocomplete()
tpps_user_autocomplete |
( |
|
$string | ) |
|
User account auto-complete matching.
- Parameters
-
string | $string | The string the user has already entered into the text field. |
Definition at line 386 of file tpps_ajax.php.
389 ->condition(
'mail', $string,
'~*')
390 ->condition(
'name', $string,
'~*');
391 $result = db_select(
'users')
392 ->fields(
'users', array(
'uid',
'name'))
395 foreach ($result as $user) {
396 $user = user_load($user->uid);
397 $matches[
"$user->mail"] = check_plain($user->name);
400 drupal_json_output($matches);