Example #1
0
 function prepareData($zData = '', $sView = 'list')
 {
     // Prepares the data by "enriching" the variable received with links, pictures, etc.
     if (!in_array($sView, array('list', 'entry'))) {
         $sView = 'list';
     }
     // Makes sure it's an array and htmlspecialchars() all the values.
     $zData = parent::prepareData($zData, $sView);
     if ($sView == 'list') {
         $zData['row_id'] = $zData['id'];
         if ($this->sObjectID) {
             // Can't use CURRENT_PATH here, because that might resolve to the ajax/viewlist.php file.
             $zData['row_link'] = (ctype_digit($this->sObjectID) ? 'diseases' : 'genes') . '/' . $this->sObjectID . '/columns/' . $zData['colid'];
             // Note: I chose not to use rawurlencode() here!
             $zData['colid_'] = '<A href="' . $zData['row_link'] . '" class="hide">' . $zData['colid'] . '</A>';
         }
         $zData['form_type_'] = lovd_describeFormType($zData);
     } else {
         // Remove unnecessary columns.
         if ($zData['edited_by'] == NULL) {
             // Never been edited.
             unset($this->aColumnsViewEntry['edited_by_'], $this->aColumnsViewEntry['edited_date']);
         }
         // Remove columns based on form type?
         $aFormType = explode('|', $zData['form_type']);
         if ($aFormType[2] != 'select') {
             unset($this->aColumnsViewEntry['select_options']);
         }
         $zData['description_legend_short'] = html_entity_decode(str_replace(array("\r", "\n"), ' ', $zData['description_legend_short']));
         $zData['description_legend_full'] = html_entity_decode(str_replace(array("\r", "\n"), ' ', $zData['description_legend_full']));
         $zData['public_add_'] = '<IMG src="gfx/mark_' . $zData['public_add'] . '.png" alt="" width="11" height="11">';
     }
     // FIXME; for titles use tooltips?
     $zData['mandatory_'] = '<IMG src="gfx/mark_' . $zData['mandatory'] . '.png" alt="" width="11" height="11">';
     $zData['public_view_'] = '<IMG src="gfx/mark_' . $zData['public_view'] . '.png" alt="" width="11" height="11">';
     return $zData;
 }
Example #2
0
 function prepareData($zData = '', $sView = 'list')
 {
     // Prepares the data by "enriching" the variable received with links, pictures, etc.
     if (!in_array($sView, array('list', 'entry'))) {
         $sView = 'list';
     }
     // Makes sure it's an array and htmlspecialchars() all the values.
     $zData = parent::prepareData($zData, $sView);
     if ($sView == 'list') {
         $zData['row_id'] = $zData['id'];
         $zData['row_link'] = 'columns/' . $zData['id'];
         // Note: I chose not to use rawurlencode() here!
         $zData['colid_'] = '<A href="' . $zData['row_link'] . '" class="hide">' . $zData['colid'] . '</A>';
         $zData['form_type_'] = lovd_describeFormType($zData);
     } else {
         // Remove unnecessary columns.
         if ($zData['edited_by'] == NULL) {
             // Never been edited.
             unset($this->aColumnsViewEntry['edited_by_'], $this->aColumnsViewEntry['edited_date']);
         }
         // Remove columns based on form type?
         $aFormType = explode('|', $zData['form_type']);
         if ($aFormType[2] != 'select') {
             unset($this->aColumnsViewEntry['select_options']);
         } else {
             unset($this->aColumnsViewEntry['preg_pattern']);
         }
         $zData['mandatory_'] = '<IMG src="gfx/mark_' . $zData['mandatory'] . '.png" alt="" width="11" height="11">';
         $zData['description_legend_short'] = html_entity_decode(str_replace(array("\r", "\n"), ' ', $zData['description_legend_short']));
         $zData['description_legend_full'] = html_entity_decode(str_replace(array("\r", "\n"), ' ', $zData['description_legend_full']));
         $zData['form_type_'] = lovd_describeFormType($zData) . '<BR>' . $zData['form_type'];
         $zData['public_add_'] = '<IMG src="gfx/mark_' . $zData['public_add'] . '.png" alt="" width="11" height="11">';
         $zData['allow_count_all_'] = '<IMG src="gfx/mark_' . $zData['allow_count_all'] . '.png" alt="" width="11" height="11">';
         if ($zData['category'] == 'VariantOnTranscript') {
             // Show genes for which this column is activated.
             $this->aColumnsViewEntry['parent_objects'] = 'Column activated for genes';
             $zData['parent_objects'] = $this->lovd_getObjectLinksHTML($zData['genes'], 'genes/%s');
         } elseif ($zData['category'] == 'Phenotype') {
             // Show diseases for which this column is activated.
             $this->aColumnsViewEntry['parent_objects'] = "Column activated for diseases";
             $zData['parent_objects'] = $this->lovd_getObjectLinksHTML($zData['diseases'], 'diseases/%s');
         } else {
             unset($this->aColumnsViewEntry['parent_objects']);
         }
     }
     // FIXME; for titles use tooltips?
     $zData['active_'] = '<IMG src="gfx/mark_' . (int) $zData['active'] . '.png" alt="" width="11" height="11">';
     $zData['hgvs_'] = '<IMG src="gfx/mark_' . $zData['hgvs'] . '.png" alt="" title="This column is ' . ($zData['hgvs'] ? '' : 'not ') . 'required by the HGVS standards for sequence variant databases" width="11" height="11">';
     $zData['standard_'] = '<IMG src="gfx/mark_' . $zData['standard'] . '.png" alt="" title="This column is ' . ($zData['standard'] ? '' : 'not ') . 'enabled by default" width="11" height="11">';
     $zData['public_view_'] = '<IMG src="gfx/mark_' . $zData['public_view'] . '.png" alt="" width="11" height="11">';
     return $zData;
 }
