本文整理汇总了PHP中Forms::Form方法的典型用法代码示例。如果您正苦于以下问题:PHP Forms::Form方法的具体用法?PHP Forms::Form怎么用?PHP Forms::Form使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Forms
的用法示例。
在下文中一共展示了Forms::Form方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_form
protected function create_form($uri)
{
$form = Forms::Form('mainform')->action($uri);
$validator = Validation::Validator();
$use_validator = false;
foreach ($this->form_fields as $name => $parms) {
if (isset($parms['if_component_exists'])) {
if (!CMS::component_exists($parms['if_component_exists'])) {
continue;
}
}
if (isset($parms['embedded_admin']) && $this->embedded_admin) {
if (!$parms['embedded_admin']) {
continue;
}
}
$type = isset($parms['type']) ? trim($parms['type']) : 'input';
$method = 'create_form_field_' . $type;
if (method_exists($this, $method)) {
$this->{$method}($form, $name, $parms);
} else {
if (isset(self::$field_types[$type])) {
self::$field_types[$type]->form_field($form, $name, $parms);
if ($dir = self::$field_types[$type]->is_upload($parms)) {
$this->upload_fields[$name] = $dir;
}
} else {
$form->input($name);
}
}
if (isset($parms['match'])) {
if ($parms['match'] == 'presence') {
$validator->validate_presence_of($name, $parms['error_message']);
} else {
if ($parms['match'] == 'email') {
$validator->validate_email_for($name, $parms['error_message']);
} else {
if ($parms['match'] == 'email presence') {
$validator->validate_presence_of($name, $parms['error_message']);
$validator->validate_email_for($name, $parms['error_message']);
} else {
$validator->validate_format_of($name, $parms['match'], $parms['error_message']);
}
}
}
$use_validator = true;
}
}
if ($use_validator) {
$form->validate_with($validator);
}
return $form;
}
示例2: create_form
public function create_form($url, $action = 'edit', $from_name = 'mainform')
{
$form = Forms::Form($from_name)->action($url);
$this->filtered_form_fields = $this->filter_form_fields($action);
CMS_Fields::form_fields($form, $this->filtered_form_fields);
foreach ($this->filtered_form_fields as $name => $parms) {
$type = CMS_Fields::type($parms);
if ($type->is_upload()) {
$this->upload_fields[$name] = $parms;
}
}
$this->form = $form;
return $form;
}
示例3: __construct
/**
* @param WS_Environment $env
*/
public function __construct(WS_Environment $env)
{
$this->env = $env;
$this->form = Forms::Form('auth')->method(Net_HTTP::POST)->begin_fields->input('login')->password('password')->end_fields;
}
示例4: massupdate_form
protected function massupdate_form($rows)
{
if (count($rows) == 0) {
return false;
}
$fields = $this->list_fields();
if ($fields) {
foreach ($this->list_fields() as $field => $parms) {
if (isset($parms['edit'])) {
$data = $parms['edit'];
if ($data === true) {
$data = array('type' => 'input');
}
if (is_string($data)) {
$data = array('type' => $data);
}
$this->massupdate_fields[$field] = $data;
}
}
}
if (count($this->massupdate_fields) == 0) {
return false;
}
$form = Forms::Form('massupdate')->action($this->action_url('list', $this->page))->input('ids');
$ids = array();
foreach ($rows as $row) {
$id = $this->item_id($row);
$ids[$id] = $id;
foreach ($this->massupdate_fields as $field => $data) {
$name = "{$field}{$id}";
$type = CMS_Fields::type($data);
if ($type->is_upload()) {
$type = CMS_Fields::type('input');
}
$type->form_fields($form, $name, $data);
$type->assign_from_object($form, $row->{$field}, $name, $data);
}
}
$form['ids'] = implode(',', $ids);
return $form;
}