Example #1
0
                    $subgroup = $DB->pselectOne("SELECT sg.Subgroup_name\n                            FROM test_names tn\n                            LEFT JOIN test_subgroups sg ON (tn.Sub_group=sg.ID)\n                        WHERE tn.Test_name=:inst", array('inst' => $instrument));
                    $DDEEn = in_array($instrument, $DDE);
                    $dets[$instrument] = ['FullName' => $FullName, 'Subgroup' => $subgroup, 'DoubleDataEntryEnabled' => $DDEEn];
                }
                $JSONArray['Instruments'] = $dets;
            } else {
                $JSONArray['Instruments'] = array_keys($Instruments);
            }
        }
        if ($this->bVisits) {
            $Visits = \Utility::getExistingVisitLabels($this->ProjectID);
            $VisitNames = array_keys($Visits);
            $JSONArray['Visits'] = $VisitNames;
        }
        $this->JSON = $JSONArray;
    }
    /**
     * Calculates the ETag for this project by taking an MD5 of the
     * JSON
     *
     * @return string ETag for project
     */
    function calculateETag()
    {
        return md5('Project:' . json_encode($this->JSON, true));
    }
}
if (isset($_REQUEST['PrintProjectJSON'])) {
    $Proj = new Project($_SERVER['REQUEST_METHOD'], $_REQUEST['Project'], isset($_REQUEST['Candidates']) ? true : false, isset($_REQUEST['Instruments']) ? true : false, isset($_REQUEST['Visits']) ? true : false, isset($_REQUEST['InstrumentDetails']) ? true : false);
    print $Proj->toJSONString();
}