示例#1
0
文件: testaddpt.php 项目: uhtoff/eCRF
<?php

$page = "core";
echo '<h3>Randomise a test patient:</h3>';
echo "<br/>";
$form = new HTMLForm('addcore.php', 'post');
$fields = $trial->getFormFields($page);
$data = $trial->record->getData($page);
if (is_null($data->get('trialid'))) {
    $id = $trial->generateTrialID();
    $data->set('trialid', $id);
}
$_SESSION['newTrialID'] = $data->get('trialid');
if (!isset($data->centre_id)) {
    $data->centre_id = $user->getCentre();
}
// Default centre id = user's own centre
// Remove all non-local centres from centre_id options
foreach ($fields['core-centre_id']['options'] as $key => $value) {
    if ($data->centre_id != $key) {
        unset($fields['core-centre_id']['options'][$key]);
    }
}
$form->processFields($fields, $data);
if (isset($_SESSION['inputErr'])) {
    $form->addErrors($_SESSION['inputErr']);
    unset($_SESSION['inputErr']);
}
$form->addInput('hidden', 'page', $page);
$form->addInput('hidden', 'return', 'testaddpt');
echo $form->writeHTML();
示例#2
0
<?php

$trialID = $trial->record->getData('core')->get('trialid');
echo '<h3>Record an adverse event for patient ID ', $trialID, '</h3>';
echo "<br/>";
$form = new HTMLForm('adddata.php', 'post');
$fields = $trial->getFormFields($page);
$form->processFields($fields);
$form->addInput('hidden', 'page', $page);
$form->addInput('hidden', 'link_id', $trial->addRecord());
$form->addInput('hidden', 'return', 'adverseevent');
$form->addCancelButton('index.php');
$_SESSION['csrfToken'] = $token = base64_encode(openssl_random_pseudo_bytes(32));
$form->addInput('hidden', 'csrfToken', $token);
echo $form->writeHTML();
示例#3
0
文件: sitereg.php 项目: uhtoff/eCRF
<?php

$showSearch = true;
if (isset($_POST['centreSelect']) && is_numeric($_POST['centreSelect'])) {
    $centreEdit = new Centre($_POST['centreSelect']);
    if ($centreEdit->get('name') && ($centreEdit->getCountry() == $user->getCountry() || $user->isCentralAdmin())) {
        $showSearch = false;
        echo "<h4>Edit the centre below</h4>";
        $form = new HTMLForm('process.php', 'post');
        $fields = $trial->getFormFields($page);
        $form->processFields($fields, $centreEdit);
        if ($user->isCentralAdmin()) {
            $sql = "SELECT units.number, units.name FROM units WHERE number IN ( SELECT number FROM formFields\n                    LEFT JOIN units ON units.number=formFields.fieldname\n                    GROUP BY units.number )\n                    GROUP BY units.number\n                    HAVING count(units.number)>1";
            $numbers = DB::cleanQuery($sql);
            if ($numbers->getRows()) {
                $defUnits = $centreEdit->getUnits();
                foreach ($numbers->rows as $row) {
                    $input = $form->addInput('select', "units[{$row->number}]");
                    $input->addLabel("Units for {$row->name}");
                    $sql = "SELECT id, unit FROM units\n                WHERE number = ?\n                ORDER BY unitorder";
                    $pA = array('s', $row->number);
                    $units = DB::cleanQuery($sql, $pA);
                    $options = array();
                    foreach ($units->rows as $unitRow) {
                        $options[$unitRow->id] = $unitRow->unit;
                    }
                    $input->addOption($options, true);
                    if (isset($defUnits[$row->number])) {
                        $input->addValue($defUnits[$row->number]['units_id']);
                    }
                    $input->setMand();
示例#4
0
文件: dataentry.php 项目: uhtoff/eCRF
                    }
                }
            }
            echo "</ul>";
        }
        $counter++;
    }
    echo "</ul>";
} else {
    $page = $trial->getPage();
    $data = $trial->record;
    // Get data object from trial record
    $fields = $trial->getFormFields($page);
    // Get fields from DB
    $form->addID('dataEntry');
    $form->processFields($fields, $data, $trial->getUser()->getCentreUnits(), $user->getLanguage());
    // Create form from fields and data object
    if (isset($_SESSION['inputErr'])) {
        // If any errors then add them to the form
        $form->addErrors($_SESSION['inputErr']);
        unset($_SESSION['inputErr']);
    }
    if ($page === 'core' && !$user->isRoot()) {
        $form->makeReadOnly();
    }
    if ($trial->record->isSigned() || $trial->record->isPreSigned()) {
        $form->disableForm();
    }
}
$form->addClass('crf');
$form->addInput('hidden', 'page', $trial->getPage());
示例#5
0
文件: usersett.php 项目: uhtoff/eCRF
<?php

