本文整理汇总了PHP中custom_field_get_value函数的典型用法代码示例。如果您正苦于以下问题:PHP custom_field_get_value函数的具体用法?PHP custom_field_get_value怎么用?PHP custom_field_get_value使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了custom_field_get_value函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_bug_id
function display_bug_id($p_event, $p_text)
{
$p_bug_id = (int) $p_text;
if (!bug_exists($p_bug_id)) {
return $p_text;
}
$bug = bug_get($p_bug_id);
$project = $bug->__get("project_id");
if ($project != plugin_config_get('project_id')) {
return $p_text;
}
$p_field_id = plugin_config_get('field_id');
$prefix = plugin_config_get('prefix');
$has_parent = false;
$t_bugs_ids = relationship_get_all_src($p_bug_id);
foreach ($t_bugs_ids as $t_relaship) {
if ($t_relaship->type == BUG_BLOCKS) {
$has_parent = true;
break;
}
}
$t_bugs_ids = relationship_get_all_dest($p_bug_id);
foreach ($t_bugs_ids as $t_relaship) {
if ($t_relaship->type == BUG_DEPENDANT) {
$has_parent = true;
break;
}
}
$prefix_two = plugin_config_get('prefix_two');
if ($has_parent) {
$prefix = $prefix_two;
}
$p_def = custom_field_get_definition($p_field_id);
$t_custom_field_value = custom_field_get_value($p_field_id, $p_bug_id);
global $g_custom_field_type_definition;
if (isset($g_custom_field_type_definition[$p_def['type']]['#function_string_value'])) {
return $prefix . call_user_func($g_custom_field_type_definition[$p_def['type']]['#function_string_value'], $t_custom_field_value);
}
return $prefix . $t_custom_field_value;
}
示例2: mci_issue_get_custom_fields
/**
* Get the custom field values associated with the specified issue id.
*
* @param integer $p_issue_id Issue id to get the custom field values for.
*
* @return null if no custom field defined for the project that contains the issue, or if no custom
* fields are accessible to the current user.
*/
function mci_issue_get_custom_fields($p_issue_id)
{
$t_project_id = bug_get_field($p_issue_id, 'project_id');
$t_custom_fields = array();
$t_related_custom_field_ids = custom_field_get_linked_ids($t_project_id);
foreach ($t_related_custom_field_ids as $t_id) {
$t_def = custom_field_get_definition($t_id);
if (custom_field_has_read_access($t_id, $p_issue_id)) {
# user has not access to read this custom field.
$t_value = custom_field_get_value($t_id, $p_issue_id);
if ($t_value === false) {
continue;
}
# return a blank string if the custom field value is undefined
if ($t_value === null) {
$t_value = '';
}
$t_custom_field_value = array();
$t_custom_field_value['field'] = array();
$t_custom_field_value['field']['id'] = $t_id;
$t_custom_field_value['field']['name'] = $t_def['name'];
$t_custom_field_value['value'] = $t_value;
$t_custom_fields[] = $t_custom_field_value;
}
}
return count($t_custom_fields) == 0 ? null : $t_custom_fields;
}
示例3: string_custom_field_value
/**
* Prepare a string containing a custom field value for display
* @param array $p_def Contains the definition of the custom field.
* @param integer $p_field_id Contains the id of the field.
* @param integer $p_bug_id Contains the bug id to display the custom field value for.
* @return string
* @access public
*/
function string_custom_field_value(array $p_def, $p_field_id, $p_bug_id)
{
$t_custom_field_value = custom_field_get_value($p_field_id, $p_bug_id);
if ($t_custom_field_value === null) {
return '';
}
global $g_custom_field_type_definition;
if (isset($g_custom_field_type_definition[$p_def['type']]['#function_string_value'])) {
return call_user_func($g_custom_field_type_definition[$p_def['type']]['#function_string_value'], $t_custom_field_value);
}
return string_display_links($t_custom_field_value);
}
示例4: error_parameters
# no value was given by the user.
error_parameters(lang_get_defaulted(custom_field_get_field($t_cf_id, 'name')));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
} else {
# The custom field isn't compulsory and the user did
# not supply a value. Therefore we can just ignore this
# custom field completely (ie. don't attempt to update
# the field).
continue;
}
}
if (!custom_field_has_write_access($t_cf_id, $f_bug_id)) {
trigger_error(ERROR_ACCESS_DENIED, ERROR);
}
$t_new_custom_field_value = gpc_get_custom_field("custom_field_{$t_cf_id}", $t_cf_def['type'], null);
$t_old_custom_field_value = custom_field_get_value($t_cf_id, $f_bug_id);
# Validate the value of the field against current validation rules.
# This may cause an error if validation rules have recently been
# modified such that old values that were once OK are now considered
# invalid.
if (!custom_field_validate($t_cf_id, $t_new_custom_field_value)) {
error_parameters(lang_get_defaulted(custom_field_get_field($t_cf_id, 'name')));
trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR);
}
# Remember the new custom field values so we can set them when updating
# the bug (done after all data passed to this update page has been
# validated).
$t_custom_fields_to_set[] = array('id' => $t_cf_id, 'value' => $t_new_custom_field_value);
}
# Perform validation of the duplicate ID of the bug.
if ($t_updated_bug->duplicate_id !== 0) {
示例5: 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 = ' ';
}
$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;
}
}
}
}
}
示例6: getSprintValue
function getSprintValue($p_bug_id)
{
return custom_field_get_value($this->spr, $p_bug_id);
}
示例7: string_custom_field_value
function string_custom_field_value($p_def, $p_field_id, $p_bug_id)
{
$t_custom_field_value = custom_field_get_value($p_field_id, $p_bug_id);
switch ($p_def['type']) {
case CUSTOM_FIELD_TYPE_EMAIL:
return "<a href=\"mailto:{$t_custom_field_value}\">{$t_custom_field_value}</a>";
break;
case CUSTOM_FIELD_TYPE_ENUM:
case CUSTOM_FIELD_TYPE_LIST:
case CUSTOM_FIELD_TYPE_MULTILIST:
case CUSTOM_FIELD_TYPE_CHECKBOX:
return str_replace('|', ', ', $t_custom_field_value);
break;
case CUSTOM_FIELD_TYPE_DATE:
if ($t_custom_field_value != null) {
return date(config_get('short_date_format'), $t_custom_field_value);
}
break;
default:
return string_display_links($t_custom_field_value);
}
}
示例8: getProductBacklogByBugId
function getProductBacklogByBugId($p_bug_id)
{
if (bug_exists($p_bug_id)) {
$this->getAdditionalProjectFields();
$t_value = custom_field_get_value($this->pb, $p_bug_id);
if (!empty($t_value)) {
$t_sql = "SELECT * FROM gadiv_productbacklogs WHERE name=" . db_param(0);
$t_result = $this->executeQuery($t_sql, array($t_value));
if (count($t_result) > 0) {
return $t_result[0];
}
}
}
return null;
}
示例9: kanban_ajax_request_bug_update_status
/**
* updates the status field
* @return bool
* @access public
* @see bug_update.php
*/
function kanban_ajax_request_bug_update_status()
{
$p_bug_id = gpc_get_int('id');
$p_new_status = gpc_get_int('new_status');
$t_project_id = gpc_get_int('project_id');
$c_bug_id = (int) $p_bug_id;
$f_new_status = (int) $p_new_status;
$t_bug_data = bug_get($c_bug_id, true);
$f_update_mode = gpc_get_bool('update_mode', FALSE);
# set if called from generic update page
if (!(access_has_bug_level(access_get_status_threshold($f_new_status, $t_project_id), $c_bug_id) || access_has_bug_level(config_get('update_bug_threshold'), $c_bug_id) || bug_get_field($c_bug_id, 'reporter_id') == auth_get_current_user_id() && (ON == config_get('allow_reporter_reopen') || ON == config_get('allow_reporter_close')))) {
access_denied();
}
# extract current extended information
$t_old_bug_status = $t_bug_data->status;
log_event(LOG_AJAX, "Old bug status {$t_old_bug_status} - trying update to new status {$f_new_status}...");
$t_bug_data->reporter_id = gpc_get_int('reporter_id', $t_bug_data->reporter_id);
$t_bug_data->handler_id = gpc_get_int('handler_id', $t_bug_data->handler_id);
$t_bug_data->duplicate_id = gpc_get_int('duplicate_id', $t_bug_data->duplicate_id);
$t_bug_data->priority = gpc_get_int('priority', $t_bug_data->priority);
$t_bug_data->severity = gpc_get_int('severity', $t_bug_data->severity);
$t_bug_data->reproducibility = gpc_get_int('reproducibility', $t_bug_data->reproducibility);
$t_bug_data->status = gpc_get_int('new_status', $t_bug_data->status);
$t_bug_data->resolution = gpc_get_int('resolution', $t_bug_data->resolution);
$t_bug_data->projection = gpc_get_int('projection', $t_bug_data->projection);
$t_bug_data->category_id = gpc_get_int('category_id', $t_bug_data->category_id);
$t_bug_data->eta = gpc_get_int('eta', $t_bug_data->eta);
$t_bug_data->os = gpc_get_string('os', $t_bug_data->os);
$t_bug_data->os_build = gpc_get_string('os_build', $t_bug_data->os_build);
$t_bug_data->platform = gpc_get_string('platform', $t_bug_data->platform);
$t_bug_data->version = gpc_get_string('version', $t_bug_data->version);
$t_bug_data->build = gpc_get_string('build', $t_bug_data->build);
$t_bug_data->fixed_in_version = gpc_get_string('fixed_in_version', $t_bug_data->fixed_in_version);
$t_bug_data->view_state = gpc_get_int('view_state', $t_bug_data->view_state);
$t_bug_data->summary = gpc_get_string('summary', $t_bug_data->summary);
$t_due_date = gpc_get_string('due_date', null);
if (access_has_project_level(config_get('roadmap_update_threshold'), $t_bug_data->project_id)) {
$t_bug_data->target_version = gpc_get_string('target_version', $t_bug_data->target_version);
}
if ($t_due_date !== null) {
if (is_blank($t_due_date)) {
$t_bug_data->due_date = 1;
} else {
$t_bug_data->due_date = strtotime($t_due_date);
}
}
$t_bug_data->description = gpc_get_string('description', $t_bug_data->description);
$t_bug_data->steps_to_reproduce = gpc_get_string('steps_to_reproduce', $t_bug_data->steps_to_reproduce);
$t_bug_data->additional_information = gpc_get_string('additional_information', $t_bug_data->additional_information);
$f_private = gpc_get_bool('private');
$f_bugnote_text = gpc_get_string('bugnote_text', '');
$f_time_tracking = gpc_get_string('time_tracking', '0:00');
$f_close_now = gpc_get_string('close_now', false);
# Handle auto-assigning
if (config_get('bug_submit_status') == $t_bug_data->status && $t_bug_data->status == $t_old_bug_status && 0 != $t_bug_data->handler_id && ON == config_get('auto_set_status_to_assigned')) {
$t_bug_data->status = config_get('bug_assigned_status');
}
helper_call_custom_function('issue_update_validate', array($c_bug_id, $t_bug_data, $f_bugnote_text));
$t_resolved = config_get('bug_resolved_status_threshold');
$t_closed = config_get('bug_closed_status_threshold');
$t_custom_status_label = "update";
# default info to check
if ($t_bug_data->status == $t_resolved) {
$t_custom_status_label = "resolved";
}
if ($t_bug_data->status == $t_closed) {
$t_custom_status_label = "closed";
}
$t_related_custom_field_ids = custom_field_get_linked_ids($t_bug_data->project_id);
foreach ($t_related_custom_field_ids as $t_id) {
$t_def = custom_field_get_definition($t_id);
# Only update the field if it would have been display for editing
if (!(!$f_update_mode && $t_def['require_' . $t_custom_status_label] || !$f_update_mode && $t_def['display_' . $t_custom_status_label] && in_array($t_custom_status_label, array("resolved", "closed")) || $f_update_mode && $t_def['display_update'] || $f_update_mode && $t_def['require_update'])) {
continue;
}
# Do not set custom field value if user has no write access.
if (!custom_field_has_write_access($t_id, $c_bug_id)) {
continue;
}
if ($t_def['require_' . $t_custom_status_label] && !gpc_isset_custom_field($t_id, $t_def['type'])) {
error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
# Only update the field if it is posted,
# or if it is empty, and the current value isn't the default
if (!gpc_isset_custom_field($t_id, $t_def['type']) && custom_field_get_value($t_id, $c_bug_id) == $t_def['default_value']) {
continue;
}
if (!custom_field_set_value($t_id, $c_bug_id, gpc_get_custom_field("custom_field_{$t_id}", $t_def['type'], NULL))) {
error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
log_event(LOG_AJAX, "Error setting new status: " . ERROR_CUSTOM_FIELD_INVALID_VALUE . "\nBugdata: " . print_r($t_bug_data, true) . " Line: " . __LINE__);
trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR);
}
}
//.........这里部分代码省略.........
示例10: format_value
function format_value($bug, $field_name)
{
$values = array('id' => function ($bug) {
return sprintf('%s <%s>', $bug->id, string_get_bug_view_url_with_fqdn($bug->id));
}, 'project_id' => function ($bug) {
return project_get_name($bug->project_id);
}, 'reporter_id' => function ($bug) {
return '@' . user_get_name($bug->reporter_id);
}, 'handler_id' => function ($bug) {
return empty($bug->handler_id) ? plugin_lang_get('no_user') : '@' . user_get_name($bug->handler_id);
}, 'duplicate_id' => function ($bug) {
return sprintf('%s <%s>', $bug->duplicate_id, string_get_bug_view_url_with_fqdn($bug->duplicate_id));
}, 'priority' => function ($bug) {
return get_enum_element('priority', $bug->priority);
}, 'severity' => function ($bug) {
return get_enum_element('severity', $bug->severity);
}, 'reproducibility' => function ($bug) {
return get_enum_element('reproducibility', $bug->reproducibility);
}, 'status' => function ($bug) {
return get_enum_element('status', $bug->status);
}, 'resolution' => function ($bug) {
return get_enum_element('resolution', $bug->resolution);
}, 'projection' => function ($bug) {
return get_enum_element('projection', $bug->projection);
}, 'category_id' => function ($bug) {
return category_full_name($bug->category_id, false);
}, 'eta' => function ($bug) {
return get_enum_element('eta', $bug->eta);
}, 'view_state' => function ($bug) {
return $bug->view_state == VS_PRIVATE ? lang_get('private') : lang_get('public');
}, 'sponsorship_total' => function ($bug) {
return sponsorship_format_amount($bug->sponsorship_total);
}, 'os' => function ($bug) {
return $bug->os;
}, 'os_build' => function ($bug) {
return $bug->os_build;
}, 'platform' => function ($bug) {
return $bug->platform;
}, 'version' => function ($bug) {
return $bug->version;
}, 'fixed_in_version' => function ($bug) {
return $bug->fixed_in_version;
}, 'target_version' => function ($bug) {
return $bug->target_version;
}, 'build' => function ($bug) {
return $bug->build;
}, 'summary' => function ($bug) {
return HipChatPlugin::clean_summary(bug_format_summary($bug->id, SUMMARY_FIELD));
}, 'last_updated' => function ($bug) {
return date(config_get('short_date_format'), $bug->last_updated);
}, 'date_submitted' => function ($bug) {
return date(config_get('short_date_format'), $bug->date_submitted);
}, 'due_date' => function ($bug) {
return date(config_get('short_date_format'), $bug->due_date);
}, 'description' => function ($bug) {
return string_display_links($bug->description);
}, 'steps_to_reproduce' => function ($bug) {
return string_display_links($bug->steps_to_reproduce);
}, 'additional_information' => function ($bug) {
return string_display_links($bug->additional_information);
});
// Discover custom fields.
$t_related_custom_field_ids = custom_field_get_linked_ids($bug->project_id);
foreach ($t_related_custom_field_ids as $t_id) {
$t_def = custom_field_get_definition($t_id);
$values['custom_' . $t_def['name']] = function ($bug) use($t_id) {
return custom_field_get_value($t_id, $bug->id);
};
}
if (isset($values[$field_name])) {
$func = $values[$field_name];
return $func($bug);
} else {
return sprintf(plugin_lang_get('unknown_field'), $field_name);
}
}
示例11: gantt_get_start_date
function gantt_get_start_date($p_bug_id)
{
$t_assignment_date = gantt_get_assigned_date($p_bug_id);
$t_creation_date = bug_get_field($p_bug_id, 'date_submitted');
if (plugin_config_get('use_start_date_field') && plugin_config_get('custom_field_id_for_start_date') > 0) {
$t_custom_start_date = custom_field_get_value(plugin_config_get('custom_field_id_for_start_date'), $p_bug_id);
if (!is_blank($t_custom_start_date)) {
//Start date has been set for the issue: we can use its value.
//We don't care if the Start Date is greater than the creation date or not!
$t_start_date = $t_custom_start_date;
} else {
//Start date has not been filled yet. Use the assignement date instead.
if (null == $t_assignment_date) {
$t_start_date = $t_creation_date;
} else {
$t_start_date = $t_assignment_date;
}
}
} else {
//use only the assignment date
if (null == $t_assignment_date) {
$t_start_date = $t_creation_date;
} else {
$t_start_date = $t_assignment_date;
}
}
return gantt_adjust_working_day($t_start_date);
}