Procedural File: tag_api.php
Source Location: /core/tag_api.php
Page Details
Tag API
| Author: | John Reese |
| Copyright: | Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org |
| Copyright: | Copyright (C) 2002 - 2009 MantisBT Team - mantisbt-dev@lists.sourceforge.net |
| Link: | http://www.mantisbt.org |
Functions
tag_bug_attach [line 548]
void tag_bug_attach(
integer $p_tag_id, integer $p_bug_id, [integer $p_user_id = null]
)
|
|
Attach a tag to a bug.
Parameters:
|
integer |
$p_tag_id: |
Tag ID |
|
integer |
$p_bug_id: |
Bug ID |
|
integer |
$p_user_id: |
User ID |
tag_bug_detach [line 599]
void tag_bug_detach(
integer $p_tag_id, integer $p_bug_id, [boolean $p_add_history = true], [integer $p_user_id = null]
)
|
|
Detach a tag from a bug.
Parameters:
|
integer |
$p_tag_id: |
Tag ID |
|
integer |
$p_bug_id: |
Bug ID |
|
boolean |
$p_add_history: |
Add history entries to bug |
|
integer |
$p_user_id: |
User Id (or null for current logged in user) |
tag_bug_detach_all [line 645]
void tag_bug_detach_all(
integer $p_bug_id, [boolean $p_add_history = true], [integer $p_user_id = null]
)
|
|
Detach all tags from a given bug.
Parameters:
|
integer |
$p_bug_id: |
Bug ID |
|
boolean |
$p_add_history: |
Add history entries to bug |
|
integer |
$p_user_id: |
User Id (or null for current logged in user) |
tag_bug_get_attached [line 498]
array tag_bug_get_attached(
Bug $p_bug_id
)
|
|
Return an array of tags attached to a given bug sorted by tag name.
Parameters:
API Tags:
| Return: | Array of tag rows with attachement information |
tag_bug_get_row [line 477]
array tag_bug_get_row(
integer $p_tag_id, integer $p_bug_id
)
|
|
Return the tag attachment row.
Parameters:
|
integer |
$p_tag_id: |
Tag ID |
|
integer |
$p_bug_id: |
Bug ID |
API Tags:
| Return: | Tag attachment row |
tag_bug_is_attached [line 459]
boolean tag_bug_is_attached(
integer $p_tag_id, integer $p_bug_id
)
|
|
Determine if a tag is attached to a bug.
Parameters:
|
integer |
$p_tag_id: |
Tag ID |
|
integer |
$p_bug_id: |
Bug ID |
API Tags:
| Return: | True if the tag is attached |
tag_cmp_name [line 129]
integer tag_cmp_name(
array $p_tag1, array $p_tag2
)
|
|
Compare two tag rows based on tag name.
Parameters:
|
array |
$p_tag1: |
Tag row 1 |
|
array |
$p_tag2: |
Tag row 2 |
API Tags:
| Return: | -1 when Tag 1 < Tag 2, 1 when Tag 1 > Tag 2, 0 otherwise |
tag_create [line 286]
integer tag_create(
string $p_name, [integer $p_user_id = null], [string $p_description = '']
)
|
|
Create a tag with the given name, creator, and description.
Defaults to the currently logged in user, and a blank description.
Parameters:
|
string |
$p_name: |
Tag name |
|
integer |
$p_user_id: |
User ID |
|
string |
$p_description: |
Description |
API Tags:
tag_delete [line 379]
void tag_delete(
integer $p_tag_id
)
|
|
Delete a tag with the given ID.
Parameters:
|
integer |
$p_tag_id: |
Tag ID |
tag_display_attached [line 689]
void tag_display_attached(
Bug $p_bug_id
)
|
|
Display a list of attached tag hyperlinks separated by the configured hyperlinks.
Parameters:
tag_display_link [line 660]
void tag_display_link(
array $p_tag_row, [integer $p_bug_id = 0]
)
|
|
Display a tag hyperlink.
If a bug ID is passed, the tag link will include a detach link if the user has appropriate privileges.
Parameters:
|
array |
$p_tag_row: |
Tag row |
|
integer |
$p_bug_id: |
Bug ID |
tag_ensure_exists [line 59]
void tag_ensure_exists(
integer $p_tag_id
)
|
|
Ensure a tag exists with the given ID.
Parameters:
|
integer |
$p_tag_id: |
Tag ID |
tag_ensure_name_is_valid [line 116]
void tag_ensure_name_is_valid(
string $p_name
)
|
|
Ensure a tag name is valid.
Parameters:
tag_ensure_unique [line 86]
void tag_ensure_unique(
string $p_name
)
|
|
Ensure that a name is unique.
Parameters:
tag_exists [line 45]
boolean tag_exists(
integer $p_tag_id
)
|
|
Determine if a tag exists with the given ID.
Parameters:
|
integer |
$p_tag_id: |
Tag ID |
API Tags:
| Return: | True if tag exists |
tag_get [line 221]
array tag_get(
integer $p_tag_id
)
|
|
Return a tag row for the given ID.
Parameters:
|
integer |
$p_tag_id: |
Tag ID |
API Tags:
tag_get_bugs_attached [line 525]
array tag_get_bugs_attached(
integer $p_tag_id
)
|
|
Return an array of bugs that a tag is attached to.
Parameters:
|
integer |
$p_tag_id: |
Tag ID |
API Tags:
| Return: | Array of bug ID's. |
tag_get_by_name [line 245]
Tag tag_get_by_name(
string $p_name
)
|
|
Return a tag row for the given name.
Parameters:
API Tags:
tag_get_candidates_for_bug [line 408]
The tag_get_candidates_for_bug(
int $p_bug_id
)
|
|
Gets the candidates for the specified bug. These are existing tags that are not associated with the bug already.
Parameters:
|
int |
$p_bug_id: |
The bug id, if 0 returns all tags. |
API Tags:
| Return: | array of tag rows, each with id, name, and description. |
tag_get_field [line 266]
mixed tag_get_field(
integer $p_tag_id, string $p_field_name
)
|
|
Return a single field from a tag row for the given ID.
Parameters:
|
integer |
$p_tag_id: |
Tag ID |
|
string |
$p_field_name: |
Field name |
API Tags:
tag_is_unique [line 72]
boolean tag_is_unique(
string $p_name
)
|
|
Determine if a given name is unique (not already used).
Uses a case-insensitive search of the database for existing tags with the same name.
Parameters:
API Tags:
| Return: | True if name is unique |
tag_name_is_valid [line 106]
boolean tag_name_is_valid(
string $p_name, array &$p_matches, [string $p_prefix = ""]
)
|
|
Determine if a given name is valid.
Name must not contain '+' and '-' characters (they are used for filters) and the configured tag separator. The matches parameter allows to also receive an array of regex matches, which by default only includes the valid tag name itself. The prefix parameter is optional, but allows you to prefix the regex check, which is useful for filters, etc.
Parameters:
|
string |
$p_name: |
Tag name |
|
array |
&$p_matches: |
Array reference for regex matches |
|
string |
$p_prefix: |
Prefix regex pattern |
API Tags:
| Return: | True if the name is valid |
tag_parse_filters [line 183]
array tag_parse_filters(
string $p_string
)
|
|
Parse a filter string to extract existing and new tags.
When given a string, parses for tag names separated by configured separator, then returns an array of tag rows for each tag. Existing tags get the full row of information returned. If the tag does not exist, a row is returned with id = -1 and the tag name, and if the name is invalid, a row is returned with id = -2 and the tag name. The resulting array is then sorted by tag name.
Parameters:
|
string |
$p_string: |
Filter string to parse |
API Tags:
| Return: | Rows of tags parsed from filter string |
tag_parse_string [line 143]
array tag_parse_string(
string $p_string
)
|
|
Parse a form input string to extract existing and new tags.
When given a string, parses for tag names separated by configured separator, then returns an array of tag rows for each tag. Existing tags get the full row of information returned. If the tag does not exist, a row is returned with id = -1 and the tag name, and if the name is invalid, a row is returned with id = -2 and the tag name. The resulting array is then sorted by tag name.
Parameters:
|
string |
$p_string: |
Input string to parse |
API Tags:
| Return: | Rows of tags parsed from input string |
tag_stats_attached [line 712]
integer tag_stats_attached(
integer $p_tag_id
)
|
|
Get the number of bugs a given tag is attached to.
Parameters:
|
integer |
$p_tag_id: |
Tag ID |
API Tags:
| Return: | Number of attached bugs |
tag_stats_related [line 732]
array tag_stats_related(
integer $p_tag_id, [integer $p_limit = 5]
)
|
|
Get a list of related tags.
Returns a list of tags that are the most related to the given tag, based on the number of times they have been attached to the same bugs. Defaults to a list of five tags.
Parameters:
|
integer |
$p_tag_id: |
Tag ID |
|
integer |
$p_limit: |
List size |
API Tags:
| Return: | Array of tag rows, with share count added |
tag_update [line 329]
void tag_update(
integer $p_tag_id, string $p_name, integer $p_user_id, string $p_description
)
|
|
Update a tag with given name, creator, and description.
Parameters:
|
integer |
$p_tag_id: |
Tag ID |
|
string |
$p_name: |
Tag name |
|
integer |
$p_user_id: |
User ID |
|
string |
$p_description: |
Description |
|
|