本文整理汇总了PHP中Forge::hidden方法的典型用法代码示例。如果您正苦于以下问题:PHP Forge::hidden方法的具体用法?PHP Forge::hidden怎么用?PHP Forge::hidden使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Forge
的用法示例。
在下文中一共展示了Forge::hidden方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$profiler = new Profiler();
$foods = array('tacos' => array('tacos', FALSE), 'burgers' => array('burgers', FALSE), 'spaghetti' => array('spaghetti (checked)', TRUE), 'cookies' => array('cookies (checked)', TRUE));
$form = new Forge(NULL, 'New User');
// Create each input, following this format:
//
// type($name)->attr(..)->attr(..);
//
$form->hidden('hideme')->value('hiddenz!');
$form->input('email')->label(TRUE)->rules('required|valid_email');
$form->input('username')->label(TRUE)->rules('required|length[5,32]');
$form->password('password')->label(TRUE)->rules('required|length[5,32]');
$form->password('confirm')->label(TRUE)->matches($form->password);
$form->checkbox('remember')->label('Remember Me');
$form->checklist('foods')->label('Favorite Foods')->options($foods)->rules('required');
$form->dropdown('state')->label('Home State')->options(locale_US::states())->rules('required');
$form->dateselect('birthday')->label(TRUE)->minutes(15)->years(1950, date('Y'));
$form->submit('save')->value('Save');
if ($form->validate()) {
echo Kohana::debug($form->as_array());
}
echo $form->render();
// Using a custom template:
// echo $form->render('custom_view', TRUE);
// Inside the view access the inputs using $input_id->render(), ->label() etc
//
// To get the errors use $input_id_errors.
// Set the error format with $form->error_format('<div>{message}</div>');
// Defaults to <p class="error">{message}</p>
//
// Examples:
// echo $username->render(); echo $password_errors;
}
示例2: Forge
function two_hiddens_test()
{
$form = new Forge("test/controller", "", "post");
$form->hidden("HIDDEN_NAME")->value("HIDDEN_VALUE");
$csrf = access::csrf_token();
$expected = "<form action=\"http://./index.php/test/controller\" method=\"post\" class=\"form\">\n" . "<input type=\"hidden\" name=\"csrf\" value=\"{$csrf}\" />" . "<input type=\"hidden\" name=\"HIDDEN_NAME\" value=\"HIDDEN_VALUE\" />" . " <ul>\n" . " </ul>\n" . "</form>";
$this->assert_same($expected, (string) $form);
}
示例3: Forge
static function get_login_form($url)
{
$form = new Forge($url, "", "post", array("id" => "g-login-form"));
$form->set_attr("class", "g-narrow");
$form->hidden("continue_url")->value(Session::instance()->get("continue_url"));
$group = $form->group("login")->label(t("Login"));
$group->input("name")->label(t("Username"))->id("g-username")->class(null)->callback("auth::validate_too_many_failed_logins")->error_messages("too_many_failed_logins", t("Too many failed login attempts. Try again later"));
$group->password("password")->label(t("Password"))->id("g-password")->class(null);
$group->inputs["name"]->error_messages("invalid_login", t("Invalid name or password"));
$group->submit("")->value(t("Login"));
return $form;
}
示例4: Forge
static function get_edit_form($movie)
{
$form = new Forge("movies/update/{$movie->id}", "", "post", array("id" => "g-edit-movie-form"));
$form->hidden("from_id");
$group = $form->group("edit_item")->label(t("Edit Movie"));
$group->input("title")->label(t("Title"))->value($movie->title)->error_messages("required", t("You must provide a title"))->error_messages("length", t("Your title is too long"));
$group->textarea("description")->label(t("Description"))->value($movie->description);
$group->input("name")->label(t("Filename"))->value($movie->name)->error_messages("conflict", t("There is already a movie, photo or album with this name"))->error_messages("no_slashes", t("The movie name can't contain a \"/\""))->error_messages("no_trailing_period", t("The movie name can't end in \".\""))->error_messages("illegal_data_file_extension", t("You cannot change the movie file extension"))->error_messages("required", t("You must provide a movie file name"))->error_messages("length", t("Your movie file name is too long"));
$group->input("slug")->label(t("Internet Address"))->value($movie->slug)->error_messages("conflict", t("There is already a movie, photo or album with this internet address"))->error_messages("not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores"))->error_messages("required", t("You must provide an internet address"))->error_messages("length", t("Your internet address is too long"));
module::event("item_edit_form", $movie, $form);
$group = $form->group("buttons")->label("");
$group->submit("")->value(t("Modify"));
return $form;
}
示例5: Forge
static function get_tag_form($itemids)
{
$tagPane = new Forge("organize/__FUNCTION__", "", "post", array("id" => "gEditTags", "ref" => "edit_tags"));
$tagPane->hidden("item")->value(implode("|", $itemids));
$item_count = count($itemids);
$ids = implode(", ", $itemids);
$tags = Database::instance()->query("SELECT t.name, COUNT(it.item_id) as count\n FROM {items_tags} it, {tags} t\n WHERE it.tag_id = t.id\n AND it.item_id in({$ids})\n GROUP BY it.tag_id\n ORDER BY t.name ASC");
$taglist = array();
foreach ($tags as $tag) {
$taglist[] = $tag->name . ($item_count > $tag->count ? "*" : "");
}
$taglist = implode("; ", $taglist);
$tagPane->textarea("tags")->label(t("Tags"))->value($taglist);
return $tagPane;
}
示例6: Forge
static function get_edit_form($parent)
{
$form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gEditAlbumForm"));
$form->hidden("_method")->value("put");
$group = $form->group("edit_album")->label(t("Edit Album"));
if ($parent->id != 1) {
$group->input("name")->label(t("Name"))->value($parent->name);
}
$group->input("title")->label(t("Title"))->value($parent->title);
$group->textarea("description")->label(t("Description"))->value($parent->description);
$group->hidden("type")->value("album");
$group->submit("")->value(t("Modify"));
$form->add_rules_from(ORM::factory("item"));
return $form;
}
示例7: Forge
static function get_edit_form($parent)
{
$form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gEditAlbumForm"));
$form->hidden("_method")->value("put");
$group = $form->group("edit_album")->label(t("Edit Album"));
$group->input("title")->label(t("Title"))->value($parent->title);
$group->textarea("description")->label(t("Description"))->value($parent->description);
if ($parent->id != 1) {
$group->input("dirname")->label(t("Directory Name"))->value($parent->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 \".\""));
}
$sort_order = $group->group("sort_order", array("id" => "gAlbumSortOrder"))->label(t("Sort Order"));
$sort_order->dropdown("column", array("id" => "gAlbumSortColumn"))->label(t("Sort by"))->options(array("weight" => t("Default"), "captured" => t("Capture Date"), "created" => t("Creation Date"), "title" => t("Title"), "updated" => t("Updated Date"), "view_count" => t("Number of views"), "rand_key" => t("Random")))->selected($parent->sort_column);
$sort_order->dropdown("direction", array("id" => "gAlbumSortDirection"))->label(t("Order"))->options(array("ASC" => t("Ascending"), "DESC" => t("Descending")))->selected($parent->sort_order);
$group->hidden("type")->value("album");
$group->submit("")->value(t("Modify"));
$form->add_rules_from(ORM::factory("item"));
return $form;
}
示例8: Forge
static function get_tag_form($itemids)
{
$tagPane = new Forge("organize/__FUNCTION__", "", "post", array("id" => "gEditTags", "ref" => "edit_tags"));
$tagPane->hidden("item")->value(implode("|", $itemids));
$item_count = count($itemids);
$ids = implode(", ", $itemids);
// Lame stopgap security check. This code is going to get rewritten anyway.
foreach ($itemids as $id) {
$item = ORM::factory("item", $id);
access::required("view", $item);
access::required("edit", $item);
}
$tags = Database::instance()->query("SELECT t.name, COUNT(it.item_id) as count\n FROM {items_tags} it, {tags} t\n WHERE it.tag_id = t.id\n AND it.item_id in({$ids})\n GROUP BY it.tag_id\n ORDER BY t.name ASC");
$taglist = array();
foreach ($tags as $tag) {
$taglist[] = $tag->name . ($item_count > $tag->count ? "*" : "");
}
$taglist = implode("; ", $taglist);
$tagPane->textarea("tags")->label(t("Tags"))->value($taglist);
return $tagPane;
}
示例9: Forge
static function get_edit_form($parent)
{
$form = new Forge("albums/update/{$parent->id}", "", "post", array("id" => "g-edit-album-form"));
$form->hidden("from_id")->value($parent->id);
$group = $form->group("edit_item")->label(t("Edit Album"));
$group->input("title")->label(t("Title"))->value($parent->title)->error_messages("required", t("You must provide a title"))->error_messages("length", t("Your title is too long"));
$group->textarea("description")->label(t("Description"))->value($parent->description);
if ($parent->id != 1) {
$group->input("name")->label(t("Directory Name"))->value($parent->name)->error_messages("conflict", t("There is already a movie, photo or album with this name"))->error_messages("no_slashes", t("The directory name can't contain a \"/\""))->error_messages("no_trailing_period", t("The directory name can't end in \".\""))->error_messages("required", t("You must provide a directory name"))->error_messages("length", t("Your directory name is too long"));
$group->input("slug")->label(t("Internet Address"))->value($parent->slug)->error_messages("conflict", t("There is already a movie, photo or album with this internet address"))->error_messages("not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores"))->error_messages("required", t("You must provide an internet address"))->error_messages("length", t("Your internet address is too long"));
} else {
$group->hidden("name")->value($parent->name);
$group->hidden("slug")->value($parent->slug);
}
$sort_order = $group->group("sort_order", array("id" => "g-album-sort-order"))->label(t("Sort Order"));
$sort_order->dropdown("column", array("id" => "g-album-sort-column"))->label(t("Sort by"))->options(album::get_sort_order_options())->selected($parent->sort_column);
$sort_order->dropdown("direction", array("id" => "g-album-sort-direction"))->label(t("Order"))->options(array("ASC" => t("Ascending"), "DESC" => t("Descending")))->selected($parent->sort_order);
module::event("item_edit_form", $parent, $form);
$group = $form->group("buttons")->label("");
$group->hidden("type")->value("album");
$group->submit("")->value(t("Modify"));
return $form;
}
示例10: Forge
static function get_edit_form($photo)
{
$form = new Forge("photos/{$photo->id}", "", "post", array("id" => "gEditPhotoForm"));
$form->hidden("_method")->value("put");
$group = $form->group("edit_item")->label(t("Edit Photo"));
$group->input("title")->label(t("Title"))->value($photo->title);
$group->textarea("description")->label(t("Description"))->value($photo->description);
$group->input("filename")->label(t("Filename"))->value($photo->name)->error_messages("conflict", t("There is already a file with this name"))->callback("item::validate_no_slashes")->error_messages("no_slashes", t("The photo name can't contain a \"/\""))->callback("item::validate_no_trailing_period")->error_messages("no_trailing_period", t("The photo name can't end in \".\""));
module::event("item_edit_form", $photo, $form);
$group->submit("")->value(t("Modify"));
$form->add_rules_from(ORM::factory("item"));
return $form;
}
示例11: Forge
static function get_edit_form($photo)
{
$form = new Forge("photos/{$photo->id}", "", "post", array("id" => "g-edit-photo-form"));
$form->hidden("_method")->value("put");
$group = $form->group("edit_item")->label(t("Edit Photo"));
$group->input("title")->label(t("Title"))->value($photo->title);
$group->textarea("description")->label(t("Description"))->value($photo->description);
$group->input("filename")->label(t("Filename"))->value($photo->name)->rules("required")->error_messages("name_conflict", t("There is already a movie, photo or album with this name"))->callback("item::validate_no_slashes")->error_messages("no_slashes", t("The photo name can't contain a \"/\""))->callback("item::validate_no_trailing_period")->error_messages("no_trailing_period", t("The photo name can't end in \".\""));
$group->input("slug")->label(t("Internet Address"))->value($photo->slug)->callback("item::validate_url_safe")->error_messages("slug_conflict", t("There is already a movie, photo or album with this internet address"))->error_messages("not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores"));
module::event("item_edit_form", $photo, $form);
$group = $form->group("buttons")->label("");
$group->submit("")->value(t("Modify"));
$form->add_rules_from(ORM::factory("item"));
return $form;
}
示例12: _get_delfaces_form
private function _get_delfaces_form($id)
{
// Generate a form to allow the user to remove face data
// from a photo.
// Make a new Form.
$form = new Forge("tagfaces/delface", "", "post", array("id" => "g-tag-del-faces-form"));
// Create an array of all the tags that already have faces.
$existing_faces = ORM::factory("items_face")->where("item_id", $id)->find_all();
// turn the $existing_faces array into an array that can be used
// for a checklist.
$array_faces = "";
foreach ($existing_faces as $oneFace) {
$array_faces[$oneFace->id] = array(ORM::factory("tag", $oneFace->tag_id)->name, false);
}
if ($array_faces) {
// Add a checklist to the form.
$tags_group = $form->group("ExistingFaces")->label(t("Tags with faces:"));
$tags_group->checklist("facesList")->options($array_faces)->label(t("Select the tag(s) that correspond(s) to the face(s) you wish to delete:"));
}
// Add the id# of the photo and a delete button to the form.
$form->hidden("item_id")->value($id);
$form->submit("DeleteFace")->value(t("Delete face(s)"));
// Return the newly generated form.
return $form;
}
示例13: Forge
static function get_edit_form($parent)
{
$form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gEditAlbumForm"));
$form->hidden("_method")->value("put");
$group = $form->group("edit_item")->label(t("Edit Album"));
$group->input("title")->label(t("Title"))->value($parent->title);
$group->textarea("description")->label(t("Description"))->value($parent->description);
if ($parent->id != 1) {
$group->input("dirname")->label(t("Directory Name"))->value($parent->name)->rules("required")->error_messages("name_conflict", t("There is already a photo or album with this 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 \".\""));
$group->input("slug")->label(t("Internet Address"))->value($parent->slug)->error_messages("slug_conflict", t("There is already a photo or album with this internet address"))->callback("item::validate_url_safe")->error_messages("not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores"));
}
$sort_order = $group->group("sort_order", array("id" => "gAlbumSortOrder"))->label(t("Sort Order"));
$sort_order->dropdown("column", array("id" => "gAlbumSortColumn"))->label(t("Sort by"))->options(album::get_sort_order_options())->selected($parent->sort_column);
$sort_order->dropdown("direction", array("id" => "gAlbumSortDirection"))->label(t("Order"))->options(array("ASC" => t("Ascending"), "DESC" => t("Descending")))->selected($parent->sort_order);
module::event("item_edit_form", $parent, $form);
$group = $form->group("buttons")->label("");
$group->hidden("type")->value("album");
$group->submit("")->value(t("Modify"));
$form->add_rules_from(ORM::factory("item"));
return $form;
}
示例14: Forge
/**
* Display delete confirmation message and form
* @param object $item
* @return string form
*/
static function get_delete_form($item)
{
if (Input::instance()->get("page_type") == "album") {
$page_type = "album";
} else {
$page_type = "photo";
}
$form = new Forge("quick/delete/{$item->id}?page_type={$page_type}", "", "post", array("id" => "gConfirmDelete"));
$form->hidden("_method")->value("put");
$group = $form->group("confirm_delete")->label(t("Confirm Deletion"));
$group->submit("")->value(t("Delete"));
return $form;
}