本文整理匯總了PHP中PFBC\Form::render方法的典型用法代碼示例。如果您正苦於以下問題:PHP Form::render方法的具體用法?PHP Form::render怎麽用?PHP Form::render使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PFBC\Form
的用法示例。
在下文中一共展示了Form::render方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: findUser
exit;
}
// Namespaces to use
use PFBC\Form;
use PFBC\Element;
use PFBC\Validation;
// If form is submitted and correct
if (!empty($_POST) && Form::isValid("assignExaminator", false)) {
$uid = findUser($_POST['username']);
// Get current Course
$course = $user->getCourse($cid);
if ($uid == -1) {
Form::setError('assignExaminator', 'Error: Unable to find that user.');
header("Location: ?view=assignexaminator&cid={$cid}");
exit;
} else {
Form::clearValues('assignExaminator');
}
// Add user to examinators
$course->addExaminator($uid);
echo '<h3>Success!</h3><a href="?view=course&cid=' . $cid . '"><button class="btn btn-success">Go back</button></a>';
} else {
$form = new Form("assignExaminator");
$form->configure(array("action" => "?view=assignexaminator&cid={$cid}"));
$form->addElement(new Element\HTML('<legend>Assign new examinator</legend>'));
$form->addElement(new Element\Hidden("form", "assignExaminator"));
$form->addElement(new Element\Textbox('Username:', 'username', array('validation' => new Validation\RegExp('/^[a-z\\d]{2,64}$/', 'Error: The %element% field must contain a username.'), 'required' => 1, 'longDesc' => 'This user will be added as an examinator to the course')));
$form->addElement(new Element\Button("Add user"));
$form->addElement(new Element\Button("Cancel", "button", array("onclick" => "history.go(-1);")));
$form->render();
}