Exemplo n.º 1
0
function get_export_plugin_list_r()
{
    $pluginList = NULL;
    $export_type_r = get_export_r();
    if (is_array($export_type_r)) {
        while (list(, $pluginRef) = @each($export_type_r)) {
            include_once "./lib/export/" . $pluginRef . ".class.php";
            $exportPlugin = new $pluginRef();
            if ($exportPlugin !== NULL) {
                if (strcasecmp($pluginRef, get_class($exportPlugin)) === 0) {
                    $pluginList[] = array(name => $pluginRef, description => $exportPlugin->get_display_name());
                } else {
                    opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, 'Export class is not valid', array($pluginRef));
                }
            }
        }
    }
    return $pluginList;
}
Exemplo n.º 2
0
/**
    boolean - TRUE or FALSE only
    text - arbritrary text
    textarea - arbritrary text
    email - email address
    number - enforce a numeric value
    datemask - enforce a date mask.
    usertype - Restrict to a single user type only.
    usertype_array - Restrict to set of user types only.
    value_select(option1,option2)
    array - keys will be numeric and in sequence only.
*/
function get_group_block_input_field($config_group_item_r, $value)
{
    // replace period with '$', so we can avoid PHP auto-replacing '.' with '_' and the
    // confusion that will bring.
    $config_group_item_r['group_id'] = str_replace('.', '$', $config_group_item_r['group_id']);
    $fieldname = $config_group_item_r['group_id'] . '[' . $config_group_item_r['id'] . ']';
    if ($config_group_item_r['keyid'] != '0') {
        $fieldname .= '[' . $config_group_item_r['keyid'] . ']';
    }
    switch ($config_group_item_r['type']) {
        case 'boolean':
            return checkbox_field($fieldname, $config_group_item_r['prompt'], $value !== NULL && $value === TRUE, 'TRUE');
            break;
        case 'readonly':
            return readonly_field($fieldname, htmlspecialchars($value));
            break;
        case 'text':
            return text_field($fieldname, $config_group_item_r['prompt'], 50, 255, 'N', htmlspecialchars($value));
            break;
        case 'password':
            return password_field($fieldname, $config_group_item_r['prompt'], 50, 255, 'N', htmlspecialchars($value));
            break;
        case 'textarea':
            return textarea_field($fieldname, $config_group_item_r['prompt'], 50, 5, 255, 'N', htmlspecialchars($value));
            break;
        case 'email':
            return email_field($fieldname, $config_group_item_r['prompt'], 50, 255, 'N', htmlspecialchars($value));
            break;
        case 'number':
            return number_field($fieldname, $config_group_item_r['prompt'], 10, 50, 'N', htmlspecialchars($value));
            break;
        case 'datemask':
            return text_field($fieldname, $config_group_item_r['prompt'], 50, 255, 'N', htmlspecialchars($value));
            break;
        case 'instance_attribute_type':
            return custom_select($fieldname, fetch_instance_attribute_type_rs(), '%s_attribute_type% - %description%', 1, $value, 's_attribute_type');
            break;
        case 'language':
            return custom_select($fieldname, fetch_language_rs(), '%language%', 1, $value, 'language', NULL, 'default_ind');
            break;
        case 'theme':
            return custom_select($fieldname, get_user_theme_r(), '%value%', 1, $value);
            break;
        case 'export':
            return custom_select($fieldname, array_merge(array(''), get_export_r()), '%value%', 1, $value);
            break;
        case 'value_select':
            $value_options_r = explode(',', $config_group_item_r['subtype']);
            return value_select($fieldname, $value_options_r, 1, $value);
            break;
        case 'array':
            $buffer = '';
            switch ($config_group_item_r['subtype']) {
                case 'text':
                case 'number':
                    $element_name = $config_group_item_r['group_id'] . "[" . $config_group_item_r['id'] . "][]";
                    $buffer .= "<select name=\"" . $element_name . "\" size=\"5\" MULTIPLE>\n";
                    if (is_array($value)) {
                        reset($value);
                        while (list($key, $val) = each($value)) {
                            $buffer .= "<option value=\"" . $val . "\" SELECTED>" . $val . "\n";
                        }
                    }
                    $buffer .= "</select>";
                    $buffer .= "<ul class=\"actionButtons\">";
                    $buffer .= "<li><input type=\"button\" class=\"button\" value=\"Edit\" onClick=\"updateSelectedOption(this.form['" . $element_name . "'], '" . $config_group_item_r['prompt'] . "', '" . $config_group_item_r['subtype'] . "');\"></li>";
                    $buffer .= "<li><input type=\"button\" class=\"button\" value=\"Add\" onClick=\"addSelectOption(this.form['" . $element_name . "'], '" . $config_group_item_r['prompt'] . "', '" . $config_group_item_r['subtype'] . "');\"></li>";
                    $buffer .= "<li><input type=\"button\" class=\"button\" value=\"Delete\" onClick=\"removeSelectedOption(this.form['" . $element_name . "']);\"></li>";
                    $buffer .= "</ul>";
                    break;
            }
            return $buffer;
    }
    //else
    return '>>> ERROR <<<';
}