当前位置: 首页>>代码示例>>PHP>>正文


PHP columns_get_plugin_columns函数代码示例

本文整理汇总了PHP中columns_get_plugin_columns函数的典型用法代码示例。如果您正苦于以下问题:PHP columns_get_plugin_columns函数的具体用法?PHP columns_get_plugin_columns怎么用?PHP columns_get_plugin_columns使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了columns_get_plugin_columns函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: column_get_title

/**
 * Gets the localized title for the specified column.  The column can be native or custom.
 * The custom fields must contain the 'custom_' prefix.
 *
 * @param string $p_column - The column name.
 * @return string The column localized name.
 * @access public
 */
function column_get_title($p_column)
{
    $t_custom_field = column_get_custom_field_name($p_column);
    if ($t_custom_field !== null) {
        $t_field_id = custom_field_get_id_from_name($t_custom_field);
        if ($t_field_id === false) {
            $t_custom_field = '@' . $t_custom_field . '@';
        } else {
            $t_def = custom_field_get_definition($t_field_id);
            $t_custom_field = lang_get_defaulted($t_def['name']);
        }
        return $t_custom_field;
    }
    $t_plugin_columns = columns_get_plugin_columns();
    if (isset($t_plugin_columns[$p_column])) {
        $t_column_object = $t_plugin_columns[$p_column];
        return $t_column_object->title;
    }
    switch ($p_column) {
        case 'attachment_count':
            return lang_get('attachments');
        case 'bugnotes_count':
            return '#';
        case 'category_id':
            return lang_get('category');
        case 'edit':
            return '';
        case 'handler_id':
            return lang_get('assigned_to');
        case 'last_updated':
            return lang_get('updated');
        case 'os_build':
            return lang_get('os_version');
        case 'project_id':
            return lang_get('email_project');
        case 'reporter_id':
            return lang_get('reporter');
        case 'selection':
            return '';
        case 'sponsorship_total':
            return sponsorship_get_currency();
        case 'version':
            return lang_get('product_version');
        case 'view_state':
            return lang_get('view_status');
        default:
            return lang_get_defaulted($p_column);
    }
}
开发者ID:N0ctrnl,项目名称:mantisbt,代码行数:57,代码来源:columns_api.php

示例2: filter_get_query_sort_data

/**
 * Add sort parameters to the query clauses
 * @param array   &$p_filter       Filter to sort.
 * @param boolean $p_show_sticky   Whether to show sticky items.
 * @param array   $p_query_clauses Array of query clauses.
 * @return array $p_query_clauses
 */
