コード例 #1
0
ファイル: announcements.php プロジェクト: LOVDnl/LOVD3
        if ($_POST['password'] && !lovd_verifyPassword($_POST['password'], $_AUTH['password'])) {
            lovd_errorAdd('password', 'Please enter your correct password for authorization.');
        }
        if (!lovd_error()) {
            $_DATA->deleteEntry($nID);
            // Write to log...
            lovd_writeLog('Event', LOG_EVENT, 'Deleted announcement ' . $nID . ' (' . $zData['type'] . ') - ' . lovd_shortenString(strip_tags($zData['announcement']), 150));
            // Thank the user...
            header('Refresh: 3; url=' . lovd_getInstallURL() . $_PE[0]);
            $_T->printHeader();
            $_T->printTitle();
            lovd_showInfoTable('Successfully deleted the announcement!', 'success');
            $_T->printFooter();
            exit;
        } else {
            // Because we're sending the data back to the form, I need to unset the password fields!
            unset($_POST['password']);
        }
    }
    $_T->printHeader();
    $_T->printTitle();
    lovd_errorPrint();
    // Table.
    print '      <FORM action="' . CURRENT_PATH . '?' . ACTION . '" method="post">' . "\n";
    // Array which will make up the form table.
    $aForm = array(array('POST', '', '', '', '50%', '14', '50%'), array('Deleting announcement', '', 'print', lovd_shortenString(htmlspecialchars($zData['announcement']), 150)), 'skip', array('Enter your password for authorization', '', 'password', 'password', 20), array('', '', 'submit', 'Delete announcement'));
    lovd_viewForm($aForm);
    print '</FORM>' . "\n\n";
    $_T->printFooter();
    exit;
}
コード例 #2
0
ファイル: object_screenings.php プロジェクト: LOVDnl/LOVD3
 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 $_AUTH, $_DB, $nID;
     if ($_AUTH['level'] >= LEVEL_CURATOR) {
         $aSelectOwner = $_DB->query('SELECT id, CONCAT(name, " (#", id, ")") as name_id FROM ' . TABLE_USERS . ' ORDER BY name')->fetchAllCombine();
         $aFormOwner = array('Owner of this data', '', 'select', 'owned_by', 1, $aSelectOwner, false, false, false);
     } else {
         $aFormOwner = array();
     }
     // Get list of genes.
     $aGenesForm = $_DB->query('SELECT id, name FROM ' . TABLE_GENES . ' ORDER BY id')->fetchAllCombine();
     $nData = count($aGenesForm);
     foreach ($aGenesForm as $sID => $sGene) {
         $aGenesForm[$sID] = $sID . ' (' . lovd_shortenString($sGene, 50) . ')';
     }
     if (!$nData) {
         $aGenesForm = array('' => 'No gene entries available');
     }
     $nFieldSize = count($aGenesForm) < 10 ? count($aGenesForm) : 10;
     // FIXME; right now two blocks in this array are put in, and optionally removed later. However, the if() above can build an entire block, such that one of the two big unset()s can be removed.
     // A similar if() to create the "authorization" block, or possibly an if() in the building of this form array, is easier to understand and more efficient.
     // Array which will make up the form table.
     $this->aFormData = array_merge(array(array('POST', '', '', '', '35%', '14', '65%'), array('', '', 'print', '<B>Screening information</B>'), 'hr'), $this->buildForm(), array('aGenes' => array('Genes screened', '', 'select', 'genes', $nFieldSize, $aGenesForm, false, true, false), array('', '', 'note', 'Please select no more than 15 genes. For genome-wide analysis, <B>no</B> genes should be selected.'), 'variants_found' => array('Have variants been found?', 'Please uncheck this box when no variants have been found using this screening.', 'checkbox', 'variants_found'), 'hr', 'general_skip' => 'skip', 'general' => array('', '', 'print', '<B>General information</B>'), 'general_hr1' => 'hr', 'owner' => $aFormOwner, 'general_hr2' => 'hr', 'skip', 'authorization' => array('Enter your password for authorization', '', 'password', 'password', 20)));
     if (ACTION == 'create' || ACTION == 'publish' && GET) {
         // When creating, or when publishing without any changes, unset the authorization.
         unset($this->aFormData['authorization']);
     } elseif (lovd_getProjectFile() != '/import.php') {
         if ($_DB->query('SELECT COUNT(variantid) FROM ' . TABLE_SCR2VAR . ' WHERE screeningid = ?', array($nID))->fetchColumn()) {
             unset($this->aFormData['variants_found']);
         }
     }
     if ($_AUTH['level'] < LEVEL_CURATOR) {
         unset($this->aFormData['general_skip'], $this->aFormData['general'], $this->aFormData['general_hr1'], $this->aFormData['owner'], $this->aFormData['general_hr2']);
     }
     return parent::getForm();
 }
