$this->safeExit(0); } if ($values === 'YYYY-MM-DD' && !preg_match("/\\d\\d\\d\\d\\-\\d\\d\\-\\d\\d/", $data['Candidate'][$field])) { $this->header("HTTP/1.1 400 Bad Request"); $this->safeExit(0); } } /** * Testable wrapper for Candidate::createNew * * @param string $DoB Date of birth of the candidate * @param string $edc EDC of the candidate * @param string $gender Gender of the candidate to be created * @param string $PSCID PSCID of the candidate to be created * * @return none */ public function createNew($DoB, $edc, $gender, $PSCID) { $user = \User::singleton(); \Candidate::createNew($user->getCenterID(), $DoB, $edc, $gender, $PSCID); } } if (isset($_REQUEST['PrintCandidates'])) { if ($_SERVER['REQUEST_METHOD'] === 'POST') { $obj = new Candidates($_SERVER['REQUEST_METHOD'], $_POST); } else { $obj = new Candidates($_SERVER['REQUEST_METHOD']); } print $obj->toJSONString(); }