示例#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 $_AUTH, $_DB, $_SETT;
     if (ACTION == 'edit') {
         global $zData;
         $_POST['diseaseid'] = $zData['diseaseid'];
     }
     if (!empty($_POST['diseaseid'])) {
         $sDisease = $_DB->query('SELECT name FROM ' . TABLE_DISEASES . ' WHERE id = ?', array($_POST['diseaseid']))->fetchColumn();
     } else {
         $sDisease = 'all diseases';
     }
     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>Phenotype information related to ' . $sDisease . '</B>'), 'hr'), $this->buildForm(), array('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) {
         // When creating, or when publishing without any changes, unset the authorization.
         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']);
     }
     return parent::getForm();
 }
示例#2
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 $_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
 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();
 }
示例#4
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 $_AUTH, $_CONF, $_DB, $_SETT, $zData, $_DATA;
     $aSelectAllele = $_DB->query('SELECT id, name FROM ' . TABLE_ALLELES . ' ORDER BY display_order')->fetchAllCombine();
     if (!empty($_GET['geneid'])) {
         $aFormChromosome = array('Chromosome', '', 'print', $_POST['chromosome']);
     } elseif (ACTION == 'edit') {
         $aFormChromosome = array('Chromosome', '', 'print', $zData['chromosome']);
     } else {
         $aChromosomes = array_keys($_SETT['human_builds'][$_CONF['refseq_build']]['ncbi_sequences']);
         $aSelectChromosome = array_combine($aChromosomes, $aChromosomes);
         $aFormChromosome = array('Chromosome', '', 'select', 'chromosome', 1, $aSelectChromosome, false, false, false);
     }
     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();
     }
     $aTranscriptsForm = array();
     if (!empty($_DATA['Transcript'])) {
         foreach (array_keys($_DATA['Transcript']) as $sGene) {
             $aTranscriptsForm = array_merge($aTranscriptsForm, $_DATA['Transcript'][$sGene]->getForm());
         }
     }
     // Add genome build name to VOG/DNA field.
     $this->aColumns['VariantOnGenome/DNA']['description_form'] = '<B>Relative to ' . $_CONF['refseq_build'] . ' / ' . $_SETT['human_builds'][$_CONF['refseq_build']]['ncbi_name'] . '.</B>' . (!$this->aColumns['VariantOnGenome/DNA']['description_form'] ? '' : '<BR>' . $this->aColumns['VariantOnGenome/DNA']['description_form']);
     // 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%')), $aTranscriptsForm, array(array('', '', 'print', '<B>Genomic variant information</B>'), 'hr', array('Allele', '', 'select', 'allele', 1, $aSelectAllele, false, false, false), array('', '', 'note', 'If you wish to report an homozygous variant, please select "Both (homozygous)" here.'), $aFormChromosome), $this->buildForm(), array(array('Affects function (reported)', '', 'select', 'effect_reported', 1, $_SETT['var_effect'], false, false, false), 'effect' => array('Affects function (concluded)', '', 'select', 'effect_concluded', 1, $_SETT['var_effect'], false, false, false), '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) {
         // When creating, or when publishing without any changes, unset the authorization.
         unset($this->aFormData['authorization']);
     }
     if ($_AUTH['level'] < LEVEL_CURATOR) {
         unset($this->aFormData['effect'], $this->aFormData['general_skip'], $this->aFormData['general'], $this->aFormData['general_hr1'], $this->aFormData['owner'], $this->aFormData['status'], $this->aFormData['general_hr2']);
     }
     return parent::getForm();
 }
 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, $_AUTH;
     // Create form per gene.
     foreach ($this->aTranscripts as $nTranscriptID => $aTranscript) {
         list($sTranscriptNM, $sGene) = $aTranscript;
         if ($sGene != $this->sObjectID) {
             continue;
         }
         $sPrefix = lovd_getProjectFile() == '/import.php' ? '' : $nTranscriptID . '_';
         $aEffectForm = array(array('Affects function (reported)', '', 'select', $sPrefix . 'effect_reported', 1, $_SETT['var_effect'], false, false, false));
         if ($_AUTH['level'] >= LEVEL_CURATOR) {
             $aEffectForm[] = array('Affects function (concluded)', '', 'select', $sPrefix . 'effect_concluded', 1, $_SETT['var_effect'], false, false, false);
         }
         $this->aFormData = array_merge($this->aFormData, array(array('', '', 'print', '<B class="transcript" transcriptid="' . $nTranscriptID . '">Transcript variant on ' . $sTranscriptNM . ' (' . $sGene . ')</B>'), 'hr'), $this->buildForm($sPrefix), $aEffectForm, array('hr', 'skip'));
     }
     return parent::getForm();
 }