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(); }
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; }
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 APIs Console key (optional):"))->value(module::get_var("exif_gps", "googlemap_api_key")); $gps_global_group->input("max_auto_zoom_level")->label(t("Maximum Auto-Zoom Level:"))->value(module::get_var("exif_gps", "googlemap_max_autozoom")); $gps_global_group->checkbox("toolbar_map_album")->label(t("Show \"Map this album\" icon?"))->checked(module::get_var("exif_gps", "toolbar_map_album", false)); $gps_global_group->checkbox("toolbar_map_user")->label(t("Show \"Map this user\" icon?"))->checked(module::get_var("exif_gps", "toolbar_map_user", false)); $gps_global_group->checkbox("restrict_maps")->label(t("Restrict maps to registered users?"))->checked(module::get_var("exif_gps", "restrict_maps", false)); // Create a group for marker cluster settings $gps_markercluster = $form->group("markercluster")->label(t("Marker Cluster Settings")); $gps_markercluster->input("markercluster_gridsize")->label(t("Grid Size"))->value(module::get_var("exif_gps", "markercluster_gridsize"))->rules("required"); $gps_markercluster->input("markercluster_maxzoom")->label(t("Max Zoom"))->value(module::get_var("exif_gps", "markercluster_maxzoom"))->rules("required"); // 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; }
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; }
private function _get_form() { $form = new Forge("admin/auto_date", "", "post", array("id" => "g-admin-auto_date-form")); $group = $form->group("auto_date")->label(t("Default filename convention(php's <a href=\"http://php.net/manual/en/function.strptime.php\">strptime() format</a>)")); $group->input("template")->id("template")->label(t("Template:"))->value(module::get_var("auto_date", "template")); $form->submit("submit")->value(t("Save")); return $form; }
private function _get_form() { $form = new Forge("admin/date_tag", "", "post", array("id" => "g-admin-date_tag-form")); $group = $form->group("date_tag")->label(t("Default Tag (php's <a href=\"http://php.net/manual/en/function.date.php\">date() format</a>)")); $group->input("template")->id("template")->label(t("Template:"))->value(module::get_var("date_tag", "template")); $form->submit("submit")->value(t("Save")); return $form; }
private function _get_form() { $form = new Forge("admin/photoannotation/handler", "", "post", array("id" => "g-admin-form")); $group = $form->group("photoannotation")->label(t("Photo annotation settings")); $group->checkbox("showfaces")->label(t("Show face annotation below photo."))->checked(module::get_var("photoannotation", "showfaces", false)); $group->checkbox("shownotes")->label(t("Show note annotations below photo."))->checked(module::get_var("photoannotation", "shownotes", false)); $form->submit("submit")->value(t("Save")); return $form; }
private function _get_form() { $form = new Forge("admin/custom_header/handler", "", "post", array("id" => "g-admin-form")); $group = $form->group("custom_header")->label(t("Custom header")); $group->textarea("custom_header_code")->label(t('Enter custom header tags on the form [meta name:"name" content:"content"/] to render <meta name="name" content="content"/>. Pure HTML cannot be used due to internal filtering.'))->value(module::get_var("custom_header", "code")); $form->submit("submit")->value(t("Save")); return $form; }
private function _get_form() { $form = new Forge("admin/default_sort", "", "post", array("id" => "g-admin-default_sort-form")); $group = $form->group("sort_order")->label(t("Sort Order")); $group->dropdown("sort_column")->id(t("sort_column"))->label(t("Sort by"))->options(array_merge(array("none" => t("None")), album::get_sort_order_options()))->selected(module::get_var("default_sort", "default_sort_column", "none")); $group->dropdown("sort_direction")->id(t("sort_direction"))->label(t("Sort by"))->options(array("none" => t("None"), "ASC" => t("Ascending"), "DESC" => t("Descending")))->selected(module::get_var("default_sort", "default_sort_direction", "none")); $form->submit("submit")->value(t("Save")); return $form; }
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); }
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; }
private function _get_admin_form() { $form = new Forge("admin/movies/save", "", "post", array("id" => "g-movies-admin-form")); $group = $form->group("settings")->label(t("Settings")); $group->dropdown("allow_uploads")->label(t("Allow movie uploads into Gallery (does not affect existing movies)"))->options(array("autodetect" => t("only if FFmpeg is detected (default)"), "always" => t("always"), "never" => t("never")))->selected(module::get_var("gallery", "movie_allow_uploads", "autodetect")); $group->checkbox("rebuild_thumbs")->label(t("Rebuild all movie thumbnails (once FFmpeg is installed, use this to update existing movie thumbnails)"))->checked(false); // always set as false $form->submit("save")->value(t("Save")); return $form; }
private function _get_admin_form() { $form = new Forge("admin/pdf/save", "", "post", array("id" => "g-pdf-admin-form")); $group = $form->group("settings")->label(t("PDF settings")); $group->checkbox("make_thumb")->label(t("Generate thumbnails (only if Ghostscript is found)"))->checked(module::get_var("pdf", "make_thumb", null)); $group->checkbox("movie_overlay_hide")->label(t("Hide overlay from \"movie_overlay\" module (tested with Movie Overlay v3)"))->checked(module::get_var("pdf", "movie_overlay_hide", null)); $group->checkbox("rebuild_thumbs")->label(t("Mark all existing PDFs for rebuild - afterward, go to Maintenace | Rebuild Images"))->checked(false); // always set as false $form->submit("")->value(t("Save")); return $form; }
private function _get_admin_form() { // Make a new Form. $form = new Forge("admin/language_flags/saveprefs", "", "post", array("id" => "g-language-flags-adminForm")); // Figure out what type of flags to display. $group_flag_types = $form->group("flag_types"); $group_flag_types->dropdown('flag_shape')->label(t("Flag Shape:"))->options(array('rectangular' => 'Rectangular', 'round' => 'Round', 'square' => 'Square', 'custom' => 'Custom'))->selected(module::get_var("language_flags", "flag_shape")); // Add a save button to the form. $form->submit("SavePrefs")->value(t("Save")); // Return the newly generated form. return $form; }
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(); }
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; }
private function _get_form() { $form = new Forge("admin/dynamic/handler", "", "post", array("id" => "gAdminForm")); foreach (array("updates", "popular") as $album) { $album_defn = unserialize(module::get_var("dynamic", $album)); $group = $form->group($album)->label(t($album_defn->title)); $group->checkbox("{$album}_enabled")->label(t("Enable"))->value(1)->checked($album_defn->enabled); $group->input("{$album}_limit")->label(t("Limit (leave empty for unlimited)"))->value(empty($album_defn->limit) ? "" : $album_defn->limit)->rules("valid_numeric"); $group->textarea("{$album}_description")->label(t("Description"))->rules("length[0,2048]")->value($album_defn->description); } $form->submit("submit")->value(t("Submit")); return $form; }
private function _get_admin_form() { $form = new Forge("admin/movie_tools/save", "", "post", array("id" => "g-movie-tools-admin-form")); $formats = movie_tools::get_formats(); $settings_formats = $form->group("formats")->label(t("Movie format supported")); foreach ($formats as $id => $data) { $settings_formats->checkbox($id)->label($data["name"])->checked(module::get_var("movie_tools", "allow_{$id}", false)); } $settings_formats->input("custom_formats")->label(t("Additional movie formats (enter using the same formatting as the table above)"))->callback(array($this, "_validate_custom_formats"))->error_messages("valid_custom_formats", t("You must enter valid formats like the examples in the table"))->value(movie_tools::formats_json_to_string(module::get_var("movie_tools", "custom_formats", ""))); $settings_thumbs = $form->group("thumbs")->label(t("Movie thumbnails")); $settings_thumbs->input("extract_frame_time")->label(t("Seconds from start of movie at which thumbnails are extracted (default: 3)"))->rules("required|valid_numeric")->callback(array($this, "_validate_extract_frame_time"))->error_messages("required", t("You must enter a number"))->error_messages("valid_numeric", t("You must enter a number"))->error_messages("valid_min", t("The value cannot be negative"))->value(module::get_var("gallery", "movie_extract_frame_time", 3)); $form->submit("save")->value(t("Save")); return $form; }
private function _get_form() { $form = new Forge("admin/menu_links/handler", "", "post", array("id" => "g-admin-form")); $group = $form->group("menu")->label(t("First link on menu")); $group->input("menu_title")->label(t('Enter the title.'))->value(module::get_var("menu_links", "title")); $group->input("menu_url")->label(t('Enter the URL of the link.'))->value(module::get_var("menu_links", "url")); $group = $form->group("menu2")->label(t("Gallery root album title")); $group->input("menu_title2")->label(t('Enter the title.'))->value(module::get_var("menu_links", "title2", "home"))->rules("required"); $group->checkbox("menu_hidden")->label(t("Hide link"))->checked(module::get_var("menu_links", "hidden", false) == 1); $group = $form->group("menu3")->label(t("Link after the Gallery root album.")); $group->input("menu_title3")->label(t('Enter the title.'))->value(module::get_var("menu_links", "title3")); $group->input("menu_url3")->label(t('Enter the URL of the link.'))->value(module::get_var("menu_links", "url3")); $form->submit("submit")->value(t("Save")); return $form; }
private function _get_s3_form() { $form = new Forge("admin/aws_s3", "", "post", array("id" => "g-admin-s3-form")); $group = $form->group("aws_s3")->label(t("Amazon S3 Settings")); $group->checkbox("enabled")->id("s3-enabled")->checked(module::get_var("aws_s3", "enabled"))->label("S3 enabled"); $group->input("access_key")->id("s3-access-key")->label("Access Key ID")->value(module::get_var("aws_s3", "access_key"))->rules("required")->error_messages("required", "This field is required")->message('<a target="_blank" href="https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&action=access-key">Sign up to Amazon S3</a>'); $group->input("secret_key")->id("s3-secret-key")->label("Secret Access Key")->value(module::get_var("aws_s3", "secret_key"))->rules("required")->error_messages("required", "This field is required"); $group->input("bucket_name")->id("s3-bucket")->label("Bucket Name")->value(module::get_var("aws_s3", "bucket_name"))->rules("required")->error_messages("required", "This field is required")->message("Note: This module will not create a bucket if it does not already exist. Please ensure you have already created the bucket and the bucket has the correct ACL permissions before continuing."); $group->input("g3id")->id("s3-g3id")->label("G3 ID")->value(module::get_var("aws_s3", "g3id", md5(time())))->rules("required")->error_messages("required", "This field is required")->message("This field allows for multiple G3 instances running off of a single S3 bucket."); $group->checkbox("use_ssl")->id("s3-use-ssl")->checked(module::get_var("aws_s3", "use_ssl"))->label("Use SSL for S3 transfers"); $group = $form->group("cdn_settings")->label(t("CDN Settings")); $group->input("url_str")->id("s3-url-str")->label("URL String")->value(module::get_var("aws_s3", "url_str", "http://{bucket}.s3.amazonaws.com/g3/{guid}/{resource}"))->rules("required")->message("Configure the URL to access uploaded resources on the CDN. Use the following variables to define and build up the URL:<br />\n• {bucket} - Bucket Name<br />\n• {guid} - Unique identifier for this gallery installation<br />\n• {resource} - The end path to the resource/object"); $group->input("sig_exp")->id("sig_exp")->label("Private Content Signature Duration")->value(module::get_var("aws_s3", "sig_exp", 60))->rules("required")->callback("aws_s3::validate_number")->error_messages("not_numeric", "The value provided is not numeric. Please enter a number in this field.")->message("Set the time in seconds for the generated signature for access to permission-restricted S3 objects<br /><br />\nNote: this module does not yet support the creation of signatures to access private objects on S3 via CloudFront CDN."); $form->submit("save")->value("Save Settings"); return $form; }
private function _get_admin_form() { // Make a new Form. $form = new Forge("admin/iptc/saveprefs", "", "post", array("id" => "g-iptc-adminForm")); // Create group for display settings $iptc_display_group = $form->group("Global")->label(t("Display Settings")); $show = t("Show"); foreach (iptc::keys() as $keyword => $iptcvar) { unset($checkbox); $checkbox[$keyword] = array($show . " \"" . $iptcvar[1] . "\" ?", module::get_var("iptc", "show_" . $keyword)); $iptc_display_group->checklist($keyword)->options($checkbox); } // Add a save button to the form. $form->submit("SaveSettings")->value(t("Save")); // Return the newly generated form. return $form; }
private function _get_admin_form() { // Make a new Form. $form = new Forge("admin/downloadfullsize/saveprefs", "", "post", array("id" => "g-download-fullsize-adminForm")); // Make an array for the different types of download links. $linkOptions["fButton"] = array(t("Show Floppy Disk Picture Link"), module::get_var("downloadfullsize", "fButton")); // Setup a few checkboxes on the form. $add_links = $form->group("DownloadLinks"); $add_links->checklist("DownloadLinkOptions")->options($linkOptions); if (module::is_active("keeporiginal")) { $KeepOriginalOptions["DownloadOriginalImage"] = array(t("Allow visitors to download the original image when available?"), module::get_var("downloadfullsize", "DownloadOriginalImage")); $keeporiginal_group = $form->group("KeepOriginalPrefs")->label(t("KeepOriginal Preferences")); $keeporiginal_group->checklist("DownloadOriginalOptions")->options($KeepOriginalOptions); } // Add a save button to the form. $form->submit("SaveLinks")->value(t("Save")); // Return the newly generated form. return $form; }
private function _get_admin_form() { // Make a new Form. $form = new Forge("admin/phpmailer/saveprefs", "", "post", array("id" => "g-php-mailer-admin-form")); // Create the input boxes for the PHPMailer Settings $phpmailerGroup = $form->group("PHPMailerSettings"); $phpmailerGroup->input("phpmailer_path")->label(t("Location of PHPMailer Class"))->value(module::get_var("phpmailer", "phpmailer_path")); $phpmailerGroup->input("phpmailer_from_address")->label(t("From Email Address"))->value(module::get_var("phpmailer", "phpmailer_from_address")); $phpmailerGroup->input("phpmailer_from_name")->label(t("From Name"))->value(module::get_var("phpmailer", "phpmailer_from_name")); // Create the input boxes for the SMTP server settings $phpmailerSMTP = $form->group("PHPMailerSMTPSettings"); $phpmailerSMTP->input("phpmailer_smtp_server")->label(t("SMTP Server Address"))->value(module::get_var("phpmailer", "smtp_server")); $phpmailerSMTP->input("phpmailer_smtp_login")->label(t("SMTP Login Name"))->value(module::get_var("phpmailer", "smtp_login")); $phpmailerSMTP->input("phpmailer_smtp_password")->label(t("SMTP Password"))->value(module::get_var("phpmailer", "smtp_password")); // Add a save button to the form. $form->submit("SaveSettings")->value(t("Save")); // Return the newly generated form. return $form; }
private function _get_admin_form() { $form = new Forge("admin/tag_albums/saveprefs", "", "post", array("id" => "g-tag-albums-admin-form")); $tag_albums_tagsort_group = $form->group("Tag_Albums_Tag_Sort")->label(t("\"All Tags\" Album Preferences")); $tag_albums_tagsort_group->input("tag_page_title")->label(t("Page Title"))->value(module::get_var("tag_albums", "tag_page_title")); $tag_albums_tagsort_group->dropdown("tag_index")->label(t("Tag album's index should display:"))->options(array("default" => "(default) Individual Tag Albums", "tagcloudpage" => "Tag Cloud Page Module", "alltags" => "All Tags Module"))->selected(module::get_var("tag_albums", "tag_index")); $tag_albums_tagsort_group->dropdown("tag_sort_by")->label(t("Sort \"All Tags\" Albums By:"))->options(array("name" => "Name", "count" => "Count", "id" => "ID Number"))->selected(module::get_var("tag_albums", "tag_sort_by")); $tag_albums_tagsort_group->dropdown("tag_sort_direction")->label(t("Display Albums In:"))->options(array("ASC" => "Ascending Order", "DESC" => "Descending"))->selected(module::get_var("tag_albums", "tag_sort_direction")); $tag_index_scope_options["tag_index_scope"] = array(t("Use tag album index setting for \"*\" albums as well?"), module::get_var("tag_albums", "tag_index_scope")); $tag_albums_tagsort_group->checklist("tag_index_scope")->options($tag_index_scope_options); $tag_index_filter_top_options["tag_index_filter_top"] = array(t("Display filter links on the top of \"All Tags\" album pages?"), module::get_var("tag_albums", "tag_index_filter_top")); $tag_albums_tagsort_group->checklist("tag_index_filter_top")->options($tag_index_filter_top_options); $tag_index_filter_bottom_options["tag_index_filter_bottom"] = array(t("Display filter links on the bottom of \"All Tags\" album pages?"), module::get_var("tag_albums", "tag_index_filter_bottom")); $tag_albums_tagsort_group->checklist("tag_index_filter_bottom")->options($tag_index_filter_bottom_options); $tag_albums_tagitemsort_group = $form->group("Tag_Albums_Tag_Item_Sort")->label(t("\"All Tags\" Sub-Album Preferences")); $tag_albums_tagitemsort_group->dropdown("subalbum_sort_by")->label(t("Sort Contents of Sub-Albums By:"))->options(array("title" => "Title", "name" => "File name", "captured" => "Date captured", "created" => "Date uploaded", "updated" => "Date modified", "view_count" => "Number of views"))->selected(module::get_var("tag_albums", "subalbum_sort_by")); $tag_albums_tagitemsort_group->dropdown("subalbum_sort_direction")->label(t("Display Contents of Sub-Albums In:"))->options(array("ASC" => "Ascending Order", "DESC" => "Descending"))->selected(module::get_var("tag_albums", "subalbum_sort_direction")); // Add a save button to the form. $form->submit("SaveSettings")->value(t("Save")); // Return the newly generated form. return $form; }
private function _get_admin_form() { // Make a new Form. $form = new Forge("admin/contactowner/saveprefs", "", "post", array("id" => "g-contact-owner-adminForm")); // Make an array for the different types of link codes. $add_contactlinks = $form->group("contactOwnerLinks"); $linkOptions["ContactOwner"] = array("Display Contact Site Owner Link", module::get_var("contactowner", "contact_owner_link")); $linkOptions["ContactUser"] = array("Display Contact Item Owner Link", module::get_var("contactowner", "contact_user_link")); // Turn the array into a series of checkboxes. $add_contactlinks->checklist("ContactOwnerLinkTypes")->options($linkOptions); // Set up some text boxes for the site owners Name, email and the // text for the contact link. $add_contacts = $form->group("contactOwner"); $add_contacts->input("owner_button_text")->label(t("Contact Owner Link Text"))->value(module::get_var("contactowner", "contact_button_text")); $add_contacts->input("owner_email")->label(t("Owner Email Address"))->value(module::get_var("contactowner", "contact_owner_email")); $add_contacts->input("owner_name")->label(t("Owner Name"))->value(module::get_var("contactowner", "contact_owner_name")); $message_prefs = $form->group("messagePrefs"); $message_prefs->input("message_header")->label(t("Email Message Header"))->value(module::get_var("contactowner", "contact_owner_header")); // Add a save button to the form. $form->submit("SaveSettings")->value(t("Save")); // Return the newly generated form. return $form; }
public function index() { // Display the admin page. $view = new Admin_View("admin.html"); $view->page_title = t("Fotomoto"); $view->content = new View("admin_fotomotorw.html"); // Generate a form to allow the user to choose which links to display under photos. $form = new Forge("admin/fotomotorw/savedisplay", "", "post", array("id" => "g-fotomotorw-admin-display-prefs")); $display_links_group = $form->group("fotomoto_display_links_group"); $link_options["fotomoto_buy_prints"] = array(t("Buy Prints"), module::get_var("fotomotorw", "fotomoto_buy_prints")); $link_options["fotomoto_buy_cards"] = array(t("Buy Cards"), module::get_var("fotomotorw", "fotomoto_buy_cards")); $link_options["fotomoto_buy_download"] = array(t("Download"), module::get_var("fotomotorw", "fotomoto_buy_download")); $link_options["fotomoto_share_ecard"] = array(t("Send eCard"), module::get_var("fotomotorw", "fotomoto_share_ecard")); $link_options["fotomoto_share_facebook"] = array(t("Share on Facebook"), module::get_var("fotomotorw", "fotomoto_share_facebook")); $link_options["fotomoto_share_twitter"] = array(t("Share on Twitter"), module::get_var("fotomotorw", "fotomoto_share_twitter")); $link_options["fotomoto_share_digg"] = array(t("Share on Digg"), module::get_var("fotomotorw", "fotomoto_share_digg")); // Turn the array into a series of checkboxes. $display_links_group->checklist("fotomoto_display_links")->options($link_options); // Add a save button to the form. $form->submit("SaveSettings")->value(t("Save")); $view->content->display_form = $form; print $view; }
/** * Get tweet form * @param object $item * @return Forge */ static function get_tweet_form($item) { $long_url = url::abs_site($item->relative_url_cache); // Check for saved tweets for this user and item $saved = self::get_failed($item->id); if ($saved) { $default_tweet = $saved->tweet; $tweet_id = $saved->id; } else { $default_tweet = module::get_var("twitter", "default_tweet"); $tweet_id = 0; } $tweet = preg_replace("/%type/", $item->type, $default_tweet); $tweet = preg_replace("/%title/", $item->title, $tweet); $tweet = preg_replace("/%description/", $item->description, $tweet); // If bit.ly module's enabled, get the item's URL and shorten it if (!empty($item->id) && module::is_active("bitly") && module::get_var("twitter", "shorten_urls")) { $url = bitly::shorten_url($item->id); } else { $url = url::abs_site($item->relative_url_cache); } // Truncate the default tweet if it's too long $url_length = strlen($url) + 1; $tweet_length = strlen($tweet); if ($tweet_length + $url_length > self::$character_count) { $trim_pos = 0 - ($tweet_length + $url_length - 140); $tweet = substr($tweet, 0, $trim_pos); } $tweet = $tweet . ' ' . $url; $form = new Forge("twitter/tweet/{$item->id}", "", "post", array("id" => "g-twitter-tweet-form")); $group = $form->group("twitter_message")->label(t("Compose Tweet")); $group->textarea("tweet")->value($tweet)->rules("required")->error_messages("required", t("Your tweet cannot be empty!"))->id("g-tweet"); $group->hidden("tweet_id")->value($tweet_id)->id("tweet_id"); $group->checkbox("attach_image")->label(t("Attach resize image to tweet (reduces available chars)?"))->value(1)->id("g-attach_image"); $form->submit("")->value(t("Tweet")); return $form; }
private function _get_admin_form() { // Generate a form for configuring the slideshow. // Make a new Form. $form = new Forge("admin/minislideshow/saveprefs", "", "post", array("id" => "g-mini-slideshow-admin-form")); // Get location of slideshow files. $group_slideshow_files = $form->group("Minislideshow"); $group_slideshow_files->input("slideshow_url")->label(t("URL to your minislideshow.swf"))->value(module::get_var("minislideshow", "slideshow_url")); // Get additional settings for the slideshow. $group_slideshow_settings = $form->group("MinislideshowSettings"); $group_slideshow_settings->label(t("MiniSlide Show Settings")); $group_slideshow_settings->dropdown('shuffle')->label(t("Shuffle:"))->options(array('true' => 'True', '' => 'False'))->selected(module::get_var("minislideshow", "shuffle")); $group_slideshow_settings->dropdown('dropshadow')->label(t("Drop Shadow:"))->options(array('true' => 'True', '' => 'False'))->selected(module::get_var("minislideshow", "dropshadow")); $group_slideshow_settings->dropdown('show_title')->label(t("Show Title:"))->options(array('top' => 'Top', 'bottom' => 'Bottom', '' => 'False'))->selected(module::get_var("minislideshow", "show_title")); $group_slideshow_settings->dropdown('trans_in_type')->label(t("Transition In:"))->options(array('Blinds' => 'Blinds', '' => 'Fade', 'Fly' => 'Fly', 'Iris' => 'Iris', 'Photo' => 'Photo', 'PixelDissolve' => 'Pixel Dissolve', 'Rotate' => 'Rotate', 'Squeeze' => 'Squeeze', 'Wipe' => 'Wipe', 'Zoom' => 'Zoom', 'Random' => 'Random'))->selected(module::get_var("minislideshow", "trans_in_type")); $group_slideshow_settings->dropdown('trans_out_type')->label(t("Transition Out:"))->options(array('Blinds' => 'Blinds', '' => 'Fade', 'Fly' => 'Fly', 'Iris' => 'Iris', 'Photo' => 'Photo', 'PixelDissolve' => 'Pixel Dissolve', 'Rotate' => 'Rotate', 'Squeeze' => 'Squeeze', 'Wipe' => 'Wipe', 'Zoom' => 'Zoom', 'Random' => 'Random'))->selected(module::get_var("minislideshow", "trans_out_type")); $group_slideshow_settings->dropdown('mask')->label(t("Mask:"))->options(array('' => 'None', 'circleMask' => 'Circle', 'roundedMask' => 'Rounded Corners', 'starMask' => 'Star'))->selected(module::get_var("minislideshow", "mask")); $group_slideshow_settings->dropdown('use_full_image')->label(t("Use Full Image:"))->options(array('true', 'false', 'Use Resize'))->selected(module::get_var("minislideshow", "use_full_image")); $group_slideshow_settings->input("delay")->label(t("Delay:"))->value(module::get_var("minislideshow", "delay")); // Add a save button to the form. $form->submit("SaveSettings")->value(t("Save")); // Return the newly generated form. return $form; }
private function _get_form() { $form = new Forge("admin/strip_exif", "", "post", array("id" => "g-admin-strip_exif-form")); $group = $form->group("system")->label(t("System")); $exivPath = strip_exif::whereis("exiv2"); $group->input("exiv_path")->id("exiv_path")->label(t("Path to exiv2 binary:"))->value(module::get_var("strip_exif", "exiv_path", $exivPath))->callback("strip_exif::verify_exiv_path")->error_messages("required", t("You must enter the path to exiv2"))->error_messages("invalid", t("File does not exist"))->error_messages("is_dir", t("File is a directory"))->message("Auto detected exiv2 here: " . $exivPath); $group = $form->group("tags")->label(t("Tags")); $group->checkbox("exif_remove")->label(t("Strip these EXIF tags:"))->checked(module::get_var("strip_exif", "exif_remove", true) == 1); if (($exifTags = module::get_var("strip_exif", "exif_tags", self::$defExifTags)) == "") { $exifTags = self::$defExifTags; } $group->input("exif_tags")->id("exif_tags")->value($exifTags); $group->checkbox("iptc_remove")->label(t("Strip these IPTC tags:"))->checked(module::get_var("strip_exif", "iptc_remove", true) == 1); if (($iptcTags = module::get_var("strip_exif", "iptc_tags", self::$defIptcTags)) == "") { $iptcTags = self::$defIptcTags; } $group->input("iptc_tags")->id("iptc_tags")->value($iptcTags); $form->submit("submit")->value(t("Save")); return $form; }
private function _get_form() { $form = new Forge("admin/social_share/handler", "", "post", array("id" => "g-admin-form")); /// General Settings $group_general = $form->group("general_settings")->label(t("General Settings")); $group_general->checkbox("general_impage_only")->label(t("Display the enabled buttons on image and movie pages only"))->checked(module::get_var("social_share", "general_impage_only", true) == 1); /// Facebook share settings $group_facebook_share = $form->group("facebook_share_settings")->label(t("Facebook Share Button Settings")); $group_facebook_share->checkbox("facebook_share_enabled")->label(t("Display the button"))->checked(module::get_var("social_share", "facebook_share_enabled", false) == 1); $group_facebook_share->dropdown("facebook_share_layout")->label(t("The button layout to use"))->options(array("button" => t("Button"), "icon_link" => t("Icon and Link"), "icon" => t("Icon")))->selected(module::get_var("social_share", "facebook_share_layout")); $group_facebook_share->input("facebook_share_link_text")->label(t('Enter the text to place next to the Facebook icon.'))->value(module::get_var("social_share", "facebook_share_link_text", "Share")); /// Facebook like settings $group_facebook_like = $form->group("facebook_like_settings")->label(t("Facebook Like Button Settings")); $group_facebook_like->checkbox("facebook_like_enabled")->label(t("Display the button"))->checked(module::get_var("social_share", "facebook_like_enabled", false) == 1); $group_facebook_like->input("facebook_like_appId")->label(t('Enter the appId from <a href="http://developers.facebook.com/setup/" target="_blank">FaceBook Create an App</a>. You must get your *own* appID. If you see the number "123456789012345" it is only a demo.<br /> Note: www.example.com/ is different than example.com/'))->value(module::get_var("social_share", "facebook_like_appId", "123456789012345"))->rules("valid_numeric"); $group_facebook_like->input("facebook_like_adminId")->label(t('Enter <strong>your</strong Facebook <strong>numeric</strong> ID, which you can get as the "Admin" field in Stage 2 of <a href="http://developers.facebook.com/docs/reference/plugins/like/" target="_blank">FaceBook Like Button Config</a>. If you see the number "123456789012345" it is only a demo.<br />'))->value(module::get_var("social_share", "facebook_like_adminId", "123456789012345"))->rules("valid_numeric"); $group_facebook_like->input("facebook_like_site_name")->label(t('Enter the site name you want to show on Facebook.'))->value(module::get_var("social_share", "facebook_like_site_name", "Gallery")); $group_facebook_like->dropdown("facebook_like_code_type")->label(t("The type of Ccde to display for the button"))->options(array("html5" => t("HTML5 (allows the Send button and better dialogs)"), "xfbml" => t("XFBML (allows the Send button and better dialogs)"), "iframe" => t("iFrame")))->selected(module::get_var("social_share", "facebook_like_code_type")); $group_facebook_like->checkbox("facebook_like_show_faces")->label(t("Display profile photos of the Facebook friends who 'Like' below the Like button (standard layout only)."))->checked(module::get_var("social_share", "facebook_like_show_faces")); $group_facebook_like->checkbox("facebook_like_send")->label(t("Include a Send button with the Like button. This only works with the XFBML version."))->checked(module::get_var("social_share", "facebook_like_send")); $group_facebook_like->dropdown("facebook_like_action")->label(t("Verb to display"))->options(array("like" => t("Like"), "recommend" => t("Recommend")))->selected(module::get_var("social_share", "facebook_like_action")); $group_facebook_like->dropdown("facebook_like_layout")->label(t("Layout style. Determines the size and amount of social context next to the button"))->options(array("standard" => t("Standard."), "button_count" => t("Button count"), "box_count" => t("Box count")))->selected(module::get_var("social_share", "facebook_like_layout")); /// Google settings $group_google = $form->group("google_settings")->label(t("Google+ +1 Button Settings")); $group_google->checkbox("google_enabled")->label(t("Display the button"))->checked(module::get_var("social_share", "google_enabled", false) == 1); $group_google->dropdown("google_size")->label(t("Size of the button"))->options(array("standard" => t("Standard (24px)"), "small" => t("Small (15px)"), "medium" => t("Medium (20px)"), "tall" => t("Tall (60px)")))->selected(module::get_var("social_share", "google_size")); $group_google->dropdown("google_annotation")->label(t("Annotation location"))->options(array("inline" => t("Inline"), "bubble" => t("Bubble"), "none" => t("None")))->selected(module::get_var("social_share", "google_annotation")); /// Pinterest settings $group_pinterest = $form->group("pinterest_settings")->label(t("Pinterest Pinit Settings")); $group_pinterest->checkbox("pinterest_enabled")->label(t("Display the button"))->checked(module::get_var("social_share", "pinterest_enabled", false) == 1); $group_pinterest->dropdown("pinterest_count_location")->label(t("Tweet count location"))->options(array("horizontal" => t("Horizontal"), "vertical" => t("Vertical"), "none" => t("None")))->selected(module::get_var("social_share", "pinterest_count_location")); /// Twitter settings $group_twitter = $form->group("twitter_settings")->label(t("Twitter Tweet Settings")); $group_twitter->checkbox("twitter_enabled")->label(t("Display the button"))->checked(module::get_var("social_share", "twitter_enabled", false) == 1); $group_twitter->dropdown("twitter_count_location")->label(t("Tweet count location"))->options(array("horizontal" => t("Horizontal"), "vertical" => t("Vertical"), "none" => t("None")))->selected(module::get_var("social_share", "twitter_count_location")); $group_twitter->dropdown("twitter_size")->label(t("Size of the button. Large does not work with a vertical count location"))->options(array("medium" => t("Medium"), "large" => t("Large")))->selected(module::get_var("social_share", "twitter_size")); $form->submit("submit")->value(t("Save")); return $form; }