本文整理汇总了PHP中type_options函数的典型用法代码示例。如果您正苦于以下问题:PHP type_options函数的具体用法?PHP type_options怎么用?PHP type_options使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了type_options函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch_tool
/**
* Renders a panel for selecting the import tool.
*
* Lets users select the tool and provide required
* configuration options.
*/
function switch_tool()
{
global $vars, $event, $step, $tools;
extract(gpsa($vars));
pagetop(gTxt('txp_import'), '');
echo hed(gTxt('tab_import'), 1, array('class' => 'txp-heading'));
$content = '<section class="txp-edit">';
$content .= hed(gTxt('txp_import'), 2);
// Select tool.
$content .= inputLabel('import_from', tag(type_options($tools), 'select', ' id="import_from" name="import_tool"'), 'select_tool', 'import');
// Some data we collect.
$content .= inputLabel('import_section', import_section_popup(''), 'import_section', 'import_section');
$status_options = array(STATUS_LIVE => gTxt('live'), STATUS_DRAFT => gTxt('draft'), STATUS_HIDDEN => gTxt('hidden'), STATUS_PENDING => gTxt('pending'));
$content .= inputLabel('import_status', tag(type_options($status_options), 'select', ' id="import_status"'), 'import_status', 'import_status');
$content .= inputLabel('import_comment', fInput('text', 'import_comments_invite', gTxt('comments'), '', '', '', INPUT_REGULAR, '', 'import_comment'), 'import_invite', 'import_invite');
// Database imports only.
$databased = hed(gTxt('database_stuff'), 2) . inputLabel('import_database', fInput('text', 'importdb', '', '', '', '', INPUT_REGULAR, '', 'import_database'), 'import_database', 'import_database') . inputLabel('import_login', fInput('text', 'importdblogin', '', '', '', '', INPUT_REGULAR, '', 'import_login'), 'import_login', 'import_login') . inputLabel('import_password', fInput('text', 'importdbpass', '', '', '', '', INPUT_REGULAR, '', 'import_password'), 'import_password', 'import_password') . inputLabel('import_host', fInput('text', 'importdbhost', '', '', '', '', INPUT_REGULAR, '', 'import_host'), 'import_host', 'import_host');
$content .= tag($databased, 'div', ' id="databased" style="display: none;"');
// Movable Type (MySQL DB) specific.
$mtblogid = inputLabel('import_blogid', fInput('text', 'import_blog_id', '', '', '', '', INPUT_REGULAR, '', 'import_blogid'), 'import_blogid', 'import_blogid');
$content .= tag($mtblogid, 'div', ' id="mtblogid" style="display: none;"');
// WordPress specific.
$wponly = inputLabel('import_wpprefix', fInput('text', 'wpdbprefix', 'wp_', '', '', '', INPUT_REGULAR, '', 'import_wpprefix'), 'import_wpprefix', 'import_wpprefix') . inputLabel('import_wpdbcharset', selectInput('wpdbcharset', array('utf8' => gTxt('utf8'), 'latin1' => gTxt('latin1')), 'utf8', '', '', 'import_wpdbcharset'), 'import_wpdbcharset', 'import_wpdbcharset');
$content .= tag($wponly, 'div', ' id="wponly" style="display: none;"');
$content .= graf(fInput('submit', 'choose', gTxt('continue'), 'publish'));
$content .= sInput('start_import') . eInput('import');
$content .= '</section>';
echo '<div id="' . $event . '_container" class="txp-container">' . form($content, '', '', 'post', '', '', 'import') . '</div>';
}
示例2: switch_tool
function switch_tool()
{
global $vars, $event, $step, $tools;
extract(gpsa($vars));
pagetop(gTxt('txp_import'), '');
?>
<script type="text/javascript">
<!--//
function showHideFields($sel)
{
if(document.getElementById){
document.getElementById('mtblogid').style.display = ($sel=='mtdb') ? 'block': 'none';
document.getElementById('wponly').style.display = ($sel=='wp') ? 'block': 'none';
document.getElementById('databased').style.display = ($sel=='wp' || $sel=='mtdb' || $sel=='b2')? 'block':'none';
}
}
//-->
</script>
<?php
$content = startTable('edit');
$content .= tr(tdcs(hed(gTxt('txp_import'), 3), 2));
//Select tool
$content .= tr(fLabelCell('select_tool', 'import', 'from') . td(tag(type_options($tools), 'select', " name=\"import_tool\" onchange=\"showHideFields(this.value);\""), '', 'from'), ' class="import-from"');
//Some data we collect
$content .= tr(fLabelCell('import_section', 'import_section', 'section') . td(import_section_popup(''), '', 'section'), ' class="import-section"');
$status_options = array(4 => gTxt('live'), 1 => gTxt('draft'), 2 => gTxt('hidden'), 3 => gTxt('pending'));
$content .= tr(fLabelCell('import_status', 'import_status', 'status') . td(type_select($status_options), '', 'status'), ' class="import-status"');
$content .= tr(fLabelCell('import_invite', 'import_invite', 'comment-invite') . td(fInput('text', 'comments_invite', gTxt('comments'), 'edit'), '', 'comment-invite'), ' class="import-comment"');
//DataBase imports only
$databased = tr(tdcs(hed(gTxt('database_stuff'), 3), 2)) . tr(fLabelCell('import_database', 'import_database', 'database') . td(fInput('text', 'importdb', '', 'edit'), '', 'database'), ' class="import-database"') . tr(fLabelCell('import_login', 'import_login', 'login') . td(fInput('text', 'importdblogin', '', 'edit'), '', 'login'), ' class="import-login"') . tr(fLabelCell('import_password', 'import_password', 'password') . td(fInput('text', 'importdbpass', '', 'edit'), '', 'password'), ' class="import-password"') . tr(fLabelCell('import_host', 'import_host', 'host') . td(fInput('text', 'importdbhost', '', 'edit'), '', 'host'), ' class="import-host"');
//Ugly, but a way to present a clean screen with only required fields
//while we keep JavaScript code at minimum
$content .= tr(tda(tag($databased, 'table', ' id="databased" style="display: none; border: none;"'), ' colspan="2"'));
//MT-DB Specific
$mtblogid = tr(fLabelCell('import_blogid', 'import_blogid', 'blog-id') . td(fInput('text', 'blog_id', '', 'edit'), '', 'blog-id'), ' class="import-blog-id"');
$content .= tr(tda(tag($mtblogid, 'table', ' id="mtblogid" style="display: none; border: none;"'), ' colspan="2"'));
//WordPress specific option
$wponly = tr(fLabelCell('import_wpprefix', 'import_wpprefix', 'wp-prefix') . td(fInput('text', 'wpdbprefix', 'wp_', 'edit'), '', 'wp-prefix'), ' class="import-wp-prefix"');
$content .= tr(tda(tag($wponly, 'table', ' id="wponly" style="display: none; border: none;"'), ' colspan="2"'));
$content .= endTable();
$content .= tag(fInput('submit', 'choose', gTxt('continue'), 'publish'), 'p', ' style="text-align:center"');
$content .= sInput('start_import') . eInput('import');
echo '<div id="' . $event . '_container" class="txp-container txp-edit">' . form($content, '', '', 'post', '', '', 'import') . '</div>';
}
示例3: switch_tool
function switch_tool()
{
global $vars, $event, $step, $tools;
extract(gpsa($vars));
pagetop(gTxt('txp_import'), '');
echo '<h1 class="txp-heading">' . gTxt('tab_import') . '</h1>';
?>
<script type="text/javascript">
<!--//
function showHideFields($sel)
{
if(document.getElementById){
document.getElementById('mtblogid').style.display = ($sel=='mtdb') ? 'block': 'none';
document.getElementById('wponly').style.display = ($sel=='wp') ? 'block': 'none';
document.getElementById('databased').style.display = ($sel=='wp' || $sel=='mtdb' || $sel=='b2')? 'block':'none';
}
}
//-->
</script>
<?php
$content = '<div class="txp-edit">';
$content .= hed(gTxt('txp_import'), 2);
//Select tool
$content .= inputLabel('import_from', tag(type_options($tools), 'select', ' id="import_from" name="import_tool" onchange="showHideFields(this.value);"'), 'select_tool', 'import');
//Some data we collect
$content .= inputLabel('import_section', import_section_popup(''), 'import_section', 'import_section');
$status_options = array(STATUS_LIVE => gTxt('live'), STATUS_DRAFT => gTxt('draft'), STATUS_HIDDEN => gTxt('hidden'), STATUS_PENDING => gTxt('pending'));
$content .= inputLabel('import_status', tag(type_options($status_options), 'select', ' id="import_status"'), 'import_status', 'import_status');
$content .= inputLabel('import_comment', fInput('text', 'import_comments_invite', gTxt('comments'), '', '', '', INPUT_REGULAR, '', 'import_comment'), 'import_invite', 'import_invite');
//DataBase imports only
$databased = hed(gTxt('database_stuff'), 2) . inputLabel('import_database', fInput('text', 'importdb', '', '', '', '', INPUT_REGULAR, '', 'import_database'), 'import_database', 'import_database') . inputLabel('import_login', fInput('text', 'importdblogin', '', '', '', '', INPUT_REGULAR, '', 'import_login'), 'import_login', 'import_login') . inputLabel('import_password', fInput('text', 'importdbpass', '', '', '', '', INPUT_REGULAR, '', 'import_password'), 'import_password', 'import_password') . inputLabel('import_host', fInput('text', 'importdbhost', '', '', '', '', INPUT_REGULAR, '', 'import_host'), 'import_host', 'import_host');
$content .= tag($databased, 'div', ' id="databased" style="display: none;"');
//MT-DB Specific
$mtblogid = inputLabel('import_blogid', fInput('text', 'import_blog_id', '', '', '', '', INPUT_REGULAR, '', 'import_blogid'), 'import_blogid', 'import_blogid');
$content .= tag($mtblogid, 'div', ' id="mtblogid" style="display: none;"');
//WordPress specific option
$wponly = inputLabel('import_wpprefix', fInput('text', 'wpdbprefix', 'wp_', '', '', '', INPUT_REGULAR, '', 'import_wpprefix'), 'import_wpprefix', 'import_wpprefix') . inputLabel('import_wpdbcharset', selectInput('wpdbcharset', array('utf8' => gTxt('utf8'), 'latin1' => gTxt('latin1')), 'utf8', '', '', 'import_wpdbcharset'), 'import_wpdbcharset', 'import_wpdbcharset');
$content .= tag($wponly, 'div', ' id="wponly" style="display: none;"');
$content .= graf(fInput('submit', 'choose', gTxt('continue'), 'publish'));
$content .= sInput('start_import') . eInput('import');
$content .= '</div>';
echo '<div id="' . $event . '_container" class="txp-container">' . form($content, '', '', 'post', '', '', 'import') . '</div>';
}
示例4: type_select
function type_select($options)
{
return '<select name="type">' . n . type_options($options) . '</select>' . n;
}