Example #1
0
        // true is equal to "true", but false is not equal to "false".
        if ($data['Pending'] != "true" && $data['Pending'] != "false" && $data['Pending'] !== false) {
            $this->header("HTTP/1.1 400 Bad Request");
            $this->error("Invalid value for Pending. Must be true or false.");
            $this->safeExit(0);
        }
        switch ($data['Pending']) {
            case 'true':
                $savePending = 'Y';
                break;
            case 'false':
            case false:
                $savePending = 'N';
                break;
            default:
                $savePending = null;
        }
        // Manually extract the sessionID with a select statement,
        // since the keys used to look it up are in different tables
        // and we can't join in the update wrapper.
        $factory = \NDB_Factory::singleton();
        $DB = $factory->database();
        $sessionID = $DB->pselectOne("SELECT s.ID\n               FROM session s \n                 JOIN candidate c ON (c.CandID=s.CandID) \n               WHERE c.Active='Y' AND s.Active='Y'\n                 AND s.Visit_label=:VL AND c.CandID=:CID", array('VL' => $this->VisitLabel, 'CID' => $this->CandID));
        $qcstatus = $DB->update('session', ['MRIQCStatus' => $data['SessionQC'], 'MRIQCPending' => $savePending], ['ID' => $sessionID]);
        $this->JSON = ["success" => "Updated QC"];
    }
}
if (isset($_REQUEST['PrintQC'])) {
    $obj = new Imaging($_SERVER['REQUEST_METHOD'], $_REQUEST['CandID'], $_REQUEST['VisitLabel']);
    print $obj->toJSONString();
}