本文整理汇总了PHP中Forge类的典型用法代码示例。如果您正苦于以下问题:PHP Forge类的具体用法?PHP Forge怎么用?PHP Forge使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Forge类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _get_admin_form
private function _get_admin_form()
{
$form = new Forge("admin/hide/save", "", "post", array("id" => "g-hide-admin-form"));
$form->dropdown("access_permissions")->label(t("Who can see hidden items?"))->options(hide::get_groups_as_dropdown_options())->selected(module::get_var("hide", "access_permissions"));
$form->submit("save")->value(t("Save"));
return $form;
}
示例2: get_delete_form_admin
static function get_delete_form_admin($user)
{
$form = new Forge("admin/users/delete_user/{$user->id}", "", "post", array("id" => "gDeleteUserForm"));
$group = $form->group("delete_user")->label(t("Are you sure you want to delete user %name?", array("name" => $user->name)));
$group->submit("")->value(t("Delete user %name", array("name" => $user->name)));
return $form;
}
示例3: get_delete_form_admin
static function get_delete_form_admin($email_template)
{
$form = new Forge("admin/email_templates/delete_email_template/{$email_template->id}", "", "post", array("id" => "gDeleteEmailTemplateForm"));
$group = $form->group("delete_email_template")->label(t("Are you sure you want to delete Email template %name?", array("name" => $email_template->name)));
$group->submit("")->value(t("Delete Email template %name", array("name" => $email_template->name)));
return $form;
}
示例4: get_delete_form_admin
static function get_delete_form_admin($product)
{
$form = new Forge("admin/product_lines/delete_product/{$product->id}", "", "post", array("id" => "g-delete-product-form"));
$group = $form->group("delete_product")->label(t("Are you sure you want to delete product %name?", array("name" => $product->name)));
$group->submit("")->value(t("Delete product %name", array("name" => $product->name)));
return $form;
}
示例5: _get_admin_form
private function _get_admin_form()
{
$form = new Forge("admin/star/save", "", "post", array("id" => "g-star-admin-form"));
$form->dropdown("show")->label(t("Default to showing..."))->options(array(0 => "All", 1 => "Starred"))->selected(module::get_var("star", "show"));
$form->submit("save")->value(t("Save"));
return $form;
}
示例6: get
static function get($block_id, $theme)
{
if (identity::active_user()->guest) {
return;
}
$block = "";
switch ($block_id) {
case "untagged_photo":
$attempts = 0;
do {
$item = item::random_query()->join("items_tags", "items.id", "items_tags.item_id", "left")->where("items.type", "!=", "album")->where("items_tags.item_id", "IS", null)->find_all(1)->current();
} while (!$item && $attempts++ < 3);
if ($item && $item->loaded()) {
$block = new Block();
$block->css_id = "g-tag-it-block";
$block->title = t("Tag it");
$block->content = new View("tag_it_block.html");
$block->content->item = $item;
$form = new Forge("tags/create/{$item->id}", "", "post", array("id" => "g-tag-it-add-tag-form", "class" => "g-short-form"));
$label = $item->is_album() ? t("Add tag to album") : ($item->is_photo() ? t("Add tag to photo") : t("Add tag to movie"));
$group = $form->group("add_tag")->label("Add Tag");
$group->input("name")->label($label)->rules("required")->id("name");
$group->hidden("item_id")->value($item->id);
$group->submit("")->value(t("Add Tag"));
$block->content->form = $form;
}
break;
}
return $block;
}
示例7: _get_admin_form
private function _get_admin_form()
{
// Make a new Form.
$form = new Forge("admin/user_info/saveprefs", "", "post", array("id" => "g-user_info-admin-form"));
// Create the input boxes for the User Information Settings
$user_infoGroup = $form->group("UserInformationSettings");
$user_infoGroup->dropdown("per_page")->label(t("Number of records to display per page"))->options(array("5" => t("5"), "10" => t("10"), "15" => t("15"), "25" => t("25"), "50" => t("50"), "75" => t("75"), "100" => t("100"), "125" => t("125")))->selected(module::get_var("user_info", "per_page"));
$user_infoGroup->dropdown("default_sort_column")->label(t("Default Column to Sort By"))->options(array("id" => t("id"), "user_id" => t("user_id"), "user_name" => t("user_name"), "ip_address" => t("ip_address"), "time_stamp" => t("time_stamp"), "action" => t("action")))->selected(module::get_var("user_info", "default_sort_column"));
$user_infoGroup->dropdown("default_sort_order")->label(t("Default Sort Order"))->options(array("ASC" => t("Ascending"), "DESC" => t("Descending")))->selected(module::get_var("user_info", "default_sort_order"));
$user_infoGroup->dropdown("use_default_gallery_date_format")->label(t("Use Default Gallery Date/Time Format"))->options(array("Yes" => t("Yes"), "No" => t("No")))->selected(module::get_var("user_info", "use_default_gallery_date_format"));
$user_infoGroup->input("date_format")->label(t("Format of the Date & Time - <a href='http://php.net/manual/en/function.date.php' target='_blank'>PHP Date</a>"))->value(module::get_var("user_info", "date_format"));
$user_infoGroup->dropdown("log_logins")->label(t("Log Logins"))->options(array("Yes" => t("Yes"), "No" => t("No")))->selected(module::get_var("user_info", "log_logins"));
$user_infoGroup->input("color_login")->label(t("<font color='%color_login'>Login Color</font> - Hex Only - <a href='http://www.w3schools.com/HTML/html_colornames.asp' target='_blank'>HTML Colors</a>", array("color_login" => module::get_var("user_info", "color_login"))))->value(module::get_var("user_info", "color_login"));
$user_infoGroup->dropdown("log_logouts")->label(t("Log Logouts"))->options(array("Yes" => t("Yes"), "No" => t("No")))->selected(module::get_var("user_info", "log_logouts"));
$user_infoGroup->input("color_logout")->label(t("<font color='%color_logout'>Logout Color</font> - Hex Only - <a href='http://www.w3schools.com/HTML/html_colornames.asp' target='_blank'>HTML Colors</a>", array("color_logout" => module::get_var("user_info", "color_logout"))))->value(module::get_var("user_info", "color_logout"));
$user_infoGroup->dropdown("log_failed_logins")->label(t("Log Failed Logins"))->options(array("Yes" => t("Yes"), "No" => t("No")))->selected(module::get_var("user_info", "log_failed_logins"));
$user_infoGroup->input("color_failed_login")->label(t("<font color='%color_failed_login'>Failed Login Color</font> - Hex Only - <a href='http://www.w3schools.com/HTML/html_colornames.asp' target='_blank'>HTML Colors</a>", array("color_failed_login" => module::get_var("user_info", "color_failed_login"))))->value(module::get_var("user_info", "color_failed_login"));
$user_infoGroup->dropdown("log_re_authenticate_logins")->label(t("Log Re-Authenticate Logins"))->options(array("Yes" => t("Yes"), "No" => t("No")))->selected(module::get_var("user_info", "log_re_authenticate_logins"));
$user_infoGroup->input("color_re_authenticate_login")->label(t("<font color='%color_re_authenticate_login'>Re-Authenticate Login Color</font> - Hex Only - <a href='http://www.w3schools.com/HTML/html_colornames.asp' target='_blank'>HTML Colors</a>", array("color_re_authenticate_login" => module::get_var("user_info", "color_re_authenticate_login"))))->value(module::get_var("user_info", "color_re_authenticate_login"));
$user_infoGroup->dropdown("log_user_created")->label(t("Log User Created"))->options(array("Yes" => t("Yes"), "No" => t("No")))->selected(module::get_var("user_info", "log_user_created"));
$user_infoGroup->input("color_user_created")->label(t("<font color='%color_user_created'>User Created Color</font> - Hex Only - <a href='http://www.w3schools.com/HTML/html_colornames.asp' target='_blank'>HTML Colors</a>", array("color_user_created" => module::get_var("user_info", "color_user_created"))))->value(module::get_var("user_info", "color_user_created"));
// Add a save button to the form.
$form->submit("SaveSettings")->value(t("Save"));
// Return the newly generated form.
return $form;
}
示例8: get_delete_form
static function get_delete_form()
{
$form = new Forge("admin/watermarks/delete", "", "post", array("id" => "g-delete-watermark-form"));
$group = $form->group("delete_watermark")->label(t("Really delete Watermark?"));
$group->submit("")->value(t("Delete"));
return $form;
}
示例9: emailid
public function emailid($user_id)
{
// Display a form that a vistor can use to contact a registered user.
// If this page is disabled, show a 404 error.
if (module::get_var("contactowner", "contact_user_link") != true) {
kohana::show_404();
}
// Locate the record for the user specified by $user_id,
// use this to determine the user's name.
$userDetails = ORM::factory("user")->where("id", $user_id)->find_all();
// Make a new form with a couple of text boxes.
$form = new Forge("contactowner/sendemail", "", "post", array("id" => "gContactOwnerSendForm"));
$sendmail_fields = $form->group("contactOwner");
$sendmail_fields->input("email_to")->label(t("To:"))->value($userDetails[0]->name);
$sendmail_fields->input("email_from")->label(t("From:"))->value(user::active()->email);
$sendmail_fields->input("email_subject")->label(t("Subject:"))->value("");
$sendmail_fields->textarea("email_body")->label(t("Message:"))->value("");
$sendmail_fields->hidden("email_to_id")->value($user_id);
// Add a save button to the form.
$sendmail_fields->submit("SendMessage")->value(t("Send"));
// Set up and display the actual page.
$template = new Theme_View("page.html", "Contact");
$template->content = new View("contactowner_emailform.html");
$template->content->sendmail_form = $form;
print $template;
}
示例10: get
static function get($block_id, $theme)
{
$block = "";
// Only display on album pages that the user can edit.
$item = $theme->item();
if (!$item || !$item->is_album() || !access::can("edit", $item)) {
return;
}
switch ($block_id) {
case "batch_tag":
// Make a new sidebar block.
$block = new Block();
$block->css_id = "g-batch-tag";
$block->title = t("Batch Tag");
$block->content = new View("batchtag_block.html");
// Make a new form to place in the sidebar block.
$form = new Forge("batchtag/tagitems", "", "post", array("id" => "g-batch-tag-form"));
$label = t("Tag everything in this album:");
$group = $form->group("add_tag")->label("Add Tag");
$group->input("name")->label($label)->rules("required|length[1,64]");
$group->checkbox("tag_subitems")->label(t("Include sub-albums?"))->value(true)->checked(false);
$group->hidden("item_id")->value($item->id);
$group->submit("")->value(t("Add Tag"));
$block->content->batch_tag_form = $form;
break;
}
return $block;
}
示例11: get_email_form
static function get_email_form($user_id, $item_id = null)
{
// Determine name of the person the message is going to.
$str_to_name = "";
if ($user_id == -1) {
$str_to_name = module::get_var("contactowner", "contact_owner_name");
} else {
// Locate the record for the user specified by $user_id,
// use this to determine the user's name.
$userDetails = ORM::factory("user")->where("id", "=", $user_id)->find_all();
$str_to_name = $userDetails[0]->name;
}
// If item_id is set, include a link to the item.
$email_body = "";
if (!empty($item_id)) {
$item = ORM::factory("item", $item_id);
$email_body = "This message refers to <a href=\"" . url::abs_site("{$item->type}s/{$item->id}") . "\">this page</a>.";
}
// Make a new form with a couple of text boxes.
$form = new Forge("contactowner/sendemail/{$user_id}", "", "post", array("id" => "g-contact-owner-send-form"));
$sendmail_fields = $form->group("contactOwner");
$sendmail_fields->input("email_to")->label(t("To:"))->value($str_to_name)->id("g-contactowner-to-name");
$sendmail_fields->input("email_from")->label(t("From:"))->value(identity::active_user()->email)->id("g-contactowner-from-email")->rules('required|valid_email')->error_messages("required", t("You must enter a valid email address"))->error_messages("valid_email", t("You must enter a valid email address"))->error_messages("invalid", t("You must enter a valid email address"));
$sendmail_fields->input("email_subject")->label(t("Subject:"))->value("")->id("g-contactowner-subject")->rules('required')->error_messages("required", t("You must enter a subject"));
$sendmail_fields->textarea("email_body")->label(t("Message:"))->value($email_body)->id("g-contactowner-email-body")->rules('required')->error_messages("required", t("You must enter a message"));
// Add a captcha, if there's an active captcha module.
module::event("captcha_protect_form", $form);
// Add a save button to the form.
$sendmail_fields->submit("SendMessage")->value(t("Send"));
return $form;
}
示例12: get_delete_form_admin
static function get_delete_form_admin($postage)
{
$form = new Forge("admin/postage_bands/delete_postage_band/{$postage->id}", "", "post", array("id" => "gDeletePostageForm"));
$group = $form->group("delete_postage")->label(t("Are you sure you want to delete postage band %name?", array("name" => $postage->name)));
$group->submit("")->value(t("Delete postage band %name", array("name" => $postage->name)));
return $form;
}
示例13: _get_admin_form
private function _get_admin_form()
{
// Make a new Form.
$form = new Forge("admin/exif_gps/saveprefs", "", "post", array("id" => "g-exif-gps-adminForm"));
// Create group for global settings, like the Maps API Key
$gps_global_group = $form->group("Global")->label(t("Global Settings"));
$gps_global_group->input("google_api_key")->label(t("Google Maps API Key"))->value(module::get_var("exif_gps", "googlemap_api_key"))->rules("required");
$gps_global_group->input("max_auto_zoom_level")->label(t("Maximum Auto-Zoom Level:"))->value(module::get_var("exif_gps", "googlemap_max_autozoom"));
$checkbox_user["checkbox_user"] = array(t("Show \"Map this user\" icon?"), module::get_var("exif_gps", "toolbar_map_user"));
$checkbox_album["checkbox_album"] = array(t("Show \"Map this album\" icon?"), module::get_var("exif_gps", "toolbar_map_album"));
$gps_global_group->checklist("toolbar_map_album")->options($checkbox_album);
$gps_global_group->checklist("toolbar_map_user")->options($checkbox_user);
// Create a group for sidebar settings
$gps_sidebar = $form->group("Sidebar")->label(t("Sidebar Settings"));
$gps_sidebar->input("sidebar_default_zoom")->label(t("Default Zoom Level"))->value(module::get_var("exif_gps", "sidebar_zoom"))->rules("required");
$gps_sidebar->dropdown("sidebar_mapformat")->label(t("Map Interface"))->options(array(t("Static"), t("Interactive")))->selected(module::get_var("exif_gps", "sidebar_mapformat"));
$gps_sidebar->dropdown("sidebar_maptype")->label(t("Default Map Type"))->options(array(t("Map"), t("Satellite"), t("Hybrid"), t("Terrain")))->selected(module::get_var("exif_gps", "sidebar_maptype"));
// Create a group for map album/user settings
$gps_large_map_group = $form->group("LargeMap")->label(t("Map Album/User Settings"));
$gps_large_map_group->dropdown("largemap_maptype")->label(t("Default Map Type"))->options(array(t("Map"), t("Satellite"), t("Hybrid"), t("Terrain")))->selected(module::get_var("exif_gps", "largemap_maptype"));
// Add a save button to the form.
$form->submit("SaveSettings")->value(t("Save"));
// Return the newly generated form.
return $form;
}
示例14: get_edit_form_admin
static function get_edit_form_admin()
{
$form = new Forge("admin/theme_options/save/", "", null, array("id" => "g-theme-options-form"));
$group = $form->group("requirements")->label("Prerequisites checklist");
$group->checkbox("shadowbox")->label(t("Shadowbox module"))->checked(module::is_active("shadowbox"))->disabled(true);
$file = THEMEPATH . "greydragon/theme.info";
$theme_info = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS);
$group = $form->group("edit_theme")->label(t("Grey Dragon Theme") . " - " . t("v.") . $theme_info->version);
$group->input("row_count")->label(t("Rows per album page"))->id("g-page-size")->rules("required|valid_digit")->value(module::get_var("gallery", "page_size") / 3);
$group->input("resize_size")->label(t("Resized image size (in pixels)"))->id("g-resize-size")->rules("required|valid_digit")->value(module::get_var("gallery", "resize_size"));
$group->checkbox("build_resize")->label(t("Mark to build all resizes (from Maintenace page)"))->id("g-build-resize")->value(false);
$group->checkbox("build_thumbs")->label(t("Mark to build all thumbnails (200x200) (from Maintenace page)"))->id("g-build-thumb")->value(false);
$group->checkbox("photonav_top")->label(t("Show top photo navigator"))->checked(module::get_var("th_greydragon", "photonav_top"));
$group->checkbox("photonav_bottom")->label(t("Show bottom photo navigator"))->checked(module::get_var("th_greydragon", "photonav_bottom"));
$group->dropdown("sidebar_allowed")->label(t("Allowed SideBar Positions"))->options(array("any" => t("Any"), "left" => t("Left"), "right" => t("Right"), "none" => t("None")))->selected(module::get_var("th_greydragon", "sidebar_allowed"));
$group->dropdown("sidebar_visible")->label(t("Default SideBar Position"))->options(array("right" => t("Right"), "left" => t("Left"), "none" => t("None")))->selected(module::get_var("th_greydragon", "sidebar_visible"));
$group->input("header_text")->label(t("Header text"))->id("g-header-text")->value(module::get_var("gallery", "header_text"));
$group->input("footer_text")->label(t("Footer text"))->id("g-footer-text")->value(module::get_var("gallery", "footer_text"));
$group->checkbox("show_credits")->label(t("Show site credits"))->id("g-footer-text")->checked(module::get_var("gallery", "show_credits"));
$group->input("copyright")->label(t("Copyright message to display on footer"))->id("g-theme-copyright")->value(module::get_var("th_greydragon", "copyright"));
$group->input("logo_path")->label(t("URL or path to alternate logo image"))->id("g-site-logo")->value(module::get_var("th_greydragon", "logo_path"));
module::event("theme_edit_form", $form);
$group = $form->group("buttons");
$group->submit("")->value(t("Save"));
return $form;
}
示例15: sidebar_blocks
static function sidebar_blocks($theme)
{
// Display form for tagging in the album sidebar.
// Make sure the current page belongs to an item.
if (!$theme->item()) {
return;
}
$item = $theme->item();
// Only display the form in albums that the user has edit permission in.
if ($item->is_album() && access::can("edit", $item)) {
// Make a new sidebar block.
$block = new Block();
$block->css_id = "gBatchTag";
$block->title = t("Batch Tag");
$block->content = new View("batchtag_block.html");
// Make a new form to place in the sidebar block.
$form = new Forge("batchtag/tagitems", "", "post", array("id" => "gBatchTagForm"));
$label = t("Tag everything in this album:");
$group = $form->group("add_tag")->label("Add Tag");
$group->input("name")->label($label)->rules("required|length[1,64]");
$group->hidden("item_id")->value($item->id);
$group->submit("")->value(t("Add Tag"));
$block->content->form = $form;
// Display the block.
return $block;
}
}