Example #1
0
 function showRespondentConsentRes($primkey)
 {
     $respondent = new Respondent($primkey);
     $displayNurse = new DisplayNurse();
     $lab = new Lab($primkey);
     if (loadvar('refusal') == '1') {
         //refusal!
         $refusalreason = loadvar('reason');
         $lab->setRefusal(1);
         $lab->setRefusalReason($refusalreason);
         $lab->setRefusalDate(loadvar('refusaldate'));
         for ($i = 1; $i < 6; $i++) {
             $lab->setConsent($i, 0);
         }
     } else {
         $consentList = $_POST['consent'];
         $lab->setRefusal(0);
         $lab->resetConsent();
         foreach ($consentList as $key => $consent) {
             $lab->setConsent($key, $consent);
         }
     }
     if ($lab->getConsentUrid() == 0) {
         $lab->setConsentUrid(loadvar('consenturid'));
     }
     $lab->saveChanges();
     $message = $displayNurse->displayInfo(Language::labelNurseConsentUpdated());
     return $displayNurse->showRespondentInfo($respondent, $message);
 }