function filter_get_query_sort_data(array &$p_filter, $p_show_sticky, array $p_query_clauses)
{
    # if sort is blank then default the sort and direction.  This is to fix the
    # symptoms of #3953.  Note that even if the main problem is fixed, we may
    # have to keep this code for a while to handle filters saved with this blank field.
    if (is_blank($p_filter[FILTER_PROPERTY_SORT_FIELD_NAME])) {
        $p_filter[FILTER_PROPERTY_SORT_FIELD_NAME] = 'last_updated';
        $p_filter[FILTER_PROPERTY_SORT_DIRECTION] = 'DESC';
    }
    $p_query_clauses['order'] = array();
    $t_sort_fields = explode(',', $p_filter[FILTER_PROPERTY_SORT_FIELD_NAME]);
    $t_dir_fields = explode(',', $p_filter[FILTER_PROPERTY_SORT_DIRECTION]);
    $t_plugin_columns = columns_get_plugin_columns();
    if (gpc_string_to_bool($p_filter[FILTER_PROPERTY_STICKY]) && null !== $p_show_sticky) {
        $p_query_clauses['order'][] = '{bug}.sticky DESC';
    }
    $t_count = count($t_sort_fields);
    for ($i = 0; $i < $t_count; $i++) {
        $c_sort = $t_sort_fields[$i];
        $c_dir = 'DESC' == $t_dir_fields[$i] ? 'DESC' : 'ASC';
        if (!in_array($t_sort_fields[$i], array_slice($t_sort_fields, $i + 1))) {
            # if sorting by a custom field
            if (strpos($c_sort, 'custom_') === 0) {
                $t_custom_field = utf8_substr($c_sort, utf8_strlen('custom_'));
                $t_custom_field_id = custom_field_get_id_from_name($t_custom_field);
                $t_def = custom_field_get_definition($t_custom_field_id);
                $t_value_field = $t_def['type'] == CUSTOM_FIELD_TYPE_TEXTAREA ? 'text' : 'value';
                $c_cf_alias = 'custom_field_' . $t_custom_field_id;
                # Distinguish filter table aliases from sort table aliases (see #19670)
                $t_cf_table_alias = 'cf_sort_' . $t_custom_field_id;
                $t_cf_select = $t_cf_table_alias . '.' . $t_value_field . ' ' . $c_cf_alias;
                # check to be sure this field wasn't already added to the query.
                if (!in_array($t_cf_select, $p_query_clauses['select'])) {
                    $p_query_clauses['select'][] = $t_cf_select;
                    $p_query_clauses['join'][] = 'LEFT JOIN {custom_field_string} ' . $t_cf_table_alias . ' ON
												{bug}.id = ' . $t_cf_table_alias . '.bug_id AND ' . $t_cf_table_alias . '.field_id = ' . $t_custom_field_id;
                }
                $p_query_clauses['order'][] = $c_cf_alias . ' ' . $c_dir;
                # if sorting by plugin columns
            } else {
                if (isset($t_plugin_columns[$t_sort_fields[$i]])) {
                    $t_column_object = $t_plugin_columns[$t_sort_fields[$i]];
                    if ($t_column_object->sortable) {
                        $t_clauses = $t_column_object->sortquery($c_dir);
                        if (is_array($t_clauses)) {
                            if (isset($t_clauses['join'])) {
                                $p_query_clauses['join'][] = $t_clauses['join'];
                            }
                            if (isset($t_clauses['order'])) {
                                $p_query_clauses['order'][] = $t_clauses['order'];
                            }
                        }
                    }
                    # standard column
                } else {
                    $t_sort_col = '{bug}.' . $c_sort;
                    # when sorting by due_date, always display undefined dates last
                    if ('due_date' == $c_sort && 'ASC' == $c_dir) {
                        $t_sort_due_date = $t_sort_col . ' = 1';
                        $p_query_clauses['select'][] = $t_sort_due_date;
                        $t_sort_col = $t_sort_due_date . ', ' . $t_sort_col;
                    }
                    $p_query_clauses['order'][] = $t_sort_col . ' ' . $c_dir;
                }
            }
        }
    }
    # add basic sorting if necessary
    if (!in_array('last_updated', $t_sort_fields)) {
        $p_query_clauses['order'][] = '{bug}.last_updated DESC';
    }
    if (!in_array('date_submitted', $t_sort_fields)) {
        $p_query_clauses['order'][] = '{bug}.date_submitted DESC';
    }
    return $p_query_clauses;
}
开发者ID:vipjaven,项目名称:mantisbt,代码行数:83,代码来源:filter_api.php

示例3: custom_function_default_print_column_value

/**
 * Print the value of the custom field (if the field is applicable to the project of
 * the specified issue and the current user has read access to it.
 * see custom_function_default_print_column_title() for rules about column names.
 * @param string  $p_column         Name of field to show in the column.
 * @param BugData $p_bug            Bug object.
 * @param integer $p_columns_target See COLUMNS_TARGET_* in constant_inc.php.
 * @return void
 */
function custom_function_default_print_column_value($p_column, BugData $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE)
{
    if (COLUMNS_TARGET_CSV_PAGE == $p_columns_target) {
        $t_column_start = '';
        $t_column_end = '';
        $t_column_empty = '';
    } else {
        $t_column_start = '<td class="column-%s">';
        $t_column_end = '</td>';
        $t_column_empty = '&#160;';
    }
    $t_custom_field = column_get_custom_field_name($p_column);
    if ($t_custom_field !== null) {
        printf($t_column_start, 'custom-' . $t_custom_field);
        $t_field_id = custom_field_get_id_from_name($t_custom_field);
        if ($t_field_id === false) {
            echo '@', $t_custom_field, '@';
        } else {
            $t_issue_id = $p_bug->id;
            $t_project_id = $p_bug->project_id;
            if (custom_field_is_linked($t_field_id, $t_project_id)) {
                $t_def = custom_field_get_definition($t_field_id);
                print_custom_field_value($t_def, $t_field_id, $t_issue_id);
            } else {
                # field is not linked to project
                echo $t_column_empty;
            }
        }
        echo $t_column_end;
    } else {
        $t_plugin_columns = columns_get_plugin_columns();
        if ($p_columns_target != COLUMNS_TARGET_CSV_PAGE) {
            $t_function = 'print_column_' . $p_column;
        } else {
            $t_function = 'csv_format_' . $p_column;
        }
        if (function_exists($t_function)) {
            if ($p_columns_target != COLUMNS_TARGET_CSV_PAGE) {
                $t_function($p_bug, $p_columns_target);
            } else {
                $t_function($p_bug);
            }
        } else {
            if (isset($t_plugin_columns[$p_column])) {
                $t_column_object = $t_plugin_columns[$p_column];
                print_column_plugin($t_column_object, $p_bug, $p_columns_target);
            } else {
                printf($t_column_start, $p_column);
                if (isset($p_bug->{$p_column})) {
                    echo string_display_line($p_bug->{$p_column}) . $t_column_end;
                } else {
                    echo '@' . $p_column . '@' . $t_column_end;
                }
            }
        }
    }
}
开发者ID:gtn,项目名称:mantisbt,代码行数:66,代码来源:custom_function_api.php

