当前位置: 首页>>代码示例>>PHP>>正文


PHP HTMLForm::processFields方法代码示例

本文整理汇总了PHP中HTMLForm::processFields方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLForm::processFields方法的具体用法?PHP HTMLForm::processFields怎么用?PHP HTMLForm::processFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLForm的用法示例。


在下文中一共展示了HTMLForm::processFields方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: HTMLForm

<?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();
开发者ID:uhtoff,项目名称:eCRF,代码行数:31,代码来源:testaddpt.php

示例2: HTMLForm

<?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();
开发者ID:uhtoff,项目名称:eCRF,代码行数:15,代码来源:adverseevent.php

示例3: Centre

<?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();
开发者ID:uhtoff,项目名称:eCRF,代码行数:31,代码来源:sitereg.php

示例4: unset

                    }
                }
            }
            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());
开发者ID:uhtoff,项目名称:eCRF,代码行数:31,代码来源:dataentry.php

示例5: HTMLForm

<?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();
开发者ID:uhtoff,项目名称:eCRF,代码行数:16,代码来源:usersett.php

示例6: eCRFUser

<?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()) {
开发者ID:uhtoff,项目名称:eCRF,代码行数:31,代码来源:usereg.php

示例7: Centre

<?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();
    }
}
开发者ID:uhtoff,项目名称:eCRF,代码行数:31,代码来源:addsite.php


注:本文中的HTMLForm::processFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。