コード例 #1
0
ファイル: displaynurse.php プロジェクト: nubissurveying/nubis
    function showRespondentConsent($respondent)
    {
        $lab = new Lab($respondent->getPrimkey());
        $returnStr = $this->showNurseHeader(Language::messageSMSTitle());
        $returnStr .= '<div id="wrap">';
        $returnStr .= $this->showNavBar();
        $returnStr .= '<div class="container"><p>';
        //begin content
        $returnStr .= '<ol class="breadcrumb">';
        $returnStr .= '<li>' . setSessionParamsHref(array('page' => 'nurse.search'), Language::labelSearch()) . '</li>';
        $returnStr .= '<li>' . setSessionParamsHref(array('page' => 'nurse.respondent.info', 'primkey' => $respondent->getPrimkey()), Language::labelNurseRespondent() . ' ' . $respondent->getPrimkey()) . '</li>';
        $returnStr .= '<li class="active">' . Language::labelNurseConsentShort() . '</li>';
        $returnStr .= '</ol>';
        $returnStr .= '<div class="panel panel-default">
                <div class="panel-heading">';
        $returnStr .= '<h4>Consent: ' . $respondent->getPrimkey() . '</h4>';
        $returnStr .= '                </div>
                <div class="panel-body">';
        $returnStr .= '<form method=post>';
        $returnStr .= setSessionParamsPost(array('page' => 'nurse.respondent.consent.res', 'primkey' => $respondent->getPrimkey()));
        $checked = '';
        if ($lab->isRefusal()) {
            $checked = ' CHECKED';
        }
        $returnStr .= '<input type=checkbox name=refusal id=refusal value=1' . $checked . '>' . Language::labelNurseRespondentRefusedParticipate() . '<br/>';
        $returnStr .= '<script>
$(document).ready(function() {
    //set initial state.
//    $("#refusal").val($(this).is(":checked"));
    updatedivs();

    $("#refusal").change(function() {
        updatedivs();
//        $("#refusal").val($(this).is(":checked")); 
      });
    });

      function updatedivs(){
        if($("#refusal").is(":checked")) {
          $(\'#consentform :input\').attr(\'disabled\', true);
          $(\'#consentform\').css("background","#dddddd");

          $(\'#consentform\').find("input[type=\'checkbox\']").prop("checked", false);


          $(\'#refusalreason :input\').attr(\'disabled\', false);
          $(\'#refusalreason\').css("background","#ffffff");
          $(\'#refusalreason\').show(250);


        }
        else {
          $(\'#consentform :input\').attr(\'disabled\', false);
          $(\'#consentform\').css("background","#ffffff");

          $(\'#refusalreason :input\').attr(\'disabled\', true);
          $(\'#refusalreason\').css("background","#dddddd");
          $("#refusalreason").find("input:text").val(""); 
          $(\'#refusalreason\').hide(250);


        }
      }

        </script>
        ';
        //onclick="$(\'#consentform :input\').attr(\'disabled\', true);"
        $returnStr .= '<br/>';
        $returnStr .= '<div id=refusalreason style="background-color: #dddddd;">';
        $returnStr .= '<br><table>';
        $returnStr .= '<tr><td>' . Language::labelNurseRespondentRefusalReason() . '</td><td><input type=text name=reason class="form-control" value="' . addslashes($lab->getRefusalReason()) . '"></td></tr>';
        $returnStr .= '<tr><td>' . labelNurseRespondentRefusalDate() . '</td><td><input type=text name=refusaldate class="form-control" value="' . addslashes($lab->getRefusalDate()) . '"></td></tr>';
        $returnStr .= '</table><br/></div>';
        $returnStr .= '<div id=consentform style="background-color: #ffffff;"><br/>' . Language::labelNurseConsentFor() . '<br/><br/>';
        foreach (Language::consentTypes() as $key => $consent) {
            $checked = '';
            if ($lab->getConsent($key) == 1) {
                $checked = ' CHECKED';
            }
            $returnStr .= '<label><input type=checkbox name=consent[' . $key . '] value=1' . $checked . '> ' . $consent . '</label><br/>';
        }
        $returnStr .= '</div>';
        if ($lab->getConsentUrid() == 0) {
            //only if not assigned yet!
            $returnStr .= '<br/>' . Language::labelNurseStaffConsent();
            $returnStr .= '<select name="consenturid" class="form-control" style="width:220px">';
            $drivers = Language::labelNurseDrivers();
            foreach ($drivers as $i => $driver) {
                //          for($i = 1; $i < 5; $i++){
                $returnStr .= '<option value=' . $i . '>' . $driver . ' (' . $i . ')</option>';
            }
            $returnStr .= '<option value=99>' . Language::labelNurseOtherStaff() . '</option>';
            $returnStr .= '</select>';
            $returnStr .= '<br/>';
        }
        $returnStr .= '<button type="submit" class="btn btn-default navbar-btn">' . Language::labelNurseButtonSave() . '</button>';
        $returnStr .= '</form>';
        $returnStr .= '                </div></div>';
        //end content
        $returnStr .= '</p></div>    </div>';
        //container and wrap
        $returnStr .= $this->showBottomBar();
        $returnStr .= $this->showFooter(false);
        return $returnStr;
    }
コード例 #2
0
ファイル: nurse.php プロジェクト: nubissurveying/nubis
 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);
 }