Example #3
0
 function prepareData($zData = '', $sView = 'list')
 {
     // Prepares the data by "enriching" the variable received with links, pictures, etc.
     if (!in_array($sView, array('list'))) {
         $sView = 'list';
     }
     // Makes sure it's an array and htmlspecialchars() all the values.
     $zData = parent::prepareData($zData, $sView);
     $zData['user_'] = '<A href="users/' . $zData['userid'] . '">' . $zData['user'] . '</A>';
     $zData['del'] = '<A href="#" onclick="lovd_AJAX_deleteLogEntry(\'Logs\', \'' . $zData['row_id'] . '\'); return false;"><IMG src="gfx/mark_0.png" alt="Delete" title="Delete" width="11" height="11" style="margin-top : 3px;"/></A>';
     $zData['entry'] = str_replace(array("\r\n", "\r", "\n"), '<BR/>', $zData['log']);
     $zData['entry'] = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;", $zData['entry']);
     // 2013-09-30; 3.0-08; Make log entry texts clickable.
     switch ($zData['event']) {
         case 'ColCreate':
             $zData['entry'] = preg_replace('/(link) ([0-9]+) /', '$1 <A href="links/$2">$2</A> ', $zData['entry']);
         case 'ColAdd':
         case 'ColEdit':
         case 'ColRemove':
             $zData['entry'] = preg_replace('/olumn ([A-Z][A-Za-z0-9\\/_]+) /', 'olumn <A href="columns/$1">$1</A> ', $zData['entry']);
             break;
         case 'DiseaseCreate':
         case 'DiseaseEdit':
             $zData['entry'] = preg_replace('/(disease|entry) ([0-9]+)( .+)?$/', '$1 <A href="diseases/$2">$2</A>$3', $zData['entry']);
             break;
         case 'CuratorAuthorize':
         case 'CuratorSort':
             $zData['entry'] = preg_replace('/the ([A-Z][A-Za-z0-9-]+) gene/', 'the <A href="genes/$1">$1</A> gene', $zData['entry']);
             $zData['entry'] = preg_replace('/#([0-9]+)\\s/', '#<A href="users/$1">$1</A> ', $zData['entry']);
             break;
         case 'GeneCreate':
         case 'GeneEdit':
         case 'GeneEmpty':
         case 'TranscriptCreate':
             $zData['entry'] = preg_replace('/(database|entry|gene|the) ([A-Z][A-Za-z0-9-]+)([ ;].+)?$/', '$1 <A href="genes/$2">$2</A>$3', $zData['entry']);
             break;
         case 'IndividualCreate':
         case 'IndividualEdit':
             $zData['entry'] = preg_replace('/(entry|individual) ([0-9]{8})( .+)?$/', '$1 <A href="individuals/$2">$2</A>$3', $zData['entry']);
             break;
         case 'LinkCreate':
         case 'LinkEdit':
             $zData['entry'] = preg_replace('/(link) ([0-9]+) /', '$1 <A href="links/$2">$2</A> ', $zData['entry']);
             break;
         case 'PhenotypeCreate':
             $zData['entry'] = preg_replace('/(entry) ([0-9]+) /', '$1 <A href="phenotypes/$2">$2</A> ', $zData['entry']);
             $zData['entry'] = preg_replace('/(individual) ([0-9]+) /', '$1 <A href="individuals/$2">$2</A> ', $zData['entry']);
             $zData['entry'] = preg_replace('/(disease) ([0-9]+)$/', '$1 <A href="diseases/$2">$2</A>', $zData['entry']);
             break;
         case 'PhenotypeEdit':
             $zData['entry'] = preg_replace('/(entry) ([0-9]+)$/', '$1 <A href="phenotypes/$2">$2</A>', $zData['entry']);
             break;
         case 'ScreeningCreate':
         case 'ScreeningEdit':
         case 'VariantConfirm':
         case 'VariantRemove':
             $zData['entry'] = preg_replace('/(entry|screening) (#)?([0-9]+)$/', '$1 $2<A href="screenings/$3">$3</A>', $zData['entry']);
             break;
         case 'TranscriptEdit':
             $zData['entry'] = preg_replace('/(entry) (#)?([0-9]+) /', '$1 $2<A href="transcripts/$3">$3</A> ', $zData['entry']);
             break;
         case 'ShareAccess':
             $zData['entry'] = preg_replace('/(user) (#)?([0-9]+)/', '$1 $2<A href="users/$3">$3</A>', $zData['entry']);
             break;
         case 'UserBoot':
         case 'UserCreate':
         case 'UserEdit':
         case 'UserLock':
         case 'UserRegister':
         case 'UserResetPassword':
         case 'UserUnlock':
             $zData['entry'] = preg_replace('/(ID|user) (#)?([0-9]+)( .+)?$/', '$1 $2<A href="users/$3">$3</A>$4', $zData['entry']);
             break;
         case 'VariantCreate':
         case 'VariantEdit':
         case 'VariantMap':
             $zData['entry'] = preg_replace('/(entry|variant) (#)?([0-9]+)( .+)?$/', '$1 $2<A href="variants/$3">$3</A>$4', $zData['entry']);
             break;
     }
     return $zData;
 }
