Exemplo n.º 1
0
 lovd_isAuthorized('gene', $_AUTH['curates']);
 require ROOT_PATH . 'class/object_screenings.php';
 $_DATA = new LOVD_Screening();
 require ROOT_PATH . 'inc-lib-form.php';
 $bSubmit = isset($_AUTH['saved_work']['submissions']['individual'][$_POST['individualid']]);
 if (POST) {
     lovd_errorClean();
     $_DATA->checkFields($_POST);
     if (!lovd_error()) {
         // Fields to be used.
         $aFields = array_merge(array('individualid', 'variants_found', 'owned_by', 'created_by', 'created_date'), $_DATA->buildFields());
         // Prepare values.
         $_POST['owned_by'] = $_AUTH['level'] >= LEVEL_CURATOR ? $_POST['owned_by'] : $_AUTH['id'];
         $_POST['created_by'] = $_AUTH['id'];
         $_POST['created_date'] = date('Y-m-d H:i:s');
         $nID = $_DATA->insertEntry($_POST, $aFields);
         // Write to log...
         lovd_writeLog('Event', LOG_EVENT, 'Created screening information entry ' . $nID);
         $aSuccessGenes = array();
         if (!empty($_POST['genes']) && is_array($_POST['genes'])) {
             foreach ($_POST['genes'] as $sGene) {
                 // Add disease to gene.
                 if (in_array($sGene, lovd_getGeneList())) {
                     $q = $_DB->query('INSERT INTO ' . TABLE_SCR2GENE . ' VALUES (?, ?)', array($nID, $sGene), false);
                     // FIXME; I think this is not possible without a query error, that by default halts the system. Maybe you want to set $_DB->query()'s third argument to false?
                     if (!$q->rowCount()) {
                         // Silent error.
                         // FIXME; maybe better to group the error messages, just like when editing?
                         lovd_writeLog('Error', LOG_EVENT, 'Gene entry ' . $sGene . ' - could not be added to screening ' . $nID);
                     } else {
                         $aSuccessGenes[] = $sGene;