<?php require_once "library/core/class-form.php"; /* Step 1: Create the form object */ $login = new akForm("login-form", "/login-processor.php", FORM_METHOD_POST); /* Step 2: Create and add items */ /* Step 2.1: State in hidden fields */ $login->createSimpleItem("login-item-referrer", FORM_ITEM_HIDDEN, "referrer", $login_form_referrer); $login->createSimpleItem("login-item-action", FORM_ITEM_HIDDEN, "auth-action", "login"); /* Step 2.2: Username/password fields */ $item = new akFormItem("login-item-username", FORM_ITEM_TEXT, "username"); $item->label = "Username:"******"Enter username or email address..."; $login->adopt($item); $item = new akFormItem("login-item-password", FORM_ITEM_PASSWORD, "password"); $item->label = "Password:"******"Enter password..."; $login->adopt($item); /* Step 2.3: Submit button */ $item = new akFormItem("login-item-submit", FORM_ITEM_SUBMIT, "submit", "Log in"); $login->adopt($item); /* Step 3: Emit the form */ $login->emit();
// @param $editor_option_preview Add a preview button. // $editor_filename = block_getParameter('editor-filename'); $editor_hostpage = block_getParameter('editor-hostpage'); $editor_processor = block_getParameter('editor-processor'); $editor_block_width = block_getParameter('block-width'); $editor_width = '' . 0.95 * $editor_block_width . 'px'; if (null == $editor_filename) { print 'Something is wrong.'; return; } // Step 1: Create the base form $editor = new akForm("edit-html-form", $editor_processor, FORM_METHOD_POST); // Step 2: Generate items for the form */ // Hidden reference to the file and host page $editor->createSimpleItem("hidden-filename-item", FORM_ITEM_HIDDEN, "file", $editor_filename); $editor->createSimpleItem("hidden-hostpage-item", FORM_ITEM_HIDDEN, "hostpage", $editor_hostpage); // Main text area $textarea = new akFormItem("file-text", FORM_ITEM_TEXTAREA, "edit-html-contents", file_get_contents($editor_filename)); $textarea->addStyle('width', $editor_width); $textarea->vsize = 15; $editor->adopt($textarea); // Submit/cancel buttons $editor->createSimpleItem("submit-item", FORM_ITEM_SUBMIT, "submit-item", "Save changes"); $canit = new akFormItem("cancel-button", FORM_ITEM_BUTTON, "cancel-item", "Cancel"); $canit->addEvent("onClick", "window.location.replace('" . $editor_hostpage . "');"); $editor->adopt($canit); // Step 3: Emit the form $editor->emit(); ?> </div>