Exemplo n.º 1
0
 function getForm()
 {
     // Build the form.
     // If we've built the form before, simply return it. Especially imports will repeatedly call checkFields(), which calls getForm().
     if (!empty($this->aFormData)) {
         return parent::getForm();
     }
     global $_SETT;
     $aHumanBuilds = array();
     foreach ($_SETT['human_builds'] as $sCode => $aBuild) {
         $aHumanBuilds[$sCode] = $sCode . ' / ' . $aBuild['ncbi_name'];
     }
     // No more hg18! We'll support LOVDs having this setting, but we won't allow new installations to pick this setting.
     unset($aHumanBuilds['hg18']);
     $aFeedHistory = array('Not available');
     for ($i = 1; $i <= 12; $i++) {
         $aFeedHistory[$i] = $i . ' month' . ($i == 1 ? '' : 's');
     }
     $this->aFormData = array(array('POST', '', '', '', '335', '14', ''), array('', '', 'print', '<B>General system settings</B>'), 'hr', array('Title of this LOVD installation', 'This will be shown on the top of every page.', 'text', 'system_title', 45), array('Institute (optional)', 'The institute which runs this database is displayed in the public area and in emails sent by LOVD. It\'s commonly set to a laboratory name or a website name.', 'text', 'institute', 45), array('Database URL (optional)', 'This is the URL with which the database can be accessed by the outside world, including "http://" or "https://". It will also be used in emails sent by LOVD. This field is mandatory if you select the "Include in the global LOVD listing" option.<BR>If you click the "check" link, LOVD will verify or try to predict the value.', 'print', '<INPUT type="text" name="location_url" size="40" id="location_url" value="' . (empty($_POST['location_url']) ? '' : htmlspecialchars($_POST['location_url'])) . '"' . (!lovd_errorFindField('location_url') ? '' : ' class="err"') . '>&nbsp;<SPAN id="location_url_check">(<A href="#" onclick="javascript:lovd_checkURL(); return false;">check</A>)</SPAN>'), array('LOVD email address', 'This email address will be used to send emails from LOVD to users. We need this address to make sure that emails from LOVD arrive. Please note that although strictly speaking this email address does not need to exist, we recommend that you use a valid address.', 'text', 'email_address', 40), array('Forward messages to database admin?', 'This will forward messages to the database administrator about submitter registrations and submissions.', 'checkbox', 'send_admin_submissions'), 'refseq_build' => array('Human Build to map to (UCSC/NCBI)', 'We need to know which version of the Human Build we need to map the variants in this LOVD to.', 'select', 'refseq_build', 1, $aHumanBuilds, false, false, false), array('List database changes in feed for how long?', 'LOVD includes a "newsfeed" that allows users to get a list of changes recently made in the database. Select here how many months back you want changes to appear on this list. Set to "Not available" to disable the newsfeed.', 'print', '&nbsp;<I style="color : #666666;">Not yet implemented</I>'), 'hr', 'skip', 'skip', array('', '', 'print', '<B>Connection settings (optional)</B>'), array('', '', 'note', 'The following settings apply to how LOVD connects to other resources.<BR>Some networks have no access to the outside world except through a proxy. If this applies to the network this server is installed on, please fill in the proxy server information here.'), 'hr', array('Proxy server host name', 'The host name of the proxy server, such as www-cache.institution.edu.', 'text', 'proxy_host', 20), array('Proxy server port number', 'The port number of the proxy server, such as 3128.', 'text', 'proxy_port', 4), 'skip', array('', '', 'note', 'The following two fields only apply if the proxy server requires authentication.'), array('Proxy server username', 'In case the proxy server requires authentication, please enter the required username here.', 'text', 'proxy_username', 20), array('Proxy server password', 'In case the proxy server requires authentication, please enter the required password here.', 'password', 'proxy_password', 20, true), 'hr', 'skip', 'skip', array('', '', 'print', '<B>Customize LOVD</B>'), array('', '', 'note', 'Here you can customize the way LOVD looks. We will add more options here later.'), 'hr', array('System logo', 'If you wish to have your custom logo on the top left of every page instead of the default LOVD logo, enter the path to the image here, relative to the LOVD installation path.', 'text', 'logo_uri', 40), array('', '', 'note', 'Currently, only images already uploaded to the LOVD server are allowed here.'), 'hr', 'skip', 'skip', array('', '', 'print', '<B>Global LOVD statistics</B>'), array('', '', 'note', 'The following settings apply to the kind of information your LOVD install sends to the development team to gather statistics about global LOVD usage.'), 'hr', array('Send statistics?', 'This sends <I>anonymous</I> statistics about the number of submitters, genes, individuals and variants in your installation of LOVD.', 'checkbox', 'send_stats'), array('Include in the global LOVD listing?', 'We keep a public listing of LOVD installations, their genes and their URLs. Deselect this checkbox if you do not want to be included in this public listing.', 'checkbox', 'include_in_listing'), 'hr', 'skip', 'skip', array('', '', 'print', '<B>Security settings</B>'), array('', '', 'note', 'Using the following settings you can control some security settings of LOVD.'), 'hr', array('Allow submitter registration?', 'Enabling this setting allows submitters to create their own accounts in your LOVD installation. Having it enabled is the default setting, and this could not be disabled prior to LOVD 3.0-17.<BR>Note, that submitters can never register when your LOVD installation is set to read-only because of an active announcement with the read-only setting enabled. See the Announcements section in the Setup area for more information.', 'checkbox', 'allow_submitter_registration'), array('Lock users after 3rd failed login?', 'Do you want to lock users (submitters, curators and managers) after three failed attempts to log in using their username?<BR>(This does <I>not</I> affect the database administrator account)', 'checkbox', 'lock_users'), array('Allow (locked) users to retrieve a new password?', 'Do you want to enable an "I forgot my password" option that allows users who forgot their password to retrieve a new one?', 'checkbox', 'allow_unlock_accounts'), array('Enable submitters to change data?', 'Enabling this setting allows submitters to make changes to data previously submitted by them or assigned to them.', 'checkbox', 'allow_submitter_mods'), array('Enable getting counts of hidden entries?', 'Enabling this feature allows the public to find the number of entries in the database (including hidden entries) matching one or more search terms on a specified set of columns. This feature will only mention the number of variant entries matched, without showing them.', 'print', '&nbsp;<I style="color : #666666;">Not yet implemented</I>'), array('Force SSL-only access to LOVD?', 'SSL is a secure protocol allowing for encryption of data sent between you and LOVD. When you will record sensitive individual information in LOVD, you <B>should</B> enable this setting, as the individual information can otherwise be \'sniffed\' off the network. If you do not record sensitive information, enabling SSL is <I>recommended</I>.', 'checkbox', 'use_ssl'), array('Use data versioning of biological data?', 'Versioning allows you to see all previous versions of a certain data entry (individuals, variants, phenotype information, etc) and allows you to return the entry to a previous state. Please note that this feature requires quite a lot of space in the database. Disabling this feature later will not free any space, just prevent more space from being used.', 'print', '&nbsp;<I style="color : #666666;">Not yet implemented</I>'), 'uninstall' => array('Disable LOVD uninstall?', 'Select this to disable the "Uninstall LOVD" option in the Setup area. Please note that this uninstall lock can only be removed by directly accessing the MySQL database.', 'checkbox', 'lock_uninstall'), 'uninstall_hr' => 'hr');
     if (lovd_getProjectFile() != '/install/index.php') {
         unset($this->aFormData['uninstall'], $this->aFormData['uninstall_hr']);
         global $_CONF;
         $this->aFormData['refseq_build'] = array('Human Build to map to (UCSC/NCBI)', '', 'print', '&nbsp;' . $_CONF['refseq_build']);
     }
     return parent::getForm();
 }
