本文整理汇总了PHP中generate_input函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_input函数的具体用法?PHP generate_input怎么用?PHP generate_input使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate_input函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: render_login
function render_login($username = '', $small = false)
{
if ($username) {
?>
<h2>Welcome <?php
echo ucwords($username);
?>
</h2>
<?php
echo anchor('user/logout', "Logout");
?>
<?php
} else {
?>
<h2>Account Login</h2>
<?php
echo form_open('user/login');
?>
<label>email</label>
<?php
echo generate_input('email', 'input', 'input', '');
?>
<label>password</label>
<?php
echo generate_input('password', 'password', 'input', '');
?>
<input type="image" src="/beex/images/buttons/signin.gif" style="width:auto;" />
</form>
<?php
echo anchor('', 'Forgot your password?');
?>
<?php
echo $small ? anchor("user/newuser", "Register with Beex") : anchor("user/newuser", "<img src='/beex/images/buttons/register.gif' style='display:block; margin:8px auto;'>");
?>
<?php
}
}
开发者ID:beexsvn,项目名称:Beex.org,代码行数:37,代码来源:beexdisplayfunctions_helper.php
示例2: create_field_entry_custom_field
function create_field_entry_custom_field($field, $key, $disabled = FALSE)
{
global $custom_fields, $tbl_entry;
global $is_mandatory_field, $text_input_max, $maxlength;
echo "<div>\n";
$params = array('label' => get_loc_field_name($tbl_entry, $key) . ":", 'name' => VAR_PREFIX . $key, 'value' => isset($custom_fields[$key]) ? $custom_fields[$key] : NULL, 'disabled' => $disabled, 'attributes' => array(), 'maxlength' => isset($maxlength["entry.{$key}"]) ? $maxlength["entry.{$key}"] : NULL, 'mandatory' => isset($is_mandatory_field["entry.{$key}"]) && $is_mandatory_field["entry.{$key}"]);
// Output a checkbox if it's a boolean or integer <= 2 bytes (which we will
// assume are intended to be booleans)
if ($field['nature'] == 'boolean' || $field['nature'] == 'integer' && isset($field['length']) && $field['length'] <= 2) {
generate_checkbox($params);
} elseif ($field['nature'] == 'character' && isset($field['length']) && $field['length'] > $text_input_max) {
// HTML5 does not allow a pattern attribute for the textarea element
$params['attributes'][] = 'rows="8"';
$params['attributes'][] = 'cols="40"';
generate_textarea($params);
} else {
$is_integer_field = $field['nature'] == 'integer' && $field['length'] > 2;
if ($is_integer_field) {
$params['type'] = 'number';
$params['step'] = '1';
} else {
$params['type'] = 'text';
if ($params['mandatory']) {
// 'required' is not sufficient for strings, because we also want to make sure
// that the string contains at least one non-whitespace character
$params['pattern'] = REGEX_TEXT_POS;
}
}
$params['field'] = "entry.{$key}";
generate_input($params);
}
echo "</div>\n";
}
开发者ID:jberanek,项目名称:mrbs_clone,代码行数:33,代码来源:edit_entry.php
示例3: generate_input
break;
case 'email':
generate_input($label_text, $var_name, $data[$key], FALSE, isset($maxlength["users.{$key}"]) ? $maxlength["users.{$key}"] : NULL, 'type=email multiple');
break;
default:
// Output a checkbox if it's a boolean or integer <= 2 bytes (which we will
// assume are intended to be booleans)
if ($field['nature'] == 'boolean' || $field['nature'] == 'integer' && isset($field['length']) && $field['length'] <= 2) {
echo "<label for=\"{$var_name}\">{$label_text}</label>\n";
echo "<input type=\"checkbox\" class=\"checkbox\" " . "id=\"{$var_name}\" name=\"{$var_name}\" value=\"1\"" . (!empty($data[$key]) ? " checked=\"checked\"" : "") . ">\n";
} elseif (!empty($select_options["users.{$key}"])) {
generate_select($label_text, $var_name, $data[$key], $select_options["users.{$key}"]);
} elseif ($field['nature'] == 'character' && isset($field['length']) && $field['length'] > $text_input_max) {
generate_textarea($label_text, $var_name, $data[$key]);
} else {
generate_input($label_text, $var_name, $data[$key], FALSE, isset($maxlength["users.{$key}"]) ? $maxlength["users.{$key}"] : NULL);
}
break;
}
// end switch
echo "</div>\n";
}
// end switch
// Then output any error messages associated with the field
// except for the password field which is a special case
switch ($key) {
case 'email':
if (!empty($invalid_email)) {
echo "<p class=\"error\">" . get_vocab('invalid_email') . "</p>\n";
}
break;
开发者ID:koroder,项目名称:Web-portal-for-academic-institution,代码行数:31,代码来源:edit_users.php
示例4: generate_input
$mission_statement_cell = generate_input($name, 'text', $edit, $value);
$name = 'about_us';
$value = $new ? set_value($name) : @$item->{$name};
$about_us_cell = generate_input($name, 'text', $edit, $value);
$name = 'rss_feed';
$value = $new ? set_value($name) : @$item->{$name};
$rss_feed_cell = generate_input($name, 'input', $edit, $value);
$name = 'twitter_link';
$value = $new ? set_value($name) : @$item->{$name};
$twitter_link_cell = generate_input($name, 'input', $edit, $value);
$name = 'facebook_link';
$value = $new ? set_value($name) : @$item->{$name};
$facebook_link_cell = generate_input($name, 'input', $edit, $value);
$name = 'youtube_link';
$value = $new ? set_value($name) : @$item->{$name};
$youtube_link_cell = generate_input($name, 'input', $edit, $value);
}
$attributes = array('id' => 'npoform', 'class' => 'form');
$hidden_fields = array('user_id' => $this->session->userdata('user_id'));
?>
<div id="NPORegistration" class="registration_form">
<div id="LeftColumn">
<p class="small_help_title">THIS IS HOW YOUR PROFILE SIDEBAR WILL APPEAR.</p>
<div class="MiniProfile" id="MiniProfile">
<h2>NonProfit</h2>
<div class="info">
<div class='image'>
开发者ID:beexsvn,项目名称:Beex.org,代码行数:31,代码来源:npoform.php
示例5: add_slashes
break;
case "phone":
$value = add_slashes($phone);
$edit_value = $phone;
break;
case "mobile":
$value = add_slashes($mobile);
$edit_value = $mobile;
break;
case "message":
$value = nl2br(ucfirst($message));
$edit_value = $message;
break;
}
echo display_contact($each_set->attribute, $value);
echo generate_input($each_set->form_element, $each_set->options, $each_set->attribute, $each_set->searchable, $each_set->placeholder, $each_set->class_name, $each_set->style_name, $i, $each_set->is_required, $each->title_placeholder, $edit_value, "edit", $salutation);
if ($i == 1) {
?>
<div class="row dispRow">
<div class="column small-2">
<strong class="radius" > E-mail</strong>
</div>
<div class="small-1 columns alignmyprofile"> <b> : </b></div>
<div class="columns small-9 displayEle alignmyprofile">
<?php
echo $email;
?>
<!--<a href="change-email.php" style="margin-left:10px">Change</a>-->
</div>
</div>
开发者ID:rushyendra1,项目名称:cportalWP,代码行数:31,代码来源:page-profile.php
示例6: set_value
echo "<th colspan=2>5. How</td></tr>\r\n\t\t<tr>";
$name = 'challenge_blurb';
$value = $new ? set_value($name) : $item->{$name};
echo "<td>Blurb (120 characters or less)</td><td>" . generate_input($name, 'text', $edit, $value) . "</td>\r\n\t\t</tr>\r\n\t\t<tr>";
$name = 'challenge_description';
$value = $new ? set_value($name) : $item->{$name};
echo "<td>Describe the challenge (text)</td><td>" . generate_input($name, 'text', $edit, $value) . "</td>\r\n\t\t</tr>\r\n\t\t<tr>";
$name = 'challenge_video';
$value = $new ? set_value($name) : $item->{$name};
echo "<td>Upload a video explanation</td><td>" . generate_input($name, 'input', $edit, $value) . "</td>\r\n\t\t</tr>\r\n\t\t<tr>";
$name = 'challenge_whydo';
$value = $new ? set_value($name) : $item->{$name};
echo "<td colspan=2>Optional</td></tr><tr><td>Why are you doing this challenge?</td><td>" . generate_input($name, 'text', $edit, $value) . "</td>\r\n\t\t</tr>\r\n\t\t<tr>";
$name = 'challenge_whycare';
$value = $new ? set_value($name) : $item->{$name};
echo "<td>Why do you care about this nonprofit?</td><td>" . generate_input($name, 'text', $edit, $value) . "</td>\r\n\t\t</tr>\r\n\t\t<tr>";
if ($edit) {
$data = array('class' => 'submit');
echo "<td colspan=2>" . form_submit($data, 'Update challenge') . "</td>";
}
echo "</tr>\r\n \t</table>";
if ($edit) {
echo "</form>";
}
?>
<div id="challengeForm" class="form">
<div id="LeftColumn">
</div>
开发者ID:beexsvn,项目名称:Beex.org,代码行数:30,代码来源:challenge_form.backup.php
示例7: generate_input
$blurb_cell = generate_input($name, 'text', $edit, $value, '', array('maxlength' => '140'));
$name = 'advice';
$value = $new ? set_value($name) : @$item->{$name};
$advice_cell = generate_input($name, 'text', $edit, $value);
// Website Cell
$name = 'website';
$value = $new ? set_value($name) : @$item->{$name};
$website_cell = generate_input($name, 'input', $edit, $value);
// Website Cell
$name = 'upsets';
$value = $new ? set_value($name) : @$item->{$name};
$upsets_cell = generate_input($name, 'text', $edit, $value);
// Website Cell
$name = 'joy';
$value = $new ? set_value($name) : @$item->{$name};
$joy_cell = generate_input($name, 'text', $edit, $value);
if ($edit) {
$data = array('class' => 'submit');
$verb = $new ? 'Add' : 'Edit';
$submit_cell = form_submit($data, $verb . ' User');
}
?>
<div id="UserForm" class="registration_form">
<div id="LeftColumn">
<p class="small_help_title">THIS IS HOW YOUR PROFILE STUB WILL APPEAR.</p>
<div class="MiniProfile" id="MiniProfile">
<h2>Challenger</h2>
<div class="info">
开发者ID:beexsvn,项目名称:Beex.org,代码行数:31,代码来源:user_form.php
示例8: day_name
for ($i = 0; $i < 7; $i++) {
$wday = ($i + $weekstarts) % 7;
echo " <label><input class=\"checkbox\" name=\"rep_day[{$wday}]\" type=\"checkbox\"";
if ($rep_day[$wday]) {
echo " checked=\"checked\"";
}
echo ">" . day_name($wday) . "</label>\n";
}
?>
</div>
</div>
<?php
echo "<div>\n";
$label_text = get_vocab("rep_num_weeks") . ":<br>" . get_vocab("rep_for_nweekly");
generate_input($label_text, 'rep_num_weeks', $rep_num_weeks);
echo "</div>\n";
echo "</fieldset>\n";
} elseif (isset($id)) {
// otherwise, if it's an existing booking, show the repeat information
// and pass it through to the handler but do not let the user edit it
// (because they're either not allowed to, or else they've chosen to edit
// an individual entry rather than a series).
// (NOTE: when repeat bookings are restricted to admins, an ordinary user
// would not normally be able to get to the stage of trying to edit a series.
// But we have to cater for the possibility because it could happen if (a) the
// series was created before the policy was introduced or (b) the user has
// been demoted since the series was created).
$key = "rep_type_" . (isset($rep_type) ? $rep_type : REP_NONE);
echo "<fieldset id=\"rep_info\">\n";
echo "<legend></legend>\n";
开发者ID:JeremyJacquemont,项目名称:SchoolProjects,代码行数:31,代码来源:edit_entry.php
示例9: create_field_entry_max_duration
function create_field_entry_max_duration()
{
global $max_duration_enabled, $max_duration_secs, $max_duration_periods;
// The max duration policies
echo "<fieldset>\n";
echo "<legend>" . get_vocab("booking_durations") . "</legend>\n";
echo "<div>\n";
$params = array('label' => get_vocab("max_duration") . ":", 'name' => 'area_max_duration_enabled', 'value' => $max_duration_enabled, 'class' => 'enabler');
generate_checkbox($params);
echo "</div>\n";
echo "<div>\n";
$attributes = array('class="text"', 'type="number"', 'min="0"', 'step="1"');
$params = array('name' => 'area_max_duration_periods', 'label' => get_vocab("mode_periods") . ':', 'value' => $max_duration_periods, 'attributes' => $attributes);
generate_input($params);
echo "</div>\n";
echo "<div>\n";
$max_duration_value = $max_duration_secs;
toTimeString($max_duration_value, $max_duration_units);
$attributes = array('class="text"', 'type="number"', 'min="0"', 'step="1"');
$params = array('name' => 'area_max_duration_value', 'label' => get_vocab("mode_times") . ':', 'value' => $max_duration_value, 'attributes' => $attributes);
generate_input($params);
$units = array("seconds", "minutes", "hours", "days", "weeks");
$options = array();
foreach ($units as $unit) {
$options[$unit] = get_vocab($unit);
}
$params = array('name' => 'area_max_duration_units', 'value' => array_search($max_duration_units, $options), 'options' => $options);
generate_select($params);
echo "</div>\n";
echo "</fieldset>\n";
}
开发者ID:cvelayo,项目名称:worklog,代码行数:31,代码来源:edit_area_room.php
示例10: generate_input
table th {background-color:inherit; border:none; color:#999; vertical-align:top;}
.messagebig {width:auto;}
.messagetext {width:100%;height:200px;}
#buttontable {margin-left:228px; width:65%; margin-top:10px;}
#buttontable td {text-align:right; width:50%}
#buttontable th {text-align:left; width:50%}
#buttontable img {cursor:pointer;}
</style>
<form class="FormBG form" style="background-color:#fff;">
<h2 class="title">Messaging</h2>
<table style="margin-bottom:0px;">
<tr>
<th>Message Text</th>
<td class="messagebig"><?php
echo generate_input('message', 'text', true, '', '', 'messagetext');
?>
</td>
</tr>
</table>
<table id="buttontable">
<tr>
<th><a href="/beex/media/donor_emails.xls"><img src="/beex/images/buttons/export-donor.gif" /></a></th>
<td><img src="/beex/images/buttons/send-all-donors.gif" /></td>
</tr>
<tr>
<th><img src="/beex/images/buttons/export-challenger.gif" /></th>
<td><img src="/beex/images/buttons/send-all-challengers.gif" /></td>
</tr>
开发者ID:beexsvn,项目名称:Beex.org,代码行数:31,代码来源:messaging.php
示例11: set_value
echo "</tr>\r\n\t\t<tr>";
$name = 'hometown';
$value = $new ? set_value($name) : $item->{$name};
echo "<td>Hometown</td><td>" . generate_input($name, 'input', $edit, $value) . "</td>\r\n\t\t</tr>\r\n\t\t<tr>";
$name = 'zip';
$value = $new ? set_value($name) : $item->{$name};
echo "<td>Zip</td><td>" . generate_input($name, 'input', $edit, $value, '', array('class' => 'zip', 'maxlength' => 5)) . "</td>\r\n\t\t</tr>\r\n\t\t<tr>";
$name = 'network';
$value = $new ? set_value($name) : $item->{$name};
echo "<td>Network</td><td>" . generate_input($name, 'input', $edit, $value) . "</td>\r\n\t\t</tr>\r\n\t\t<tr>";
$sexes = array('M' => 'M', 'F' => 'F');
$name = 'gender';
$value = $new ? set_value($name) : $item->{$name};
echo "<td>Gender</td><td>" . generate_input($name, 'dropdown', $edit, $value, $sexes) . "</td>\r\n\t\t</tr>\r\n\t\t<tr>";
$name = 'whycare';
$value = $new ? set_value($name) : $item->{$name};
echo "<td>Why do you care?</td><td>" . generate_input($name, 'text', $edit, $value) . "</td>\r\n\t\t</tr>\r\n\t\t<tr>";
$name = 'blurb';
$value = $new ? set_value($name) : $item->{$name};
echo "<td>Blurb (140 chars)</td><td>" . generate_input($name, 'text', $edit, $value) . "</td>\r\n\t\t</tr>\r\n\t\t<tr>";
$name = 'advice';
$value = $new ? set_value($name) : $item->{$name};
echo "<td>Advice for fundraisers</td><td>" . generate_input($name, 'text', $edit, $value) . "</td>\r\n\t\t</tr>\r\n\t\t<tr>";
if ($edit) {
$data = array('class' => 'submit');
echo "<td colspan=2>" . form_submit($data, 'Add User') . "</td>";
}
echo "</tr>\r\n \t</table>";
if ($edit) {
echo "</form>";
}
开发者ID:beexsvn,项目名称:Beex.org,代码行数:31,代码来源:user_form.back.php
示例12: generate_input
//echo $cluster_code;
} else {
$joina = false;
}
if ($username = $this->session->userdata('username')) {
$name = 'user_id';
$email_cell = $username;
if ($new) {
$email_cell .= generate_input($name, 'hidden', $edit, $user_id);
}
} else {
$data = array('name' => 'email', 'id' => 'email', 'size' => 25, 'value' => $new ? set_value('email') : $item->user_id);
$email_cell = $edit ? form_input($data) : $item->user_id;
$name = 'password';
$value = $new ? set_value($name) : $item->{$name};
$password_cell = generate_input($name, 'password', $edit, $value);
}
if (isset($cluster_code)) {
$setup['npo_name'] = $this->beex->name_that_npo($cluster_code);
}
$setup['edit'] = $edit;
$setup['new'] = $new;
$setup['item'] = $item;
$setup['npos'] = $this->MItems->getDropdownArray('npos', 'name');
if (isset($cluster_code) && $cluster_code) {
$setup['npo_name'] = $this->beex->name_that_npo($cluster_code);
$setup['cluster'] = $this->MItems->getCluster($cluster_code)->row();
}
$this->load->helper('array');
$this->load->helper('beexform');
$cells = challenge_form_setup($setup);
开发者ID:beexsvn,项目名称:Beex.org,代码行数:31,代码来源:challenge_form.php
示例13: base_url
<p><input type="file" name="filename" onchange="ajaxUpload(this.form,'<?php
echo base_url();
?>
index.php/ajax/image_upload/cluster','upload_area','File Uploading Please Wait...<br /><img src=\'images/loader_light_blue.gif\' width=\'128\' height=\'15\' border=\'0\' />','<img src=\'images/error.gif\' width=\'16\' height=\'16\' border=\'0\' /> Error in Upload.'); return false;" /></p>
</form>
</fieldset>
<div id="upload_area" name="upload_area">
</div>
<?php
//echo generate_input('cluster_image', 'file', $edit, '');
?>
</div>
<div class="input_wrapper">
<label>Video URL Link:</label>
<?php
echo generate_input('cluster_video', 'text', $edit, '');
?>
</div>
<div class="input_buttons">
<img src="<?php
echo base_url();
?>
images/buttons/prev.gif" alt="Prev Step" id="media_tab_prev_btn" class="prev_btn">
<img src="<?php
echo base_url();
?>
images/buttons/next.gif" alt="Next Step" id="media_tab_next_btn" class="next_btn">
<?php
if ($edit_id) {
?>
<img src="<?php
开发者ID:beexsvn,项目名称:Beex.org,代码行数:31,代码来源:cluster_form.php
示例14: generate_input
generate_input($params);
$units = array("seconds", "minutes", "hours", "days", "weeks");
$options = array();
foreach ($units as $unit) {
$options[$unit] = get_vocab($unit);
}
$params = array('name' => 'area_min_ba_units', 'value' => array_search($min_ba_units, $options), 'options' => $options);
generate_select($params);
echo "</div>\n";
// Maximum book ahead
echo "<div>\n";
$params = array('label' => get_vocab("max_book_ahead") . ":", 'name' => 'area_max_ba_enabled', 'value' => $max_book_ahead_enabled, 'class' => 'enabler');
generate_checkbox($params);
$attributes = array('class="text"', 'type="number"', 'min="0"', 'step="1"');
$params = array('name' => 'area_max_ba_value', 'value' => $max_ba_value, 'attributes' => $attributes);
generate_input($params);
$params = array('name' => 'area_max_ba_units', 'value' => array_search($max_ba_units, $options), 'options' => $options);
// options same as before
generate_select($params);
echo "</div>\n";
// The max_per booking policies
echo "<table>\n";
echo "<thead>\n";
echo "<tr>\n";
echo "<th></th>\n";
echo "<th>" . get_vocab("this_area") . "</th>\n";
echo "<th title=\"" . get_vocab("whole_system_note") . "\">" . get_vocab("whole_system") . "</th>\n";
echo "</tr>\n";
echo "</thead>\n";
echo "<tbody>\n";
foreach ($interval_types as $interval_type) {
开发者ID:linuxmuster,项目名称:linuxmuster-mrbs-manager,代码行数:31,代码来源:edit_area_room.php
示例15: generate_input
<td><?php
echo generate_input('name', 'input', true, '');
?>
</td>
</tr>
<tr>
<td class="label"><label>E-mail:</label></td>
<td><?php
echo generate_input('email', 'input', true, '');
?>
</td>
</tr>
<!--<tr>
<td class="label"><label>E-mail Message:<br /><br /><span style="font-size:9px; font-style:italic;">**Invites contain a cluster access code. When this code is entered into a "Join a Cluster" field on the website, the user will be prompted to fill out the form below. You (cluster admin) can accept or reject anyone who fills out the form on the <a>admin dashboard page</a>.</span></label></td>
<td><?php
echo generate_input('personal_message', 'text', true, '', 'big_text');
?>
</td>
</tr>-->
<!--
<tr>
<td colspan=2><h5>Join Cluster Form</h5></td>
</tr>
<tr>
<td colspan="2"><a>+ Add questions</a><br />Max 3 questions</td>
</tr>
<tr>
<td class="label"><label>Question 1</label></td>
<td><input /></td>
</tr>
开发者ID:beexsvn,项目名称:Beex.org,代码行数:31,代码来源:add_teammates_form.php
示例16: generate_search_criteria
function generate_search_criteria(&$vars)
{
global $booking_types, $select_options;
global $private_somewhere, $approval_somewhere, $confirmation_somewhere;
global $user_level, $tbl_entry, $tbl_area, $tbl_room;
global $field_natures, $field_lengths;
global $report_search_field_order;
echo "<fieldset>\n";
echo "<legend>" . get_vocab("search_criteria") . "</legend>\n";
foreach ($report_search_field_order as $key) {
switch ($key) {
case 'report_start':
echo "<div id=\"div_report_start\">\n";
echo "<label>" . get_vocab("report_start") . ":</label>\n";
genDateSelector("from_", $vars['from_day'], $vars['from_month'], $vars['from_year']);
echo "</div>\n";
break;
case 'report_end':
echo "<div id=\"div_report_end\">\n";
echo "<label>" . get_vocab("report_end") . ":</label>\n";
genDateSelector("to_", $vars['to_day'], $vars['to_month'], $vars['to_year']);
echo "</div>\n";
break;
case 'areamatch':
$options = sql_query_array("SELECT area_name FROM {$tbl_area} ORDER BY area_name");
if ($options === FALSE) {
trigger_error(sql_error(), E_USER_WARNING);
fatal_error(FALSE, get_vocab("fatal_db_error"));
}
echo "<div id=\"div_areamatch\">\n";
$params = array('label' => get_vocab("match_area") . ':', 'name' => 'areamatch', 'options' => $options, 'force_indexed' => TRUE, 'value' => $vars['areamatch']);
generate_datalist($params);
echo "</div>\n";
break;
case 'roommatch':
// (We need DISTINCT because it's possible to have two rooms of the same name
// in different areas)
$options = sql_query_array("SELECT DISTINCT room_name FROM {$tbl_room} ORDER BY room_name");
if ($options === FALSE) {
trigger_error(sql_error(), E_USER_WARNING);
fatal_error(FALSE, get_vocab("fatal_db_error"));
}
echo "<div id=\"div_roommatch\">\n";
$params = array('label' => get_vocab("match_room") . ':', 'name' => 'roommatch', 'options' => $options, 'force_indexed' => TRUE, 'value' => $vars['roommatch']);
generate_datalist($params);
echo "</div>\n";
break;
case 'typematch':
echo "<div id=\"div_typematch\">\n";
$options = array();
foreach ($booking_types as $type) {
$options[$type] = get_type_vocab($type);
}
$params = array('label' => get_vocab("match_type") . ':', 'name' => 'typematch[]', 'id' => 'typematch', 'options' => $options, 'force_assoc' => TRUE, 'value' => $vars['typematch'], 'multiple' => TRUE, 'attributes' => 'size="5"');
generate_select($params);
echo "<span>" . get_vocab("ctrl_click_type") . "</span>\n";
echo "</div>\n";
break;
case 'namematch':
echo "<div id=\"div_namematch\">\n";
$params = array('label' => get_vocab("match_entry") . ':', 'name' => 'namematch', 'value' => $vars['namematch']);
generate_input($params);
echo "</div>\n";
break;
case 'descrmatch':
echo "<div id=\"div_descrmatch\">\n";
$params = array('label' => get_vocab("match_descr") . ':', 'name' => 'descrmatch', 'value' => $vars['descrmatch']);
generate_input($params);
echo "</div>\n";
break;
case 'creatormatch':
echo "<div id=\"div_creatormatch\">\n";
$params = array('label' => get_vocab("createdby") . ':', 'name' => 'creatormatch', 'value' => $vars['creatormatch']);
generate_input($params);
echo "</div>\n";
break;
case 'match_private':
// Privacy status
// Only show this part of the form if there are areas that allow private bookings
if ($private_somewhere) {
// If they're not logged in then there's no point in showing this part of the form because
// they'll only be able to see public bookings anyway (and we don't want to alert them to
// the existence of private bookings)
if (empty($user_level)) {
echo "<input type=\"hidden\" name=\"match_private\" value=\"" . PRIVATE_NO . "\">\n";
} else {
echo "<div id=\"div_privacystatus\">\n";
$options = array(PRIVATE_BOTH => get_vocab("both"), PRIVATE_NO => get_vocab("default_public"), PRIVATE_YES => get_vocab("default_private"));
$params = array('label' => get_vocab("privacy_status") . ':', 'name' => 'match_private', 'options' => $options, 'value' => $vars['match_private']);
generate_radio_group($params);
echo "</div>\n";
}
}
break;
case 'match_confirmed':
// Confirmation status
// Only show this part of the form if there are areas that require approval
if ($confirmation_somewhere) {
echo "<div id=\"div_confirmationstatus\">\n";
$options = array(CONFIRMED_BOTH => get_vocab("both"), CONFIRMED_YES => get_vocab("confirmed"), CONFIRMED_NO => get_vocab("tentative"));
//.........这里部分代码省略.........
开发者ID:bdwong-mirrors,项目名称:mrbs,代码行数:101,代码来源:report.php
示例17: create_field_entry_custom_field
function create_field_entry_custom_field($field, $key, $disabled = FALSE)
{
global $custom_fields, $tbl_entry, $select_options;
global $is_mandatory_field, $text_input_max;
$var_name = VAR_PREFIX . $key;
$value = $custom_fields[$key];
$label_text = get_loc_field_name($tbl_entry, $key) . ":";
$mandatory = array_key_exists("entry.{$key}", $is_mandatory_field) && $is_mandatory_field["entry.{$key}"] ? true : false;
echo "<div>\n";
// Output a checkbox if it's a boolean or integer <= 2 bytes (which we will
// assume are intended to be booleans)
if ($field['nature'] == 'boolean' || $field['nature'] == 'integer' && isset($field['length']) && $field['length'] <= 2) {
echo "<label for=\"{$var_name}\">{$label_text}</label>\n";
echo "<input type=\"checkbox\" class=\"checkbox\" " . "id=\"{$var_name}\" name=\"{$var_name}\" value=\"1\" " . (!empty($value) ? " checked=\"checked\"" : "") . ($disabled ? " disabled=\"disabled\"" : "") . ($mandatory ? " required" : "") . ">\n";
} elseif (!empty($select_options["entry.{$key}"])) {
generate_select($label_text, $var_name, $value, $select_options["entry.{$key}"], $mandatory, $disabled);
} elseif ($field['nature'] == 'character' && isset($field['length']) && $field['length'] > $text_input_max) {
// HTML5 does not allow a pattern attribute for the textarea element
$attributes = isset($is_mandatory_field["entry.{$key}"]) && $is_mandatory_field["entry.{$key}"] ? "required" : "";
generate_textarea($label_text, $var_name, $value, $disabled, $attributes);
} else {
$is_integer_field = $field['nature'] == 'integer' && $field['length'] > 2;
if ($is_integer_field) {
$attributes = 'type="number" step="1"';
} else {
$attributes = 'type="text"';
}
if (isset($is_mandatory_field["entry.{$key}"]) && $is_mandatory_field["entry.{$key}"]) {
$attributes .= ' required';
// 'required' is not sufficient for strings, because we also want to make sure
// that the string contains at least one non-whitespace character
$attributes .= $is_integer_field ? '' : ' pattern="' . REGEX_TEXT_POS . '"';
}
generate_input($label_text, $var_name, $value, $disabled, NULL, $attributes);
}
if ($disabled) {
echo "<input type=\"hidden\" name=\"{$var_name}\" value=\"{$value}\">\n";
}
echo "</div>\n";
}
开发者ID:koroder,项目名称:Web-portal-for-academic-institution,代码行数:40,代码来源:edit_entry.php
注:本文中的generate_input函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论