コード例 #3
0
ファイル: columns.php プロジェクト: LOVDnl/LOVD3
         $sSQL .= ' ORDER BY g.id';
         $aPossibleTargets = array_map('lovd_shortenString', $_DB->query($sSQL, $aSQL)->fetchAllCombine());
         $nPossibleTargets = count($aPossibleTargets);
     } elseif ($sCategory == 'Phenotype') {
         // Retrieve list of diseases that DO HAVE this column and you are authorized to remove columns from.
         $sSQL = 'SELECT DISTINCT d.id, CONCAT(d.symbol, " (", d.name, ")") FROM ' . TABLE_DISEASES . ' AS d INNER JOIN ' . TABLE_SHARED_COLS . ' AS sc ON (d.id = sc.diseaseid AND sc.colid = ?)';
         $aSQL = array($zData['id']);
         if ($_AUTH['level'] < LEVEL_MANAGER) {
             // FIXME: Before today (2013-06-24), this code contained a check if the column had values or not. Removal was then disallowed. Perhaps we should be checking here if there are values in
             //   entries that this user does not have access to. If two curators share access on the disease, but do not share a gene, one curator should not have rights to delete the other's data.
             $sSQL .= ' LEFT OUTER JOIN ' . TABLE_GEN2DIS . ' AS g2d ON (d.id = g2d.diseaseid) WHERE g2d.geneid IN (?' . str_repeat(', ?', count($_AUTH['curates']) - 1) . ') OR d.id = 0 GROUP BY d.id';
             $aSQL = array_merge($aSQL, $_AUTH['curates']);
         }
         $sSQL .= ' ORDER BY d.symbol';
         $aPossibleTargets = array_map(function ($sInput) {
             return lovd_shortenString($sInput, 75);
         }, $_DB->query($sSQL, $aSQL)->fetchAllCombine());
         $nPossibleTargets = count($aPossibleTargets);
     }
     if (!$nPossibleTargets) {
         // Column has already been removed from everything it can be removed from.
         $_T->printHeader();
         $_T->printTitle();
         lovd_showInfoTable('This column has already been removed from all ' . $aTableInfo['unit'] . 's.', 'stop');
         $_T->printFooter();
         exit;
     }
 }
 // Check if column is enabled for target.
 lovd_errorClean();
 if ($aTableInfo['shared'] && !empty($_POST['target'])) {
コード例 #4
0
ファイル: get_gene_switcher.php プロジェクト: LOVDnl/LOVD3
 * You should have received a copy of the GNU General Public License
 * along with LOVD.  If not, see <http://www.gnu.org/licenses/>.
 *
 *************/
define('ROOT_PATH', '../');
require ROOT_PATH . 'inc-init.php';
session_write_close();
$nMaxDropDown = 10;
$qGenes = $_DB->query('SELECT id AS value, CONCAT(id, " (", name, ")") AS label FROM ' . TABLE_GENES . ' ORDER BY id');
$zGenes = $qGenes->fetchAllAssoc();
if (empty($zGenes)) {
    die(json_encode(AJAX_DATA_ERROR));
}
foreach ($zGenes as $key => $aValues) {
    // This will shorten the gene names nicely, to prevent long gene names from messing up the form.
    $zGenes[$key]['label'] = lovd_shortenString($aValues['label'], 75);
}
if (count($zGenes) < $nMaxDropDown) {
    // Create the option elements.
    // Try to determine the currently selected gene, so we can pre-select that one,
    // making it easier to select genes close alphabetically, and also ensuring the
    // onChange() to run if the first gene from the list is selected.
    // This code is similar to inc-init.php's parsing to find CurrDB.
    $sCurrDB = '';
    if (!empty($_SERVER['HTTP_REFERER']) && preg_match('/^' . preg_quote(lovd_getInstallURL(), '/') . '(configuration|genes|transcripts|variants|individuals|view)\\/([^\\/]+)/', $_SERVER['HTTP_REFERER'], $aRegs)) {
        if (!in_array($aRegs[2], array('in_gene', 'upload')) && !ctype_digit($aRegs[2])) {
            $sCurrDB = strtoupper($aRegs[2]);
            // Not checking capitalization here yet.
        }
    }
    $sOptions = '';
コード例 #5
0
ファイル: diseases.php プロジェクト: LOVDnl/LOVD3
             } else {
                 $aSuccess[] = $sGene;
             }
         }
     }
     if (count($aSuccess)) {
         lovd_writeLog('Event', LOG_EVENT, 'Disease information entry ' . $nID . ' - ' . $_POST['symbol'] . ' - successfully added to gene(s) ' . implode(', ', $aSuccess));
     }
     // Thank the user...
     $_T->printHeader();
     $_T->printTitle();
     lovd_showInfoTable('Successfully created the disease information entry!', 'success');
     if (isset($_GET['in_window'])) {
         // We're in a new window, refresh opener en close window.
         print '      <SCRIPT type="text/javascript">
                          $(opener.document.forms[0][\'active_diseases[]\']).append(\'<OPTION value="' . $nID . '">' . lovd_shortenString($_POST['symbol'] . ' (' . $_POST['name'] . ')', 75) . '</OPTION>\');
                          if ($(opener.document.forms[0][\'active_diseases[]\']).attr(\'size\') < 15) {
                              $(opener.document.forms[0][\'active_diseases[]\']).attr(\'size\', eval($(opener.document.forms[0][\'active_diseases[]\']).attr(\'size\')) + 1);
                          }
                          if (opener.document.location.href.match(/\\/(individuals\\/' . (empty($_POST['genes']) ? '' : '|genes\\/(' . implode('|', $_POST['genes']) . ')\\?') . ')/)) {
                              $(opener.document.forms[0][\'active_diseases[]\']).children(\'option:last\').attr(\'selected\', 1);
                          }
                          setTimeout(\'self.close();\', 1000);</SCRIPT>' . "\n\n";
     } else {
         print '      <SCRIPT type="text/javascript">setTimeout(\'window.location.href=\\\'' . lovd_getInstallURL() . CURRENT_PATH . '/' . $nID . '\\\';\', 3000);</SCRIPT>' . "\n\n";
     }
     $_T->printFooter();
     exit;
 } else {
     // Because we're sending the data back to the form, I need to unset the password fields!
     unset($_POST['password']);
コード例 #6
0
ファイル: transcripts.php プロジェクト: LOVDnl/LOVD3
    if (empty($zData['transcripts'])) {
        lovd_showInfoTable('No more transcripts available that have not been added yet!', 'warning');
        $_T->printFooter();
        exit;
    }
    if (!lovd_error()) {
        print '      To add the selected transcripts to the gene, please press "Add" at the bottom of the form.<BR>' . "\n" . '      <BR>' . "\n\n";
    }
    lovd_errorPrint();
    $atranscriptNames = array();
    $aTranscriptsForm = array();
    foreach ($zData['transcripts'] as $sTranscript) {
        // Until revision 679 the transcript version was not used in the index. The version number was removed with preg_replace.
        // Can not figure out why version is not included. Therefore, for now we will do without preg_replace.
        if (!isset($aTranscriptNames[$sTranscript])) {
            $aTranscriptsForm[$sTranscript] = lovd_shortenString($zData['transcriptNames'][$sTranscript], 50);
            $aTranscriptsForm[$sTranscript] .= str_repeat(')', substr_count($aTranscriptsForm[$sTranscript], '(')) . ' (' . $sTranscript . ')';
        }
    }
    asort($aTranscriptsForm);
    $nTranscriptsFormSize = count($aTranscriptsForm) < 10 ? count($aTranscriptsForm) : 10;
    // Table.
    print '      <FORM action="' . $sPath . '" method="post">' . "\n";
    // Array which will make up the form table.
    $aForm = array_merge(array(array('POST', '', '', '', '40%', '14', '60%'), array('Transcriptomic reference sequence(s)', 'Select transcript references (NM accession numbers). Please note that transcripts already added to this gene database, are not shown', 'select', 'active_transcripts', $nTranscriptsFormSize, $aTranscriptsForm, false, true, true), array('', '', 'submit', 'Add transcript(s) to gene')));
    lovd_viewForm($aForm);
    print '<INPUT type="hidden" name="workID" value="' . $_POST['workID'] . '">' . "\n";
    print '</FORM>' . "\n\n";
    $_T->printFooter();
    exit;
}
コード例 #7
0
ファイル: object_diseases.php プロジェクト: LOVDnl/LOVD3
 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 $_DB, $_AUTH, $_SETT;
     // Get list of genes, to connect disease to gene.
     if ($_AUTH['level'] == LEVEL_CURATOR) {
         $aGenes = $_AUTH['curates'];
         if (ACTION == 'edit') {
             global $zData;
             // 2016-09-08; 3.0-17; Don't forget to run array_values() since a missing key results in a query error... :|
             $aGenes = array_values(array_unique(array_merge($aGenes, $zData['genes'])));
         }
         $aGenesForm = $_DB->query('SELECT id, name FROM ' . TABLE_GENES . ' WHERE id IN (?' . str_repeat(', ?', count($aGenes) - 1) . ') ORDER BY id', $aGenes)->fetchAllCombine();
     } else {
         $aGenesForm = $_DB->query('SELECT id, name FROM ' . TABLE_GENES . ' ORDER BY id')->fetchAllCombine();
     }
     $nData = count($aGenesForm);
     foreach ($aGenesForm as $sID => $sGene) {
         $aGenesForm[$sID] = $sID . ' (' . lovd_shortenString($sGene, 50) . ')';
     }
     if (!$nData) {
         $aGenesForm = array('' => 'No gene entries available');
     }
     $nFieldSize = count($aGenesForm) < 15 ? count($aGenesForm) : 15;
     // Array which will make up the form table.
     $this->aFormData = array(array('POST', '', '', '', '35%', '14', '65%'), array('', '', 'print', '<B>Disease information</B>'), 'hr', array('Disease abbreviation', '', 'text', 'symbol', 15), array('Disease name', '', 'text', 'name', 40), array('OMIM ID (optional)', '', 'text', 'id_omim', 10), array('Associated tissues', '', 'select', 'tissues', 10, $_SETT['disease_tissues'], false, true, false), array('Disease features', '', 'textarea', 'features', 50, 5), array('Remarks', '', 'textarea', 'remarks', 50, 5), 'hr', 'skip', array('', '', 'print', '<B>Relation to genes (optional)</B>'), 'hr', 'aGenes' => array('This disease has been linked to these genes', '', 'select', 'genes', $nFieldSize, $aGenesForm, false, true, false), 'hr', 'skip');
     return parent::getForm();
 }
コード例 #8
0
ファイル: object_individuals.php プロジェクト: LOVDnl/LOVD3
 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 $_AUTH, $_DB, $_SETT;
     // Get list of diseases.
     $aDiseasesForm = $_DB->query('SELECT id, IF(CASE symbol WHEN "-" THEN "" ELSE symbol END = "", name, CONCAT(symbol, " (", name, ")")) FROM ' . TABLE_DISEASES . ' ORDER BY (id > 0), (symbol != "" AND symbol != "-") DESC, symbol, name')->fetchAllCombine();
     $nDiseases = count($aDiseasesForm);
     foreach ($aDiseasesForm as $nID => $sDisease) {
         $aDiseasesForm[$nID] = lovd_shortenString($sDisease, 75);
     }
     $nFieldSize = $nDiseases < 15 ? $nDiseases : 15;
     if (!$nDiseases) {
         $aDiseasesForm = array('' => 'No disease entries available');
         $nFieldSize = 1;
     }
     if ($_AUTH['level'] >= LEVEL_CURATOR) {
         $aSelectOwner = $_DB->query('SELECT id, CONCAT(name, " (#", id, ")") as name_id FROM ' . TABLE_USERS . ' ORDER BY name')->fetchAllCombine();
         $aFormOwner = array('Owner of this data', '', 'select', 'owned_by', 1, $aSelectOwner, false, false, false);
         $aSelectStatus = $_SETT['data_status'];
         if (lovd_getProjectFile() == '/import.php') {
             // During an import the status pending is allowed, therefore only status in progress is unset.
             unset($aSelectStatus[STATUS_IN_PROGRESS]);
         } else {
             unset($aSelectStatus[STATUS_PENDING], $aSelectStatus[STATUS_IN_PROGRESS]);
         }
         $aFormStatus = array('Status of this data', '', 'select', 'statusid', 1, $aSelectStatus, false, false, false);
     } else {
         $aFormOwner = array();
         $aFormStatus = array();
     }
     // FIXME; right now two blocks in this array are put in, and optionally removed later. However, the if() above can build an entire block, such that one of the two big unset()s can be removed.
     // A similar if() to create the "authorization" block, or possibly an if() in the building of this form array, is easier to understand and more efficient.
     // Array which will make up the form table.
     $this->aFormData = array_merge(array(array('POST', '', '', '', '35%', '14', '65%'), array('', '', 'print', '<B>Individual information</B>'), 'hr'), $this->buildForm(), array(array('Panel size', '', 'text', 'panel_size', 10), array('', '', 'note', 'Fill in how many individuals this entry represents (default: 1).'), array('ID of panel this entry belongs to (optional)', 'Fill in LOVD\'s individual ID of the group to which this individual or group of individuals belong to (Optional).', 'text', 'panelid', 10), 'hr', 'skip', array('', '', 'print', '<B>Relation to diseases</B>'), 'hr', 'aDiseases' => array('This individual has been diagnosed with these diseases', '', 'select', 'active_diseases', $nFieldSize, $aDiseasesForm, false, true, false), 'diseases_info' => array('', '', 'note', ($nDiseases < 25 ? '' : '<A href="#" onclick="lovd_openWindow(\'' . lovd_getInstallURL() . 'diseases?&amp;no_links&amp;in_window\', \'Diseases\', 1000, 550); return false;">Find the used disease abbreviation in the list of diseases</A>.<BR>') . 'Diseases not in this list are not yet configured in this LOVD. If any disease you would like to select is not in here, please mention this in the remarks, preferably including the omim number. This way, a manager can configure this disease in this LOVD.'), 'diseases_create' => array('', '', 'note', ($nDiseases < 25 ? '' : '<A href="#" onclick="lovd_openWindow(\'' . lovd_getInstallURL() . 'diseases?&amp;no_links&amp;in_window\', \'Diseases\', 1000, 550); return false;">Find the used disease abbreviation in the list of diseases</A>.<BR>') . 'Diseases not in this list are not yet configured in this LOVD.<BR>Do you want to <A href="#" onclick="lovd_openWindow(\'' . lovd_getInstallURL() . 'diseases?create&amp;in_window\', \'DiseasesCreate\', 800, 550); return false;">configure more diseases</A>?'), 'hr', 'general_skip' => 'skip', 'general' => array('', '', 'print', '<B>General information</B>'), 'general_hr1' => 'hr', 'owner' => $aFormOwner, 'status' => $aFormStatus, 'general_hr2' => 'hr', 'skip', 'authorization' => array('Enter your password for authorization', '', 'password', 'password', 20)));
     if (ACTION == 'create' || ACTION == 'publish' && GET) {
         unset($this->aFormData['authorization']);
     }
     if ($_AUTH['level'] < LEVEL_CURATOR) {
         unset($this->aFormData['general_skip'], $this->aFormData['general'], $this->aFormData['general_hr1'], $this->aFormData['owner'], $this->aFormData['status'], $this->aFormData['general_hr2']);
     }
     if ($_AUTH['level'] < LEVEL_MANAGER) {
         unset($this->aFormData['diseases_create']);
     } else {
         unset($this->aFormData['diseases_info']);
     }
     return parent::getForm();
 }
コード例 #9
0
ファイル: inc-init.php プロジェクト: LOVDnl/LOVD3
         // We'll check this value further down in this code.
         if (!in_array($aRegs[2], array('in_gene', 'upload')) && !ctype_digit($aRegs[2])) {
             $_SESSION['currdb'] = $aRegs[2];
             // Not checking capitalization here yet.
         }
     }
     // Simply so that we can build somewhat correct email headers.
     if (empty($_CONF['institute'])) {
         $_CONF['institute'] = $_SERVER['HTTP_HOST'];
     }
     if (empty($_CONF['email_address'])) {
         $_CONF['email_address'] = 'noreply@' . (substr($_SERVER['HTTP_HOST'], 0, 4) == 'www.' ? substr($_SERVER['HTTP_HOST'], 4) : $_SERVER['HTTP_HOST']);
     }
     // Set email headers.
     $_SETT['email_mime_boundary'] = md5('PHP_MIME');
     $_SETT['email_headers'] = 'MIME-Version: 1.0' . PHP_EOL . 'Content-Type: text/plain; charset=UTF-8' . PHP_EOL . 'X-Priority: 3' . PHP_EOL . 'X-Mailer: PHP/' . phpversion() . PHP_EOL . 'From: ' . (ON_WINDOWS ? '' : '"LOVD (' . lovd_shortenString($_CONF['system_title'], 50) . ')" ') . '<' . $_CONF['email_address'] . '>';
     $_SETT['email_mime_headers'] = preg_replace('/^Content-Type.+$/m', 'Content-Type: multipart/mixed; boundary="' . $_SETT['email_mime_boundary'] . '"' . PHP_EOL . 'Content-Transfer-Encoding: 7bit', $_SETT['email_headers']);
 }
 if (!in_array(lovd_getProjectFile(), array('/check_update.php'))) {
     // Load gene data.
     if (!empty($_SESSION['currdb'])) {
         $_SETT['currdb'] = @$_DB->query('SELECT * FROM ' . TABLE_GENES . ' WHERE id = ?', array($_SESSION['currdb']))->fetchAssoc();
         if (!$_SETT['currdb']) {
             $_SESSION['currdb'] = false;
         } else {
             // Replace with what we have in the database, so we won't run into issues on other pages when CurrDB is used for navigation to other tabs.
             $_SESSION['currdb'] = $_SETT['currdb']['id'];
         }
     } else {
         $_SESSION['currdb'] = false;
     }
コード例 #10
0
ファイル: object_genes.php プロジェクト: LOVDnl/LOVD3
 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)) {
         if (lovd_getProjectFile() == '/import.php') {
             // During import the refseq_genomic is required, else the import
             // starts complaining that the selected refseq_genomic is not valid
             // Therefore we set the refseq_genomic in the aFormData property
             // before the getForm() is returned.
             global $zData;
             $aSelectRefseqGenomic = array_combine(array($zData['refseq_genomic']), array($zData['refseq_genomic']));
             $this->aFormData['refseq_genomic'] = array('Genomic reference sequence', '', 'select', 'refseq_genomic', 1, $aSelectRefseqGenomic, false, false, false);
         }
         return parent::getForm();
     }
     global $_DB, $zData, $_SETT;
     // Get list of diseases.
     $aDiseasesForm = $_DB->query('SELECT id, IF(CASE symbol WHEN "-" THEN "" ELSE symbol END = "", name, CONCAT(symbol, " (", name, ")")) FROM ' . TABLE_DISEASES . ' WHERE id > 0 ORDER BY (symbol != "" AND symbol != "-") DESC, symbol, name')->fetchAllCombine();
     $nDiseases = count($aDiseasesForm);
     if (!$nDiseases) {
         $aDiseasesForm = array('' => 'No disease entries available');
         $nDiseasesFormSize = 1;
     } else {
         $aDiseasesForm = array_combine(array_keys($aDiseasesForm), array_map('lovd_shortenString', $aDiseasesForm, array_fill(0, $nDiseases, 75)));
         $nDiseasesFormSize = $nDiseases < 15 ? $nDiseases : 15;
     }
     // References sequences (genomic and transcripts).
     if (lovd_getProjectFile() == '/import.php') {
         $aSelectRefseqGenomic = array_combine(array($zData['refseq_genomic']), array($zData['refseq_genomic']));
     } else {
         $aSelectRefseqGenomic = array_combine($zData['genomic_references'], $zData['genomic_references']);
     }
     $aTranscriptNames = array();
     $aTranscriptsForm = array();
     if (!empty($zData['transcripts'])) {
         foreach ($zData['transcripts'] as $sTranscript) {
             // Until revision 679 the transcript version was not used in the index and removed with preg_replace.
             // Can not figure out why version is not included. Therefore, for now we will do without preg_replace.
             if (!isset($aTranscriptNames[$sTranscript])) {
                 $aTranscriptsForm[$sTranscript] = lovd_shortenString($zData['transcriptNames'][$sTranscript], 50);
                 $aTranscriptsForm[$sTranscript] .= str_repeat(')', substr_count($aTranscriptsForm[$sTranscript], '(')) . ' (' . $sTranscript . ')';
             }
         }
         asort($aTranscriptsForm);
     } else {
         $aTranscriptsForm = array('' => 'No transcripts available');
     }
     $nTranscriptsFormSize = count($aTranscriptsForm);
     $nTranscriptsFormSize = $nTranscriptsFormSize < 10 ? $nTranscriptsFormSize : 10;
     $aSelectRefseq = array('c' => 'Coding DNA', 'g' => 'Genomic');
     $aSelectDisclaimer = array(0 => 'No', 1 => 'Use standard LOVD disclaimer', 2 => 'Use own disclaimer (enter below)');
     $aSelectHeaderFooter = array(-1 => 'Left', 0 => 'Center', 1 => 'Right');
     // Array which will make up the form table.
     $this->aFormData = array(array('POST', '', '', '', '35%', '14', '65%'), array('', '', 'print', '<B>General information</B>'), 'hr', array('Full gene name', '', 'print', $zData['name'], 50), array('Official gene symbol', '', 'print', $zData['id']), array('Chromosome', '', 'print', $zData['chromosome']), array('Chromosomal band', '', 'text', 'chrom_band', 10), array('Imprinting', 'Please note:<BR>Maternally imprinted (expressed from the paternal allele)<BR>Paternally imprinted (expressed from the maternal allele)', 'select', 'imprinting', 1, $_SETT['gene_imprinting'], false, false, false), array('Date of creation (optional)', 'Format: YYYY-MM-DD. If left empty, today\'s date will be used.', 'text', 'created_date', 10), 'hr', 'skip', array('', '', 'print', '<B>Relation to diseases (optional)</B>'), 'hr', array('This gene has been linked to these diseases', 'Listed are all disease entries currently configured in LOVD.', 'select', 'active_diseases', $nDiseasesFormSize, $aDiseasesForm, false, true, false), array('', '', 'note', 'Diseases not in this list are not yet configured in this LOVD.<BR>Do you want to <A href="#" onclick="lovd_openWindow(\'' . lovd_getInstallURL() . 'diseases?create&amp;in_window\', \'DiseasesCreate\', 800, 550); return false;">configure more diseases</A>?'), 'hr', 'skip', array('', '', 'print', '<B>Reference sequences (mandatory)</B>'), array('', '', 'note', 'Collecting variants requires a proper reference sequence. Without a genomic and a transcript reference sequence the variants in this LOVD database cannot be interpreted properly or mapped to the genome.'), 'hr', 'refseq_genomic' => array('Genomic reference sequence', '', 'select', 'refseq_genomic', 1, $aSelectRefseqGenomic, false, false, false), array('', '', 'note', 'Select the genomic reference sequence (NG, NC, LRG accession number). Only the references that are available to LOVD are shown.'), 'transcripts' => array('Transcript reference sequence(s)', 'Select transcript references (NM accession numbers).', 'select', 'active_transcripts', $nTranscriptsFormSize, $aTranscriptsForm, false, true, false), 'hr', 'skip', array('', '', 'print', '<B>Links to information sources (optional)</B>'), array('', '', 'note', 'Here you can add links that will be displayed on the gene\'s LOVD gene homepage.'), 'hr', array('Homepage URL', '', 'text', 'url_homepage', 40), array('', '', 'note', 'If you have a separate homepage about this gene, you can specify the URL here. Format: complete URL, including "http://".'), array('External links', '', 'textarea', 'url_external', 55, 3), array('', '', 'note', 'Here you can provide links to other resources on the internet that you would like to link to. One link per line, format: complete URLs or "Description &lt;URL&gt;".'), array('HGNC ID', '', 'print', $zData['id_hgnc']), array('Entrez Gene (Locuslink) ID', '', 'print', $zData['id_entrez'] ? $zData['id_entrez'] : 'Not Available'), array('OMIM Gene ID', '', 'print', $zData['id_omim'] ? $zData['id_omim'] : 'Not Available'), array('Provide link to HGMD', 'Do you want a link to this gene\'s entry in the Human Gene Mutation Database added to the homepage?', 'checkbox', 'show_hgmd'), array('Provide link to GeneCards', 'Do you want a link to this gene\'s entry in the GeneCards database added to the homepage?', 'checkbox', 'show_genecards'), array('Provide link to GeneTests', 'Do you want a link to this gene\'s entry in the GeneTests database added to the homepage?', 'checkbox', 'show_genetests'), array('This gene has a human-readable reference sequence', '', 'select', 'refseq', 1, $aSelectRefseq, 'No', false, false), array('', '', 'note', 'Although GenBank files are the official reference sequence, they are not very readable for humans. If you have a human-readable format of your reference sequence online, please select the type here.'), array('Human-readable reference sequence location', '', 'text', 'refseq_url', 40), 'refseqparse_new' => array('', '', 'note', 'If you are going to use our <A href="#" onclick="lovd_openWindow(\'' . lovd_getInstallURL() . 'scripts/refseq_parser.php\', \'RefSeqParser\', 800, 500); return false;">Reference Sequence Parser</A> to create a human-readable reference sequence, the result will be located at "' . lovd_getInstallURL() . 'refseq/' . $zData['id'] . '_codingDNA.html".'), 'refseqparse_edit' => array('', '', 'note', 'If you used our <A href="#" onclick="lovd_openWindow(\'' . lovd_getInstallURL() . 'scripts/refseq_parser.php?symbol=' . $zData['id'] . '\', \'RefSeqParser\', 800, 500); return false;">Reference Sequence Parser</A> to create a human-readable reference sequence, the result is located at "' . lovd_getInstallURL() . 'refseq/' . $zData['id'] . '_codingDNA.html".'), 'hr', 'skip', array('', '', 'print', '<B>Customizations (optional)</B>'), array('', '', 'note', 'You can use the following fields to customize the gene\'s LOVD gene homepage.'), 'hr', array('Citation reference(s)', '', 'textarea', 'reference', 30, 3), array('', '', 'note', '(Active custom link : <A href="#" onmouseover="lovd_showToolTip(\'Click to insert:<BR>{PMID:[1]:[2]}<BR><BR>Links to abstracts in the PubMed database.<BR>[1] = The name of the author(s).<BR>[2] = The PubMed ID.\');" onmouseout="lovd_hideToolTip();" onclick="lovd_insertCustomLink(this, \'{PMID:[1]:[2]}\'); return false">Pubmed</A>)'), array('Include disclaimer', '', 'select', 'disclaimer', 1, $aSelectDisclaimer, false, false, false), array('', '', 'note', 'If you want a disclaimer added to the gene\'s LOVD gene homepage, select your preferred option here.'), array('Text for own disclaimer<BR>(HTML enabled)', '', 'textarea', 'disclaimer_text', 55, 3), array('', '', 'note', 'Only applicable if you choose to use your own disclaimer (see option above).'), array('Page header<BR>(HTML enabled)', '', 'textarea', 'header', 55, 3), array('', '', 'note', 'Text entered here will appear above all public gene-specific pages.'), array('Header aligned to', '', 'select', 'header_align', 1, $aSelectHeaderFooter, false, false, false), array('Page footer<BR>(HTML enabled)', '', 'textarea', 'footer', 55, 3), array('', '', 'note', 'Text entered here will appear below all public gene-specific pages.'), array('Footer aligned to', '', 'select', 'footer_align', 1, $aSelectHeaderFooter, false, false, false), array('Notes for the LOVD gene homepage<BR>(HTML enabled)', '', 'textarea', 'note_index', 55, 3), array('', '', 'note', 'Text entered here will appear in the General Information box on the gene\'s LOVD gene homepage.'), array('Notes for the variant listings<BR>(HTML enabled)', '', 'textarea', 'note_listing', 55, 3), array('', '', 'note', 'Text entered here will appear below the gene\'s variant listings.'), 'hr', 'skip', array('', '', 'print', '<B>Security settings</B>'), array('', '', 'note', 'Using the following settings you can control some security settings of LOVD.'), 'hr', array('Allow public to download variant entries', '', 'checkbox', 'allow_download'), array('Allow my public variant and individual data to be indexed by WikiProfessional', '', 'checkbox', 'allow_index_wiki'), 'hr', 'skip');
     if (ACTION == 'edit') {
         $this->aFormData['transcripts'] = array('Transcriptomic reference sequence(s)', '', 'note', 'To add, remove or edit transcriptomic reference sequences for this gene, please see the gene\'s detailed view.');
         unset($this->aFormData['refseqparse_new']);
     } else {
         unset($this->aFormData['refseqparse_edit']);
     }
     return parent::getForm();
 }
コード例 #11
0
ファイル: object_links.php プロジェクト: LOVDnl/LOVD3
 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;
 }
コード例 #12
0
ファイル: configuration.php プロジェクト: LOVDnl/LOVD3
    } else {
        $qGenes = $_DB->query('SELECT g.id, CONCAT(g.id, " (", g.name, ")") AS name FROM ' . TABLE_GENES . ' AS g ORDER BY g.id', array());
    }
    $aGenes = $qGenes->fetchAllRow();
    $nGenes = count($aGenes);
    // If there are no genes, we're done here.
    if (!$nGenes) {
        lovd_showInfoTable('There is currently no gene configured in LOVD yet' . ($_AUTH['level'] == LEVEL_CURATOR ? ' that you have access to.' : '.<BR>Maybe you want to <A href="genes?create">create a new gene</A> now?'), 'stop');
        $_T->printFooter();
        exit;
    } else {
        print '    Please select a gene database:<BR>' . "\n" . '    <FORM action="' . CURRENT_PATH . '" id="formSelectGeneDB" onsubmit="window.location.href = \'' . lovd_getInstallURL() . $_PE[0] . '/\' + $(this).children(\'select\').val(); return false;" method="GET">' . "\n" . '      <SELECT name="select_db" onchange="$(\'#formSelectGeneDB\').submit();">' . "\n";
        foreach ($aGenes as $aGene) {
            list($sID, $sName) = $aGene;
            // This will shorten the gene names nicely, to prevent long gene names from messing up the form.
            $sName = lovd_shortenString($sName, 100);
            if (substr($sName, -3) == '...') {
                $sName .= str_repeat(')', substr_count($sName, '('));
            }
            print '      <OPTION value="' . $sID . '">' . $sName . '</OPTION>' . "\n";
        }
        print '      </SELECT><BR>' . "\n" . '      <INPUT type="submit" value="Select gene database">' . "\n" . '    </FORM>' . "\n\n";
        if ($nGenes == 1) {
            // Just one gene, submit form now.
            print '      <SCRIPT type="text/javascript">' . "\n" . '        $("#formSelectGeneDB").submit();' . "\n" . '      </SCRIPT>' . "\n\n";
        }
        $_T->printFooter();
        exit;
    }
}
// URL: /configuration/DMD
コード例 #13
0
ファイル: object_custom.php プロジェクト: LOVDnl/LOVD3
 function buildForm($sPrefix = '')
 {
     // Builds the array needed to display the form.
     global $_AUTH;
     $aFormData = array();
     foreach ($this->aColumns as $sCol => $aCol) {
         if (!$aCol['public_add'] && $_AUTH['level'] < LEVEL_CURATOR) {
             continue;
         }
         // Build what type of form entry?
         $aEntry = array();
         if ($aCol['form_type'][2] != 'select') {
             // No select entry; add entry name.
             foreach ($aCol['form_type'] as $key => $val) {
                 if (!$key && !$aCol['mandatory']) {
                     // Add '(Optional)'.
                     $val .= ' (optional)';
                 }
                 $aEntry[] = $val;
                 if ($key == 2) {
                     // Add the form entry name.
                     $aEntry[] = $sPrefix . $sCol;
                 }
             }
             // Setting the key allows easy post-processing of the form.
             $aFormData[$sPrefix . $sCol] = $aEntry;
         } else {
             // Select entries are modified a little more - need source data.
             foreach ($aCol['form_type'] as $key => $val) {
                 if (!$key && !$aCol['mandatory']) {
                     // Add '(Optional)'.
                     $val .= ' (optional)';
                 } elseif ($key == 3) {
                     // Size
                     // We need to place the form entry name (e.g. "Individual/Gender") in between.
                     $aEntry[] = $sPrefix . $sCol;
                 } elseif ($key == 4) {
                     // Select: true|false|--select--
                     // We need to place the form entry data in between.
                     $aData = array();
                     foreach ($aCol['select_options'] as $sLine) {
                         if (substr_count($sLine, '=')) {
                             list($sKey, $sVal) = explode('=', $sLine, 2);
                             $sVal = lovd_shortenString(trim($sVal), 75);
                             // NOTE: This array *refuses* to create string keys if the contents are integer strings. So the keys can actually be integers.
                             $aData[trim($sKey)] = $sVal;
                         } else {
                             $sVal = trim($sLine);
                             $sVal = lovd_shortenString($sVal, 75);
                             $aData[$sVal] = $sVal;
                         }
                     }
                     // Add currently filled in data if it's not in the selection_values, or else we'll lose it!
                     if (!empty($_POST[$sCol])) {
                         if (is_array($_POST[$sCol])) {
                             $aPOST = $_POST[$sCol];
                             // Multiple selection list.
                         } else {
                             $aPOST = array($_POST[$sCol]);
                             // Drop down list.
                         }
                         foreach ($aPOST as $sOption) {
                             if ($sOption && !array_key_exists($sOption, $aData)) {
                                 // Add entry!
                                 $aData[$sOption] = $sOption;
                             }
                         }
                     }
                     $aEntry[] = $aData;
                 }
                 if ($val == 'false') {
                     $val = false;
                 } elseif ($val == 'true') {
                     $val = true;
                 }
                 $aEntry[] = $val;
             }
             // Shorten selection list if source data is shorter.
             if ($aEntry[4] > 1) {
                 // Size > 1.
                 $nItems = count($aEntry[5]);
                 if ($nItems < $aEntry[4]) {
                     // Set size = number of options.
                     $aEntry[4] = $nItems;
                 }
             }
             // Setting the key allows easy post-processing of the form.
             $aFormData[$sPrefix . $sCol] = $aEntry;
         }
         // Any custom links we want to mention?
         if (!empty($aCol['custom_links'])) {
             $sLinks = '';
             foreach ($aCol['custom_links'] as $nLink) {
                 $aLink = $this->aCustomLinks[$nLink];
                 $sToolTip = str_replace(array("\r\n", "\r", "\n"), '<BR>', 'Click to insert:<BR>' . $aLink['pattern_text'] . '<BR><BR>' . addslashes(htmlspecialchars($aLink['description'])));
                 $sLinks .= ($sLinks ? ', ' : '') . '<A href="#" onmouseover="lovd_showToolTip(\'' . $sToolTip . '\');" onmouseout="lovd_hideToolTip();" onclick="lovd_insertCustomLink(this, \'' . $aLink['pattern_text'] . '\'); return false">' . $aLink['name'] . '</A>';
             }
             $aFormData[$sPrefix . $sCol . '_links'] = array('', '', 'print', '<SPAN class="S11">(Active custom link' . (count($aCol['custom_links']) == 1 ? '' : 's') . ' : ' . $sLinks . ')</SPAN>');
         }
         // Need to add description?
         if ($aCol['description_form']) {
             $aFormData[$sPrefix . $sCol . '_notes'] = array('', '', 'note', $aCol['description_form']);
         }
     }
     return $aFormData;
 }