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


PHP custom_field_get_id_from_name函数代码示例

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


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

示例1: mci_get_custom_field_id_from_objectref

/**
 * Get the custom field id given an object ref.  The id is set based on the following algorithm:
 * - id from objectref (if not zero).
 * - id corresponding to name in object ref.
 * - 0, if object ref doesn't contain an id or a name.
 *
 * @param ObjectRef  $p_object_ref   An associate array with "id" and "name" keys.
 */
function mci_get_custom_field_id_from_objectref($p_object_ref)
{
    if ((int) $p_object_ref['id'] != 0) {
        $t_id = (int) $p_object_ref['id'];
    } else {
        if (!is_blank($p_object_ref['name'])) {
            $t_id = custom_field_get_id_from_name($p_object_ref['name']);
        } else {
            $t_id = 0;
        }
    }
    return $t_id;
}
开发者ID:kaos,项目名称:mantisbt,代码行数:21,代码来源:mc_custom_field_api.php

示例2: mci_get_custom_field_id_from_objectref

/**
 * Get the custom field id given an object ref.  The id is set based on the following algorithm:
 * - id from objectref (if not zero).
 * - id corresponding to name in object ref.
 * - 0, if object ref doesn't contain an id or a name.
 *
 * @param stdClass $p_object_ref An associate array with "id" and "name" keys.
 * @return integer
 */
function mci_get_custom_field_id_from_objectref(stdClass $p_object_ref)
{
    $p_object_ref = SoapObjectsFactory::unwrapObject($p_object_ref);
    if (isset($p_object_ref['id']) && (int) $p_object_ref['id'] != 0) {
        $t_id = (int) $p_object_ref['id'];
    } else {
        if (!is_blank($p_object_ref['name'])) {
            $t_id = custom_field_get_id_from_name($p_object_ref['name']);
        } else {
            $t_id = 0;
        }
    }
    return $t_id;
}
开发者ID:gtn,项目名称:mantisbt,代码行数:23,代码来源:mc_custom_field_api.php

示例3: process


//.........这里部分代码省略.........
                                 $t_custom_fields[++$i] = new stdClass();
                             }
                             switch ($reader->localName) {
                                 default:
                                     $field = $reader->localName;
                                     $reader->read();
                                     $t_custom_fields[$i]->{$field} = $reader->value;
                             }
                         }
                     }
                     break;
                 case 'bugnotes':
                     // store bug notes
                     $i = -1;
                     $depth_bn = $reader->depth;
                     while ($reader->read() && ($reader->depth > $depth_bn || $reader->nodeType != XMLReader::END_ELEMENT)) {
                         if ($reader->nodeType == XMLReader::ELEMENT) {
                             if ($reader->localName == 'bugnote') {
                                 $t_bugnotes[++$i] = new stdClass();
                             }
                             switch ($reader->localName) {
                                 case 'reporter':
                                     $t_old_id = $reader->getAttribute('id');
                                     $reader->read();
                                     $t_bugnotes[$i]->reporter_id = $this->get_user_id($reader->value, $userId);
                                     break;
                                 case 'view_state':
                                     $t_old_id = $reader->getAttribute('id');
                                     $reader->read();
                                     $t_bugnotes[$i]->private = $reader->value == VS_PRIVATE ? true : false;
                                     break;
                                 default:
                                     $field = $reader->localName;
                                     $reader->read();
                                     $t_bugnotes[$i]->{$field} = $reader->value;
                             }
                         }
                     }
                     break;
                 case 'attachments':
                     // store attachments
                     $i = -1;
                     $depth_att = $reader->depth;
                     while ($reader->read() && ($reader->depth > $depth_att || $reader->nodeType != XMLReader::END_ELEMENT)) {
                         if ($reader->nodeType == XMLReader::ELEMENT) {
                             if ($reader->localName == 'attachment') {
                                 $t_attachments[++$i] = new stdClass();
                             }
                             switch ($reader->localName) {
                                 default:
                                     $field = $reader->localName;
                                     $reader->read();
                                     $t_attachments[$i]->{$field} = $reader->value;
                             }
                         }
                     }
                     break;
                 default:
                     $field = $reader->localName;
                     //echo "using default handler for field: $field\n";
                     $reader->read();
                     $this->newbug_->{$field} = $reader->value;
             }
         }
     }
     // now save the new bug
     $this->new_id_ = $this->newbug_->create();
     // add custom fields
     if ($this->new_id_ > 0 && is_array($t_custom_fields) && count($t_custom_fields) > 0) {
         foreach ($t_custom_fields as $t_custom_field) {
             $t_custom_field_id = custom_field_get_id_from_name($t_custom_field->name);
             if (custom_field_ensure_exists($t_custom_field_id) && custom_field_is_linked($t_custom_field_id, $t_project_id)) {
                 custom_field_set_value($t_custom_field->id, $this->new_id_, $t_custom_field->value);
             } else {
                 error_parameters($t_custom_field->name, $t_custom_field_id);
                 trigger_error(ERROR_CUSTOM_FIELD_NOT_LINKED_TO_PROJECT, ERROR);
             }
         }
     }
     // add bugnotes
     if ($this->new_id_ > 0 && is_array($t_bugnotes) && count($t_bugnotes) > 0) {
         foreach ($t_bugnotes as $t_bugnote) {
             bugnote_add($this->new_id_, $t_bugnote->note, $t_bugnote->time_tracking, $t_bugnote->private, $t_bugnote->note_type, $t_bugnote->note_attr, $t_bugnote->reporter_id, false, $t_bugnote->date_submitted, $t_bugnote->last_modified, true);
         }
     }
     // add attachments
     if ($this->new_id_ > 0 && is_array($t_attachments) && count($t_attachments) > 0) {
         foreach ($t_attachments as $t_attachment) {
             // Create a temporary file in the temporary files directory using sys_get_temp_dir()
             $temp_file_name = tempnam(sys_get_temp_dir(), 'MantisImport');
             file_put_contents($temp_file_name, base64_decode($t_attachment->content));
             $file_data = array('name' => $t_attachment->filename, 'type' => $t_attachment->file_type, 'tmp_name' => $temp_file_name, 'size' => filesize($temp_file_name), 'error' => UPLOAD_ERR_OK);
             // unfortunately we have no clue who has added the attachment (this could only be fetched from history -> feel free to implement this)
             // also I have no clue where description should come from...
             file_add($this->new_id_, $file_data, 'bug', $t_attachment->title, $p_desc = '', $p_user_id = null, $t_attachment->date_added, true);
             unlink($temp_file_name);
         }
     }
     //echo "\nnew bug: $this->new_id_\n";
 }