echo '<h3>Update your details</h3>';
echo '<h4>If you wish to change your password, provide your current password and confirm the new password</h4>';
$form = new HTMLForm('process.php', 'post');
$fields = $trial->getFormFields($page);
$form->processFields($fields, $user);
if (isset($_SESSION['inputErr'])) {
    // If any errors then add them to the form
    $form->addErrors($_SESSION['inputErr']);
    unset($_SESSION['inputErr']);
}
$form->addInput('hidden', 'page', $page);
$_SESSION['csrfToken'] = $token = base64_encode(openssl_random_pseudo_bytes(32));
$form->addInput('hidden', 'csrfToken', $token);
echo $form->writeHTML();
示例#6
0
文件: usereg.php 项目: uhtoff/eCRF
<?php

$showSearch = true;
if (isset($_POST['userSelect']) && is_numeric($_POST['userSelect'])) {
    $userEdit = new eCRFUser($_POST['userSelect']);
    if ($userEdit->get('email') && $userEdit->getPrivilege() >= $user->getPrivilege()) {
        $showSearch = false;
        echo "<h4>Edit the user's details below</h4>";
        $form = new HTMLForm('process.php', 'post');
        $fields = $trial->getFormFields($page);
        $form->processFields($fields, $userEdit);
        if (isset($_SESSION['inputErr'])) {
            // If any errors then add them to the form
            $form->addErrors($_SESSION['inputErr']);
            unset($_SESSION['inputErr']);
        }
        $centre = new Data($userEdit->getCentre(), 'Centre');
        $form->addInputValue('usereg-country', $centre->get('country_id'));
        $form->addInput('hidden', 'userID', $userEdit->getID());
        $form->addInput('hidden', 'page', $page);
        $form->addInput('hidden', 'deleteUser', 'false');
        $form->addButton('Delete', array('btn-danger', 'hidden'));
        $form->addCancelButton('index.php?page=usereg');
        $_SESSION['csrfToken'] = $token = base64_encode(openssl_random_pseudo_bytes(32));
        $form->addInput('hidden', 'csrfToken', $token);
        echo $form->writeHTML();
    }
}
if ($showSearch) {
    $sql = "SELECT *, user.id as userID, centre.name as centreName, country.name as countryName, privilege.name as privilegeName, privilege_id FROM user\n        LEFT JOIN centre ON centre_id = centre.id\n        LEFT JOIN country ON country_id = country.id\n        LEFT JOIN privilege ON privilege_id = privilege.id";
    if ($user->isLocal()) {
示例#7
0
文件: addsite.php 项目: uhtoff/eCRF
<?php

echo "<h4>Add a centre</h4>";
if (isset($_SESSION['newCentre'])) {
    $centre = $_SESSION['newCentre'];
} else {
    $centre = new Centre();
}
$form = new HTMLForm('process.php', 'post');
$fields = $trial->getFormFields($page);
$form->processFields($fields, $centre);
$form->addInput('hidden', 'page', $page);
$form->addCancelButton('index.php?page=sitereg');
$sql = "SELECT units.number, units.name FROM units WHERE number IN ( SELECT number FROM formFields\n                LEFT JOIN units ON units.number=formFields.fieldname\n                GROUP BY units.number )\n                GROUP BY units.number\n                HAVING count(units.number)>1";
$numbers = DB::cleanQuery($sql);
if ($numbers->getRows()) {
    $defUnits = $trial->getUser()->getCentreUnits();
    foreach ($numbers->rows as $row) {
        $input = $form->addInput('select', "units[{$row->number}]");
        $input->addLabel("Units for {$row->name}");
        $sql = "SELECT id, unit FROM units\n            WHERE number = ?\n            ORDER BY unitorder";
        $pA = array('s', $row->number);
        $units = DB::cleanQuery($sql, $pA);
        $options = array();
        foreach ($units->rows as $unitRow) {
            $options[$unitRow->id] = $unitRow->unit;
        }
        $input->addOption($options, true);
        $input->setMand();
    }
}