本文整理汇总了PHP中HTMLForm::addInput方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLForm::addInput方法的具体用法?PHP HTMLForm::addInput怎么用?PHP HTMLForm::addInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLForm
的用法示例。
在下文中一共展示了HTMLForm::addInput方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HTMLForm
<?php
$trialID = $trial->record->getData('core')->get('trialid');
echo '<h3>Discontinuation of 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', 'discontinue');
$form->addCancelButton('index.php');
$_SESSION['csrfToken'] = $token = base64_encode(openssl_random_pseudo_bytes(32));
$form->addInput('hidden', 'csrfToken', $token);
echo $form->writeHTML();
示例2: HTMLForm
<?php
echo '<h3>Reset your password</h3>';
echo '<h4>Please complete the form below and submit it, this will submit your account for reauthorisation which will generate a new password. Passwords are not stored in a form which they can be retrieved, in common with good security practices.</h4>';
$form = new HTMLForm('process.php', 'post');
$fields = $trial->getFormFields($page);
if (isset($_SESSION[$include])) {
$data = $_SESSION[$include];
} else {
$data = NULL;
}
$form->processFields($fields, $data);
if (isset($_SESSION['inputErr'])) {
// If any errors then add them to the form
$form->addErrors($_SESSION['inputErr']);
unset($_SESSION['inputErr']);
}
$input = $form->addInput('recaptcha', 'recaptcha');
// Add reCAPTCHA
$input->addLabel("Please complete the reCAPTCHA");
$form->addInput('hidden', 'page', $page);
$_SESSION['csrfToken'] = $token = base64_encode(openssl_random_pseudo_bytes(32));
$form->addInput('hidden', 'csrfToken', $token);
echo $form->writeHTML();
示例3: 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();
示例4: Centre
$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();
}
}
示例5: foreach
echo "<div class=\"alert alert-success\">";
echo "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>";
echo "<p>Don't forget to write the " . Config::get('idName') . " on your paper case record form. You may need to come back and check your data.</p>";
echo "<h4>The " . Config::get('idName') . " for this record is {$trial->getTrialID()}";
echo "</div>";
if ($complete = $trial->checkAllComplete()) {
echo "<div class=\"alert alert-info\">";
echo "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>";
echo "<p>The following pages are incomplete -</p>";
echo "<ul>";
foreach ($complete as $c) {
echo "<li>{$c}</li>";
}
echo "</ul>";
echo "</div>";
$form->addInput('hidden', 'incomplete', '1');
}
if ($comment = $trial->record->get('comment')) {
echo "<div class=\"alert alert-info\">";
echo "<p>The comment attached to this record is: " . nl2br(HTML::clean($comment)) . "</p>";
echo "</div>";
}
if ($trial->record->isSigned()) {
if ($trial->user->canUnsign()) {
$input = $form->addInput('yesno', 'unsignpt');
$input->addLabel('Unsign record and reopen it for editing?');
} else {
echo "<h4>The record has been signed off, please contact the PRISM admin team if you want it unsigned.</h4>";
$form->disableForm();
}
} elseif ($trial->record->isPreSigned()) {
示例6: 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();
示例7: eCRFUser
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()) {
$sql .= " WHERE centre.id = ?";
$pA = array('i', $user->getCentre());
$userSearch = DB::cleanQuery($sql, $pA);
示例8: HTMLForm
$page = "core";
echo '<h3>Randomise a 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', 'addpt');
$_SESSION['csrfToken'] = $token = base64_encode(openssl_random_pseudo_bytes(32));
$form->addInput('hidden', 'csrfToken', $token);
echo $form->writeHTML();
示例9: 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();
}
}