Example #4
0
 function prepareData($zData = '', $sView = 'list')
 {
     global $_SETT;
     // Prepares the data by "enriching" the variable received with links, pictures, etc.
     if (!in_array($sView, array('list', 'entry'))) {
         $sView = 'list';
     }
     // Makes sure it's an array and htmlspecialchars() all the values.
     $zData = parent::prepareData($zData, $sView);
     if ($sView != 'list') {
         $zData['gene_name_'] = '<A href="genes/' . rawurlencode($zData['geneid']) . '">' . $zData['geneid'] . '</A> (' . $zData['gene_name'] . ')';
         $sNCBILink = $zData['id_ncbi'];
         // For mitochondrial genes we have to change the NCBI URL.
         if (isset($_SETT['mito_genes_aliases'][$zData['geneid']])) {
             $sNCBILink = str_replace('(' . $_SETT['mito_genes_aliases'][$zData['geneid']] . '_v001)', '', $zData['id_ncbi']);
         }
         $zData['id_ncbi_'] = '<A href="http://www.ncbi.nlm.nih.gov/nuccore/' . $sNCBILink . '" target="_blank">' . $zData['id_ncbi'] . '</A>';
         // Exon/intron info table. Check if files exist, and build link. Otherwise, remove field.
         $sExonTable = '';
         $sExonTableFileHTML = ROOT_PATH . 'refseq/' . $zData['geneid'] . '_' . $zData['id_ncbi'] . '_table.html';
         $sExonTableFileTXT = ROOT_PATH . 'refseq/' . $zData['geneid'] . '_' . $zData['id_ncbi'] . '_table.txt';
         if (is_readable($sExonTableFileHTML)) {
             $sExonTable .= (!$sExonTable ? '' : ', ') . '<A href="' . $sExonTableFileHTML . '" target="_blank">HTML</A>';
         }
         if (is_readable($sExonTableFileTXT)) {
             $sExonTable .= (!$sExonTable ? '' : ', ') . '<A href="' . $sExonTableFileTXT . '" target="_blank">Txt</A>';
         }
         if ($sExonTable) {
             $zData['exon_table'] = 'Exon/intron information table: ' . $sExonTable;
         } else {
             unset($this->aColumnsViewEntry['exon_table']);
         }
     }
     return $zData;
 }
Example #5
0
 function prepareData($zData = '', $sView = 'list')
 {
     // Prepares the data by "enriching" the variable received with links, pictures, etc.
     global $_DB, $_SETT;
     if (!in_array($sView, array('list', 'entry'))) {
         $sView = 'list';
     }
     // Makes sure it's an array and htmlspecialchars() all the values.
     $zData = parent::prepareData($zData, $sView);
     $zData['active'] = file_exists(session_save_path() . '/sess_' . $zData['phpsessid']);
     if ($sView == 'list') {
         $zData['orcid_id_'] = !$zData['orcid_id'] ? '&nbsp;' : '<IMG src="gfx/check.png" alt="' . $zData['orcid_id'] . '" title="' . $zData['orcid_id'] . '">';
         $zData['name'] = '<A href="' . $zData['row_link'] . '" class="hide">' . $zData['name'] . '</A>';
         $sAlt = $zData['active'] ? 'Online' : ($zData['locked'] ? 'Locked' : 'Offline');
         $zData['status_'] = $zData['locked'] || $zData['active'] ? '<IMG src="gfx/' . ($zData['locked'] ? 'status_locked' : 'status_online') . '.png" alt="' . $sAlt . '" title="' . $sAlt . '" width="14" height="14">' : '';
         $zData['last_login_'] = substr($zData['last_login'], 0, 10);
         $zData['created_date_'] = substr($zData['created_date'], 0, 10);
         $zData['level_'] = substr($zData['level_'], 1);
     } else {
         $zData['orcid_id_'] = '';
         if ($zData['orcid_id']) {
             $zData['orcid_id_'] = '<A href="http://orcid.org/' . $zData['orcid_id'] . '" target="_blank">' . $zData['orcid_id'] . '</A>';
         }
         $zData['password_force_change_'] = $zData['password_force_change'] ? '<IMG src="gfx/mark_1.png" alt="" width="11" height="11"> Yes' : 'No';
         if (!empty($zData['saved_work'])) {
             $zData['saved_work'] = unserialize(htmlspecialchars_decode($zData['saved_work']));
             if (!empty($zData['saved_work']['submissions']['individual']) || !empty($zData['saved_work']['submissions']['screening'])) {
                 $zData['saved_work_'] = '<A href="users/' . $zData['id'] . '?submissions">Unfinished submissions</A>';
             } else {
                 $zData['saved_work_'] = 'N/A';
             }
         } else {
             $zData['saved_work_'] = 'N/A';
         }
         // Provide links to gene symbols this user is curator and collaborator for. Easy access to one's own genes.
         $this->aColumnsViewEntry['curates_'] .= ' ' . count($zData['curates']) . ' gene' . (count($zData['curates']) == 1 ? '' : 's');
         if (isset($this->aColumnsViewEntry['collaborates_'])) {
             // This is only visible for Curators, so we don't want to mess around with aColumnsViewEntry when this field is no longer there.
             $this->aColumnsViewEntry['collaborates_'][0] .= ' ' . count($zData['collaborates']) . ' gene' . (count($zData['collaborates']) == 1 ? '' : 's');
         }
         // Get HTML links for genes curated by current user.
         $zData['curates_'] = $this->lovd_getObjectLinksHTML($zData['curates'], 'genes/%s');
         $zData['collaborates_'] = '';
         foreach ($zData['collaborates'] as $key => $sGene) {
             $zData['collaborates_'] .= (!$key ? '' : ', ') . '<A href="genes/' . $sGene . '">' . $sGene . '</A>';
         }
         // Submissions...
         if (lovd_isAuthorized('user', $zData['id']) === false) {
             // Not authorized to view hidden data for this user; so we're not manager and we're not viewing ourselves. Nevermind then.
             unset($this->aColumnsViewEntry['ownes_']);
         } else {
             // Either we're viewing ourselves, or we're manager or up. Like this is easy, because now we don't need to check for the data status of the data.
             $nOwnes = 0;
             $sOwnes = '';
             // FIXME: Phenotypes is not included, because we don't have a phenotypes overview to link to (must be disease-specific).
             foreach (array('individuals', 'screenings', 'variants') as $sDataType) {
                 $n = $_DB->query('SELECT COUNT(*) FROM ' . constant('TABLE_' . strtoupper($sDataType)) . ' WHERE owned_by = ?', array($zData['id']))->fetchColumn();
                 if ($n) {
                     $nOwnes += $n;
                     $sOwnes .= (!$sOwnes ? '' : ', ') . '<A href="' . $sDataType . '?search_owned_by_=%3D%22' . rawurlencode(html_entity_decode($zData['name'])) . '%22">' . $n . ' ' . ($n == 1 ? substr($sDataType, 0, -1) : $sDataType) . '</A>';
                 }
             }
             $this->aColumnsViewEntry['ownes_'] .= ' ' . $nOwnes . ' data entr' . ($nOwnes == 1 ? 'y' : 'ies');
             $zData['ownes_'] = $sOwnes;
         }
         $this->aColumnsViewEntry['colleagues_'] = 'Shares access with ' . count($zData['colleagues']) . ' user' . (count($zData['colleagues']) == 1 ? '' : 's');
         $zData['colleagues_'] = $this->lovd_getObjectLinksHTML($zData['colleagues'], 'users/%s');
         $zData['allowed_ip_'] = preg_replace('/[;,]+/', '<BR>', $zData['allowed_ip']);
         $zData['status_'] = $zData['active'] ? '<IMG src="gfx/status_online.png" alt="Online" title="Online" width="14" height="14" align="top"> Online' : 'Offline';
         $zData['locked_'] = $zData['locked'] ? '<IMG src="gfx/status_locked.png" alt="Locked" title="Locked" width="14" height="14" align="top"> Locked' : 'No';
         $zData['level_'] = $_SETT['user_levels'][$zData['level']];
     }
     return $zData;
 }
