本文整理汇总了PHP中bugnote_get_all_visible_bugnotes函数的典型用法代码示例。如果您正苦于以下问题:PHP bugnote_get_all_visible_bugnotes函数的具体用法?PHP bugnote_get_all_visible_bugnotes怎么用?PHP bugnote_get_all_visible_bugnotes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bugnote_get_all_visible_bugnotes函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get($request)
{
/*
* Returns a Response with a representation of the note list.
*
* @param $request - The Request we're responding to
*/
$this->bug_id = BugnoteList::get_bug_id_from_url($request->url);
# Access checking and note gathering is based on Mantis's
# email_build_visible_bug_data().
$project_id = bug_get_field($this->bug_id, 'project_id');
$user_id = auth_get_current_user_id();
$access_level = user_get_access_level($user_id, $project_id);
if (!access_has_bug_level(VIEWER, $this->bug_id)) {
throw new HTTPException(403, "Access denied");
}
$visible_notes = bugnote_get_all_visible_bugnotes($this->bug_id, $access_level, 'ASC', 0);
$visible_note_ids = array();
foreach ($visible_notes as $n) {
$visible_note_ids[] = (int) $n->id;
}
# Apply conditions and sorts
$sql_to_add = $this->_build_sql_from_querystring($request->query);
$note_ids = array();
if ($sql_to_add) {
$mantis_bugnote_table = config_get('mantis_bugnote_table');
$query = "SELECT n.id FROM {$mantis_bugnote_table} n {$sql_to_add};";
$result = db_query($query);
foreach ($result as $r) {
if (in_array((int) $r[0], $visible_note_ids)) {
$note_ids[] = (int) $r[0];
}
}
} else {
$note_ids = $visible_note_ids;
}
$this->rsrc_data = array();
$this->rsrc_data['results'] = array();
foreach ($note_ids as $n) {
$config = get_config();
$this->rsrc_data['results'][] = Bugnote::get_url_from_mantis_id($n);
}
$resp = new Response();
$resp->status = 200;
$resp->body = $this->_repr($request);
return $resp;
}
示例2: require_api
require_api('lang_api.php');
require_api('prepare_api.php');
require_api('print_api.php');
require_api('string_api.php');
require_api('user_api.php');
# grab the user id currently logged in
$t_user_id = auth_get_current_user_id();
#precache access levels
if (isset($g_project_override)) {
access_cache_matrix_project($g_project_override);
} else {
access_cache_matrix_project(helper_get_current_project());
}
# get the bugnote data
$t_bugnote_order = current_user_get_pref('bugnote_order');
$t_bugnotes = bugnote_get_all_visible_bugnotes($f_bug_id, $t_bugnote_order, 0, $t_user_id);
#precache users
$t_bugnote_users = array();
foreach ($t_bugnotes as $t_bugnote) {
$t_bugnote_users[] = $t_bugnote->reporter_id;
}
user_cache_array_rows($t_bugnote_users);
$num_notes = count($t_bugnotes);
?>
<?php
# Bugnotes BEGIN
?>
<a id="bugnotes"></a><br />
<?php
示例3: mc_issue_update
//.........这里部分代码省略.........
if (isset($p_issue['view_state'])) {
$t_bug_data->view_state = mci_get_view_state_id($p_issue['view_state']);
}
if (isset($p_issue['date_submitted'])) {
$t_bug_data->date_submitted = $p_issue['date_submitted'];
}
if (isset($p_issue['date_updated'])) {
$t_bug_data->last_updated = $p_issue['last_updated'];
}
if (isset($p_issue['profile_id'])) {
$t_bug_data->profile_id = $p_issue['profile_id'];
}
if (isset($p_issue['os'])) {
$t_bug_data->os = $p_issue['os'];
}
if (isset($p_issue['os_build'])) {
$t_bug_data->os_build = $p_issue['os_build'];
}
if (isset($p_issue['build'])) {
$t_bug_data->build = $p_issue['build'];
}
if (isset($p_issue['platform'])) {
$t_bug_data->platform = $p_issue['platform'];
}
if (isset($p_issue['version'])) {
$t_bug_data->version = $p_issue['version'];
}
if (isset($p_issue['fixed_in_version'])) {
$t_bug_data->fixed_in_version = $p_issue['fixed_in_version'];
}
if (isset($p_issue['sticky']) && access_has_bug_level(config_get('set_bug_sticky_threshold'), $t_bug_data->id)) {
$t_bug_data->sticky = $p_issue['sticky'];
}
if (isset($p_issue['due_date']) && access_has_global_level(config_get('due_date_update_threshold'))) {
$t_bug_data->due_date = SoapObjectsFactory::parseDateTimeString($p_issue['due_date']);
} else {
$t_bug_data->due_date = date_get_null();
}
if (access_has_project_level(config_get('roadmap_update_threshold'), $t_bug_data->project_id, $t_user_id)) {
$t_bug_data->target_version = isset($p_issue['target_version']) ? $p_issue['target_version'] : '';
}
$t_set_custom_field_error = mci_issue_set_custom_fields($p_issue_id, $p_issue['custom_fields'], true);
if ($t_set_custom_field_error != null) {
return $t_set_custom_field_error;
}
if (isset($p_issue['monitors'])) {
mci_issue_set_monitors($p_issue_id, $t_user_id, $p_issue['monitors']);
}
if (isset($p_issue['notes']) && is_array($p_issue['notes'])) {
$t_bugnotes = bugnote_get_all_visible_bugnotes($p_issue_id, 'DESC', 0);
$t_bugnotes_by_id = array();
foreach ($t_bugnotes as $t_bugnote) {
$t_bugnotes_by_id[$t_bugnote->id] = $t_bugnote;
}
foreach ($p_issue['notes'] as $t_note) {
$t_note = SoapObjectsFactory::unwrapObject($t_note);
if (isset($t_note['view_state'])) {
$t_view_state = $t_note['view_state'];
} else {
$t_view_state = config_get('default_bugnote_view_status');
}
if (isset($t_note['id']) && (int) $t_note['id'] > 0) {
$t_bugnote_id = (int) $t_note['id'];
$t_view_state_id = mci_get_enum_id_from_objectref('view_state', $t_view_state);
if (array_key_exists($t_bugnote_id, $t_bugnotes_by_id)) {
$t_bugnote_changed = false;
if ($t_bugnote->note !== $t_note['text']) {
bugnote_set_text($t_bugnote_id, $t_note['text']);
$t_bugnote_changed = true;
}
if ($t_bugnote->view_state != $t_view_state_id) {
bugnote_set_view_state($t_bugnote_id, $t_view_state_id == VS_PRIVATE);
$t_bugnote_changed = true;
}
if (isset($t_note['time_tracking']) && $t_note['time_tracking'] != $t_bugnote->time_tracking) {
bugnote_set_time_tracking($t_bugnote_id, mci_get_time_tracking_from_note($p_issue_id, $t_note));
$t_bugnote_changed = true;
}
if ($t_bugnote_changed) {
bugnote_date_update($t_bugnote_id);
}
}
} else {
$t_view_state_id = mci_get_enum_id_from_objectref('view_state', $t_view_state);
$t_note_type = isset($t_note['note_type']) ? (int) $t_note['note_type'] : BUGNOTE;
$t_note_attr = isset($t_note['note_type']) ? $t_note['note_attr'] : '';
bugnote_add($p_issue_id, $t_note['text'], mci_get_time_tracking_from_note($p_issue_id, $t_note), $t_view_state_id == VS_PRIVATE, $t_note_type, $t_note_attr, $t_user_id, false);
}
}
# The issue has been cached earlier in the bug_get() call. Flush the cache since it is
# now stale. Otherwise, the email notification will be based on the cached data.
bugnote_clear_cache($p_issue_id);
}
if (isset($p_issue['tags']) && is_array($p_issue['tags'])) {
mci_tag_set_for_issue($p_issue_id, $p_issue['tags'], $t_user_id);
}
# submit the issue
log_event(LOG_WEBSERVICE, 'updating issue \'' . $p_issue_id . '\'');
return $t_bug_data->update(true, true);
}
示例4: mci_issue_get_notes
/**
* Get all visible notes for a specific issue
*
* @param integer $p_issue_id The id of the issue to retrieve the notes for
* @return Array that represents an IssueNoteData structure
*/
function mci_issue_get_notes( $p_issue_id ) {
$t_user_id = auth_get_current_user_id();
$t_lang = mci_get_user_lang( $t_user_id );
$t_project_id = bug_get_field( $p_issue_id, 'project_id' );
$t_user_bugnote_order = 'ASC'; // always get the notes in ascending order for consistency to the calling application.
$t_has_time_tracking_access = access_has_bug_level( config_get( 'time_tracking_view_threshold' ), $p_issue_id );
$t_result = array();
foreach( bugnote_get_all_visible_bugnotes( $p_issue_id, $t_user_bugnote_order, 0 ) as $t_value ) {
$t_bugnote = array();
$t_bugnote['id'] = $t_value->id;
$t_bugnote['reporter'] = mci_account_get_array_by_id( $t_value->reporter_id );
$t_bugnote['date_submitted'] = timestamp_to_iso8601( $t_value->date_submitted );
$t_bugnote['last_modified'] = timestamp_to_iso8601( $t_value->last_modified );
$t_bugnote['text'] = $t_value->note;
$t_bugnote['view_state'] = mci_enum_get_array_by_id( $t_value->view_state, 'view_state', $t_lang );
$t_bugnote['time_tracking'] = $t_has_time_tracking_access ? $t_value->time_tracking : 0;
$t_bugnote['note_type'] = $t_value->note_type;
$t_bugnote['note_attr'] = $t_value->note_attr;
$t_result[] = $t_bugnote;
}
return (count( $t_result ) == 0 ? null : $t_result );
}
示例5: bugnote_get_all_visible_as_string
/**
* Build a string that captures all the notes visible to the logged in user along with their
* metadata. The string will contain information about each note including reporter, timestamp,
* time tracking, view state. This will result in multi-line string with "\n" as the line
* separator.
*
* @param integer $p_bug_id A bug identifier.
* @param integer $p_user_bugnote_order Sort order.
* @param integer $p_user_bugnote_limit Number of bugnotes to display to user.
* @param integer $p_user_id An user identifier.
* @return string The string containing all visible notes.
* @access public
*/
function bugnote_get_all_visible_as_string($p_bug_id, $p_user_bugnote_order, $p_user_bugnote_limit, $p_user_id = null)
{
$t_notes = bugnote_get_all_visible_bugnotes($p_bug_id, $p_user_bugnote_order, $p_user_bugnote_limit, $p_user_id);
$t_date_format = config_get('normal_date_format');
$t_show_time_tracking = access_has_bug_level(config_get('time_tracking_view_threshold'), $p_bug_id);
$t_output = '';
foreach ($t_notes as $t_note) {
$t_note_string = '@' . user_get_name($t_note->reporter_id);
if ($t_note->view_state != VS_PUBLIC) {
$t_note_string .= ' (' . lang_get('private') . ')';
}
$t_note_string .= ' ' . date($t_date_format, $t_note->date_submitted);
if ($t_show_time_tracking && $t_note->note_type == TIME_TRACKING) {
$t_time_tracking_hhmm = db_minutes_to_hhmm($t_note->time_tracking);
$t_note_string .= ' ' . lang_get('time_tracking_time_spent') . ' ' . $t_time_tracking_hhmm;
}
$t_note_string .= "\n" . $t_note->note . "\n";
if (!empty($t_output)) {
$t_output .= "---\n";
}
$t_output .= $t_note_string;
}
return $t_output;
}
示例6: number_format
$c_filesize = number_format($t_attachment['size']);
$c_date_added = date($t_date_format, $t_attachment['date_added']);
echo $c_filename . ' (' . $c_filesize . ' ' . lang_get('bytes') . ') <span class="italic-small">' . $c_date_added . '</span><br />' . string_display_links($t_path . $c_download_url);
if ($t_attachment['preview'] && $t_attachment['type'] == 'image' && $f_type_page == 'html') {
echo '<br /><img src="', $c_download_url, '" alt="', $t_attachment['alt'], '" /><br />';
}
}
?>
</td>
</tr>
<tr><td colspan="6" class="print"> </td></tr>
<?php
$t_user_bugnote_limit = 0;
$t_bugnotes = bugnote_get_all_visible_bugnotes($t_id, $t_user_bugnote_order, $t_user_bugnote_limit);
?>
<tr><td class="print" colspan="6">
<table class="width100" cellspacing="1">
<?php
# no bugnotes
if (0 == count($t_bugnotes)) {
?>
<tr>
<td class="print" colspan="2">
<?php
echo $t_lang_no_bugnotes_msg;
?>
</td>
</tr>
<?php
示例7: mci_issue_get_notes
/**
* Get all visible notes for a specific issue
*
* @param integer $p_issue_id The id of the issue to retrieve the notes for
* @return Array that represents an IssueNoteData structure
*/
function mci_issue_get_notes($p_issue_id)
{
$t_user_id = auth_get_current_user_id();
$t_lang = mci_get_user_lang($t_user_id);
$t_project_id = bug_get_field($p_issue_id, 'project_id');
$t_user_access_level = user_get_access_level($t_user_id, $t_project_id);
$t_user_bugnote_order = 'ASC';
// always get the notes in ascending order for consistency to the calling application.
$t_result = array();
foreach (bugnote_get_all_visible_bugnotes($p_issue_id, $t_user_access_level, $t_user_bugnote_order, 0) as $t_value) {
$t_bugnote = array();
$t_bugnote['id'] = $t_value->id;
$t_bugnote['reporter'] = mci_account_get_array_by_id($t_value->reporter_id);
$t_bugnote['date_submitted'] = timestamp_to_iso8601($t_value->date_submitted);
$t_bugnote['last_modified'] = timestamp_to_iso8601($t_value->last_modified);
$t_bugnote['text'] = $t_value->note;
$t_bugnote['view_state'] = mci_enum_get_array_by_id($t_value->view_state, 'view_state', $t_lang);
$t_result[] = $t_bugnote;
}
return $t_result;
}
示例8: mc_issue_update
//.........这里部分代码省略.........
$t_bug_data->resolution = mci_get_resolution_id($p_issue['resolution']);
}
if (isset($p_issue['projection'])) {
$t_bug_data->projection = mci_get_projection_id($p_issue['projection']);
}
if (isset($p_issue['eta'])) {
$t_bug_data->eta = mci_get_eta_id($p_issue['eta']);
}
if (isset($p_issue['view_state'])) {
$t_bug_data->view_state = mci_get_view_state_id($p_issue['view_state']);
}
if (isset($p_issue['date_submitted'])) {
$t_bug_data->date_submitted = $p_issue['date_submitted'];
}
if (isset($p_issue['date_updated'])) {
$t_bug_data->last_updated = $p_issue['last_updated'];
}
if (isset($p_issue['profile_id'])) {
$t_bug_data->profile_id = $p_issue['profile_id'];
}
if (isset($p_issue['os'])) {
$t_bug_data->os = $p_issue['os'];
}
if (isset($p_issue['os_build'])) {
$t_bug_data->os_build = $p_issue['os_build'];
}
if (isset($p_issue['build'])) {
$t_bug_data->build = $p_issue['build'];
}
if (isset($p_issue['platform'])) {
$t_bug_data->platform = $p_issue['platform'];
}
if (isset($p_issue['version'])) {
$t_bug_data->version = $p_issue['version'];
}
if (isset($p_issue['fixed_in_version'])) {
$t_bug_data->fixed_in_version = $p_issue['fixed_in_version'];
}
if (isset($p_issue['sticky']) && access_has_bug_level(config_get('set_bug_sticky_threshold'), $t_bug_data->id)) {
$t_bug_data->sticky = $p_issue['sticky'];
}
if (isset($p_issue['due_date']) && access_has_global_level(config_get('due_date_update_threshold'))) {
$t_bug_data->due_date = mci_iso8601_to_timestamp($p_issue['due_date']);
} else {
$t_bug_data->due_date = date_get_null();
}
if (access_has_project_level(config_get('roadmap_update_threshold'), $t_bug_data->project_id, $t_user_id)) {
$t_bug_data->target_version = isset($p_issue['target_version']) ? $p_issue['target_version'] : '';
}
mci_issue_set_custom_fields($p_issue_id, $p_issue['custom_fields'], true);
if (isset($p_issue['monitors'])) {
mci_issue_set_monitors($p_issue_id, $t_user_id, $p_issue['monitors']);
}
if (isset($p_issue['notes']) && is_array($p_issue['notes'])) {
$t_bugnotes = bugnote_get_all_visible_bugnotes($p_issue_id, 'DESC', 0);
$t_bugnotes_by_id = array();
foreach ($t_bugnotes as $t_bugnote) {
$t_bugnotes_by_id[$t_bugnote->id] = $t_bugnote;
}
foreach ($p_issue['notes'] as $t_note) {
if (isset($t_note['view_state'])) {
$t_view_state = $t_note['view_state'];
} else {
$t_view_state = config_get('default_bugnote_view_status');
}
if (isset($t_note['id']) && (int) $t_note['id'] > 0) {
$t_bugnote_id = (int) $t_note['id'];
$t_view_state_id = mci_get_enum_id_from_objectref('view_state', $t_view_state);
if (array_key_exists($t_bugnote_id, $t_bugnotes_by_id)) {
$t_bugnote_changed = false;
if ($t_bugnote->note !== $t_note['text']) {
bugnote_set_text($t_bugnote_id, $t_note['text']);
$t_bugnote_changed = true;
}
if ($t_bugnote->view_state !== $t_view_state_id) {
bugnote_set_view_state($t_bugnote_id, $t_view_state_id == VS_PRIVATE);
$t_bugnote_changed = true;
}
if (isset($t_note['time_tracking']) && $t_note['time_tracking'] !== $t_bugnote->time_tracking) {
bugnote_set_time_tracking($t_bugnote_id, mci_get_time_tracking_from_note($p_issue_id, $t_note));
$t_bugnote_changed = true;
}
if ($t_bugnote_changed) {
bugnote_date_update($t_bugnote_id);
}
}
} else {
$t_view_state_id = mci_get_enum_id_from_objectref('view_state', $t_view_state);
$note_type = isset($t_note['note_type']) ? (int) $t_note['note_type'] : BUGNOTE;
$note_attr = isset($t_note['note_type']) ? $t_note['note_attr'] : '';
bugnote_add($p_issue_id, $t_note['text'], mci_get_time_tracking_from_note($p_issue_id, $t_note), $t_view_state_id == VS_PRIVATE, $note_type, $note_attr, $t_user_id, FALSE);
}
}
}
if (isset($p_issue['tags']) && is_array($p_issue['tags'])) {
mci_tag_set_for_issue($p_issue_id, $p_issue['tags'], $t_user_id);
}
# submit the issue
return $t_bug_data->update(true, true);
}