コード例 #1
0
$Form->switch_layout('none');
echo '<table cellspacing="0" class="compose_layout" align="center"><tr>';
$display_title_field = $edited_Item->get_type_setting('use_title') != 'never';
if ($display_title_field) {
    // Display title
    $field_required = $edited_Item->get_type_setting('use_title') == 'required' ? $required_star : '';
    echo '<td width="1%" class="label">' . $field_required . '<strong>' . T_('Title') . ':</strong></td>';
    echo '<td width="97%" class="input">';
    $Form->text_input('post_title', $item_title, 20, '', '', array('maxlength' => 255, 'style' => 'width: 100%;'));
    echo '</td>';
} else {
    // Hide title
    $Form->hidden('post_title', $item_title);
}
// -- Language chooser BEGIN --
$locale_options = locale_options($edited_Item->get('locale'), false, true);
if (is_array($locale_options)) {
    // We've only one enabled locale.
    // Tblue> The locale name is not really needed here, but maybe we
    //        want to display the name of the only locale?
    $Form->hidden('post_locale', $locale_options[0]);
    //pre_dump( $locale_options );
} else {
    // More than one locale => select field.
    echo '<td width="1%" class="label">';
    if ($display_title_field) {
        echo '&nbsp;&nbsp;';
    }
    echo '<strong>' . T_('Language') . ':</strong></td>';
    echo '<td width="1%" class="select">';
    $Form->select_options('post_locale', $locale_options, '');
コード例 #2
0
ファイル: _locale.funcs.php プロジェクト: Ariflaw/b2evolution
/**
 * [callback function] Returns an <option> set with default locale selected
 *
 * @param string default value
 */
function locale_options_return($default = '')
{
    $r = locale_options($default, false);
    return $r;
}
コード例 #3
0
    $Form->end_fieldset();
    $Form->end_form(array(array('', 'actionArray[confirm_update]', T_('Confirm')), array('', 'actionArray[abort_update]', T_('Abort'))));
} else {
    // show main form
    $Form = new Form($pagenow, 'loc_checkchanges');
    $Form->begin_form('fform');
    $Form->add_crumb('locales');
    $Form->hidden('ctrl', 'locales');
    $Form->hidden('action', 'update');
    $Form->hidden('loc_transinfo', $loc_transinfo);
    $Form->begin_fieldset(T_('Regional settings') . get_manual_link('locales-tab'));
    if (!isset($locales[$Settings->get('default_locale')]) || !$locales[$Settings->get('default_locale')]['enabled']) {
        // default locale is not enabled
        param_error('newdefault_locale', T_('Note: default locale is not enabled.'));
    }
    $locale_options = locale_options($Settings->get('default_locale'), false);
    $Form->select_input_options('newdefault_locale', $locale_options, T_('Default locale'), T_('Overridden by browser config, user locale or blog locale (in this order).'));
    // $Form->select( 'newdefault_locale', $Settings->get('default_locale'), 'locale_options_return', T_('Default locale'), T_('Overridden by browser config, user locale or blog locale (in this order).'));
    $Form->end_fieldset();
    $Form->begin_fieldset(T_('Available locales') . get_manual_link('locales-tab'));
    echo '<p class="center">';
    if ($loc_transinfo) {
        global $messages_pot_file_info;
        $messages_pot_file_info = locale_file_po_info($locales_path . 'messages.pot');
        $messages_DB_info = $DB->get_var('SELECT COUNT(iost_ID) FROM T_i18n_original_string');
        echo '<a href="' . $pagenow . '?ctrl=locales&amp;loc_transinfo=0">' . T_('Hide translation info'), '</a><br /><br />';
        $Form->output = false;
        $button_generate_POT_file = $Form->button(array('submit', 'actionArray[generate_pot]', T_('(Re)generate POT file'), 'SaveButton'));
        $button_import_POT_file = $Form->button(array('submit', 'actionArray[import_pot]', T_('(Re)import POT file'), 'SaveButton'));
        $Form->output = true;
        echo sprintf(T_('# strings in .POT file: %s - # strings in DB: %s '), $messages_pot_file_info['all'] . ' ' . $button_generate_POT_file, $messages_DB_info . ' ' . $button_import_POT_file) . '<br />';