CoreAPI
[ class tree: CoreAPI ] [ index: CoreAPI ] [ all elements ]

Procedural File: tag_api.php

Source Location: /core/tag_api.php



Page Details:

Tag API



Tags:

author:  John Reese
copyright:  Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
copyright:  Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
link:  http://www.mantisbt.org


Includes:

require_once('history_api.php') [line 36]
requires history api

require_once('bug_api.php') [line 31]
requires bug api







tag_bug_attach [line 545]

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
[ Top ]



tag_bug_detach [line 596]

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)
[ Top ]



tag_bug_detach_all [line 642]

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)
[ Top ]



tag_bug_get_attached [line 495]

array tag_bug_get_attached( Bug $p_bug_id)

Return an array of tags attached to a given bug sorted by tag name.



Tags:

return:  Array of tag rows with attachement information


Parameters

Bug   $p_bug_id   ID
[ Top ]



tag_bug_get_row [line 474]

array tag_bug_get_row( integer $p_tag_id, integer $p_bug_id)

Return the tag attachment row.



Tags:

return:  Tag attachment row


Parameters

integer   $p_tag_id   Tag ID
integer   $p_bug_id   Bug ID
[ Top ]



tag_bug_is_attached [line 456]

boolean tag_bug_is_attached( integer $p_tag_id, integer $p_bug_id)

Determine if a tag is attached to a bug.



Tags:

return:  True if the tag is attached


Parameters

integer   $p_tag_id   Tag ID
integer   $p_bug_id   Bug ID
[ Top ]



tag_cmp_name [line 127]

integer tag_cmp_name( array $p_tag1, array $p_tag2)

Compare two tag rows based on tag name.



Tags:

return:  -1 when Tag 1 < Tag 2, 1 when Tag 1 > Tag 2, 0 otherwise


Parameters

array   $p_tag1   Tag row 1
array   $p_tag2   Tag row 2
[ Top ]



tag_create [line 284]

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.




Tags:

return:  Tag ID


Parameters

string   $p_name   Tag name
integer   $p_user_id   User ID
string   $p_description   Description
[ Top ]



tag_delete [line 376]

void tag_delete( integer $p_tag_id)

Delete a tag with the given ID.



Parameters

integer   $p_tag_id   Tag ID
[ Top ]



tag_display_attached [line 686]

void tag_display_attached( Bug $p_bug_id)

Display a list of attached tag hyperlinks separated by the configured hyperlinks.



Parameters

Bug   $p_bug_id   ID
[ Top ]



tag_display_link [line 657]

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
[ Top ]



tag_ensure_exists [line 57]

void tag_ensure_exists( integer $p_tag_id)

Ensure a tag exists with the given ID.



Parameters

integer   $p_tag_id   Tag ID
[ Top ]



tag_ensure_name_is_valid [line 114]

void tag_ensure_name_is_valid( string $p_name)

Ensure a tag name is valid.



Parameters

string   $p_name   Tag name
[ Top ]



tag_ensure_unique [line 84]

void tag_ensure_unique( string $p_name)

Ensure that a name is unique.



Parameters

string   $p_name   Tag name
[ Top ]



tag_exists [line 43]

boolean tag_exists( integer $p_tag_id)

Determine if a tag exists with the given ID.



Tags:

return:  True if tag exists


Parameters

integer   $p_tag_id   Tag ID
[ Top ]



tag_get [line 219]

array tag_get( integer $p_tag_id)

Return a tag row for the given ID.



Tags:

return:  Tag row


Parameters

integer   $p_tag_id   Tag ID
[ Top ]



tag_get_bugs_attached [line 522]

array tag_get_bugs_attached( integer $p_tag_id)

Return an array of bugs that a tag is attached to.



Tags:

return:  Array of bug ID's.


Parameters

integer   $p_tag_id   Tag ID
[ Top ]



tag_get_by_name [line 243]

Tag tag_get_by_name( string $p_name)

Return a tag row for the given name.



Tags:

return:  row


Parameters

string   $p_name   Tag name
[ Top ]



tag_get_candidates_for_bug [line 405]

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.



Tags:

return:  array of tag rows, each with id, name, and description.


Parameters

int   $p_bug_id   The bug id, if 0 returns all tags.
[ Top ]



tag_get_field [line 264]

mixed tag_get_field( integer $p_tag_id, string $p_field_name)

Return a single field from a tag row for the given ID.



Tags:

return:  Field value


Parameters

integer   $p_tag_id   Tag ID
string   $p_field_name   Field name
[ Top ]



tag_is_unique [line 70]

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.




Tags:

return:  True if name is unique


Parameters

string   $p_name   Tag name
[ Top ]



tag_name_is_valid [line 104]

boolean tag_name_is_valid( string $p_name, array &$p_matches, [string $p_prefix = ''])

Determine if a given name is valid.

Name must not begin with '+' and '-' characters (they are used for filters) and must not contain 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.




Tags:

return:  True if the name is valid


Parameters

string   $p_name   Tag name
array   &$p_matches   Array reference for regex matches
string   $p_prefix   Prefix regex pattern
[ Top ]



tag_parse_filters [line 181]

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.




Tags:

return:  Rows of tags parsed from filter string


Parameters

string   $p_string   Filter string to parse
[ Top ]



tag_parse_string [line 141]

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.




Tags:

return:  Rows of tags parsed from input string


Parameters

string   $p_string   Input string to parse
[ Top ]



tag_stats_attached [line 709]

integer tag_stats_attached( integer $p_tag_id)

Get the number of bugs a given tag is attached to.



Tags:

return:  Number of attached bugs


Parameters

integer   $p_tag_id   Tag ID
[ Top ]



tag_stats_related [line 729]

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.




Tags:

return:  Array of tag rows, with share count added


Parameters

integer   $p_tag_id   Tag ID
integer   $p_limit   List size
[ Top ]



tag_update [line 327]

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
[ Top ]



Documentation generated on Sun, 12 Dec 2010 23:50:52 +0900 by phpDocumentor 1.4.3
inserted by FC2 system