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

Procedural File: custom_field_api.php

Source Location: /core/custom_field_api.php



Page Details:



Tags:

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


Includes:

require_once('bug_api.php') [line 28]
requires bug_api

require_once('helper_api.php') [line 32]
requires helper_api

require_once('date_api.php') [line 36]
requires date_api

require_once('cfdefs'.DIRECTORY_SEPARATOR.'cfdef_'.$type.'.php') [line 58]






custom_field_allow_manage_display [line 61]

void custom_field_allow_manage_display( $p_type, $p_display)



Parameters

   $p_type  
   $p_display  
[ Top ]



custom_field_cache_array_rows [line 128]

null custom_field_cache_array_rows( array $p_cf_id_array)

Cache custom fields contained within an array of field id's



Tags:

access:  public


Parameters

array   $p_cf_id_array   array of custom field id's
[ Top ]



custom_field_cache_row [line 89]

array custom_field_cache_row( int $p_field_id, [bool $p_trigger_errors = true])

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.



Tags:

return:  array representing custom field
access:  public


Parameters

int   $p_field_id   integer representing custom field id
bool   $p_trigger_errors   indicates whether to trigger an error if the field is not found
[ Top ]



custom_field_clear_cache [line 161]

bool custom_field_clear_cache( [int $p_field_id = null])

Clear the custom field cache (or just the given id if specified)



Tags:

access:  public


Parameters

int   $p_field_id   custom field id
[ Top ]



custom_field_create [line 390]

int custom_field_create( string $p_name)

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




Tags:

return:  custom field id
access:  public


Parameters

string   $p_name   custom field name
[ Top ]



custom_field_database_to_value [line 1288]

mixed custom_field_database_to_value( mixed $p_value, int $p_type)

Convert the database-value to value, depending of the type

return value for further operation




Tags:

access:  public


Parameters

mixed   $p_value  
int   $p_type  
[ Top ]



custom_field_default_to_value [line 1304]

mixed custom_field_default_to_value( mixed $p_value, int $p_type)

Convert the default-value to value depending on the type. For example, in case of date, this would translate 'tomorrow' to tomorrow's date.



Tags:

access:  public


Parameters

mixed   $p_value  
int   $p_type  
[ Top ]



custom_field_delete_all_values [line 747]

bool custom_field_delete_all_values( int $p_bug_id)

Delete all custom values associated with the specified bug.

return true on success, false on failure

To be called from bug_delete().




Tags:

access:  public


Parameters

int   $p_bug_id   bug id
[ Top ]



custom_field_destroy [line 688]

bool custom_field_destroy( int $p_field_id)

Delete the field definition and all associated values and project associations

return true on success, false on failure




Tags:

access:  public


Parameters

int   $p_field_id   custom field id
[ Top ]



custom_field_distinct_values [line 1226]

bool|array custom_field_distinct_values( array $p_field_def, [int $p_project_id = ALL_PROJECTS])

Get All Possible Values for a Field.



Tags:

access:  public


Parameters

array   $p_field_def   custom field definition
int   $p_project_id   project id
[ Top ]



custom_field_ensure_exists [line 250]

bool custom_field_ensure_exists( int $p_field_id)

Check to see whether the field id is defined

return true if the field is defined, error otherwise




Tags:

access:  public


Parameters

int   $p_field_id   custom field id
[ Top ]



custom_field_ensure_name_unique [line 295]

bool custom_field_ensure_name_unique( string $p_name)

Check to see whether the name is unique

return true if the name has not been used, error otherwise




Tags:

access:  public


Parameters

string   $p_name   Custom field name
[ Top ]



custom_field_exists [line 220]

bool custom_field_exists( int $p_field_id)

Check to see whether the field id is defined

return true if the field is defined, false otherwise




Tags:

access:  public


Parameters

int   $p_field_id   custom field id
[ Top ]



custom_field_get_all_linked_fields [line 1038]

array custom_field_get_all_linked_fields( int $p_bug_id)

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'




Tags:

access:  public


Parameters

int   $p_bug_id   bug id
[ Top ]



custom_field_get_definition [line 948]

array custom_field_get_definition( int $p_field_id)

Return a field definition row for the field or error if the field does not exist



Tags:

return:  custom field definition
access:  public


Parameters

int   $p_field_id   custom field id
[ Top ]