Example #6
0
 function prepareData($zData = '', $sView = 'list')
 {
     // Prepares the data by "enriching" the variable received with links, pictures, etc.
     if (!in_array($sView, array('list', 'entry'))) {
         $sView = 'list';
     }
     // Makes sure it's an array and htmlspecialchars() all the values.
     $zData = parent::prepareData($zData, $sView);
     if ($sView == 'list') {
         $zData['type_'] = '<IMG src="gfx/lovd_form_' . $zData['type'] . '.png" alt="' . $zData['type'] . '" title="' . $zData['type'] . '" width="16" height="16">';
     } else {
         $zData['announcement'] = html_entity_decode($zData['announcement']);
     }
     $zData['lovd_read_only_'] = '<IMG src="gfx/mark_' . (int) $zData['lovd_read_only'] . '.png" alt="" width="11" height="11">';
     return $zData;
 }
Example #7
0
 function prepareData($zData = '', $sView = 'list')
 {
     // Prepares the data by "enriching" the variable received with links, pictures, etc.
     if (!in_array($sView, array('list', 'entry'))) {
         $sView = 'list';
     }
     // Makes sure it's an array and htmlspecialchars() all the values.
     $zData = parent::prepareData($zData, $sView);
     if ($sView == 'list') {
         $zData['row_id'] = $zData['id'];
         $zData['symbol'] = '<A href="' . $zData['row_link'] . '" class="hide">' . $zData['symbol'] . '</A>';
         $zData['genes_'] = '';
         $i = 0;
         if (count($zData['genes']) > 22) {
             // Don't show all genes.
             foreach ($zData['genes'] as $key => $sID) {
                 $zData['genes_'] .= (!$key ? '' : ', ') . $sID;
                 $i++;
                 if ($i >= 20) {
                     break;
                 }
             }
             $zData['genes_'] .= ', ' . ($zData['gene_count'] - $i) . ' more';
         } else {
             $zData['genes_'] = implode(', ', $zData['genes']);
         }
     } else {
         if (!empty($zData['id_omim'])) {
             $zData['id_omim'] = '<A href="' . lovd_getExternalSource('omim', $zData['id_omim'], true) . '" target="_blank">' . $zData['id_omim'] . '</A>';
         }
         $zData['phenotypes_'] = $zData['phenotypes'];
         if ($zData['phenotypes']) {
             $zData['phenotypes_'] = '<A href="phenotypes/disease/' . $zData['id'] . '">' . $zData['phenotypes'] . '</A>';
         }
         // Provide links to gene symbols this disease is associated with.
         $this->aColumnsViewEntry['genes_'] .= ' ' . count($zData['genes']) . ' gene' . (count($zData['genes']) == 1 ? '' : 's');
         $zData['genes_'] = '';
         $zData['genes_short_'] = '';
         $i = 0;
         foreach ($zData['genes'] as $key => $sID) {
             $zData['genes_'] .= (!$key ? '' : ', ') . '<A href="genes/' . $sID . '">' . $sID . '</A>';
             if ($i < 20) {
                 $zData['genes_short_'] .= (!$key ? '' : ', ') . '<A href="genes/' . $sID . '">' . $sID . '</A>';
                 $i++;
             }
         }
         if (count($zData['genes']) > 22) {
             // Replace long gene list by shorter one, allowing expand.
             $zData['genes_'] = '<SPAN>' . $zData['genes_short_'] . ', <A href="#" onclick="$(this).parent().hide(); $(this).parent().next().show(); return false;">' . (count($zData['genes']) - $i) . ' more...</A></SPAN><SPAN style="display : none;">' . $zData['genes_'] . '</SPAN>';
         }
     }
     return $zData;
 }
Example #8
0
 function prepareData($zData = '', $sView = 'list')
 {
     // Prepares the data by "enriching" the variable received with links, pictures, etc.
     global $_AUTH, $_CONF, $_DB, $_SETT;
     if (!in_array($sView, array('list', 'entry'))) {
         $sView = 'list';
     }
     // Makes sure it's an array and htmlspecialchars() all the values.
     $zData = parent::prepareData($zData, $sView);
     if ($sView == 'list') {
         $zData['updated_date_'] = substr($zData['updated_date'], 0, 10);
     } else {
         $zData['imprinting_'] = $_SETT['gene_imprinting'][$zData['imprinting']];
         // FIXME; zou dit een external source moeten zijn?
         $zData['refseq_genomic_'] = '<A href="' . (substr($zData['refseq_genomic'], 0, 3) == 'LRG' ? 'ftp://ftp.ebi.ac.uk/pub/databases/lrgex/' . $zData['refseq_genomic'] . '.xml' : 'http://www.ncbi.nlm.nih.gov/nuccore/' . $zData['refseq_genomic']) . '" target="_blank">' . $zData['refseq_genomic'] . '</A>';
         $zData['refseq_UD_'] = '<A href="' . str_replace('services', 'Reference/', $_CONF['mutalyzer_soap_url']) . $zData['refseq_UD'] . '.gb" target="_blank">' . $zData['refseq_UD'] . '</A>';
         // Transcript links and exon/intron info table. Check if files exist, and build link. Otherwise, remove field.
         $zData['refseq_transcript_'] = '';
         $zData['exon_tables'] = '';
         foreach ($zData['transcripts'] as $aTranscript) {
             list($nTranscriptID, $sNCBI) = $aTranscript;
             $zData['refseq_transcript_'] .= (!$zData['refseq_transcript_'] ? '' : ', ') . '<A href="transcripts/' . $nTranscriptID . '">' . $sNCBI . '</A>';
             $sExonTableFile = ROOT_PATH . 'refseq/' . $zData['id'] . '_' . $sNCBI . '_table.html';
             if (is_readable($sExonTableFile)) {
                 $zData['exon_tables'] .= (!$zData['exon_tables'] ? '' : ', ') . '<A href="' . $sExonTableFile . '" target="_blank">' . $sNCBI . '</A>';
             }
         }
         if (!$zData['refseq_transcript_']) {
             unset($this->aColumnsViewEntry['refseq_transcript_']);
         }
         if (!$zData['exon_tables']) {
             unset($this->aColumnsViewEntry['exon_tables']);
         }
         // Associated with diseases...
         $zData['diseases_'] = '';
         $zData['disease_omim_'] = '';
         foreach ($zData['diseases'] as $aDisease) {
             list($nID, $nOMIMID, $sSymbol, $sName) = $aDisease;
             // Link to disease entry in LOVD.
             $zData['diseases_'] .= (!$zData['diseases_'] ? '' : ', ') . '<A href="diseases/' . $nID . '">' . $sSymbol . '</A>';
             if ($nOMIMID) {
                 // Add link to OMIM for each disease that has an OMIM ID.
                 $zData['disease_omim_'] .= (!$zData['disease_omim_'] ? '' : '<BR>') . '<A href="' . lovd_getExternalSource('omim', $nOMIMID, true) . '" target="_blank">' . $sSymbol . ($sSymbol == $sName ? '' : ' (' . $sName . ')') . '</A>';
             }
         }
         if (isset($zData['reference'])) {
             // FIXME; is 't niet beter de PubMed custom link data uit de database te halen? Als ie ooit wordt aangepast, gaat dit fout.
             $zData['reference'] = preg_replace('/\\{PMID:(.*):(.*)\\}/U', '<A href="http://www.ncbi.nlm.nih.gov/pubmed/$2" target="_blank">$1</A>', $zData['reference']);
         }
         $zData['allow_download_'] = '<IMG src="gfx/mark_' . $zData['allow_download'] . '.png" alt="" width="11" height="11">';
         $zData['allow_index_wiki_'] = '<IMG src="gfx/mark_' . $zData['allow_index_wiki'] . '.png" alt="" width="11" height="11">';
         // Human readable RefSeq link.
         if ($zData['refseq_url']) {
             $zData['refseq_url_'] = '<A href="' . $zData['refseq_url'] . '" target="_blank">' . ($zData['refseq'] == 'c' ? 'Coding DNA' : 'Genomic') . ' reference sequence</A>';
         }
         // Curators and collaborators.
         $zData['curators_'] = $zData['collaborators_'] = '';
         $aCurators = $aCollaborators = array();
         foreach ($zData['curators'] as $aVal) {
             if ($aVal) {
                 // Should always be true, since genes should always have a curator!
                 list($nUserID, $sName, $bAllowEdit, $nOrder) = $aVal;
                 if ($bAllowEdit) {
                     $aCurators[$nUserID] = array($sName, $nOrder);
                 } else {
                     $aCollaborators[$nUserID] = $sName;
                 }
             }
         }
         asort($aCollaborators);
         // Sort collaborators by name.
         $nCurators = count($aCurators);
         $nCollaborators = count($aCollaborators);
         // Curator string.
         $i = 0;
         foreach ($aCurators as $nUserID => $aUser) {
             $i++;
             list($sName, $nOrder) = $aUser;
             // 2013-06-05; 3.0-06; There should be no link for users not logged in; they can't access these anyways.
             if ($_AUTH) {
                 // Use links, hidden curators possibly in the list (depends on exact user level).
                 $zData['curators_'] .= ($i == 1 ? '' : ($i == $nCurators ? ' and ' : ', ')) . ($nOrder ? '<B><A href="users/' . $nUserID . '">' . $sName . '</A></B>' : '<I><A href="users/' . $nUserID . '">' . $sName . '</A> (hidden)</I>');
             } else {
                 // Don't use links, and we never see hidden users anyways.
                 $zData['curators_'] .= ($i == 1 ? '' : ($i == $nCurators ? ' and ' : ', ')) . '<B>' . $sName . '</B>';
             }
         }
         $this->aColumnsViewEntry['curators_'] .= ' (' . $nCurators . ')';
         if ($_AUTH['level'] >= LEVEL_COLLABORATOR) {
             // Collaborator string.
             $i = 0;
             foreach ($aCollaborators as $nUserID => $sName) {
                 $i++;
                 $zData['collaborators_'] .= ($i == 1 ? '' : ($i == $nCollaborators ? ' and ' : ', ')) . '<A href="users/' . $nUserID . '">' . $sName . '</A>';
             }
             $this->aColumnsViewEntry['collaborators_'][0] .= ' (' . $nCollaborators . ')';
         }
         // Links on the stats numbers that lead to their views.
         $zData['variants_'] = 0;
         if ($zData['variants']) {
             $zData['variants_'] = '<A href="variants/' . $zData['id'] . '?search_var_status=%3D%22Marked%22%7C%3D%22Public%22">' . $zData['variants'] . '</A>';
         }
         $zData['uniq_variants_'] = 0;
         if ($zData['uniq_variants']) {
             $zData['uniq_variants_'] = '<A href="variants/' . $zData['id'] . '/unique?search_var_status=%3D%22Marked%22%7C%3D%22Public%22">' . $zData['uniq_variants'] . '</A>';
         }
         //'count_individuals' => 'Individuals with public variants',
         $zData['hidden_variants_'] = $zData['hidden_variants'];
         if ($zData['hidden_variants'] && $_AUTH['level'] >= LEVEL_CURATOR) {
             $zData['hidden_variants_'] = '<A href="variants/' . $zData['id'] . '?search_var_status=%3D%22Pending%22%7C%3D%22Non%20public%22">' . $zData['hidden_variants'] . '</A>';
         }
         $zData['note_index'] = html_entity_decode($zData['note_index']);
         // The individual count can only be found by adding up all distinct individual's panel_size.
         // 2013-10-11; 3.0-08; This query was first done using GROUP_CONCAT incorporated in the ViewEntry query. However, since the results were sometimes too long for MySQL, resulting in incorrect numbers and notices, this query is better represented as a separate query.
         $zData['count_individuals'] = (int) $_DB->query('SELECT SUM(panel_size) FROM (SELECT DISTINCT i.id, i.panel_size FROM ' . TABLE_INDIVIDUALS . ' AS i INNER JOIN ' . TABLE_SCREENINGS . ' AS s ON (i.id = s.individualid) INNER JOIN ' . TABLE_SCR2VAR . ' AS s2v ON (s.id = s2v.screeningid) INNER JOIN ' . TABLE_VARIANTS . ' AS vog ON (s2v.variantid = vog.id) INNER JOIN ' . TABLE_VARIANTS_ON_TRANSCRIPTS . ' AS vot ON (vog.id = vot.id) INNER JOIN ' . TABLE_TRANSCRIPTS . ' AS t ON (vot.transcriptid = t.id) WHERE i.panelid IS NULL AND vog.statusid >= ' . STATUS_MARKED . ' AND t.geneid = ?)i', array($zData['id']))->fetchColumn();
         $zData['created_date_'] = str_replace(' 00:00:00', '', $zData['created_date_']);
         if ($zData['updated_date']) {
             $zData['version_'] = '<B>' . $zData['id'] . date(':ymd', strtotime($zData['updated_date_'])) . '</B>';
         } else {
             unset($this->aColumnsViewEntry['version_']);
             if ($_AUTH['level'] < LEVEL_COLLABORATOR) {
                 // Also unset the empty updated_date field; users lower than collaborator don't see the updated_by field, either.
                 unset($this->aColumnsViewEntry['updated_date_']);
             }
         }
         if ($_AUTH['level'] < LEVEL_COLLABORATOR) {
             // Public, change date timestamps to human readable format.
             $zData['created_date_'] = date('F d, Y', strtotime($zData['created_date_']));
             $zData['updated_date_'] = date('F d, Y', strtotime($zData['updated_date_']));
         }
         // Graphs & utilities.
         if ($zData['variants']) {
             $zData['graphs'] = '<A href="' . CURRENT_PATH . '/graphs" class="hide">Graphs displaying summary information of all variants in the database</A> &raquo;';
             $sURLBedFile = rawurlencode(str_replace('https://', 'http://', $_CONF['location_url'] ? $_CONF['location_url'] : lovd_getInstallURL()) . 'api/rest/variants/' . $zData['id'] . '?format=text/bed');
             $sURLUCSC = 'http://genome.ucsc.edu/cgi-bin/hgTracks?clade=mammal&amp;org=Human&amp;db=' . $_CONF['refseq_build'] . '&amp;position=chr' . $zData['chromosome'] . ':' . ($zData['position_g_mrna_start'] - 50) . '-' . ($zData['position_g_mrna_end'] + 50) . ($zData['sense'] ? '' : '&amp;complement_hg19=1') . '&amp;hgt.customText=' . $sURLBedFile;
             $zData['ucsc'] = 'Show variants in the UCSC Genome Browser (<A href="' . $sURLUCSC . '" target="_blank">full view</A>, <A href="' . $sURLUCSC . rawurlencode('&visibility=4') . '" target="_blank">compact view</A>)';
             if ($_CONF['refseq_build'] == 'hg18') {
                 $sURLEnsembl = 'http://may2009.archive.ensembl.org/Homo_sapiens/Location/View?r=' . $zData['chromosome'] . ':' . ($zData['position_g_mrna_start'] - 50) . '-' . ($zData['position_g_mrna_end'] + 50) . ';data_URL=';
             } elseif ($_CONF['refseq_build'] == 'hg19') {
                 $sURLEnsembl = 'http://grch37.ensembl.org/Homo_sapiens/Location/View?r=' . $zData['chromosome'] . ':' . ($zData['position_g_mrna_start'] - 50) . '-' . ($zData['position_g_mrna_end'] + 50) . ';contigviewbottom=url:';
             } else {
                 $sURLEnsembl = 'http://www.ensembl.org/Homo_sapiens/Location/View?r=' . $zData['chromosome'] . ':' . ($zData['position_g_mrna_start'] - 50) . '-' . ($zData['position_g_mrna_end'] + 50) . ';contigviewbottom=url:';
             }
             // The weird addition in the end is to fake a proper name in Ensembl.
             $sURLEnsembl .= $sURLBedFile . rawurlencode('&name=/' . $zData['id'] . ' variants');
             $zData['ensembl'] = 'Show variants in the Ensembl Genome Browser (<A href="' . $sURLEnsembl . '=labels" target="_blank">full view</A>, <A href="' . $sURLEnsembl . '=normal" target="_blank">compact view</A>)';
             $zData['ncbi'] = 'Show distribution histogram of variants in the <A href="http://www.ncbi.nlm.nih.gov/projects/sviewer/?id=' . $_SETT['human_builds'][$_CONF['refseq_build']]['ncbi_sequences'][$zData['chromosome']] . '&amp;v=' . ($zData['position_g_mrna_start'] - 100) . ':' . ($zData['position_g_mrna_end'] + 100) . '&amp;content=7&amp;url=' . $sURLBedFile . '" target="_blank">NCBI Sequence Viewer</A>';
         } else {
             unset($this->aColumnsViewEntry['TableStart_Graphs'], $this->aColumnsViewEntry['TableHeader_Graphs'], $this->aColumnsViewEntry['graphs'], $this->aColumnsViewEntry['ucsc'], $this->aColumnsViewEntry['ensembl'], $this->aColumnsViewEntry['ncbi'], $this->aColumnsViewEntry['TableEnd_Graphs'], $this->aColumnsViewEntry['HR_2']);
         }
         // URLs for "Links to other resources".
         $zData['url_homepage_'] = $zData['url_homepage'] ? '<A href="' . $zData['url_homepage'] . '" target="_blank">' . $zData['url_homepage'] . '</A>' : '';
         $zData['url_external_'] = '';
         if ($zData['url_external']) {
             $aLinks = explode("\r\n", $zData['url_external']);
             foreach ($aLinks as $sLink) {
                 if (preg_match('/^(.+) &lt;(.+)&gt;$/', $sLink, $aRegs)) {
                     $zData['url_external_'] .= ($zData['url_external_'] ? '<BR>' : '') . '<A href="' . $aRegs[2] . '" target="_blank">' . $aRegs[1] . '</A>';
                 } else {
                     $zData['url_external_'] .= ($zData['url_external_'] ? '<BR>' : '') . '<A href="' . $sLink . '" target="_blank">' . $sLink . '</A>';
                 }
             }
         }
         $aExternal = array('id_omim', 'id_hgnc', 'id_entrez', 'id_pubmed_gene', 'show_hgmd', 'show_genecards', 'show_genetests');
         foreach ($aExternal as $sColID) {
             list($sType, $sSource) = explode('_', $sColID, 2);
             if (!empty($zData[$sColID])) {
                 $zData[$sColID . '_'] = '<A href="' . lovd_getExternalSource($sSource, $sType == 'id' ? $zData[$sColID] : rawurlencode($zData['id']), true) . '" target="_blank">' . ($sType == 'id' ? $zData[$sColID] : rawurlencode($zData['id'])) . '</A>';
             } else {
                 $zData[$sColID . '_'] = '';
             }
         }
         // Link to PubMed articles now shows Entrez Gene ID, which might be misinterpreted as a number of articles. Replace by Gene Symbol.
         $zData['id_pubmed_gene_'] = str_replace($zData['id_entrez'] . '</A>', $zData['id'] . '</A>', $zData['id_pubmed_gene_']);
         // Disclaimer.
         $sYear = substr($zData['created_date'], 0, 4);
         $sYear = (int) $sYear && $sYear < date('Y') ? $sYear . '-' . date('Y') : date('Y');
         $aDisclaimer = array(0 => 'No', 1 => 'Standard LOVD disclaimer', 2 => 'Own disclaimer');
         $zData['disclaimer_'] = $aDisclaimer[$zData['disclaimer']];
         $zData['disclaimer_text_'] = !$zData['disclaimer'] ? '' : ($zData['disclaimer'] == 2 ? html_entity_decode($zData['disclaimer_text']) : 'The contents of this LOVD database are the intellectual property of the respective curator(s). Any unauthorised use, copying, storage or distribution of this material without written permission from the curator(s) will lead to copyright infringement with possible ensuing litigation. Copyright &copy; ' . $sYear . '. All Rights Reserved. For further details, refer to Directive 96/9/EC of the European Parliament and the Council of March 11 (1996) on the legal protection of databases.<BR><BR>We have used all reasonable efforts to ensure that the information displayed on these pages and contained in the databases is of high quality. We make no warranty, express or implied, as to its accuracy or that the information is fit for a particular purpose, and will not be held responsible for any consequences arising out of any inaccuracies or omissions. Individuals, organisations and companies which use this database do so on the understanding that no liability whatsoever either direct or indirect shall rest upon the curator(s) or any of their employees or agents for the effects of any product, process or method that may be produced or adopted by any part, notwithstanding that the formulation of such product, process or method may be based upon information here provided.');
         // Unset fields that will not be shown if they're empty.
         foreach (array('note_index', 'refseq_url_', 'url_homepage_', 'url_external_', 'id_entrez_', 'id_pubmed_gene_', 'id_omim_', 'disease_omim_', 'show_hgmd_', 'show_genecards_', 'show_genetests_') as $key) {
             if (empty($zData[$key])) {
                 unset($this->aColumnsViewEntry[$key]);
             }
         }
     }
     return $zData;
 }