Exemplo n.º 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'];
         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;
 }
Exemplo n.º 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', '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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 5
0
 function __construct($sTable)
 {
     // Construct an object from a given database table name.
     $this->sTable = $sTable;
     parent::__construct();
 }
Exemplo n.º 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;
 }
Exemplo n.º 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'))) {
         $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;
 }
Exemplo n.º 8
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;
 }
Exemplo n.º 9
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;
 }
Exemplo n.º 10
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;
 }
Exemplo n.º 11
0
 function insertAll($aData, $aFields = array())
 {
     global $_AUTH, $_SETT;
     foreach (array_keys($this->aTranscripts) as $nTranscriptID) {
         if (empty($aData['ignore_' . $nTranscriptID])) {
             foreach ($aFields as $sField) {
                 if (strpos($sField, '/')) {
                     $aData[$sField] = $aData[$nTranscriptID . '_' . $sField];
                 }
             }
             $aData['transcriptid'] = $nTranscriptID;
             $aData['effectid'] = $aData[$nTranscriptID . '_effect_reported'] . ($_AUTH['level'] >= LEVEL_CURATOR ? $aData[$nTranscriptID . '_effect_concluded'] : substr($_SETT['var_effect_default'], -1));
             $aData['position_c_start'] = $aData[$nTranscriptID . '_position_c_start'];
             $aData['position_c_start_intron'] = $aData[$nTranscriptID . '_position_c_start_intron'];
             $aData['position_c_end'] = $aData[$nTranscriptID . '_position_c_end'];
             $aData['position_c_end_intron'] = $aData[$nTranscriptID . '_position_c_end_intron'];
             LOVD_Object::insertEntry($aData, $aFields);
         }
     }
     return $this->aTranscripts;
 }
Exemplo n.º 12
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;
 }
Exemplo n.º 13
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;
 }
Exemplo n.º 14
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;
 }