本文整理汇总了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();
}