Example #9
0
 function prepareData($zData = '', $sView = 'list', $sViewListID = '')
 {
     // Prepares the data by "enriching" the variable received with links, pictures, etc.
     global $_AUTH, $_SETT;
     // Makes sure it's an array and htmlspecialchars() all the values.
     $zData = parent::prepareData($zData, $sView);
     // Mark all statusses from Marked and lower; Marked will be red, all others gray.
     // In the VariantOnTranscriptUnique view the var_statusid can contain multiple IDs, these IDs are separated by a ",".
     // PHP always takes the first integer-like part of a string when a string and an integer are compared.
     // But to avoid problems in the future, only the first character is compared.
     $bVarStatus = !empty($zData['var_statusid']) && substr($zData['var_statusid'], 0, 1) <= STATUS_MARKED;
     $bIndStatus = !empty($zData['ind_statusid']) && $zData['ind_statusid'] <= STATUS_MARKED;
     if ($bVarStatus && $bIndStatus) {
         $nStatus = min(substr($zData['var_statusid'], 0, 1), $zData['ind_statusid']);
         $zData['class_name'] = $nStatus == STATUS_MARKED ? 'marked' : 'del';
     } elseif ($bVarStatus) {
         $zData['class_name'] = substr($zData['var_statusid'], 0, 1) == STATUS_MARKED ? 'marked' : 'del';
     } elseif ($bIndStatus) {
         $zData['class_name'] = $zData['ind_statusid'] == STATUS_MARKED ? 'marked' : 'del';
     }
     // Replace rs numbers with dbSNP links.
     if (!empty($zData['VariantOnGenome/dbSNP'])) {
         $zData['VariantOnGenome/dbSNP'] = preg_replace('/(rs\\d+)/', '<SPAN' . ($sView != 'list' ? '' : ' onclick="cancelParentEvent(event);"') . '><A href="http://www.ncbi.nlm.nih.gov/SNP/snp_ref.cgi?rs=' . "\$1" . '" target="_blank">' . "\$1" . '</A></SPAN>', $zData['VariantOnGenome/dbSNP']);
     }
     foreach ($this->aColumns as $sCol => $aCol) {
         if ($_AUTH['level'] < LEVEL_MANAGER && !$this->nID && substr($sCol, 0, 19) == 'VariantOnTranscript') {
             // Not a special authorized person, no gene selected, VOT column.
             // A column that has been disabled for this gene, may still show its value to collaborators and higher.
             if ((!$_AUTH || !in_array($zData['geneid'], $_AUTH['allowed_to_view'])) && (is_array($zData['geneid']) && count(array_diff($zData['geneid'], $aCol['public_view'])) || !is_array($zData['geneid']) && !in_array($zData['geneid'], $aCol['public_view']))) {
                 $zData[$sCol] = '';
             }
         }
         if (!empty($aCol['custom_links'])) {
             foreach ($aCol['custom_links'] as $nLink) {
                 $sRegexpPattern = $this->aCustomLinks[$nLink]['regexp_pattern'];
                 $sReplaceText = $this->aCustomLinks[$nLink]['replace_text'];
                 if ($sView == 'list') {
                     $sReplaceText = '<SPAN class="custom_link" onmouseover="lovd_showToolTip(\'' . str_replace('"', '\\\'', $sReplaceText) . '\', this);">' . strip_tags($sReplaceText) . '</SPAN>';
                 }
                 $zData[$aCol['id']] = preg_replace($sRegexpPattern . 'U', $sReplaceText, $zData[$aCol['id']]);
             }
         }
     }
     if ($sView == 'list') {
         // "Clean" the GROUP_CONCAT columns for double values.
         foreach ($zData as $sCol => $sVal) {
             if (strpos($sCol, 'Screening/') === 0) {
                 $zData[$sCol] = implode(', ', array_unique(explode(';', $sVal)));
             }
             if (strpos($sViewListID, 'CustomVL_VOTunique') === 0 && (strpos($sCol, 'VariantOnGenome/') === 0 || strpos($sCol, 'VariantOnTranscript/') === 0)) {
                 // In the GROUP_CONCAT query a double semicolon (;;) is used as a separator, so it can be recognized here.
                 $aElements = explode(';;', $sVal);
                 $nElements = count($aElements);
                 $sNewElement = '';
                 $nCount = 0;
                 // VariantOnGenome and VariantOnTranscript columns with more then 200 characters are cut off.
                 // A string is added which states how many more unique items are available.
                 foreach ($aElements as $nKey => $sElement) {
                     if (strlen(strip_tags($sNewElement)) + strlen(strip_tags($sElement)) <= $_SETT['unique_view_max_string_length']) {
                         $sNewElement .= ($sNewElement === '' ? '' : ', ') . $sElement;
                         $nCount++;
                     }
                 }
                 $nNotPrinted = $nElements - $nCount;
                 if ($nNotPrinted > 0) {
                     $sNewElement .= ($sNewElement === '' ? '' : ', ') . '<I>' . $nNotPrinted . ' more item' . ($nNotPrinted == 1 ? '' : 's') . '</I>';
                 }
                 $zData[$sCol] = $sNewElement;
             }
         }
     }
     return $zData;
 }
