21 $data = isset($state[
'saved_values']) ? $state[
'saved_values'] : NULL;
26 unset($data[
'frontpage']);
27 unset($data[
'form_build_id']);
30 $pub = &$page_1[
'publication'];
31 $org = &$page_1[
'organism'];
33 if (isset($page_1[
'#cleared']) and $page_1[
'#cleared']) {
34 $data[
'#page_1_cleared'] = TRUE;
37 $data[
'#page_1_cleared'] = FALSE;
39 $data[
'#study_photo'] = $page_1[
'photo'] ?? NULL;
40 $data[
'Publication DOI'] = isset($page_1[
'doi']) ? $page_1[
'doi'] : NULL;
41 $data[
'Publication Title'] = isset($pub[
'title']) ? $pub[
'title'] : NULL;
42 $data[
'Primary Author'] = isset($page_1[
'primaryAuthor']) ? $page_1[
'primaryAuthor'] : NULL;
43 $data[
'Organization'] = isset($page_1[
'organization']) ? $page_1[
'organization'] : NULL;
44 $data[
'Publication Status'] = isset($pub[
'status']) ? $pub[
'status'] : NULL;
45 $data[
'Publication Year'] = isset($pub[
'year']) ? $pub[
'year'] : NULL;
46 $data[
'Publication Abstract'] = isset($pub[
'abstract']) ? $pub[
'abstract'] : NULL;
47 $data[
'Publication Journal'] = isset($pub[
'journal']) ? $pub[
'journal'] : NULL;
49 if (isset($pub[
'secondaryAuthors'][
'number'])) {
50 $data[
'#number_secondary_authors'] = $pub[
'secondaryAuthors'][
'number'];
51 for ($i = 1; $i <= $data[
'#number_secondary_authors']; $i++) {
52 if (isset($pub[
'secondaryAuthors'][
"$i"]) and $pub[
'secondaryAuthors'][
"$i"] !=
'') {
53 $data[
"Secondary Author $i"] = $pub[
'secondaryAuthors'][
"$i"];
58 if (isset($org[
'number'])) {
59 $data[
'#number_organisms'] = $org[
'number'];
60 for ($i = 1; $i <= $data[
'#number_organisms']; $i++) {
61 if (isset($org[
"$i"][
'name']) and $org[
"$i"][
'name'] !=
'') {
62 $data[
"Species $i"] = $org[
"$i"][
'name'];
70 if (isset($page_2[
'#cleared']) and $page_2[
'#cleared']) {
71 $data[
'#page_2_cleared'] = TRUE;
74 $data[
'#page_2_cleared'] = FALSE;
76 $data[
'Experiment Starting Month'] = !empty($page_2[
'StartingDate'][
'month']) ? $page_2[
'StartingDate'][
'month'] : NULL;
77 $data[
'Experiment Starting Year'] = !empty($page_2[
'StartingDate'][
'year']) ? $page_2[
'StartingDate'][
'year'] : NULL;
78 $data[
'Experiment Ending Month'] = !empty($page_2[
'EndingDate'][
'month']) ? $page_2[
'EndingDate'][
'month'] : NULL;
79 $data[
'Experiment Ending Year'] = !empty($page_2[
'EndingDate'][
'year']) ? $page_2[
'EndingDate'][
'year'] : NULL;
80 if (!empty($page_2[
'study_location'])) {
82 $legacy_loc = &$page_2[
'study_location'];
83 $data[
'#location_type'] = (isset($legacy_loc[
'type']) and $legacy_loc[
'type']) ? $legacy_loc[
'type'] : NULL;
85 if ($data[
'#location_type'] ==
'2' and isset($legacy_loc[
'custom'])) {
86 $data[
'Study Location'] = $legacy_loc[
'custom'];
88 elseif ($data[
'#location_type'] and isset($legacy_loc[
'coordinates'])) {
89 $data[
'Study Location'] = $legacy_loc[
'coordinates'];
93 if (isset($page_2[
'data_type']) and $page_2[
'data_type']) {
94 $data[
'Data Type'] = $page_2[
'data_type'];
97 if (isset($page_2[
'study_type']) and $page_2[
'study_type']) {
98 $study_type_options = array(
99 1 =>
'Natural Population (Landscape)',
100 2 =>
'Growth Chamber',
102 4 =>
'Experimental/Common Garden',
105 if (isset($study_type_options[$page_2[
'study_type']])) {
106 $data[
'Study Type'] = $study_type_options[$page_2[
'study_type']];
109 if (!empty($page_2[
'study_info'][
'season'])) {
110 $data[
'Seasons Assessed'] = implode($page_2[
'study_info'][
'season']);
113 if (!empty($page_2[
'study_info'][
'assessions'])) {
114 $data[
'Average number of assessions'] = $page_2[
'study_info'][
'assessions'];
117 $data[
'Average High Temperature'] = isset($page_2[
'study_info'][
'temp'][
'high']) ? $page_2[
'study_info'][
'temp'][
'high'] : NULL;
118 $data[
'Average Low Temperature'] = isset($page_2[
'study_info'][
'temp'][
'low']) ? $page_2[
'study_info'][
'temp'][
'low'] : NULL;
122 'humidity' =>
'Air Humidity',
123 'light' =>
'Light Intensity',
124 'salinity' =>
'Salinity',
127 foreach ($types as $type => $label) {
128 if (!empty($page_2[
'study_info'][$type])) {
129 $set = $page_2[
'study_info'][$type];
130 if (!empty($set[
'option'])) {
131 $data[
"$label Control"] = ($set[
'option'] ==
'1') ?
'Controlled' :
'Uncontrolled';
132 if ($set[
'option'] ==
'1' and !empty($set[
'controlled'])) {
133 $data[
"$label Value"] = $set[
'controlled'];
135 elseif (!empty($set[
'uncontrolled'])) {
136 $data[
"$label Value"] = $set[
'uncontrolled'];
142 if (!empty($page_2[
'study_info'][
'rooting'][
'option'])) {
143 $data[
'Rooting Type'] = $page_2[
'study_info'][
'rooting'][
'option'];
145 if ($data[
'Rooting Type'] ==
'Soil' and !empty($page_2[
'study_info'][
'rooting'][
'soil'][
'type'])) {
146 $soil = &$page_2[
'study_info'][
'rooting'][
'soil'];
147 $data[
'Soil Type'] = $soil[
'type'];
149 if ($data[
'Soil Type'] ==
'Other') {
150 $data[
'Custom Soil Type'] = $soil[
'other'];
153 $data[
'Soil Container Type'] = isset($soil[
'container']) ? $soil[
'container'] : NULL;
157 if (!empty($page_2[
'study_info'][
'rooting'][
'ph'][
'option'])) {
158 $set = $page_2[
'study_info'][
'rooting'][
'ph'];
159 $data[
'pH Control'] = ($set[
'option'] ==
'1') ?
'Controlled' :
'Uncontrolled';
161 if ($set[
'option'] ==
'1' and !empty($set[
'controlled'])) {
162 $data[
"pH Value"] = $set[
'controlled'];
164 elseif (!empty($set[
'uncontrolled'])) {
165 $data[
"pH Value"] = $set[
'uncontrolled'];
169 if (!empty($page_2[
'study_info'][
'rooting'][
'treatment'])) {
170 $treatment = $page_2[
'study_info'][
'rooting'][
'treatment'];
172 $description = FALSE;
174 foreach ($treatment as $field => $value) {
177 $selected = ($value) ? $field : FALSE;
180 elseif ($selected and !empty($value)) {
181 $data[
"Treatment: $selected description"] = $value;
183 $description = FALSE;
187 if (!empty($page_2[
'study_info'][
'irrigation']) and !empty($page_2[
'study_info'][
'irrigation'][
'option'])) {
188 $data[
'Irrigation Type'] = $page_2[
'study_info'][
'irrigation'][
'option'];
189 if ($data[
'Irrigation Type'] ==
'Other' and !empty($page_2[
'study_info'][
'irrigation'][
'other'])) {
190 $data[
'Custom Irrigation Type'] = $page_2[
'study_info'][
'irrigation'][
'other'];
194 if (!empty($page_2[
'study_info'][
'biotic_env'][
'option'])) {
195 $biotic_envs = array();
196 foreach ($page_2[
'study_info'][
'biotic_env'][
'option'] as $key => $val) {
198 $biotic_envs[] = $key;
202 if (!empty($biotic_envs)) {
203 $data[
'Biotic Environment'] = implode(
', ', $biotic_envs);
204 if (in_array(
'Other', $biotic_envs) and !empty($page_2[
'study_info'][
'biotic_env'][
'other'])) {
205 $data[
'Custom Biotic Environment'] = $page_2[
'study_info'][
'biotic_env'][
'other'];
210 if (!empty($page_2[
'study_info'][
'treatment'][
'check'])) {
211 $treatment = &$page_2[
'study_info'][
'treatment'];
213 $description = FALSE;
215 foreach ($treatment as $field => $value) {
216 if ($field !=
'check') {
219 $selected = ($value) ? $field : FALSE;
222 elseif ($selected and !empty($value)) {
223 $data[
"Treatment: $selected description"] = $value;
225 $description = FALSE;
234 if (isset($page_3[
'#cleared']) and $page_3[
'#cleared']) {
235 $data[
'#page_3_cleared'] = TRUE;
238 $data[
'#page_3_cleared'] = FALSE;
241 $data[
'#skip_loc'] = !empty($page_3[
'skip_validation']);
242 $loc = &$page_3[
'study_location'];
243 $data[
'#location_type'] = (isset($loc[
'type']) and $loc[
'type']) ? $loc[
'type'] : NULL;
245 if ($data[
'#location_type'] ==
'2' and isset($loc[
'custom'])) {
246 $data[
'Study Location'] = $loc[
'custom'];
248 elseif ($data[
'#location_type'] and isset($loc[
'coordinates'])) {
249 $data[
'Study Location'] = $loc[
'coordinates'];
253 if (!empty($data[
'#number_organisms'])) {
254 for ($i = 1; $i <= $data[
'#number_organisms']; $i++) {
255 if (!empty($page_3[
"species-$i"][
'file'])) {
256 $organism_name = $data[
"Species $i"] .
' Accession File';
257 if ($data[
'#number_organisms'] > 1 and empty($page_3[
'check'])) {
258 $organism_name =
'Plant Accession File';
261 $data[$organism_name] = $page_3[
"species-$i"][
'file'];
262 $loc_type = $page_3[
"species-$i"][
'file-groups'][
'Location (latitude/longitude or country/state or population group)'][
'#type'] ?? NULL;
263 if (!empty($loc_type) and ($loc_type ==
"gps" or (array_search(
'gps', $loc_type) !== FALSE))) {
264 $fid = $page_3[
"species-$i"][
'file'];
267 'accession_files' => array(
269 'no_header' => $page_3[
"species-$i"][
'file-no-header'] ??
'0',
270 'id_col' => $page_3[
"species-$i"][
'file-groups'][
'Tree Id'][1],
271 'lat_col' => $page_3[
"species-$i"][
'file-groups'][
'Location (latitude/longitude or country/state or population group)'][4],
272 'long_col' => $page_3[
"species-$i"][
'file-groups'][
'Location (latitude/longitude or country/state or population group)'][5],
280 if (empty($page_3[
'check'])) {
286 $data[
"Total number of plants"] = $state[
'stats'][
'tree_count'] ?? NULL;
291 if (isset($page_4[
'#cleared']) and $page_4[
'#cleared']) {
292 $data[
'#page_4_cleared'] = TRUE;
295 $data[
'#page_4_cleared'] = FALSE;
297 if (!empty($data[
'#number_organisms'])) {
298 for ($i = 1; $i <= $data[
'#number_organisms']; $i++) {
299 if (isset($page_4[
"organism-$i"])) {
300 $org = &$page_4[
"organism-$i"];
301 $org_name = isset($data[
"Species $i"]) ? $data[
"Species $i"] : NULL;
303 if (isset($org[
'phenotype'])) {
304 $pheno = &$org[
'phenotype'];
306 if (!empty($pheno[
'iso-check'])) {
307 $data[
"$org_name Phenotype Isotope/Mass Spectrometry File"] = $pheno[
'iso'];
310 if (isset($pheno[
'phenotypes-meta'][
'number'])) {
311 $data[
'#number_phenotypes'] = $pheno[
'phenotypes-meta'][
'number'];
312 $pheno_meta = &$pheno[
'phenotypes-meta'];
313 for ($j = 1; $j <= $data[
'#number_phenotypes']; $j++) {
316 'attribute' =>
'Attribute',
317 'description' =>
'Description',
320 if (isset($pheno_meta[
"$j"][
'struct-check']) and $pheno_meta[
"$j"][
'struct-check']) {
321 $fields[
'structure'] =
'Structure';
323 if (isset($pheno_meta[
"$j"][
'val-check']) and $pheno_meta[
"$j"][
'val-check']) {
324 $fields[
'min'] =
'Minimum Value';
325 $fields[
'max'] =
'Maximum Value';
328 foreach ($fields as $field => $field_string) {
329 if (isset($pheno_meta[
"$j"][$field]) and $pheno_meta[
"$j"][$field] !=
'') {
330 $data[
"$org_name Phenotype $j $field_string"] = $pheno_meta[$j][$field];
336 if (isset($pheno[
'check']) and $pheno[
'check'] and isset($pheno[
'metadata']) and $pheno[
'metadata']) {
337 $data[
"$org_name Phenotype Metadata File"] = $pheno[
'metadata'];
340 if (isset($pheno[
'file']) and $pheno[
'file']) {
341 $data[
"$org_name Phenotype File"] = $pheno[
'file'];
343 $data[
"$org_name Phenotypes Assessed"] = isset($pheno[
'phenotype_count']) ? $pheno[
'phenotype_count'] : NULL;
347 if (isset($org[
'genotype'])) {
348 $geno = &$org[
'genotype'];
350 $marker_types = array();
351 foreach ($geno[
'marker-type'] as $key => $val) {
353 $marker_types[] = $key;
356 $data[
"$org_name Genotype Marker Types"] = isset($marker_types) ? implode(
', ', $marker_types) : NULL;
358 if (isset($geno[
'marker-type'][
'SNPs']) and $geno[
'marker-type'][
'SNPs']) {
359 $snp = $geno[
'SNPs'];
360 if (isset($snp[
'genotyping-design']) and $snp[
'genotyping-design']) {
361 $geno_design_options = array(
363 2 =>
'Targeted Capture',
364 3 =>
'Whole Genome Resequencing',
366 5 =>
'Genotyping Array',
368 if (isset($geno_design_options[$snp[
'genotyping-design']])) {
369 $data[
"$org_name Genotyping Design"] = $geno_design_options[$snp[
'genotyping-design']];
372 if (isset($data[
"$org_name Genotyping Design"]) and $data[
"$org_name Genotyping Design"] ==
'GBS' and isset($snp[
'GBS']) and $snp[
'GBS']) {
373 $gbs_options = array(
380 if (isset($gbs_options[$snp[
'GBS']])) {
381 $data[
"$org_name GBS Type"] = $gbs_options[$snp[
'GBS']];
384 if (isset($data[
"$org_name GBS Type"]) and $data[
"$org_name GBS Type"] ==
'Other' and isset($snp[
'GBS-other']) and $snp[
'GBS-other'] !=
'') {
385 $data[
"$org_name Custom GBS Type"] = $snp[
'GBS-other'];
389 if (isset($data[
"$org_name Genotyping Design"]) and $data[
"$org_name Genotyping Design"] ==
'Targeted Capture' and isset($snp[
'targeted-capture']) and $snp[
'targeted-capture']) {
390 $targeted_capture_options = array(
391 1 =>
'Exome Capture',
394 if (isset($targeted_capture_options[$snp[
'targeted-capture']])) {
395 $data[
"$org_name Targeted Capture Type"] = $targeted_capture_options[$snp[
'targeted-capture']];
398 if (isset($data[
"$org_name Targeted Capture Type"]) and $data[
"$org_name Targeted Capture Type"] ==
'Other' and isset($snp[
'targeted-capture-other']) and $snp[
'targeted-capture-other'] !=
'') {
399 $data[
"$org_name Custom Targeted Capture Type"] = $snp[
'targeted-capture-other'];
404 if (isset($geno[
'marker-type'][
'SSRs/cpSSRs']) and $geno[
'marker-type'][
'SSRs/cpSSRs'] and isset($geno[
'SSRs/cpSSRs']) and $geno[
'SSRs/cpSSRs'] !=
'') {
405 $data[
"$org_name SSRs/cpSSRs Type"] = $geno[
'SSRs/cpSSRs'];
407 if (isset($geno[
'marker-type'][
'Other']) and $geno[
'marker-type'][
'Other'] and isset($geno[
'other-marker']) and $geno[
'other-marker'] !=
'') {
408 $data[
"$org_name Other Marker Type"] = $geno[
'other-marker'];
411 if (isset($geno[
'ref-genome']) and $geno[
'ref-genome'] ===
'bio' and isset($geno[
'BioProject-id']) and $geno[
'BioProject-id'] !=
'') {
412 $data[
"$org_name BioProject Id"] = $geno[
'BioProject-id'];
414 if (isset($geno[
'assembly-auto']) and gettype($geno[
'assembly-auto']) ===
'array') {
416 foreach ($geno[
'assembly-auto'] as $id => $check) {
417 if (isset($check) and $check) {
418 $data[
"$org_name Linked Accession $count"] = $id;
424 elseif (isset($geno[
'ref-genome']) and ($geno[
'ref-genome'] ===
'manual' or $geno[
'ref-genome'] ===
'manual2') and isset($geno[
'tripal_fasta'][
'file'][
'file_upload']) and isset($geno[
'tripal_fasta'][
'file'][
'file_upload_existing']) and ($geno[
'tripal_fasta'][
'file'][
'file_upload'] or $geno[
'tripal_fasta'][
'file'][
'file_upload_existing'])) {
425 if ($geno[
'tripal_fasta'][
'file'][
'file_upload']) {
426 $data[
"$org_name Uploaded Reference File"] = $geno[
'tripal_fasta'][
'file'][
'file_upload'];
428 if ($geno[
'tripal_fasta'][
'file'][
'file_upload_existing']) {
429 $data[
"$org_name Reference File"] = $geno[
'tripal_fasta'][
'file'][
'file_upload_existing'];
432 elseif (isset($geno[
'ref-genome']) and $geno[
'ref-genome'] ===
'url' and isset($geno[
'tripal_fasta'][
'file'][
'file_remote']) and $geno[
'tripal_fasta'][
'file'][
'file_remote']) {
433 $data[
"$org_name Website of reference file"] = $geno[
'tripal_fasta'][
'file'][
'file_remote'];
435 elseif (isset($geno[
'ref-genome']) and $geno[
'ref-genome']) {
436 $data[
"$org_name Reference Genome"] = $geno[
'ref-genome'];
439 if (!empty($geno[
'files'][
'snps-assay'])) {
440 $data[
"$org_name SNPs Genotype Assay File"] = $geno[
'files'][
'snps-assay'];
443 if (!empty($geno[
'files'][
'assay-design'])) {
444 $data[
"$org_name Assay Design File"] = $geno[
'files'][
'assay-design'];
447 if (!empty($geno[
'files'][
'ssrs'])) {
448 $data[
"$org_name SSRs/cpSSRs Genotype File"] = $geno[
'files'][
'ssrs'];
451 if (!empty($geno[
'files'][
'ssrs_extra'])) {
452 $data[
"$org_name SSRs/cpSSRs Additional Genotype File"] = $geno[
'files'][
'ssrs_extra'];
455 if (!empty($geno[
'files'][
'indels'])) {
456 $data[
"$org_name Indel Genotype File"] = $geno[
'files'][
'indels'];
459 if (!empty($geno[
'files'][
'other'])) {
460 $data[
"$org_name Other Marker Genotype File"] = $geno[
'files'][
'other'];
463 if (!empty($geno[
'files'][
'vcf'])) {
464 $data[
"$org_name VCF File"] = $geno[
'files'][
'vcf'];
468 if (isset($org[
'environment'])) {
469 $env = &$org[
'environment'];
471 if (variable_get(
'tpps_cartogratree_env', FALSE)) {
472 $data[
"CartograPlant Layers"] = array();
473 foreach ($env[
'env_layers'] as $layer => $layer_id) {
474 if (!empty($layer_id)) {
475 $data[
"CartograPlant Layers"][] = $layer;
477 if (!empty($layer_id) and !empty($env[
'env_params'][$layer])) {
479 foreach ($env[
'env_params'][$layer] as $param => $param_id) {
480 if (!empty($param_id)) {
484 $data[
"CartograPlant Layer: $layer Parameters"] = implode(
', ', $params);
487 if (!empty($data[
"CartograPlant Layers"])) {
488 $data[
"CartograPlant Layers"] = implode(
', ', $data[
"CartograPlant Layers"]);
491 unset($data[
"CartograPlant Layers"]);
500 $sum_page = &$data[
'summarypage'];
501 if (!empty($sum_page[
'comments'])) {
502 $data[
"Additional Comments"] = $sum_page[
'comments'];
504 for ($i = 1; $i <= 10; $i++) {
505 if (!empty($sum_page[
'files'][$i])) {
506 $data[
"Supplemental File $i"] = $sum_page[
'files'][$i];
509 if (!empty($sum_page[
'tree_pictures'])) {
510 foreach ($sum_page[
'tree_pictures'] as $name => $fid) {
511 if (substr($name, -4) ==
'_url' or substr($name, -12) ==
'_attribution' or substr($name, -8) ==
'_license') {
515 $data[
"$name species photo"] = t(
'None provided');
518 $data[
"$name species photo"] = $fid;
522 unset($data[
'summarypage']);
524 $data[
'#dbxref_id'] = isset($state[
'dbxref_id']) ? $state[
'dbxref_id'] : NULL;
525 $data[
'#accession'] = isset($state[
'accession']) ? $state[
'accession'] : NULL;
526 $data[
'#status'] = isset($state[
'status']) ? $state[
'status'] : NULL;
528 foreach ($data as $key => $val) {
549 $map_api_key = variable_get(
'tpps_maps_api_key', NULL);
553 foreach ($flat as $key => $val) {
554 if ($key[0] !=
'#') {
555 $key_str = filter_xss(check_plain($key));
556 $val_str = filter_xss(check_plain($val));
558 if (preg_match(
'/File/', $key) and ($file = file_load($val))) {
560 $file_name = $file->filename;
561 $file_url = check_plain(file_create_url($file->uri));
562 $val_str =
"<a href='$file_url' target='blank'>$file_name</a>";
563 if (!empty($state[
'revised_files'][$val]) and ($revised_file = file_load($state[
'revised_files'][$val]))) {
564 $val = $state[
'revised_files'][$val];
565 $file_url = check_plain(file_create_url($revised_file->uri));
566 $file_name = $revised_file->filename;
567 $val_str =
"<a href='$file_url' target='blank'>$file_name</a> ( Revised from $val_str )";
569 $val_str .=
"<br><input id=\"fid_$val\" class=\"preview_button\" type=\"button\" value=\"Preview file\"></input>";
571 $val_str .=
"<br><input id=\"fid_$val\" class=\"preview_full_button\" type=\"button\" value=\"Show full file\"></input>";
573 if (preg_match(
'/^(.*)Accession File/', $key, $matches)) {
574 if (!$flat[
'#skip_loc']) {
576 $wrapper_id =
"{$fid}_map_wrapper";
577 $button_id =
"{$fid}_map_button";
578 $val_str .=
"<div id=\"$wrapper_id\"></div>" 579 .
"<input id=\"$button_id\" type=\"button\" value=\"Click here to view plants on map!\"></input>";
583 'map_buttons' => array(
585 'wrapper' => $wrapper_id,
586 'button' => $button_id,
594 $val_str .=
"<br>This submission was submitted without validating location information. As a result, we did not import location information for these plants.";
598 if (!empty($options[
'files'][
'revision_destination'])) {
599 $val_str .=
"<div id=\"file_{$file->fid}_options_dest\"></div>";
602 elseif (preg_match(
'/species photo/', $key) and (file_load($val)) and ($file_name = file_load($val)->filename)) {
603 $file_url = check_plain(file_create_url(file_load($val)->uri));
604 $val_str =
"<img src='$file_url' width='100%'>";
605 $val_str .=
"<br><a href='$file_url' target='blank'>$file_name</a>";
607 elseif (preg_match(
'/Month/', $key)) {
611 elseif (preg_match(
'/^(.*)Year/', $key, $matches)) {
613 if (isset($flat[$matches[1] .
'Month'])) {
614 $key_str = $matches[1] .
'Date';
615 $val_str =
"{$flat[$matches[1] . 'Month']} $val_str";
621 elseif (preg_match(
'/Study Location/', $key) and isset($flat[
'#location_type']) and $flat[
'#location_type']) {
623 if ($flat[
'#location_type'] ==
'2') {
629 $val_str =
"<a id=\"sidebar_map\" style=\"cursor:pointer\">$val_str</a>";
631 $map =
"<iframe frameborder=\\\"0\\\" style=\\\"border:0;width:100%;height:100%\\\" src=\\\"https://www.google.com/maps?q=$query&output=embed&key=AIzaSyDkeQ6KN6HEBxrIoiSCrCHFhIbipycqouY&z=5\\\" allowfullscreen> </iframe></div>";
632 $js =
"jQuery(document).ready(function ($) { 633 jQuery(\"#sidebar_map\").click(function() { 634 jQuery(\"#sidebar_map_wrapper\").remove(); 635 jQuery(\"#sidebar_map\").after( \"<br><div id=\\\"sidebar_map_wrapper\\\">$map</div>\" ); 638 drupal_add_js($js,
'inline');
641 elseif ($key ==
'Publication Abstract' and strlen($val_str) > 50) {
642 $val_str = substr($val_str, 0, 47) .
'...';
644 elseif ($key ==
'Publication DOI') {
645 $link = preg_match(
'/https?:\/\//', $val_str) ? $val_str :
"https://doi.org/$val_str";
646 $val_str =
"<a href=\"$link\" target=\"blank\">$val_str</a>";
648 elseif (!empty($options[
'skip_phenotypes']) and preg_match(
'/Phenotype/', $key)) {
652 $rows[] = array($key_str, $val_str);
654 elseif (preg_match(
'/^#(.*)accession_(.*)/', $key, $matches)) {
655 $val_str = filter_xss(check_plain($val));
656 $parts = explode(
" ", substr($matches[0], 1));
657 $item_id = implode(
"_", $parts);
658 $content .=
"<div id=\"$item_id\" style=\"display:none;\">$val_str</div>";
661 if (!empty($map_api_key)) {
662 $content .=
"<script src=\"https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js\"></script><script src=\"https://maps.googleapis.com/maps/api/js?key=$map_api_key&callback=initMap\" 663 async defer></script>";
672 'header' => $headers,
674 'attributes' => array(
675 'class' => array(
'view'),
676 'id' =>
'tpps_table_display',
685 if (!empty($flat[
'#study_photo'])) {
686 $url = check_plain(file_create_url(file_load($flat[
'#study_photo'])->uri));
687 $photo =
"<img src=\"$url\" style=\"display: block; margin-left: auto; margin-right: auto;\"></img>";
690 $display = $photo . theme(
'table', $vars) . $content;
709 $link =
"$base_url/tpps/details/$accession";
712 $values = $old_form_state[
'saved_values'];
715 .tgdr_complete_submission { 717 border: 1px solid #cccccc; 722 drupal_add_css($css,
'inline');
724 $display .=
"<label for='tpps_$accession'>{$values[TPPS_PAGE_1]['publication']['title']}</label><p>You can view the TPPS Details page with completed and approved TPPS and TGDR data <a href=\"$link\">here</a></p>";
726 $display .=
"<a href=\"$base_url/tpps/$accession/edit-publication\">Edit publication information</a>";
731 drupal_add_js(drupal_get_path(
'module',
'tpps') .
TPPS_JS_PATH);
732 drupal_add_css(drupal_get_path(
'module',
'tpps') .
TPPS_CSS_PATH);
734 return render($display);
751 $user = user_load($uid);
757 $params = drupal_get_query_parameters();
759 if (isset($params[
'accession']) and isset($params[
'action']) and $params[
'action'] ===
'DELETE') {
764 'status' =>
'Incomplete',
769 foreach ($states as $state) {
770 $prefix = !empty($state[
'tpps_type']) ? $state[
'tpps_type'] :
'tpps';
772 $title = $abstract = $accession_cell = NULL;
774 if (isset($page_1[
'publication'][
'title'])) {
775 $title =
"<a href='$base_url/$prefix/{$state['accession']}' style='text-decoration: underline;'>" . check_plain($page_1[
'publication'][
'title']) .
"</a>";
778 $title =
"<a href='$base_url/$prefix/{$state['accession']}' style='text-decoration: underline;'>No Title</a>";
781 if (isset($page_1[
'publication'][
'abstract'])) {
782 $abstract = check_plain($page_1[
'publication'][
'abstract']);
783 if (strlen($abstract) > 53) {
784 $abstract = substr($abstract, 0, 50) .
"...";
788 if (isset($state[
'accession'])) {
789 $accession_cell =
"<input type='submit' id='delete-{$state['accession']}' onclick='";
790 $name = isset($page_1[
'publication'][
'title']) ?
' titled ' . $page_1[
'publication'][
'title'] :
'';
791 $name = str_replace(
"'",
"", $name);
792 $name = str_replace(
'"',
"", $name);
793 $accession_cell .=
"if (confirm(\"Attention! \\n\\nAre you sure you want to delete your submission{$name}?\\nThis action cannot be undone, and all of your data will be lost!\")){window.location.href = \"$base_url/tpps-submission/{$state['accession']}/delete\"}";
794 $accession_cell .=
"' name='op' class='form-button' value='Delete'>";
799 isset($page_1[
'primaryAuthor']) ? $page_1[
'primaryAuthor'] :
"",
800 isset($page_1[
'organism'][
'number']) ? $page_1[
'organism'][
'number'] :
"",
801 isset($abstract) ? $abstract :
"",
802 isset($page_1[
'publication'][
'journal']) ? $page_1[
'publication'][
'journal'] :
"",
803 isset($accession_cell) ? $accession_cell :
"",
816 'header' => $headers,
818 'attributes' => array(
819 'class' => array(
'view'),
820 'id' =>
'tpps_incomplete_table',
828 $final = isset($state) ?
"<div class='tpps_table'><label for='tpps_incomplete_table'>Incomplete Submissions</label>" . theme(
'table', $vars) .
'</div>' :
"";
832 'status' => array(
'Pending Approval',
'Approved'),
837 foreach ($states as $state) {
839 $title = $abstract = NULL;
841 if (isset($page_1[
'publication'][
'title'])) {
842 $title =
"<a href='$base_url/completed-submission/{$state['accession']}' style='text-decoration: underline;'>" . check_plain($page_1[
'publication'][
'title']) .
"</a>";
845 $title =
"<a href='$base_url/completed-submission/{$state['accession']}' style='text-decoration: underline;'>No Title</a>";
848 if (isset($page_1[
'publication'][
'abstract'])) {
849 $abstract = check_plain($page_1[
'publication'][
'abstract']);
850 if (strlen($abstract) > 103) {
851 $abstract = substr($abstract, 0, 100) .
"...";
856 isset($title) ? $title :
"",
857 isset($page_1[
'primaryAuthor']) ? $page_1[
'primaryAuthor'] :
"",
858 isset($page_1[
'organism'][
'number']) ? $page_1[
'organism'][
'number'] :
"",
859 isset($abstract) ? $abstract :
"",
860 isset($page_1[
'publication'][
'journal']) ? $page_1[
'publication'][
'journal'] :
"",
861 isset($state[
'status']) ? $state[
'status'] :
"",
865 $headers[] =
'Status';
866 $vars[
'header'] = $headers;
867 $vars[
'rows'] = $rows;
868 $vars[
'attributes'][
'id'] =
'tpps_complete_table';
870 $final .= isset($state) ?
"<div class='tpps_table'><label for='tpps_complete_table'>Complete Submissions</label>" . theme(
'table', $vars) .
'</div>' :
"";
873 $final .=
"<h2>Could not find any Submissions</h2>";
874 $final .=
"<p>We could not find any incomplete TPPS Submissions or TPPS Submissions pending approval. If you would like to start a new TPPS Submission, you can start <a href=$base_url/tpps>here.</a></p>";
877 drupal_add_css(drupal_get_path(
'module',
'tpps') .
TPPS_CSS_PATH);
888 $params = drupal_get_query_parameters($_POST);
890 $fid = $params[
'fid'] ?? NULL;
894 $rows = $params[
'rows'] ?? 3;
895 $file = file_load($fid);
899 if ($extension ==
'vcf') {
902 $vcf_content = gzopen($location,
'r');
903 while (($vcf_line = gzgets($vcf_content)) !== FALSE) {
904 $display .= $vcf_line .
"<br>";
906 if ($count > $rows) {
910 print(render($display));
914 if ((file_load($fid))) {
917 for ($i = 0; $i < count($content) - 1; $i++) {
918 $rows[] = $content[$i];
921 'header' => $content[
'headers'],
923 'attributes' => array(
928 'id' =>
'tpps_table_display',
935 $display = render(theme(
'table', $vars));
956 $bundle = tripal_load_bundle_entity(array(
'label' => $label));
957 if (empty($bundle)) {
960 $entity_id = chado_get_record_entity_by_bundle($bundle, $id);
961 if (!empty($entity_id)) {
962 return "<a href=\"$base_url/bio_data/$entity_id\">$name</a>";
978 foreach ($tags as $tag) {
979 $color = !empty($tag[
'color']) ? $tag[
'color'] :
'white';
980 $display .=
"<span class=\"tag\" style=\"background-color:$color\"><span class=\"tag-text\">{$tag['name']}</span></span>";
tpps_standard_coord($raw_coordinate)
tpps_flatten(array $state)
tpps_completed_display($accession=NULL)
tpps_show_tags(array $tags)
tpps_entity_link($id, $name, $label)
tpps_get_path_extension($path)
tpps_delete_submission($accession, $redirect=TRUE)
tpps_table_display(array &$state, array $options=array())
tpps_load_submission($accession, $state=TRUE)
tpps_load_submission_multiple(array $conditions=array(), $state=TRUE)
tpps_get_location($location)
tpps_parse_file($fid, $max_rows=0, $no_header=FALSE, $columns=NULL)