Ejemplo n.º 1
0
function config_form()
{
    global $phpc_script, $phpc_user_tz, $phpc_user_lang, $phpc_token;
    $tz_input = create_multi_select('timezone', get_timezone_list(), $phpc_user_tz);
    $languages = array("" => __("Default"));
    foreach (get_languages() as $lang) {
        $languages[$lang] = $lang;
    }
    $lang_input = create_select('language', $languages, $phpc_user_lang);
    $form = tag('form', attributes("action=\"{$phpc_script}\"", 'method="post"'), tag('table', attributes("class=\"phpc-container\""), tag('caption', __('Settings')), tag('tfoot', tag('tr', tag('td', attributes('colspan="2"'), create_hidden('phpc_token', $phpc_token), create_hidden('action', 'settings'), create_hidden('phpc_submit', 'settings'), create_submit(__('Submit'))))), tag('tbody', tag('tr', tag('th', __('Timezone')), tag('td', $tz_input)), tag('tr', tag('th', __('Language')), tag('td', $lang_input)))));
    return tag('div', attrs('id="phpc-config"'), $form);
}
Ejemplo n.º 2
0
function config_form()
{
    global $phpc_script, $phpc_user_tz, $phpc_user_lang, $phpc_token, $phpcdb, $phpc_user;
    $tz_input = create_multi_select('timezone', get_timezone_list(), $phpc_user_tz);
    $languages = array("" => __("Default"));
    foreach (get_languages() as $lang) {
        $languages[$lang] = $lang;
    }
    $lang_input = create_select('language', $languages, $phpc_user_lang);
    $calendars = array("" => __("None"));
    foreach ($phpcdb->get_calendars() as $calendar) {
        $calendars[$calendar->get_cid()] = $calendar->get_title();
    }
    $default_input = create_select('default_cid', $calendars, $phpc_user->get_default_cid());
    $table = tag('table', attrs('class="phpc-form"'));
    if (is_user()) {
        $table->add(tag('tr', tag('th', __('Default Calendar')), tag('td', $default_input)));
    }
    $table->add(tag('tr', tag('th', __('Timezone')), tag('td', $tz_input)));
    $table->add(tag('tr', tag('th', __('Language')), tag('td', $lang_input)));
    $form = tag('form', attributes("action=\"{$phpc_script}\"", 'method="post"'), tag('div', attrs('class="phpc-sub-title"'), __('Settings')), $table, create_hidden('phpc_token', $phpc_token), create_hidden('action', 'user_settings_submit'), create_submit(__('Submit')));
    return tag('div', attrs('id="phpc-config"'), $form);
}
Ejemplo n.º 3
0
function create_config_input($element, $default = false)
{
    $name = $element[0];
    $text = $element[1];
    $type = $element[2];
    $value = false;
    if (isset($element[3])) {
        $value = $element[3];
    }
    switch ($type) {
        case PHPC_CHECK:
            if ($default == false) {
                $default = $value;
            }
            $input = create_checkbox($name, '1', $default, $text);
            break;
        case PHPC_TEXT:
            if ($default == false) {
                $default = $value;
            }
            $input = create_text($name, $default);
            break;
        case PHPC_DROPDOWN:
            $input = create_select($name, $value, $default);
            break;
        case PHPC_MULTI_DROPDOWN:
            $input = create_multi_select($name, $value, $default);
            break;
        default:
            soft_error(__('Unsupported config type') . ": {$type}");
    }
    return $input;
}