custom_field_get_field [line 960]

string custom_field_get_field( int $p_field_id, int $p_field_name)

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 ''




Tags:

access:  public


Parameters

int   $p_field_id   custom field id
int   $p_field_name   custom field name
[ Top ]



custom_field_get_ids [line 888]

array custom_field_get_ids( )

Return an array all custom field ids sorted by name



Tags:

access:  public


[ Top ]



custom_field_get_id_from_name [line 767]

bool|int custom_field_get_id_from_name( string $p_field_name, [int $p_truncated_length = null])

Get the id of the custom field with the specified name.

false is returned if no custom field found with the specified name.




Tags:

return:  false or custom field id
access:  public


Parameters

string   $p_field_name   custom field name
int   $p_truncated_length  
[ Top ]



custom_field_get_linked_fields [line 1018]

array custom_field_get_linked_fields( int $p_bug_id, int $p_user_access_level)

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'




Tags:

access:  public


Parameters

int   $p_bug_id   bug id
int   $p_user_access_level   Access level
[ Top ]



custom_field_get_linked_ids [line 812]

array custom_field_get_linked_ids( [int $p_project_id = ALL_PROJECTS])

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




Tags:

access:  public


Parameters

int   $p_project_id   project id
[ Top ]



custom_field_get_project_ids [line 921]

array custom_field_get_project_ids( int $p_field_id)

Return an array of ids of projects related to the specified custom field

(the array may be empty)




Tags:

access:  public


Parameters

int   $p_field_id   custom field id
[ Top ]



custom_field_get_sequence [line 1098]

int|bool custom_field_get_sequence( int $p_field_id, int $p_project_id)

Gets the sequence number for the specified custom field for the specified project. Returns false in case of error.



Tags:

access:  public


Parameters

int   $p_field_id   custom field id
int   $p_project_id   project id
[ Top ]



custom_field_get_value [line 981]

mixed: custom_field_get_value( int $p_field_id, int $p_bug_id)

Get the value of a custom field for the given bug



Tags:

return:  value is defined, null: no value is defined, false: read access is denied
todo:  return values are unclear... should we error when access is denied and provide an api to check whether it will be?
access:  public


Parameters

int   $p_field_id   custom field id
int   $p_bug_id   bug id
[ Top ]



custom_field_has_read_access [line 312]

bool custom_field_has_read_access( int $p_field_id, int $p_bug_id, [int $p_user_id = null])

Return true if the user can read the value of the field for the given bug, false otherwise.



Tags:

access:  public


Parameters

int   $p_field_id   custom field id
int   $p_bug_id   bug id
int   $p_user_id   user id
[ Top ]



custom_field_has_read_access_by_project_id [line 335]

bool custom_field_has_read_access_by_project_id( int $p_field_id, int $p_project_id, [int $p_user_id = null])

Return true if the user can read the value of the field for the given project, false otherwise.



Tags:

access:  public


Parameters

int   $p_field_id   custom field id
int   $p_project_id   bug id
int   $p_user_id   user id
[ Top ]



custom_field_has_write_access [line 377]

bool custom_field_has_write_access( int $p_field_id, int $p_bug_id, [int $p_user_id = null])

Return true if the user can modify the value of the field for the given bug, false otherwise.



Tags:

access:  public


Parameters

int   $p_field_id   custom field id
int   $p_bug_id   bug id
int   $p_user_id   user id
[ Top ]



custom_field_has_write_access_to_project [line 356]

bool custom_field_has_write_access_to_project( int $p_field_id, int $p_project_id, [int $p_user_id = null])

Return true if the user can modify the value of the field for the given project, false otherwise.



Tags:

access:  public


Parameters

int   $p_field_id   custom field id
int   $p_project_id   bug id
int   $p_user_id   user id
[ Top ]



custom_field_is_linked [line 184]

bool custom_field_is_linked( int $p_field_id, int $p_project_id)

Check to see whether the field is included in the given project

return true if the field is included, false otherwise




Tags:

access:  public


Parameters

int   $p_field_id   custom field id
int   $p_project_id   project id
[ Top ]



custom_field_is_name_unique [line 269]

bool custom_field_is_name_unique( string $p_name, [int $p_custom_field_id = null])

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.



Tags:

access:  public


Parameters

string   $p_name   custom field name
int   $p_custom_field_id   custom field id
[ Top ]