开发者ID:N0ctrnl,项目名称:mantisbt,代码行数:101,代码来源:Issue.php

示例4: custom_field_get_all_linked_fields

             $writer->writeAttribute('id', $t_value);
             $writer->text($t_element_data);
             $writer->endElement();
             break;
         default:
             $writer->writeElement($t_element, $t_value);
     }
 }
 # fetch and export custom fields
 $t_custom_fields = custom_field_get_all_linked_fields($t_row->id);
 if (is_array($t_custom_fields) && count($t_custom_fields) > 0) {
     $writer->startElement('custom_fields');
     foreach ($t_custom_fields as $custom_field_name => $t_custom_field) {
         $writer->startElement('custom_field');
         # id
         $writer->writeElement('id', custom_field_get_id_from_name($custom_field_name));
         # title
         $writer->writeElement('name', $custom_field_name);
         # filename
         $writer->writeElement('type', $t_custom_field['type']);
         # filesize
         $writer->writeElement('value', $t_custom_field['value']);
         # file_type
         $writer->writeElement('access_level_r', $t_custom_field['access_level_r']);
         $writer->endElement();
         # custom_field
     }
     $writer->endElement();
     # custom_fields
 }
 # fetch and export bugnotes
开发者ID:N0ctrnl,项目名称:mantisbt,代码行数:31,代码来源:export.php

示例5: 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

示例6: history_localize_item


