Example #1
0
 require ROOT_PATH . 'class/object_phenotypes.php';
 $_DATA = new LOVD_Phenotype('', $nID);
 $zData = $_DATA->loadEntry($nID);
 require ROOT_PATH . 'inc-lib-form.php';
 $bSubmit = isset($_AUTH['saved_work']['submissions']['individual'][$zData['individualid']]);
 // If we're publishing... pretend the form has been sent with a different status.
 if (GET && ACTION == 'publish') {
     $_POST = $zData;
     $_POST['statusid'] = STATUS_OK;
 }
 if (POST || ACTION == 'publish') {
     lovd_errorClean();
     $_DATA->checkFields($_POST);
     if (!lovd_error()) {
         // Fields to be used.
         $aFields = array_merge(!$bSubmit || !empty($zData['edited_by']) ? array('edited_by', 'edited_date') : array(), $_DATA->buildFields());
         // Prepare values.
         if ($_AUTH['level'] >= LEVEL_CURATOR) {
             $aFields[] = 'owned_by';
             $aFields[] = 'statusid';
         } elseif ($zData['statusid'] > STATUS_MARKED) {
             $aFields[] = 'statusid';
             $_POST['statusid'] = STATUS_MARKED;
         }
         // Only actually committed to the database if we're not in a submission, or when they are already filled in.
         $_POST['edited_by'] = $_AUTH['id'];
         $_POST['edited_date'] = date('Y-m-d H:i:s');
         if (!$bSubmit && !(GET && ACTION == 'publish')) {
             // Put $zData with the old values in $_SESSION for mailing.
             // FIXME; change owner to owned_by_ in the load entry query of object_phenotypes.php.
             $zData['owned_by_'] = $zData['owner'];