custom_field_link [line 633]

bool custom_field_link( int $p_field_id, int $p_project_id)

Add a custom field to a project

return true on success, false on failure or if already added




Tags:

access:  public


Parameters

int   $p_field_id   custom field id
int   $p_project_id   project id
[ Top ]



custom_field_prepare_possible_values [line 1209]

string|array custom_field_prepare_possible_values( string $p_possible_values)

$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.



Tags:

access:  public


Parameters

string   $p_possible_values  
[ Top ]



custom_field_set_sequence [line 1380]

bool custom_field_set_sequence( int $p_field_id, int $p_project_id, int $p_sequence)

Sets the sequence number for the specified custom field for the specified project.



Tags:

access:  public


Parameters

int   $p_field_id   custom field id
int   $p_project_id   project id
int   $p_sequence  
[ Top ]



custom_field_set_value [line 1324]

bool custom_field_set_value( int $p_field_id, int $p_bug_id, mixed $p_value, [ $p_log_insert = true], boolean $p_log)

Set the value of a custom field for a given bug

return true on success, false on failure




Tags:

access:  public


Parameters

int   $p_field_id   custom field id
int   $p_bug_id   bug id
mixed   $p_value  
boolean   $p_log   create history logs for new values
   $p_log_insert  
[ Top ]



custom_field_type [line 234]

int custom_field_type( int $p_field_id)

Return the type of a custom field if it exists.



Tags:

return:  custom field type
access:  public


Parameters

int   $p_field_id   custom field id
[ Top ]



custom_field_unlink [line 667]

bool custom_field_unlink( int $p_field_id, int $p_project_id)

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.




Tags:

access:  public


Parameters

int   $p_field_id   custom field id
int   $p_project_id   project id
[ Top ]



custom_field_unlink_all [line 725]

bool custom_field_unlink_all( int $p_project_id)

Delete all associations of custom fields to the specified project return true on success, false on failure

To be called from within project_delete().




Tags:

access:  public


Parameters

int   $p_project_id   project id
[ Top ]



custom_field_update [line 423]

bool custom_field_update( int $p_field_id, array $p_def_array)

Update the field definition

return true on success, false on failure




Tags:

access:  public


Parameters

int   $p_field_id   custom field id
array   $p_def_array   custom field definition
[ Top ]



custom_field_validate [line 1126]

bool custom_field_validate( int $p_field_id, string $p_value)

Allows the validation of a custom field value without setting it or needing a bug to exist.



Tags:

access:  public


Parameters

int   $p_field_id   custom field id
string   $p_value   custom field value
[ Top ]



custom_field_value_to_database [line 1272]

mixed custom_field_value_to_database( mixed $p_value, int $p_type)

Convert the value to save it into the database, depending of the type

return value for database




Tags:

access:  public


Parameters

mixed   $p_value  
int   $p_type  
[ Top ]



print_custom_field_input [line 1408]

void print_custom_field_input( array $p_field_def, [int $p_bug_id = null])

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




Tags:

access:  public


Parameters

array   $p_field_def   custom field definition
int   $p_bug_id   bug id
[ Top ]



print_custom_field_value [line 1463]

null print_custom_field_value( array $p_def, int $p_field_id, int $p_bug_id)

Print a custom field value for display

NOTE: This probably belongs in the print_api.php




Tags:

access:  public


Parameters

array   $p_def   contains the definition of the custom field
int   $p_field_id   contains the id of the field
int   $p_bug_id   contains the bug id to display the custom field value for
[ Top ]



string_custom_field_value [line 1442]

string string_custom_field_value( array $p_def, int $p_field_id, int $p_bug_id)

Prepare a string containing a custom field value for display



Tags:

todo:  This probably belongs in the string_api.php
access:  public


Parameters

array   $p_def   contains the definition of the custom field
int   $p_field_id   contains the id of the field
int   $p_bug_id   contains the bug id to display the custom field value for
[ Top ]



string_custom_field_value_for_email [line 1475]

string string_custom_field_value_for_email( string $p_value, int $p_type)

Prepare a string containing a custom field value for email

NOTE: This probably belongs in the string_api.php




Tags:

return:  value ready for sending via email
access:  public


Parameters

string   $p_value   value of custom field
int   $p_type   type of custom field
[ Top ]



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