示例4: filter_get_query_sort_data

/**
 *  Add sort parameters to the query clauses
 * @param array $p_filter
 * @param bool $p_show_sticky
 * @param array $p_query_clauses
 * @return array $p_query_clauses
 */
function filter_get_query_sort_data(&$p_filter, $p_show_sticky, $p_query_clauses)
{
    $t_bug_table = db_get_table('bug');
    $t_custom_field_string_table = db_get_table('custom_field_string');
    # if sort is blank then default the sort and direction.  This is to fix the
    # symptoms of #3953.  Note that even if the main problem is fixed, we may
    # have to keep this code for a while to handle filters saved with this blank field.
    if (is_blank($p_filter[FILTER_PROPERTY_SORT_FIELD_NAME])) {
        $p_filter[FILTER_PROPERTY_SORT_FIELD_NAME] = 'last_updated';
        $p_filter[FILTER_PROPERTY_SORT_DIRECTION] = 'DESC';
    }
    $p_query_clauses['order'] = array();
    $t_sort_fields = explode(',', $p_filter[FILTER_PROPERTY_SORT_FIELD_NAME]);
    $t_dir_fields = explode(',', $p_filter[FILTER_PROPERTY_SORT_DIRECTION]);
    $t_plugin_columns = columns_get_plugin_columns();
    if (gpc_string_to_bool($p_filter[FILTER_PROPERTY_STICKY]) && NULL !== $p_show_sticky) {
        $p_query_clauses['order'][] = "{$t_bug_table}.sticky DESC";
    }
    $t_count = count($t_sort_fields);
    for ($i = 0; $i < $t_count; $i++) {
        $c_sort = db_prepare_string($t_sort_fields[$i]);
        $c_dir = 'DESC' == $t_dir_fields[$i] ? 'DESC' : 'ASC';
        if (!in_array($t_sort_fields[$i], array_slice($t_sort_fields, $i + 1))) {
            # if sorting by a custom field
            if (strpos($c_sort, 'custom_') === 0) {
                $t_custom_field = utf8_substr($c_sort, utf8_strlen('custom_'));
                $t_custom_field_id = custom_field_get_id_from_name($t_custom_field);
                $t_def = custom_field_get_definition($t_custom_field_id);
                $t_value_field = $t_def['type'] == CUSTOM_FIELD_TYPE_TEXTAREA ? 'text' : 'value';
                $c_cf_alias = 'custom_field_' . $t_custom_field_id;
                $t_cf_table_alias = $t_custom_field_string_table . '_' . $t_custom_field_id;
                $t_cf_select = "{$t_cf_table_alias}.{$t_value_field} {$c_cf_alias}";
                # check to be sure this field wasn't already added to the query.
                if (!in_array($t_cf_select, $p_query_clauses['select'])) {
                    $p_query_clauses['select'][] = $t_cf_select;
                    $p_query_clauses['join'][] = "LEFT JOIN {$t_custom_field_string_table} {$t_cf_table_alias} ON {$t_bug_table}.id = {$t_cf_table_alias}.bug_id AND {$t_cf_table_alias}.field_id = {$t_custom_field_id}";
                }
                $p_query_clauses['order'][] = "{$c_cf_alias} {$c_dir}";
                # if sorting by plugin columns
            } else {
                if (isset($t_plugin_columns[$t_sort_fields[$i]])) {
                    $t_column_object = $t_plugin_columns[$t_sort_fields[$i]];
                    if ($t_column_object->sortable) {
                        $t_clauses = $t_column_object->sortquery($c_dir);
                        if (is_array($t_clauses)) {
                            if (isset($t_clauses['join'])) {
                                $p_query_clauses['join'][] = $t_clauses['join'];
                            }
                            if (isset($t_clauses['order'])) {
                                $p_query_clauses['order'][] = $t_clauses['order'];
                            }
                        }
                    }
                    # standard column
                } else {
                    if ('last_updated' == $c_sort) {
                        $c_sort = "last_updated";
                    }
                    $p_query_clauses['order'][] = "{$t_bug_table}.{$c_sort} {$c_dir}";
                }
            }
        }
    }
    # add basic sorting if necessary
    if (!in_array('last_updated', $t_sort_fields)) {
        $p_query_clauses['order'][] = "{$t_bug_table}.last_updated DESC";
    }
    if (!in_array('date_submitted', $t_sort_fields)) {
        $p_query_clauses['order'][] = "{$t_bug_table}.date_submitted DESC";
    }
    return $p_query_clauses;
}
开发者ID:nextgens,项目名称:mantisbt,代码行数:79,代码来源:filter_api.php