//.........这里部分代码省略.........
            break;
        case 'os':
            $t_field_localized = lang_get('os');
            break;
        case 'os_build':
            $t_field_localized = lang_get('os_version');
            break;
        case 'build':
            $t_field_localized = lang_get('build');
            break;
        case 'platform':
            $t_field_localized = lang_get('platform');
            break;
        case 'summary':
            $t_field_localized = lang_get('summary');
            break;
        case 'duplicate_id':
            $t_field_localized = lang_get('duplicate_id');
            break;
        case 'sponsorship_total':
            $t_field_localized = lang_get('sponsorship_total');
            break;
        case 'due_date':
            if ($p_old_value !== '') {
                $p_old_value = date(config_get('normal_date_format'), (int) $p_old_value);
            }
            if ($p_new_value !== '') {
                $p_new_value = date(config_get('normal_date_format'), (int) $p_new_value);
            }
            $t_field_localized = lang_get('due_date');
            break;
        default:
            # assume it's a custom field name
            $t_field_id = custom_field_get_id_from_name($p_field_name);
            if (false !== $t_field_id) {
                $t_cf_type = custom_field_type($t_field_id);
                if ('' != $p_old_value) {
                    $p_old_value = string_custom_field_value_for_email($p_old_value, $t_cf_type);
                }
                $p_new_value = string_custom_field_value_for_email($p_new_value, $t_cf_type);
                $t_field_localized = lang_get_defaulted($p_field_name);
            }
    }
    if (NORMAL_TYPE != $p_type) {
        switch ($p_type) {
            case NEW_BUG:
                $t_note = lang_get('new_bug');
                break;
            case BUGNOTE_ADDED:
                $t_note = lang_get('bugnote_added') . ': ' . $p_old_value;
                break;
            case BUGNOTE_UPDATED:
                $t_note = lang_get('bugnote_edited') . ': ' . $p_old_value;
                $t_old_value = (int) $p_old_value;
                $t_new_value = (int) $p_new_value;
                if ($p_linkify && bug_revision_exists($t_new_value)) {
                    if (bugnote_exists($t_old_value)) {
                        $t_bug_revision_view_page_argument = 'bugnote_id=' . $t_old_value . '#r' . $t_new_value;
                    } else {
                        $t_bug_revision_view_page_argument = 'rev_id=' . $t_new_value;
                    }
                    $t_change = '<a href="bug_revision_view_page.php?' . $t_bug_revision_view_page_argument . '">' . lang_get('view_revisions') . '</a>';
                    $t_raw = false;
                }
                break;
            case BUGNOTE_DELETED:
开发者ID:gtn,项目名称:mantisbt,代码行数:67,代码来源:history_api.php

示例7: mci_filter_search_get_rows

/**
 * Get all issue rows matching the custom filter.
 *
 * @param integer               $p_user_id          The user id.
 * @param FilterSearchData      $p_filter_search    The custom filter.
 * @param integer               $p_page_number      Start with the given page number (zero-based).
 * @param integer               $p_per_page         Number of issues to display per page.
 * @return array of issue rows
 */
function mci_filter_search_get_rows($p_user_id, $p_filter_search, $p_page_number, $p_per_page)
{
    global $g_soap_api_to_filter_names;
    // object to array
    if (is_object($p_filter_search)) {
        $p_filter_search = get_object_vars($p_filter_search);
    }
    $t_project_id = array();
    if (isset($p_filter_search['project_id'])) {
        // check access right to all projects
        foreach ($p_filter_search['project_id'] as $t_id) {
            if (mci_has_readonly_access($p_user_id, $t_id)) {
                $t_project_id[] = $t_id;
            } else {
                error_log('User: ' . $p_user_id . ' has not access right to project: ' . $t_id . '.');
            }
        }
        // user has not access right to any project
        if (count($t_project_id) < 1) {
            return mci_soap_fault_access_denied($p_user_id);
        }
    } else {
        if (!mci_has_readonly_access($p_user_id, ALL_PROJECTS)) {
            return mci_soap_fault_access_denied($p_user_id);
        }
        $t_project_id = array(ALL_PROJECTS);
    }
    $t_filter = array('_view_type' => 'advanced');
    $t_filter['project_id'] = $t_project_id;
    // default fields
    foreach ($g_soap_api_to_filter_names as $t_soap_name => $t_filter_name) {
        if (isset($p_filter_search[$t_soap_name])) {
            $t_value = $p_filter_search[$t_soap_name];
            $t_filter[$t_filter_name] = $t_value;
        }
    }
    // custom fields
    if (isset($p_filter_search['custom_fields'])) {
        foreach ($p_filter_search['custom_fields'] as $t_custom_field) {
            // object to array
            if (is_object($t_custom_field)) {
                $t_custom_field = get_object_vars($t_custom_field);
            }
            $t_field = $t_custom_field['field'];
            if (is_object($t_field)) {
                $t_field = get_object_vars($t_field);
            }
            // if is set custom_field's id, use it primary
            if (isset($t_field['id'])) {
                $t_custom_field_id = $t_field['id'];
            } else {
                $t_custom_field_id = custom_field_get_id_from_name($t_field['name']);
            }
            $t_value = $t_custom_field['value'];
            $t_filter['custom_fields'][$t_custom_field_id] = $t_value;
        }
    }
    $t_filter = filter_ensure_valid_filter($t_filter);
    $t_result = array();
    $t_page_number = $p_page_number < 1 ? 1 : $p_page_number;
    $t_page_count = 0;
    $t_bug_count = 0;
    return filter_get_bug_rows($t_page_number, $p_per_page, $t_page_count, $t_bug_count, $t_filter);
}
开发者ID:elmarculino,项目名称:mantisbt,代码行数:73,代码来源:mc_filter_api.php

示例8: 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

示例9: removeCustomField

 function removeCustomField($p_field_name)
 {
     $t_field_id = custom_field_get_id_from_name($p_field_name);
     $t_projects = project_get_all_rows();
     foreach ($t_projects as $t_row) {
         custom_field_unlink($t_field_id, $t_row['id']);
     }
 }
开发者ID:CarlosPinedaT,项目名称:agileMantis,代码行数:8,代码来源:class_commonlib.php

示例10: custom_function_default_print_column_value

function custom_function_default_print_column_value($p_column, $p_issue_row, $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>';
        $t_column_end = '</td>';
        $t_column_empty = '&nbsp;';
    }
    if (strpos($p_column, 'custom_') === 0) {
        echo $t_column_start;
        $t_custom_field = substr($p_column, 7);
        $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_issue_row['id'];
            $t_project_id = $p_issue_row['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 {
        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_issue_row, $p_columns_target);
            } else {
                $t_function($p_issue_row[$p_column]);
            }
        } else {
            if (isset($p_issue_row[$p_column])) {
                echo $t_column_start . $p_issue_row[$p_column] . $t_column_end;
            } else {
                echo $t_column_start . '@' . $p_column . '@' . $t_column_end;
            }
        }
    }
}
开发者ID:centaurustech,项目名称:BenFund,代码行数:50,代码来源:custom_function_api.php

