[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/core/ -> custom_field_api.php (summary)

Custom Field API

Copyright: Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
Copyright: Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net
File Size: 1494 lines (48 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 43 functions

  custom_field_allow_manage_display()
  custom_field_cache_row()
  custom_field_cache_array_rows()
  custom_field_clear_cache()
  custom_field_is_linked()
  custom_field_exists()
  custom_field_type()
  custom_field_ensure_exists()
  custom_field_is_name_unique()
  custom_field_ensure_name_unique()
  custom_field_has_read_access()
  custom_field_has_read_access_by_project_id()
  custom_field_has_write_access_to_project()
  custom_field_has_write_access()
  custom_field_create()
  custom_field_update()
  custom_field_link()
  custom_field_unlink()
  custom_field_destroy()
  custom_field_unlink_all()
  custom_field_delete_all_values()
  custom_field_get_id_from_name()
  custom_field_get_linked_ids()
  custom_field_get_ids()
  custom_field_get_project_ids()
  custom_field_get_definition()
  custom_field_get_field()
  custom_field_get_value()
  custom_field_get_linked_fields()
  custom_field_get_all_linked_fields()
  custom_field_get_sequence()
  custom_field_validate()
  custom_field_prepare_possible_values()
  custom_field_distinct_values()
  custom_field_value_to_database()
  custom_field_database_to_value()
  custom_field_default_to_value()
  custom_field_set_value()
  custom_field_set_sequence()
  print_custom_field_input()
  string_custom_field_value()
  print_custom_field_value()
  string_custom_field_value_for_email()

Functions
Functions that are not part of a class:

custom_field_allow_manage_display( $p_type, $p_display )   X-Ref
No description

custom_field_cache_row( $p_field_id, $p_trigger_errors = true )   X-Ref
Cache a custom field row if necessary and return the cached copy
If the second parameter is true (default), trigger an error
if the field can't be found.  If the second parameter is
false, return false if the field can't be found.

param: int $p_field_id integer representing custom field id
param: bool $p_trigger_errors indicates whether to trigger an error if the field is not found
return: array array representing custom field

custom_field_cache_array_rows( $p_cf_id_array )   X-Ref
Cache custom fields contained within an array of field id's

param: array $p_cf_id_array array of custom field id's
return: null

custom_field_clear_cache( $p_field_id = null )   X-Ref
Clear the custom field cache (or just the given id if specified)

param: int $p_field_id custom field id
return: bool

custom_field_is_linked( $p_field_id, $p_project_id )   X-Ref
Check to see whether the field is included in the given project
return true if the field is included, false otherwise

param: int $p_field_id custom field id
param: int $p_project_id project id
return: bool

custom_field_exists( $p_field_id )   X-Ref
Check to see whether the field id is defined
return true if the field is defined, false otherwise

param: int $p_field_id custom field id
return: bool

custom_field_type( $p_field_id )   X-Ref
Return the type of a custom field if it exists.

param: int $p_field_id custom field id
return: int custom field type

custom_field_ensure_exists( $p_field_id )   X-Ref
Check to see whether the field id is defined
return true if the field is defined, error otherwise

param: int $p_field_id custom field id
return: bool

custom_field_is_name_unique( $p_name, $p_custom_field_id = null )   X-Ref
Check to see whether the name is unique
return false if a field with the name already exists, true otherwise
if an id is specified, then the corresponding record is excluded from the
uniqueness test.

param: string $p_name custom field name
param: int $p_custom_field_id custom field id
return: bool

custom_field_ensure_name_unique( $p_name )   X-Ref
Check to see whether the name is unique
return true if the name has not been used, error otherwise

param: string $p_name Custom field name
return: bool

custom_field_has_read_access( $p_field_id, $p_bug_id, $p_user_id = null )   X-Ref
Return true if the user can read the value of the field for the given bug,
false otherwise.

param: int $p_field_id custom field id
param: int $p_bug_id bug id
param: int $p_user_id user id
return: bool

custom_field_has_read_access_by_project_id( $p_field_id, $p_project_id, $p_user_id = null )   X-Ref
Return true if the user can read the value of the field for the given project,
false otherwise.

param: int $p_field_id custom field id
param: int $p_project_id bug id
param: int $p_user_id user id
return: bool

custom_field_has_write_access_to_project( $p_field_id, $p_project_id, $p_user_id = null )   X-Ref
Return true if the user can modify the value of the field for the given project,
false otherwise.

param: int $p_field_id custom field id
param: int $p_project_id bug id
param: int $p_user_id user id
return: bool

custom_field_has_write_access( $p_field_id, $p_bug_id, $p_user_id = null )   X-Ref
Return true if the user can modify the value of the field for the given bug,
false otherwise.

param: int $p_field_id custom field id
param: int $p_bug_id bug id
param: int $p_user_id user id
return: bool

custom_field_create( $p_name )   X-Ref
create a new custom field with the name $p_name
the definition are the default values and can be changes later
return the ID of the new definition

param: string $p_name custom field name
return: int custom field id

custom_field_update( $p_field_id, $p_def_array )   X-Ref
Update the field definition
return true on success, false on failure

param: int $p_field_id custom field id
param: array custom field definition
return: bool

custom_field_link( $p_field_id, $p_project_id )   X-Ref
Add a custom field to a project
return true on success, false on failure or if already added

param: int $p_field_id custom field id
param: int $p_project_id project id
return: bool

custom_field_unlink( $p_field_id, $p_project_id )   X-Ref
Remove a custom field from a project
return true on success, false on failure

The values for the custom fields are not deleted.  This is to allow for the
case where a bug is moved to another project that has the field, or the
field is linked again to the project.
param: int $p_field_id custom field id
param: int $p_project_id project id
return: bool

custom_field_destroy( $p_field_id )   X-Ref
Delete the field definition and all associated values and project associations
return true on success, false on failure

param: int $p_field_id custom field id
return: bool

custom_field_unlink_all( $p_project_id )   X-Ref
Delete all associations of custom fields to the specified project
return true on success, false on failure

To be called from within project_delete().
param: int $p_project_id project id
return: bool

custom_field_delete_all_values( $p_bug_id )   X-Ref
Delete all custom values associated with the specified bug.
return true on success, false on failure

To be called from bug_delete().
param: int $p_bug_id bug id
return: bool

custom_field_get_id_from_name( $p_field_name, $p_truncated_length = null )   X-Ref
Get the id of the custom field with the specified name.
false is returned if no custom field found with the specified name.

param: string $p_field_name custom field name
param: int $p_truncated_length
return: bool|int false or custom field id

custom_field_get_linked_ids( $p_project_id = ALL_PROJECTS )   X-Ref
Return an array of ids of custom fields bound to the specified project

The ids will be sorted based on the sequence number associated with the binding
param: int $p_project_id project id
return: array

custom_field_get_ids()   X-Ref
Return an array all custom field ids sorted by name

return: array

custom_field_get_project_ids( $p_field_id )   X-Ref
Return an array of ids of projects related to the specified custom field
(the array may be empty)

param: int $p_field_id custom field id
return: array

custom_field_get_definition( $p_field_id )   X-Ref
Return a field definition row for the field or error if the field does not exist

param: int $p_field_id custom field id
return: array custom field definition

custom_field_get_field( $p_field_id, $p_field_name )   X-Ref
Return a single database field from a custom field definition row for the field
if the database field does not exist, display a warning and return ''

param: int $p_field_id custom field id
param: int $p_field_name custom field name
return: string

custom_field_get_value( $p_field_id, $p_bug_id )   X-Ref
Get the value of a custom field for the given bug

param: int $p_field_id custom field id
param: int $p_bug_id bug id
return: mixed: value is defined, null: no value is defined, false: read access is denied

custom_field_get_linked_fields( $p_bug_id, $p_user_access_level )   X-Ref
Gets the custom fields array for the given bug readable by specified level.
Array keys are custom field names. Array is sorted by custom field sequence number;
Array items are arrays with the next keys:
'type', 'value', 'access_level_r'

param: int $p_bug_id bug id
param: int $p_user_access_level Access level
return: array

custom_field_get_all_linked_fields( $p_bug_id )   X-Ref
Gets the custom fields array for the given bug. Array keys are custom field names.
Array is sorted by custom field sequence number; Array items are arrays with the next keys:
'type', 'value', 'access_level_r'

param: int $p_bug_id bug id
return: array

custom_field_get_sequence( $p_field_id, $p_project_id )   X-Ref
Gets the sequence number for the specified custom field for the specified
project.  Returns false in case of error.

param: int $p_field_id custom field id
param: int $p_project_id project id
return: int|bool

custom_field_validate( $p_field_id, $p_value )   X-Ref
Allows the validation of a custom field value without setting it
or needing a bug to exist.

param: int $p_field_id custom field id
param: string $p_value custom field value
return: bool

custom_field_prepare_possible_values( $p_possible_values )   X-Ref
$p_possible_values: possible values to be pre-processed.  If it has enum values,
it will be left as is.  If it has a method, it will be replaced by the list.

param: string $p_possible_values
return: string|array

custom_field_distinct_values( $p_field_def, $p_project_id = ALL_PROJECTS )   X-Ref
Get All Possible Values for a Field.

param: array $p_field_def custom field definition
param: int $p_project_id project id
return: bool|array

custom_field_value_to_database( $p_value, $p_type )   X-Ref
Convert the value to save it into the database, depending of the type
return value for database

param: mixed $p_value
param: int $p_type
return: mixed

custom_field_database_to_value( $p_value, $p_type )   X-Ref
Convert the database-value to value, depending of the type
return value for further operation

param: mixed $p_value
param: int $p_type
return: mixed

custom_field_default_to_value( $p_value, $p_type )   X-Ref
Convert the default-value to value depending on the type.  For example, in case of date, this
would translate 'tomorrow' to tomorrow's date.

param: mixed $p_value
param: int $p_type
return: mixed

custom_field_set_value( $p_field_id, $p_bug_id, $p_value, $p_log_insert=true )   X-Ref
Set the value of a custom field for a given bug
return true on success, false on failure

param: int $p_field_id custom field id
param: int $p_bug_id bug id
param: mixed $p_value
param: boolean $p_log create history logs for new values
return: bool

custom_field_set_sequence( $p_field_id, $p_project_id, $p_sequence )   X-Ref
Sets the sequence number for the specified custom field for the specified
project.

param: int $p_field_id custom field id
param: int $p_project_id project id
param: int $p_sequence
return: bool

print_custom_field_input( $p_field_def, $p_bug_id = null )   X-Ref
Print an input field
$p_field_def contains the definition of the custom field (including it's field id
$p_bug_id    contains the bug where this field belongs to. If it's left
away, it'll default to 0 and thus belongs to a new (i.e. non-existant) bug
NOTE: This probably belongs in the print_api.php

param: array $p_field_def custom field definition
param: int $p_bug_id bug id

string_custom_field_value( $p_def, $p_field_id, $p_bug_id )   X-Ref
Prepare a string containing a custom field value for display

param: array  $p_def contains the definition of the custom field
param: int $p_field_id contains the id of the field
param: int $p_bug_id contains the bug id to display the custom field value for
return: string

print_custom_field_value( $p_def, $p_field_id, $p_bug_id )   X-Ref
Print a custom field value for display
NOTE: This probably belongs in the print_api.php

param: array  $p_def contains the definition of the custom field
param: int $p_field_id contains the id of the field
param: int $p_bug_id contains the bug id to display the custom field value for
return: null

string_custom_field_value_for_email( $p_value, $p_type )   X-Ref
Prepare a string containing a custom field value for email
NOTE: This probably belongs in the string_api.php

param: string $p_value value of custom field
param: int $p_type    type of custom field
return: string value ready for sending via email



Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7