Example #10
0
 function prepareData($zData = '', $sView = 'list')
 {
     // Prepares the data by "enriching" the variable received with links, pictures, etc.
     if (!in_array($sView, array('list', 'entry'))) {
         $sView = 'list';
     }
     // Makes sure it's an array and htmlspecialchars() all the values.
     $zData = parent::prepareData($zData, $sView);
     if ($sView == 'list') {
         $zData['row_id'] = $zData['id'];
         $zData['row_link'] = 'links/' . rawurlencode($zData['id']);
         $zData['name'] = '<A href="' . $zData['row_link'] . '" class="hide">' . $zData['name'] . '</A>';
         $zData['replace_text'] = lovd_shortenString($zData['replace_text'], 98);
     }
     return $zData;
 }
Example #11
0
 function prepareData($zData = '', $sView = 'list')
 {
     // Prepares the data before returning it to the user.
     global $_AUTH, $_SETT;
     $zData = parent::prepareData($zData, $sView);
     foreach ($this->aColumns as $sCol => $aCol) {
         if (!$aCol['public_view'] && $_AUTH['level'] < LEVEL_OWNER) {
             continue;
         }
         if (!empty($aCol['custom_links'])) {
             foreach ($aCol['custom_links'] as $nLink) {
                 $sRegexpPattern = $this->aCustomLinks[$nLink]['regexp_pattern'];
                 $sReplaceText = $this->aCustomLinks[$nLink]['replace_text'];
                 if ($sView == 'list') {
                     $sReplaceText = '<SPAN class="custom_link" onmouseover="lovd_showToolTip(\'' . str_replace('"', '\\\'', $sReplaceText) . '\', this);">' . strip_tags($sReplaceText) . '</SPAN>';
                 }
                 $zData[$aCol['id']] = preg_replace($sRegexpPattern . 'U', $sReplaceText, $zData[$aCol['id']]);
             }
         }
     }
     // Mark the status, if shown on the page.
     if ($sView == 'entry' && isset($zData['statusid'])) {
         $zData['status'] = '<SPAN style="color : #' . $this->getStatusColor($zData['statusid']) . '">' . $_SETT['data_status'][$zData['statusid']] . '</SPAN>';
     }
     return $zData;
 }