示例11: filter_ensure_valid_filter


//.........这里部分代码省略.........
        $p_filter_arr['tag_string'] = gpc_get_string('tag_string', '');
    }
    if (!isset($p_filter_arr['tag_select'])) {
        $p_filter_arr['tag_select'] = gpc_get_string('tag_select', '');
    }
    $t_custom_fields = custom_field_get_ids();
    # @@@ (thraxisp) This should really be the linked ids, but we don't know the project
    $f_custom_fields_data = array();
    if (is_array($t_custom_fields) && sizeof($t_custom_fields) > 0) {
        foreach ($t_custom_fields as $t_cfid) {
            if (is_array(gpc_get('custom_field_' . $t_cfid, null))) {
                $f_custom_fields_data[$t_cfid] = gpc_get_string_array('custom_field_' . $t_cfid, META_FILTER_ANY);
            } else {
                $f_custom_fields_data[$t_cfid] = gpc_get_string('custom_field_' . $t_cfid, META_FILTER_ANY);
                $f_custom_fields_data[$t_cfid] = array($f_custom_fields_data[$t_cfid]);
            }
        }
    }
    #validate sorting
    $t_fields = helper_get_columns_to_view();
    $t_n_fields = count($t_fields);
    for ($i = 0; $i < $t_n_fields; $i++) {
        if (isset($t_fields[$i]) && in_array($t_fields[$i], array('selection', 'edit', 'bugnotes_count', 'attachment'))) {
            unset($t_fields[$i]);
        }
    }
    $t_sort_fields = split(',', $p_filter_arr['sort']);
    $t_dir_fields = split(',', $p_filter_arr['dir']);
    for ($i = 0; $i < 2; $i++) {
        if (isset($t_sort_fields[$i])) {
            $t_drop = false;
            $t_sort = $t_sort_fields[$i];
            if (strpos($t_sort, 'custom_') === 0) {
                if (false === custom_field_get_id_from_name(substr($t_sort, strlen('custom_')))) {
                    $t_drop = true;
                }
            } else {
                if (!in_array($t_sort, $t_fields)) {
                    $t_drop = true;
                }
            }
            if (!in_array($t_dir_fields[$i], array("ASC", "DESC"))) {
                $t_drop = true;
            }
            if ($t_drop) {
                unset($t_sort_fields[$i]);
                unset($t_dir_fields[$i]);
            }
        }
    }
    if (count($t_sort_fields) > 0) {
        $p_filter_arr['sort'] = implode(',', $t_sort_fields);
        $p_filter_arr['dir'] = implode(',', $t_dir_fields);
    } else {
        $p_filter_arr['sort'] = "last_updated";
        $p_filter_arr['dir'] = "DESC";
    }
    # validate or filter junk from other fields
    $t_multi_select_list = array('show_category' => 'string', 'show_severity' => 'int', 'show_status' => 'int', 'reporter_id' => 'int', 'handler_id' => 'int', 'show_resolution' => 'int', 'show_priority' => 'int', 'show_build' => 'string', 'show_version' => 'string', 'hide_status' => 'int', 'fixed_in_version' => 'string', 'target_version' => 'string', 'user_monitor' => 'int', 'show_profile' => 'int');
    foreach ($t_multi_select_list as $t_multi_field_name => $t_multi_field_type) {
        if (!isset($p_filter_arr[$t_multi_field_name])) {
            if ('hide_status' == $t_multi_field_name) {
                $p_filter_arr[$t_multi_field_name] = array(config_get('hide_status_default'));
            } else {
                if ('custom_fields' == $t_multi_field_name) {
                    $p_filter_arr[$t_multi_field_name] = array($f_custom_fields_data);
开发者ID:amjadtbssm,项目名称:website,代码行数:67,代码来源:filter_api.php

示例12: 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

示例13: excel_format_custom_field

/**
 * Gets the formatted value for the specified issue id, project and custom field.
 * @param integer $p_issue_id     The issue id.
 * @param integer $p_project_id   The project id.
 * @param string  $p_custom_field The custom field name (without 'custom_' prefix).
 * @return string The custom field value.
 */
function excel_format_custom_field($p_issue_id, $p_project_id, $p_custom_field)
{
    $t_field_id = custom_field_get_id_from_name($p_custom_field);
    if ($t_field_id === false) {
        return excel_prepare_string('@' . $p_custom_field . '@');
    }
    if (custom_field_is_linked($t_field_id, $p_project_id)) {
        $t_def = custom_field_get_definition($t_field_id);
        if ($t_def['type'] == CUSTOM_FIELD_TYPE_NUMERIC) {
            return excel_prepare_number(string_custom_field_value($t_def, $t_field_id, $p_issue_id));
        }
        return excel_prepare_string(string_custom_field_value($t_def, $t_field_id, $p_issue_id));
    }
    # field is not linked to project
    return excel_prepare_string('');
}
开发者ID:spring,项目名称:spring-website,代码行数:23,代码来源:excel_api.php

示例14: history_localize_item


//.........这里部分代码省略.........
                $t_field_localized = lang_get('reporter');
            }
            if (0 == $p_old_value) {
                $p_old_value = '';
            } else {
                $p_old_value = user_get_name($p_old_value);
            }
            if (0 == $p_new_value) {
                $p_new_value = '';
            } else {
                $p_new_value = user_get_name($p_new_value);
            }
            break;
        case 'fixed_in_version':
            $t_field_localized = lang_get('fixed_in_version');
            break;
        case 'date_submitted':
            $t_field_localized = lang_get('date_submitted');
            break;
        case 'last_updated':
            $t_field_localized = lang_get('last_update');
            break;
        case 'summary':
            $t_field_localized = lang_get('summary');
            break;
        case 'duplicate_id':
            $t_field_localized = lang_get('duplicate_id');
            break;
        case 'sponsorship_total':
            $t_field_localized = lang_get('sponsorship_total');
            break;
        default:
            # assume it's a custom field name
            $t_field_id = custom_field_get_id_from_name($p_field_name);
            if (false !== $t_field_id) {
                $t_cf_type = custom_field_type($t_field_id);
                if ('' != $p_old_value) {
                    $p_old_value = string_custom_field_value_for_email($p_old_value, $t_cf_type);
                }
                $p_new_value = string_custom_field_value_for_email($p_new_value, $t_cf_type);
            }
    }
    if (NORMAL_TYPE != $p_type) {
        switch ($p_type) {
            case NEW_BUG:
                $t_note = lang_get('new_bug');
                break;
            case BUGNOTE_ADDED:
                $t_note = lang_get('bugnote_added') . ": " . $p_old_value;
                break;
            case BUGNOTE_UPDATED:
                $t_note = lang_get('bugnote_edited') . ": " . $p_old_value;
                break;
            case BUGNOTE_DELETED:
                $t_note = lang_get('bugnote_deleted') . ": " . $p_old_value;
                break;
            case DESCRIPTION_UPDATED:
                $t_note = lang_get('description_updated');
                break;
            case ADDITIONAL_INFO_UPDATED:
                $t_note = lang_get('additional_information_updated');
                break;
            case STEP_TO_REPRODUCE_UPDATED:
                $t_note = lang_get('steps_to_reproduce_updated');
                break;
            case FILE_ADDED:
开发者ID:centaurustech,项目名称:BenFund,代码行数:67,代码来源:history_api.php

示例15: 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


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