示例5: excel_format_plugin_column_value

/**
 * Gets the formatted value for the specified plugin column value.
 * @param $p_custom_field The plugin column name.
 * @param $p_bug The bug to print the column for (needed for the display function of the plugin column).
 * @returns The plugin column value.
 */
function excel_format_plugin_column_value($p_column, $p_bug)
{
    $t_plugin_columns = columns_get_plugin_columns();
    if (!isset($t_plugin_columns[$p_column])) {
        return excel_prepare_string('');
    } else {
        $t_column_object = $t_plugin_columns[$p_column];
        ob_start();
        $t_column_object->display($p_bug, COLUMNS_TARGET_EXCEL_PAGE);
        $t_value = ob_get_clean();
        return excel_prepare_string($t_value);
    }
}
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:19,代码来源:excel_api.php

示例6: custom_function_override_print_column_value

function custom_function_override_print_column_value($p_column, $p_bug, $p_columns_target = COLUMNS_TARGET_VIEW_PAGE)
{
    if (COLUMNS_TARGET_CSV_PAGE == $p_columns_target) {
        $t_column_start = '';
        $t_column_end = '';
        $t_column_empty = '';
    } else {
        $t_column_start = '<td class="center">';
        $t_column_end = '</td>';
        $t_column_empty = '&#160;';
    }
    $t_custom_field = column_get_custom_field_name($p_column);
    if ($t_custom_field !== null) {
        echo $t_column_start;
        $t_field_id = custom_field_get_id_from_name($t_custom_field);
        if ($t_field_id === false) {
            echo '@', $t_custom_field, '@';
        } else {
            $t_issue_id = $p_bug->id;
            $t_project_id = $p_bug->project_id;
            if (custom_field_is_linked($t_field_id, $t_project_id)) {
                $t_def = custom_field_get_definition($t_field_id);
                if (strpos($p_column, 'custom_Deadline') === 0 && $t_def['type'] == CUSTOM_FIELD_TYPE_DATE) {
                    $deadline_date = custom_field_get_value($t_field_id, $t_issue_id);
                    if ($p_issue_row['status'] < 80) {
                        $current_date = strtotime(date("Y-m-d"));
                        if ($current_date >= $deadline_date) {
                            echo '<b><font color="red">';
                            print_custom_field_value($t_def, $t_field_id, $t_issue_id);
                            echo '</font></b>';
                        } else {
                            print_custom_field_value($t_def, $t_field_id, $t_issue_id);
                        }
                    } elseif ($deadline_date) {
                        if (lang_get_current() == 'german') {
                            echo '<b>ERLEDIGT!</b>';
                        } else {
                            echo '<b>DONE!</b>';
                        }
                    }
                } else {
                    print_custom_field_value($t_def, $t_field_id, $t_issue_id);
                }
            } else {
                // field is not linked to project
                echo $t_column_empty;
            }
        }
        echo $t_column_end;
    } else {
        $t_plugin_columns = columns_get_plugin_columns();
        if ($p_columns_target != COLUMNS_TARGET_CSV_PAGE) {
            if ($p_column == 'summary') {
                $t_function = 'print_column_summary_BFE';
            } else {
                $t_function = 'print_column_' . $p_column;
            }
        } else {
            $t_function = 'csv_format_' . $p_column;
        }
        if (function_exists($t_function)) {
            if ($p_columns_target != COLUMNS_TARGET_CSV_PAGE) {
                $t_function($p_bug, $p_columns_target);
            } else {
                $t_function($p_bug);
            }
        } else {
            if (isset($t_plugin_columns[$p_column])) {
                $t_column_object = $t_plugin_columns[$p_column];
                print_column_plugin($t_column_object, $p_bug, $p_columns_target);
            } else {
                if (isset($p_bug->{$p_column})) {
                    echo $t_column_start . string_display_line($p_bug->{$p_column}) . $t_column_end;
                } else {
                    echo $t_column_start . '@' . $p_column . '@' . $t_column_end;
                }
            }
        }
    }
}
开发者ID:bfekomsthoeft,项目名称:TTS_Praxisprojekt1,代码行数:80,代码来源:custom_functions_inc.php


注:本文中的columns_get_plugin_columns函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。