本文整理汇总了PHP中Forge::input方法的典型用法代码示例。如果您正苦于以下问题:PHP Forge::input方法的具体用法?PHP Forge::input怎么用?PHP Forge::input使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Forge
的用法示例。
在下文中一共展示了Forge::input方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _get_form
private function _get_form()
{
$form = new Forge("admin/fittoscreen/save", "", "post", array("id" => "g-admin-form"));
$form->dropdown("width_unit")->label(t("Image width unit"))->options(array("px" => "pixel margin", "pr" => "max pourcentage"))->selected(module::get_var("fittoscreen", "width_unit"));
$form->input("width")->label(t('width'))->rules("required|valid_numeric|length[1,5]")->value(module::get_var("fittoscreen", "width"));
$form->dropdown("height_unit")->label(t("Image height unit"))->options(array("px" => "pixel margin", "pr" => "max pourcentage"))->selected(module::get_var("fittoscreen", "height_unit"));
$form->input("height")->label(t('height'))->rules("required|valid_numeric|length[1,5]")->value(module::get_var("fittoscreen", "height"));
$form->submit("submit")->value(t("Save"));
return $form;
}
示例2: Forge
static function get_general_edit_form($item)
{
$generalPane = new Forge("organize/__FUNCTION__", "", "post", array("id" => "gEditGeneral", "ref" => "general"));
// In this case we know there is only 1 item, but in general we should loop
// and create multiple hidden items.
$generalPane->hidden("item[]")->value($item->id);
$generalPane->input("title")->label(t("Title"))->value($item->title);
$generalPane->textarea("description")->label(t("Description"))->value($item->description);
$generalPane->input("dirname")->label(t("Path Name"))->value($item->name)->callback("item::validate_no_slashes")->error_messages("no_slashes", t("The directory name can't contain a \"/\""))->callback("item::validate_no_trailing_period")->error_messages("no_trailing_period", t("The directory name can't end in \".\""))->callback("item::validate_no_name_conflict")->error_messages("conflict", t("The path name is not unique"));
return $generalPane;
}
示例3: _get_3nids_form
private function _get_3nids_form()
{
// Make a new form for inputing information associated with google maps.
$form = new Forge("admin/theme_3nids/save3nidsprefs", "", "post", array("id" => "gTagsMapAdminForm"));
// Input box for the Maps API Key
$form->input("title")->label(t("item title : parent or item."))->value(module::get_var("theme_3nids", "title"));
$form->input("description")->label(t("item description : tags or item or parent or nothing. If item description chosen and not available, then parent description is used."))->value(module::get_var("theme_3nids", "description"));
$form->input("photo_size")->label(t("Photo size: resize or full."))->value(module::get_var("theme_3nids", "photo_size"));
// Add a save button to the form.
$form->submit("SaveSettings")->value(t("Save"));
// Return the newly generated form.
return $form;
}
示例4: login
public function login()
{
if (Auth::instance()->logged_in()) {
$this->template->title = 'User Logout';
$form = new Forge('auth_demo/logout');
$form->submit('Logout Now');
} else {
$this->template->title = 'User Login';
$form = new Forge();
$form->input('username')->label(TRUE)->rules('required|length[4,32]');
$form->password('password')->label(TRUE)->rules('required|length[5,40]');
$form->submit('Attempt Login');
if ($form->validate()) {
// Load the user
$user = ORM::factory('user', $form->username->value);
if (Auth::instance()->login($user, $form->password->value)) {
// Login successful, redirect
url::redirect('auth_demo/login');
} else {
$form->password->add_error('login_failed', 'Invalid username or password.');
}
}
}
// Display the form
$this->template->content = $form->render();
}
示例5: Forge
function no_group_test()
{
$form = new Forge("test/controller", "", "post", array("id" => "g-test-group-form"));
$form->input("title")->label(t("Title"));
$form->textarea("description")->label(t("Text Area"));
$form->submit("")->value(t("Submit"));
$csrf = access::csrf_token();
$expected = "<form action=\"http://./index.php/test/controller\" method=\"post\" " . "id=\"g-test-group-form\">\n" . "<input type=\"hidden\" name=\"csrf\" value=\"{$csrf}\" />" . " <ul>\n" . " <li>\n" . " <label for=\"title\" >Title</label>\n" . " <input type=\"text\" name=\"title\" value=\"\" " . "class=\"textbox\" />\n" . " </li>\n" . " <li>\n" . " <label for=\"description\" >Text Area</label>\n" . " <textarea name=\"description\" rows=\"\" cols=\"\" " . "class=\"textarea\" ></textarea>\n" . " </li>\n" . " <li>\n" . " <input type=\"submit\" value=\"Submit\" class=\"submit\" />\n" . " </li>\n" . " </ul>\n" . "</form>";
$this->assert_same($expected, (string) $form);
}
示例6: upload
public function upload()
{
$profiler = new Profiler();
$form = new Forge();
$form->input('hello')->label(TRUE);
$form->upload('file', TRUE)->label(TRUE)->rules('required|size[200KB]|allow[jpg,png,gif]');
$form->submit('upload')->value('Upload');
if ($form->validate()) {
echo Kohana::debug($form->as_array());
}
echo $form->render();
}
示例7: _get_add_form
private function _get_add_form($album)
{
$form = new Forge("uploader/add/{$album->id}", "", "post", array("id" => "g-add-photos-form"));
$group = $form->group("add_photos")->label(t("Add photos to %album_title", array("album_title" => html::purify($album->title))));
$group->input("files[]")->type("file")->multiple();
$form->input("FOO")->type("hidden")->label(sprintf("You may upload several files at once. Uploading pictures may take some time - please be patient. Max. upload size of all pictures: %.0f MB.", ini_get("upload_max_filesize")));
module::event("add_photos_form", $album, $form);
$group = $form->group("buttons")->label("");
$group->submit("")->value(t("Upload"));
return $form;
}