本文整理汇总了PHP中Html::form方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::form方法的具体用法?PHP Html::form怎么用?PHP Html::form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::form方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_courseInfo_form
/**
* Returns the HTML for the courseInfo form. Makes it possible to either
* create a new form or to edit an old one.
*
* @param type $lang_id
* @param Kurssitieto $courseInfo Kurssitieto object.
* @return type
*/
public function show_courseInfo_form($lang_id, &$courseInfo)
{
// Default values (new object):
$new = true;
$description = "";
$teacher_name = "";
$course_code = "";
$visibility_value = Nakyvyys::$JULKINEN;
// Old object to be modified:
if ($courseInfo->olio_loytyi_tietokannasta) {
$new = false;
// Htmlspecialchars: Management of special signs etc.
$description = htmlspecialchars($courseInfo->get_arvo(Kurssitieto::$sarakenimi_kuvaus), ENT_QUOTES, "UTF-8", true);
$teacher_name = htmlspecialchars($courseInfo->get_arvo(Kurssitieto::$sarakenimi_opettaja_nimi), ENT_QUOTES, "UTF-8", true);
$course_code = htmlspecialchars($courseInfo->get_arvo(Kurssitieto::$sarakenimi_tunniste), ENT_QUOTES, "UTF-8", true);
$visibility_value = $courseInfo->get_arvo(Kurssitieto::$sarakenimi_nakyvyys);
}
// Visibility choises: ====================================================
$default = $visibility_value;
$visibility_object = new Perusnakyvyys();
$select_attr_array = array(Attr::name(Palautuskontrolleri::$kurssitieto_name_nakyvyys), Attr::title(Palautustekstit::visibility($lang_id)), Attr::classs("form-control"), Attr::id("course_visibility"));
$option_attr_array = array();
$visibility_dropdown_elem = $visibility_object->luo_pudotusvalikko($select_attr_array, $option_attr_array, $default, "");
//======================================================================
$save_button = $this->create_button_save_edit_courseInfo($lang_id);
$info = Palautustekstit::courseInfo_edit_form_instruction($lang_id);
if ($new) {
$save_button = $this->create_button_save_new_courseInfo($lang_id);
$info = Palautustekstit::courseInfo_new_form_instruction($lang_id);
}
$html = Html::luo_otsikko($info, array(), 2) . Html::form(array(Attr::classs("form-horizontal")), Html::div(array(Attr::classs("form-group")), Html::luo_label_for("course_code_text_field", Palautustekstit::course_code($lang_id), array(Attr::classs("control-label col-sm-2"))) . Html::div(array(Attr::classs("col-sm-10")), Html::luo_input(array(Attr::classs("form-control"), Attr::id("course_code_text_field"), Attr::type("text"), Attr::value($course_code), Attr::name(Palautuskontrolleri::$kurssitieto_name_tunniste))))) . Html::div(array(Attr::classs("form-group")), Html::luo_label_for("course_desc_text_area", Palautustekstit::description($lang_id), array(Attr::classs("control-label col-sm-2"))) . Html::div(array(Attr::classs("col-sm-10")), Html::luo_textarea($description, array(Attr::classs("form-control"), Attr::id("course_desc_text_area"), Attr::type("text"), Attr::rows(5), Attr::name(Palautuskontrolleri::$kurssitieto_name_kuvaus))))) . Html::div(array(Attr::classs("form-group")), Html::luo_label_for("course_teacher_name_text_field", Palautustekstit::teacher_name($lang_id), array(Attr::classs("control-label col-sm-2"))) . Html::div(array(Attr::classs("col-sm-10")), Html::luo_input(array(Attr::classs("form-control"), Attr::id("course_teacher_name_text_field"), Attr::type("text"), Attr::value($teacher_name), Attr::name(Palautuskontrolleri::$kurssitieto_name_opettaja_nimi))))) . Html::div(array(Attr::classs("form-group")), Html::luo_label_for("course_visibility", Palautustekstit::visibility($lang_id), array(Attr::classs("control-label col-sm-2"))) . Html::div(array(Attr::classs("col-sm-10")), $visibility_dropdown_elem)) . Html::div(array(Attr::classs("form-group")), Html::div(array(Attr::classs("col-sm-2")), "") . Html::div(array(Attr::classs("col-sm-10")), $save_button . $this->create_button_back_to_teacher_view($lang_id))));
return $html;
}
示例2: createtask_GET
function createtask_GET(Web &$w)
{
$w->Task->navigation($w, "Create Task");
// set default dropdowns for these task attributes as empty arrays
// dropdowns are populated dynamically via JSON based upon task group type selected
$tasktypes = array();
$priority = array();
$members = array();
// get list of all task groups
$taskgroups = $w->Task->getTaskGroups();
// whittle list of task groups down to only those in which i have role appropriate for creating tasks
if ($taskgroups) {
foreach ($taskgroups as $tgroup) {
if ($tgroup->getCanICreate()) {
$mytaskgroups[] = array($tgroup->title, $tgroup->id);
}
}
if ($w->request(!empty($key) ? $key : null) != "") {
$t = $w->Task->getTaskGroup($w->request('gid'));
$tasktypes = $t != "" ? $w->Task->getTaskTypes($t->task_group_type) : array();
$priority = $t != "" ? $w->Task->getTaskPriority($t->task_group_type) : array();
$members = $t != "" ? $w->Task->getMembersBeAssigned($t->id) : array();
sort($members);
$tasktext = "<table>" . "<tr><td class=section colspan=2>Task Group Description</td></tr>" . "<tr><td><b>Task Group</td><td>" . $t->title . "</td></tr>" . "<tr><td><b>Task Type</b></td><td>" . $t->getTypeTitle() . "</td></tr>" . "<tr><td><b>Description</b></td><td>" . $t->getTypeDescription() . "</td></tr>" . "</table>";
$w->ctx("tasktext", $tasktext);
}
// build form
$f = Html::form(array(array("Create a New Task - Step One", "section"), array("Task Group", "select", "task_group_id", $w->request('gid'), $mytaskgroups), array("Task Title", "text", "title"), array("Task Type", "select", "task_type", null, $tasktypes), array("Priority", "select", "priority", null, $priority), array("Date Due", "date", "dt_due"), array("Description", "textarea", "description", null, 110, 15), array("Assigned To", "select", "first_assignee_id", null, $members)), $w->localUrl("/task/tasktypeform/"), "POST", " Continue >> ");
$w->ctx("createtask", $f);
}
}
示例3: profile_GET
function profile_GET(Web &$w)
{
$p = $w->pathMatch("box");
$user = $w->Auth->user();
$contact = $user->getContact();
if ($user) {
$w->ctx("title", "Administration - Profile - " . $user->login);
} else {
$w->error("User does not exist.");
}
$lines = array();
$lines[] = array("Change Password", "section");
$lines[] = array("Password", "password", "password", "");
$lines[] = array("Repeat Password", "password", "password2", "");
$lines[] = array("Contact Details", "section");
$lines[] = array("First Name", "text", "firstname", $contact ? $contact->firstname : "");
$lines[] = array("Last Name", "text", "lastname", $contact ? $contact->lastname : "");
$lines[] = array("Communication", "section");
$lines[] = array("Home Phone", "text", "homephone", $contact ? $contact->homephone : "");
$lines[] = array("Work Phone", "text", "workphone", $contact ? $contact->workphone : "");
$lines[] = array("Private Mobile", "text", "priv_mobile", $contact ? $contact->priv_mobile : "");
$lines[] = array("Work Mobile", "text", "mobile", $contact ? $contact->mobile : "");
$lines[] = array("Fax", "text", "fax", $contact ? $contact->fax : "");
$lines[] = array("Email", "text", "email", $contact ? $contact->email : "");
$lines[] = array("Redirect URL", "text", "redirect_url", $user->redirect_url);
$f = Html::form($lines, $w->localUrl("/auth/profile"), "POST", "Update");
if ($p['box']) {
$w->setLayout(null);
$f = "<h2>Edit Profile</h2>" . $f;
}
$w->out($f);
}
示例4: tasktypeform_POST
function tasktypeform_POST(Web $w)
{
$w->Task->navigation($w, "Create Task");
// get task type, serialise REQUEST object from step 1 of creating a new task
$tid = $w->request('task_type');
$tg = $w->Task->getTaskGroup($w->request('task_group_id'));
// if no due date given, make 1 month from today
if ($w->request('dt_due') == "") {
$_POST['dt_due'] = $w->Task->getNextMonth();
}
$req = serialize($_POST);
// get the additional form fields based on type type
$theform = array();
if ($tid != "") {
$theform = $w->Task->getFormFieldsByTask($tid, $tg);
}
if (!$theform) {
$theform = array(array("Message", "static", "text", "No further information required.<p>Please save your task."));
}
// combine input from step one with form fields for step II
$hiden = array("", "hidden", "formone", $req);
array_push($theform, $hiden);
// display the form
$f = Html::form($theform, $w->localUrl("/task/edit/"), "POST", " Submit ");
$w->ctx("formfields", $f);
}
示例5: comment_GET
function comment_GET(Web $w)
{
$p = $w->pathMatch("comment_id", "tablename", "object_id");
$comment_id = intval($p["comment_id"]);
$comment = $comment_id > 0 ? $w->Comment->getComment($comment_id) : new Comment($w);
if ($comment === null) {
$comment = new Comment($w);
}
$help = <<<EOF
//italics//
**bold**
\t\t
* bullet list
* second item
** subitem
# numbered list
# second item
## sub item
[[URL|linkname]]
== Large Heading
=== Medium Heading
==== Small Heading
Horizontal Line:
---
EOF;
$form = array(array("Comment", "section"), array("", "textarea", "comment", $comment->comment, 100, 15, false), array("Help", "section"), array("", "textarea", "-help", $help, 100, 5, false), array("", "hidden", "redirect_url", $w->request("redirect_url")));
// return the comment for display and edit
$w->setLayout(null);
$w->out(Html::form($form, $w->localUrl("/admin/comment/{$p["comment_id"]}/{$p["tablename"]}/{$p["object_id"]}"), "POST", "Save"));
}
示例6: lookup_ALL
function lookup_ALL(Web &$w)
{
$w->Admin->navigation($w, "Lookup");
$types = $w->Admin->getLookupTypes();
$typelist = Html::select("type", $types, $w->request('type'));
$w->ctx("typelist", $typelist);
// tab: Lookup List
$where = array();
if (NULL == $w->request('reset')) {
if ($w->request('type') != "") {
$where['type'] = $w->request('type');
}
} else {
// Reset called, unset vars
if ($w->request("type") !== null) {
unset($_REQUEST["type"]);
}
var_dump($_REQUEST);
}
$lookup = $w->Admin->getAllLookup($where);
$line[] = array("Type", "Code", "Title", "Actions");
if ($lookup) {
foreach ($lookup as $look) {
$line[] = array($look->type, $look->code, $look->title, Html::box($w->localUrl("/admin/editlookup/" . $look->id . "/" . urlencode($w->request('type'))), " Edit ", true) . " " . Html::b($w->webroot() . "/admin/deletelookup/" . $look->id . "/" . urlencode($w->request('type')), " Delete ", "Are you sure you wish to DELETE this Lookup item?"));
}
} else {
$line[] = array("No Lookup items to list", null, null, null);
}
// display list of items, if any
$w->ctx("listitem", Html::table($line, null, "tablesorter", true));
// tab: new lookup item
$types = $w->Admin->getLookupTypes();
$f = Html::form(array(array("Create a New Entry", "section"), array("Type", "select", "type", null, $types), array("or Add New Type", "text", "ntype"), array("Key", "text", "code"), array("Value", "text", "title")), $w->localUrl("/admin/newlookup/"), "POST", " Save ");
$w->ctx("newitem", $f);
}
示例7: viewtaskgrouptypes_ALL
function viewtaskgrouptypes_ALL(Web $w)
{
$w->Task->navigation($w, "Manage Task Groups");
History::add("Manage Task Groups");
$task_groups = $w->Task->getTaskGroups();
if ($task_groups) {
usort($task_groups, array("TaskService", "sortbyGroup"));
}
// prepare column headings for display
$line = array(array("Title", "Type", "Description", "Default Assignee"));
// if task group exists, display title, group type, description, default assignee and button for specific task group info
if ($task_groups) {
foreach ($task_groups as $group) {
$line[] = array(Html::a(WEBROOT . "/task-group/viewmembergroup/" . $group->id, $group->title), $group->getTypeTitle(), $group->description, $group->getDefaultAssigneeName());
}
} else {
// if no groups for this group type, say as much
$line[] = array("There are no Task Groups Configured. Please create a New Task Group.", "", "", "", "");
}
// display list of task groups in the target task group type
$w->ctx("dashboard", Html::table($line, null, "tablesorter", true));
// tab: new task group
// get generic task group permissions
$arrassign = $w->Task->getTaskGroupPermissions();
// unset 'ALL' given all can never assign a task
unset($arrassign[0]);
// set Is Task Active dropdown
$is_active = array(array("Yes", "1"), array("No", "0"));
$grouptypes = $w->Task->getAllTaskGroupTypes();
// build form to create a new task group within the target group type
$f = Html::form(array(array("Task Group Attributes", "section"), array("Task Group Type", "select", "task_group_type", null, $grouptypes), array("Title", "text", "title"), array("Who Can Assign", "select", "can_assign", null, $arrassign), array("Who Can View", "select", "can_view", null, $w->Task->getTaskGroupPermissions()), array("Who Can Create", "select", "can_create", null, $w->Task->getTaskGroupPermissions()), array("Active", "select", "is_active", null, $is_active), array("", "hidden", "is_deleted", "0"), array("Description", "textarea", "description", null, "26", "6"), array("Default Assignee", "select", "default_assignee_id", null, $w->Auth->getUsers())), $w->localUrl("/task-group/createtaskgroup"), "POST", "Save");
// display form
$w->ctx("creategroup", $f);
}
示例8: resetpassword_GET
function resetpassword_GET(Web $w)
{
$email = $w->request('email');
// email
$token = $w->request('token');
// token
$user = $w->Auth->getUserForToken($token);
//this->getObject("User", array("password_reset_token", $token));
$validData = false;
if (!empty($user->id)) {
// Check that the password reset hasn't expired
$w->Log->setLogger("AUTH")->debug("USER: " . $user->id . " TIME: " . time() . " USER_RESET: " . $user->dt_password_reset_at . " RESULT: " . (time() - $user->dt_password_reset_at));
if (time() - $user->dt_password_reset_at > 86400) {
$w->msg("Your token has expired (max 24 hours), please submit for a new one", "/auth/forgotpassword");
return;
}
$user_contact = $user->getContact();
if (!empty($user_contact)) {
if ($user_contact->email == $email) {
// We have passed the test
$password_form = Html::form(array(array("Enter new password", "section"), array("New password", "password", "password"), array("Confirm password", "password", "password_confirm")), $w->localUrl("auth/resetpassword?email={$email}&token={$token}"), "POST", "Reset");
$w->out($password_form);
$validData = true;
}
}
}
if (!$validData) {
$w->Log->warn("Password reset attempt failed with email: {$email}, token: {$token}");
$w->out("Invalid email or token, this incident has been logged");
}
}
示例9: new_GET
/**
* Display an edit form for either creating a new
* record for ExampleData or edit an existing form.
*
* Url:
*
* /kickstart/edit/{id}
*
* @param Web $w
*/
function new_GET(Web $w)
{
// parse the url into parameters
$p = $w->pathMatch("id");
// create the edit form
$f = Html::form(array(array("New Module", "section"), array("Module Name", "text", "module_name", ""), array("Module Author", "text", "module_author", ""), array("Module Title", "text", "module_title", ""), array("Actions - one per line", "textarea", "actions", "index", null, null, "basic"), array("SQL Structure", "textarea", "sql", "", null, null, "basic")), $w->localUrl("/kickstart/new/" . $p['id']), "POST", " Save");
// circumvent the template and print straight into the layout
$w->out($f);
}
示例10: login_GET
function login_GET(Web $w)
{
// Check if logged in already
$user = $w->Auth->user();
if ($w->Auth->loggedIn() && $w->Auth->allowed($user->redirect_url)) {
$w->redirect($w->localUrl(!empty($user->redirect_url) ? $user->redirect_url : "/main"));
}
$loginform = Html::form(array(array("Application Login", "section"), array("Username", "text", "login"), array("Password", "password", "password")), $w->localUrl("auth/login"), "POST", "Login");
$w->ctx("loginform", $loginform);
}
示例11: createreport_ALL
function createreport_ALL(Web &$w)
{
$w->Report->navigation($w, "Create a Report");
// build form to create a report. display to users by role is controlled by the template
// using lookup with type ReportCategory for category listing
$f = Html::form(array(array("Create a New Report", "section"), array("Title", "text", "title", $w->request('title')), array("Module", "select", "module", $w->request('module'), $w->Report->getModules()), array("Description", "textarea", "description", $w->request('description'), "110", "2"), array("Code", "textarea", "report_code", $w->request('report_code'), "110", "22", false), array("Connection", "select", "report_connection_id", $w->request('report_connection_id'), $w->Report->getConnections())), $w->localUrl("/report/savereport"), "POST", "Save Report");
$t = Html::form(array(array("Special Parameters", "section"), array("User", "static", "user", "{{current_user_id}}"), array("Roles", "static", "roles", "{{roles}}"), array("Site URL", "static", "webroot", "{{webroot}}"), array("View Database", "section"), array("Tables", "select", "dbtables", null, $w->Report->getAllDBTables()), array(" ", "static", "dbfields", "<span id=dbfields></span>")));
// display form
$w->ctx("createreport", $f);
$w->ctx("dbform", $t);
}
示例12: editmember_GET
function editmember_GET(Web &$w)
{
$p = $w->pathMatch("repid", "userid");
// get member details for edit
$member = $w->Report->getReportMember($p['repid'], $p['userid']);
// build editable form for a member allowing change of membership type
$f = Html::form(array(array("Member Details", "section"), array("", "hidden", "report_id", $p['repid']), array("Name", "static", "name", $w->Report->getUserById($member->user_id)), array("Role", "select", "role", $member->role, $w->Report->getReportPermissions())), $w->localUrl("/report/editmember/" . $p['userid']), "POST", " Update ");
// display form
$w->setLayout(null);
$w->ctx("editmember", $f);
}
示例13: testRetornaClasseAnyComConfiguracaoPadrao
public function testRetornaClasseAnyComConfiguracaoPadrao()
{
Html::config(['input' => ['class' => 'form-input'], 'form' => ['class' => "form-horizontal"]]);
$username = Html::input(['attributes' => ['type' => 'text', 'name' => 'username']]);
$password = Html::input(['attributes' => ['type' => 'password', 'name' => 'password']]);
$form = Html::form(['attributes' => ['action' => 'save.php'], 'content' => $username . PHP_EOL . $password]);
$expected = '<form action="save.php" class="form-horizontal">';
$expected .= '<input type="text" name="username" class="form-input"/>' . PHP_EOL;
$expected .= '<input type="password" name="password" class="form-input"/>';
$expected .= '</form>';
$this->assertEquals($expected, (string) $form);
}
示例14: editlookup_GET
function editlookup_GET(Web &$w)
{
$p = $w->pathMatch("id", "type");
$lookup = $w->Admin->getLookupbyId($p['id']);
if ($lookup) {
$types = $w->Admin->getLookupTypes();
$f = Html::form(array(array("Edit an Existing Entry", "section"), array("Type", "select", "type", $lookup->type, $types), array("Key", "text", "code", $lookup->code), array("Value", "text", "title", $lookup->title)), $w->localUrl("/admin/editlookup/" . $lookup->id . "/" . $p['type']), "POST", " Update ");
$w->setLayout(null);
$w->out($f);
} else {
$w->msg("No such Lookup Item?", "/admin/lookup/");
}
}
示例15: edit_GET
/**
* Display an edit form for either creating a new
* record for ExampleData or edit an existing form.
*
* Url:
*
* /example/edit/{id}
*
* @param Web $w
*/
function edit_GET(Web $w)
{
// parse the url into parameters
$p = $w->pathMatch("id");
// create either a new or existing object
if (isset($p['id'])) {
$data = $w->Example->getDataForId($p['id']);
} else {
$data = new ExampleData($w);
}
// create the edit form
$f = Html::form(array(array("Edit Example Data", "section"), array("Title", "text", "title", $data->title), array("Data", "text", "data", $data->data)), $w->localUrl("/example/edit/" . $p['id']), "POST", " Save ");
// circumvent the template and print straight into the layout
$w->out($f);
}