本文整理汇总了PHP中FormElement::addElement方法的典型用法代码示例。如果您正苦于以下问题:PHP FormElement::addElement方法的具体用法?PHP FormElement::addElement怎么用?PHP FormElement::addElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormElement
的用法示例。
在下文中一共展示了FormElement::addElement方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forming
public static function forming()
{
$form = new Form("POST", Page::url("/forms"));
$input = new InputElement("login", "Identifiant :", "Pierre");
$form->addElement($input);
$form->addElement(new ClosedElement("br"));
// Balise, Name, Label, Value
$input = new FormElement("select", "age", "Age :", 10);
$input->addElement(new FormElement("option", "", "0-10", 0));
$input->addElement(new FormElement("option", "", "10-20", 10));
$input->addElement(new FormElement("option", "", "20-30", 20));
$input->addElement(new FormElement("option", "", "30-40", 30));
$input->addElement(new FormElement("option", "", "40-50", 40));
$form->addElement($input);
$form->addElement(new ClosedElement("br"));
$input = new FormElement("label", null, "Age : ");
$input->addClasses("label_input_checkbox_radio");
$form->addElement($input);
$input = new InputElement("mabox1", "0-10", 0, "checkbox", "mabox1");
$input->setAttribute("checked", "checked");
$form->addElement($input);
$input = new InputElement("mabox2", "10-20", 10, "checkbox", "mabox2");
$input->setAttribute("checked", "checked");
$form->addElement($input);
$input = new InputElement("mabox3", "20-30", 20, "checkbox", "mabox3");
$form->addElement($input);
$input = new InputElement("mabox4", "30-40", 30, "checkbox", "mabox4");
$input->setAttribute("checked", "checked");
$input->setAttribute("disabled", "disabled");
$form->addElement($input);
$input = new InputElement("mabox5", "40-50", 40, "checkbox", "mabox5");
$input->setAttribute("disabled", "disabled");
$form->addElement($input);
$input = new FormElement("label", null, "Age : ");
$input->addClasses("label_input_checkbox_radio");
$form->addElement($input);
$input = new InputElement("monradio", "0-10", 0, "radio", "monradio1");
$input->setAttribute("checked", "checked");
$form->addElement($input);
$input = new InputElement("monradio", "10-20", 10, "radio", "monradio2");
$form->addElement($input);
$input = new InputElement("monradio", "20-30", 20, "radio", "monradio3");
$form->addElement($input);
$input = new InputElement("monradio", "30-40", 30, "radio", "monradio4");
$form->addElement($input);
$input = new InputElement("monradio", "40-50", 40, "radio", "monradio5");
$form->addElement($input);
$input = new FormElement("textarea", "description", t("Description : "), "Test");
$input->setAttribute("row", 6);
$input->setAttribute("col", 18);
$input->addClasses("actualite_area_text");
$form->addElement($input);
$form->addElement(new ClosedElement("br"));
$input = new InputElement("monbutton", null, "Test JS", "button");
$input->setAttribute("onclick", "alert('Test JS OK');");
$form->addElement($input);
$theme = new Theme();
$theme->process_form($form);
$theme->process_theme();
}
示例2: list_of_members
public static function list_of_members($label)
{
$group = new GroupObject();
$view = array();
if ($group->load_by_label($label)) {
$group->load_members();
$members = $group->members();
$rows = array();
$theme = new Theme();
foreach ($members as $k => $v) {
$rows[] = array($k, $v->firstname, $v->lastname, $theme->linking(Page::url("/admin/groups/{$label}/delete/{$k}"), t("retirer du groupe")));
}
$form = new Form("POST", Page::url("/admin/groups/{$label}/add"));
$selector = new FormElement("select", "userid", t("selectionnez un utilisateur"));
$users = UserObject::loadAll();
foreach ($users as $u) {
$selector->addElement(new FormElement("option", "", $u->lastname . " " . $u->firstname, $u->uid));
}
$form->addElement($selector);
$form->addElement(new InputElement("add-element", null, t("ajouter un membre"), "submit"));
$f = $theme->forming($form);
$theme->set_title(t("Groupe %s", array("%s" => $label)));
$theme->add_to_body($theme->linking(Page::url("/admin/groups"), t("retourner à la liste des groupes")));
$theme->add_to_body($f, t("Ajouter un membre au groupe"));
$theme->add_to_body($theme->tabling($rows, array(t("id"), t("firstname"), t("lastname"), t("actions"))), t("Liste des membres"));
$theme->process_theme(Theme::STRUCT_ADMIN);
} else {
}
return;
}
示例3: addElement
/**
* Add child element
*
* @param HtmlElement $element
* @return HtmlElement
*/
public function addElement(HtmlElement $element)
{
if ($this->_name !== null) {
$formElems = $this->_searchFormElement($element);
foreach ($formElems as $formElem) {
$formElem->setName($this->_name);
}
}
return parent::addElement($element);
}
示例4: CreateNewUserModel
<?php
/*
Class: CreateNewUserController
By: Antonio Garcia
Date : Oct 23 2014
*/
// GUI error out put
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(-1);
require_once "CreateNewUserModel.class.php";
require_once "HTMLView.class.php";
require_once "FormElement.class.php";
require_once "CreateNewUserBodyElement.class.php";
$myModel = new CreateNewUserModel();
$myModel->setData($_POST);
$myModel->process();
$myBodyEle = new CreateNewUserBodyElement();
$myBodyEle->setData($myModel->getData());
$myFormEle = new FormElement();
//adds bodyelements to form
$myFormEle->addElement($myBodyEle);
$myView = new HTMLView();
//adds form to html element
$myView->addElement($myFormEle);
//print form with bodyelement with element in that
$myView->printView();
示例5: LoginModel
<?php
/*
Class: LoginController
Purpose : creates elements for Login View
By: Antonio Garcia
Date : Oct 23 2014
*/
// GUI error out put
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(-1);
require_once "LoginModel.class.php";
require_once "HTMLView.class.php";
require_once "FormElement.class.php";
require_once "LoginBodyElement.class.php";
$myAcmeModel = new LoginModel();
$myAcmeModel->setData($_POST);
$myAcmeModel->process();
$myAcmeBodyEle = new LoginBodyElement();
$myAcmeBodyEle->setData($myAcmeModel->getData());
$myFormEle = new FormElement();
//adds bodyelements to form
$myFormEle->addElement($myAcmeBodyEle);
$myView = new HTMLView();
//adds form to html element
$myView->addElement($myFormEle);
//print form with bodyelement with element in that
$myView->printView();