[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/core/ -> tag_api.php (sommaire)

Tag API

Author: John Reese
Poids: 716 lignes (20 kb)
Inclus ou requis: 2 fois
Référencé: 0 fois
Nécessite: 2 fichiers
 core/history_api.php
 core/bug_api.php

Définit 26 fonctions

  tag_exists()
  tag_ensure_exists()
  tag_is_unique()
  tag_ensure_unique()
  tag_name_is_valid()
  tag_ensure_name_is_valid()
  tag_cmp_name()
  tag_parse_string()
  tag_parse_filters()
  tag_get()
  tag_get_by_name()
  tag_get_field()
  tag_create()
  tag_update()
  tag_delete()
  tag_bug_is_attached()
  tag_bug_get_row()
  tag_bug_get_attached()
  tag_get_bugs_attached()
  tag_bug_attach()
  tag_bug_detach()
  tag_bug_detach_all()
  tag_display_link()
  tag_display_attached()
  tag_stats_attached()
  tag_stats_related()

Fonctions
Fonctions qui ne font pas partie d'une Classe:

tag_exists( $p_tag_id )   X-Ref
Determine if a tag exists with the given ID.

param: integer Tag ID
return: boolean True if tag exists

tag_ensure_exists( $p_tag_id )   X-Ref
Ensure a tag exists with the given ID.

param: integer Tag ID

tag_is_unique( $p_name )   X-Ref
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.

param: string Tag name
return: boolean True if name is unique

tag_ensure_unique( $p_name )   X-Ref
Ensure that a name is unique.

param: string Tag name

tag_name_is_valid( $p_name, &$p_matches, $p_prefix="" )   X-Ref
Determine if a given name is valid.
Name must start with letter/number and consist of letters, numbers,
hyphens, underscores, periods, or spaces.  The matches parameter allows
you 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.

param: string Tag name
param: array Array reference for regex matches
param: string Prefix regex pattern
return: boolean True if the name is valid

tag_ensure_name_is_valid( $p_name )   X-Ref
Ensure a tag name is valid.

param: string Tag name

tag_cmp_name( $p_tag1, $p_tag2 )   X-Ref
Compare two tag rows based on tag name.

param: array Tag row 1
param: array Tag row 2
return: integer -1 when Tag 1 < Tag 2, 1 when Tag 1 > Tag 2, 0 otherwise

tag_parse_string( $p_string )   X-Ref
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.

param: string Input string to parse
return: array Rows of tags parsed from input string

tag_parse_filters( $p_string )   X-Ref
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.

param: string Filter string to parse
return: array Rows of tags parsed from filter string

tag_get( $p_tag_id )   X-Ref
Return a tag row for the given ID.

param: integer Tag ID
return: array Tag row

tag_get_by_name( $p_name )   X-Ref
Return a tag row for the given name.

param: string Tag name
return: Tag row

tag_get_field( $p_tag_id, $p_field_name )   X-Ref
Return a single field from a tag row for the given ID.

param: integer Tag ID
param: string Field name
return: mixed Field value

tag_create( $p_name, $p_user_id=null, $p_description='' )   X-Ref
Create a tag with the given name, creator, and description.
Defaults to the currently logged in user, and a blank description.

param: string Tag name
param: integer User ID
param: string Description
return: integer Tag ID

tag_update( $p_tag_id, $p_name, $p_user_id, $p_description )   X-Ref
Update a tag with given name, creator, and description.

param: integer Tag ID
param: string Tag name
param: integer User ID
param: string Description

tag_delete( $p_tag_id )   X-Ref
Delete a tag with the given ID.

param: integer Tag ID

tag_bug_is_attached( $p_tag_id, $p_bug_id )   X-Ref
Determine if a tag is attached to a bug.

param: integer Tag ID
param: integer Bug ID
return: boolean True if the tag is attached

tag_bug_get_row( $p_tag_id, $p_bug_id )   X-Ref
Return the tag attachment row.

param: integer Tag ID
param: integer Bug ID
return: array Tag attachment row

tag_bug_get_attached( $p_bug_id )   X-Ref
Return an array of tags attached to a given bug sorted by tag name.

param: Bug ID
return: array Array of tag rows with attachement information

tag_get_bugs_attached( $p_tag_id )   X-Ref
Return an array of bugs that a tag is attached to.

param: integer Tag ID
return: array Array of bug ID's.

tag_bug_attach( $p_tag_id, $p_bug_id, $p_user_id=null )   X-Ref
Attach a tag to a bug.

param: integer Tag ID
param: integer Bug ID
param: integer User ID

tag_bug_detach( $p_tag_id, $p_bug_id, $p_add_history=true, $p_user_id = null )   X-Ref
Detach a tag from a bug.

param: integer Tag ID
param: integer Bug ID
param: boolean Add history entries to bug
param: integer User Id (or null for current logged in user)    

tag_bug_detach_all( $p_bug_id, $p_add_history=true, $p_user_id = null )   X-Ref
Detach all tags from a given bug.

param: integer Bug ID
param: boolean Add history entries to bug
param: integer User Id (or null for current logged in user)    

tag_display_link( $p_tag_row, $p_bug_id=0 )   X-Ref
Display a tag hyperlink.
If a bug ID is passed, the tag link will include a detach link if the
user has appropriate privileges.

param: array Tag row
param: integer Bug ID

tag_display_attached( $p_bug_id )   X-Ref
Display a list of attached tag hyperlinks separated by the configured hyperlinks.

param: Bug ID

tag_stats_attached( $p_tag_id )   X-Ref
Get the number of bugs a given tag is attached to.

param: integer Tag ID
return: integer Number of attached bugs

tag_stats_related( $p_tag_id, $p_limit=5 )   X-Ref
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.

param: integer Tag ID
param: integer List size
return: array Array of tag rows, with share count added



Généré le : Thu Nov 29 09:42:17 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics