function render_row(&$row) { global $gDisableEditing; $html = ""; $this->row_transition($row); $id_prefix = "v_{$row['variant_id']}__a_{$row['article_pmid']}__g_{$row['genome_id']}__d_{$row['disease_id']}__p_{$row['edit_id']}__"; $title = ""; foreach (array("article_pmid", "genome_id", "disease_id") as $keyfield) { if (strlen($row[$keyfield]) == 0) { $row[$keyfield] = 0; } } if ($row["disease_id"] != "0") { $tr = editable("{$id_prefix}f_summary_short__8x1__oddsratio", $row["summary_short"], $row["disease_name"] . "<BR />", array("rownumber" => $this->rownumber, "tip" => "Indicate the contribution of this article to OR statistics for " . htmlspecialchars($row["disease_name"]) . ".")); if ($tr != "") { if ($this->rownumber == 0) { $html .= $this->starttable; } $html .= $tr; ++$this->rownumber; } } else { if ($row["article_pmid"] != "0") { $html .= "<A name=\"a" . htmlentities($row["article_pmid"]) . "\"></A>\n"; $summary = article_get_summary($row["article_pmid"]); $html .= editable("{$id_prefix}f_summary_short__70x8__textile", $row[summary_short], $summary . "<BR />", array("tip" => "Explain this article's contribution to the conclusions drawn in the variant summary above.")); } else { if ($row["genome_id"] != "0") { $html .= "<A name=\"g" . $row["genome_id"] . "\"></A>\n"; // Pick the most human-readable name for this genome/person if (!($name = $row["name"])) { if (!($name = $row["global_human_id"])) { $name = "[" . $row["genome_id"] . "]"; } } $name = htmlspecialchars($name); // Link to the full genome(s) if ($row["dataset_count"] > 0) { $name = "<A href=\"{$row['dataset_url']}\">{$name}</A>"; } if ($row["dataset_count"] > 1) { $more = $row["dataset_count"] - 1; $name .= " ("; if ($row["dataset_url_2"]) { $name .= "<A href=\"{$row['dataset_url_2']}\">alternate</A>, "; --$more; } if ($more > 1) { $name .= "plus {$more} other data sets"; } else { if ($more == 1) { $name .= "plus 1 other data set"; } else { $name = ereg_replace(", \$", "", $name); } } $name .= ")"; } // Indicate the SNP that causes the variant if ($row["chr"]) { $name .= htmlspecialchars("\n" . substr($row["zygosity"], 0, 3) . " " . $row["allele"] . " @ " . $row["chr"] . ":" . $row["chr_pos"]); $name = nl2br($name); } $html .= editable("{$id_prefix}f_summary_short__70x8__textile", $row[summary_short], $name); } else { if ($row["disease_id"] != "0") { // Disease summary not attached to any particular publication } else { $html .= editable("{$id_prefix}f_summary_short__70x8__textile", $row[summary_short], "Short summary", array("tip" => "Provide a one line summary of clinical action to be undertaken given this variant (possibly modified by known phenotypes).")); $html .= editable("{$id_prefix}f_variant_quality", $row, "Variant quality"); global $gImpactOptions; $opts =& $gImpactOptions; $qualified_impact = evidence_qualify_impact($row["variant_quality"], $row["variant_impact"]); $html .= editable("{$id_prefix}f_variant_impact__", $row["variant_impact"], "Impact", array("select_options" => $opts, "previewtextile" => $qualified_impact, "tip" => "Categorize the expected impact of this variant.")); if (strtolower($qualified_impact) != strtolower($row["variant_impact"])) { $html .= "<P><I>(The \"" . strtolower(eregi_replace(",? " . $row["variant_impact"], "", $qualified_impact)) . "\" qualifier is assigned automatically based on the above evidence and importance scores.)</I></P>"; } global $gInheritanceOptions; $html .= editable("{$id_prefix}f_variant_dominance__", $row[variant_dominance], "Inheritance pattern", array("select_options" => $gInheritanceOptions)); $html .= editable("{$id_prefix}f_summary_long__70x8__textile", $row[summary_long], "Summary of published research, and additional commentary", array("tip" => "Provide a comprehensive review of the variant including youngest age of onset, oldest age of onset and oldest asymptomatic individual.")); } } } } if ($html == "") { return; } if (ereg('^<(TABLE|TR)', $html)) { // TODO: handle is_delete and flag_edited_id for table rows // somehow; for now just don't indicate them at all if ($row["is_delete"]) { return; } if ($row["flag_edited_id"]) { $this->html .= $html; return; } } else { if (!$gDisableEditing && getCurrentUser() || 0 < strlen($row["talk_text"])) { $show_label = 0 < strlen($row["talk_text"]) ? "<B>show discussion</B>" : "start discussion"; $html .= "<DIV class=\"rectangle-speech-border-hidden\"><DIV>{$show_label}</DIV>"; $html .= editable("{$id_prefix}f_talk_text__70x8__textile", $row[talk_text], "Discussion<BR />", array("tip" => "Comments about this section")); $html .= "</DIV>"; } } if ($row["is_delete"]) { $html .= "<DIV style=\"outline: 1px dashed #300; background-color: #fdd; color: #300; padding: 20px 20px 0 20px; margin: 0 0 10px 0;\"><P>Deleted in this revision:</P>{$html}</DIV>"; } else { if ($row["flag_edited_id"]) { if ($row["previous_edit_id"]) { $edited = "Edited"; } else { $edited = "Added"; } $html = "<DIV style=\"outline: 1px dashed #300; background-color: #dfd; color: #300; padding: 20px 20px 0 20px; margin: 0 0 10px 0;\"><P>{$edited} in this revision:</P>\n{$html}</DIV>"; } } $this->html .= $html; }
function editable_quality_preview(&$rationale) { global $gTheTextile; $html = ''; $html .= $gTheTextile->textileRestricted($rationale["text"]); if ($rationale["seealso"] && sizeof($rationale["seealso"])) { $html .= "<P>See "; foreach ($rationale["seealso"] as $a) { if ($a == "0") { $html .= "unpublished research (below)"; continue; } $summary = preg_replace('/<.*?>/', '', article_get_summary($a)); if (preg_match('/^(.*?)(\\.|,.*?\\.).*?\\..*?\\.\\s*(\\d\\d\\d\\d)[;\\s]/s', $summary, $regs)) { $summary = $regs[1] . ($regs[2] == '.' ? '' : ' et al.') . ' ' . $regs[3] . ' (' . $a . ')'; } else { $summary = $a; } $html .= "<SPAN onmouseover=\"evidence_article_citation_tip(this,'{$a}');\" onmouseout=\"UnTip();\">{$summary}</SPAN>"; $html .= ", "; } $html = ereg_replace(', $', '', $html); $html .= ".</P>\n"; } return $html; }