本文整理汇总了PHP中Forge::add_rules_from方法的典型用法代码示例。如果您正苦于以下问题:PHP Forge::add_rules_from方法的具体用法?PHP Forge::add_rules_from怎么用?PHP Forge::add_rules_from使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Forge
的用法示例。
在下文中一共展示了Forge::add_rules_from方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Forge
static function get_add_form_admin()
{
$form = new Forge("admin/users/add_group", "", "post", array("id" => "gAddGroupForm"));
$form_group = $form->group("add_group")->label(t("Add Group"));
$form_group->input("name")->label(t("Name"))->id("gName");
$form_group->inputs["name"]->error_messages("in_use", t("There is already a group with that name"));
$form_group->submit("")->value(t("Add Group"));
$group = ORM::factory("group");
$form->add_rules_from($group);
return $form;
}
示例2: Forge
static function get_edit_form_admin($product)
{
$form = new Forge("admin/product_lines/edit_product/{$product->id}", "", "post", array("id" => "gEditProductForm"));
$group = $form->group("edit_product")->label(t("Edit Product"));
$group->input("name")->label(t("Name"))->id("gProductName")->value($product->name);
$group->inputs["name"]->error_messages("in_use", t("There is already a product with that name"));
$group->input("cost")->label(t("Cost"))->id("gCost")->value($product->cost);
$group->input("description")->label(t("Description"))->id("gDescription")->value($product->description);
$group->submit("")->value(t("Modify Product"));
$form->add_rules_from($product);
return $form;
}
示例3: Forge
static function get_edit_form_admin($postage)
{
$form = new Forge("admin/postage_bands/edit_postage_band/{$postage->id}", "", "post", array("id" => "gEditPostageForm"));
$group = $form->group("edit_postage")->label(t("Edit Postage Band"));
$group->input("name")->label(t("Name"))->id("gPostageName")->value($postage->name);
$group->inputs["name"]->error_messages("in_use", t("There is already a postage band with that name"));
$group->input("flat_rate")->label(t("Flat Rate"))->id("gFlatRate")->value($postage->flat_rate);
$group->input("per_item")->label(t("Per Item"))->id("gPetItem")->value($postage->per_item);
$group->submit("")->value(t("Modify Postage Band"));
$form->add_rules_from($postage);
return $form;
}
示例4: Forge
static function get_add_form($parent)
{
$form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gAddAlbumForm"));
$group = $form->group("add_album")->label(t("Add an album to %album_title", array("album_title" => $parent->title)));
$group->input("title")->label(t("Title"));
$group->textarea("description")->label(t("Description"));
$group->input("name")->label(t("Directory Name"))->callback("item::validate_no_slashes")->error_messages("no_slashes", t("The directory name can't contain the \"/\" character"));
$group->hidden("type")->value("album");
$group->submit("")->value(t("Create"));
$form->add_rules_from(ORM::factory("item"));
return $form;
}
示例5: Forge
static function get_edit_form_admin($product)
{
$form = new Forge("admin/product_lines/edit_product/{$product->id}", "", "post", array("id" => "g-edit-product-form"));
$group = $form->group("edit_product")->label(t("Edit Product"));
$group->input("name")->label(t("Name"))->id("g-product-name")->value($product->name);
$group->inputs["name"]->error_messages("in_use", t("There is already a product with that name"));
$group->input("cost")->label(t("Cost"))->id("g-cost")->value($product->cost);
$group->input("description")->label(t("Description"))->id("g-description")->value($product->description);
$group->dropdown("postage_band")->label(t("Postage Band"))->options(postage_band::getPostageArray())->selected($product->postage_band_id);
$group->submit("")->value(t("Modify Product"));
$form->add_rules_from($product);
return $form;
}
示例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: _get_edit_form
private function _get_edit_form($user)
{
$form = new Forge("users/update/{$user->id}", "", "post", array("id" => "g-edit-user-form"));
$form->set_attr("class", "g-narrow");
$group = $form->group("edit_user")->label(t("Edit User: %name", array("name" => $user->name)));
$group->input("full_name")->label(t("Full Name"))->id("g-fullname")->value($user->full_name);
self::_add_locale_dropdown($group, $user);
$group->password("password")->label(t("Password"))->id("g-password");
$group->password("password2")->label(t("Confirm Password"))->id("g-password2")->matches($group->password);
$group->input("email")->label(t("Email"))->id("g-email")->value($user->email);
$group->input("url")->label(t("URL"))->id("g-url")->value($user->url);
$form->add_rules_from($user);
module::event("user_edit_form", $user, $form);
$group->submit("")->value(t("Save"));
return $form;
}
示例8: Forge
static function get_add_form_admin()
{
$form = new Forge("admin/users/add_user", "", "post", array("id" => "gAddUserForm"));
$group = $form->group("add_user")->label(t("Add User"));
$group->input("name")->label(t("Username"))->id("gUsername")->error_messages("in_use", t("There is already a user with that username"));
$group->input("full_name")->label(t("Full Name"))->id("gFullName");
$group->password("password")->label(t("Password"))->id("gPassword");
$group->password("password2")->label(t("Confirm Password"))->id("gPassword2")->matches($group->password);
$group->input("email")->label(t("Email"))->id("gEmail");
$group->input("url")->label(t("URL"))->id("gUrl");
self::_add_locale_dropdown($group);
$group->checkbox("admin")->label(t("Admin"))->id("gAdmin");
$group->submit("")->value(t("Add User"));
$user = ORM::factory("user");
$form->add_rules_from($user);
return $form;
}
示例9: Forge
static function get_add_form_admin()
{
$form = new Forge("admin/users/add_user", "", "post", array("id" => "gAddUserForm"));
$group = $form->group("add_user")->label(t("Add User"));
$group->input("name")->label(t("Name"))->id("gName");
$group->inputs["name"]->error_messages("in_use", t("There is already a user with that name"));
$group->input("full_name")->label(t("Full Name"))->id("gFullName");
$group->password("password")->label(t("Password"))->id("gPassword");
$group->password("password2")->label(t("Confirm Password"))->id("gPassword2");
$group->inputs["password2"]->error_messages("mistyped", t("The password and the confirm password must match"));
$group->input("email")->label(t("Email"))->id("gEmail");
$group->input("url")->label(t("URL"))->id("gUrl")->value($user->url);
$group->submit("")->value(t("Add User"));
$user = ORM::factory("user");
$form->add_rules_from($user);
return $form;
}
示例10: Forge
static function get_add_form($parent)
{
$form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gAddPhotoForm"));
$group = $form->group("add_photo")->label(t("Add Photo to %album_title", array("album_title" => $parent->title)));
$group->input("title")->label(t("Title"));
$group->textarea("description")->label(t("Description"));
$group->input("name")->label(t("Filename"));
$group->upload("file")->label(t("File"))->rules("required|allow[jpg,png,gif,flv,mp4]");
$group->hidden("type")->value("photo");
$group->submit("")->value(t("Upload"));
$form->add_rules_from(ORM::factory("item"));
return $form;
}
示例11: Forge
static function get_add_form($parent)
{
$form = new Forge("albums/{$parent->id}", "", "post", array("id" => "g-add-photo-form"));
$group = $form->group("add_photo")->label(t("Add Photo to %album_title", array("album_title" => $parent->title)));
$group->input("title")->label(t("Title"));
$group->textarea("description")->label(t("Description"));
$group->input("name")->label(t("Filename"));
$group->input("slug")->label(t("Internet Address"))->value($photo->slug)->callback("item::validate_url_safe")->error_messages("not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores"));
$group->upload("file")->label(t("File"))->rules("required|allow[jpg,png,gif,flv,mp4]");
$group->hidden("type")->value("photo");
$group->submit("")->value(t("Upload"));
$form->add_rules_from(ORM::factory("item"));
return $form;
}
示例12: 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;
}
示例13: Forge
static function get_add_form($parent)
{
$form = new Forge("albums/{$parent->id}", "", "post", array("id" => "g-add-album-form"));
$group = $form->group("add_album")->label(t("Add an album to %album_title", array("album_title" => $parent->title)));
$group->input("title")->label(t("Title"));
$group->textarea("description")->label(t("Description"));
$group->input("name")->label(t("Directory name"))->callback("item::validate_no_slashes")->error_messages("no_slashes", t("The directory name can't contain the \"/\" character"));
$group->input("slug")->label(t("Internet Address"))->callback("item::validate_url_safe")->error_messages("not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores"));
$group->hidden("type")->value("album");
$group->submit("")->value(t("Create"));
$form->add_rules_from(ORM::factory("item"));
$form->script("")->url(url::abs_file("modules/gallery/js/albums_form_add.js"));
return $form;
}
示例14: Forge
static function get_delete_form($tag)
{
$form = new Forge("admin/tags/delete/{$tag->id}", "", "post", array("id" => "gDeleteTagForm"));
$group = $form->group("delete_tag")->label(t("Really delete tag %tag_name?", array("tag_name" => $tag->name)));
$group->submit("")->value(t("Delete Tag"));
$form->add_rules_from(ORM::factory("tag"));
return $form;
}
示例15: 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_photo")->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 \".\""));
$group->submit("")->value(t("Modify"));
$form->add_rules_from(ORM::factory("item"));
return $form;
}