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

Procedural File: custom_field_api.php

Source Location: /core/custom_field_api.php

Page Details
Copyright:  Copyright (C) 2002 - 2009 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 ($t_core_dir.'bug_api.php') [line 30]

requires bug_api

[ Top ]

require_once ($t_core_dir.'helper_api.php') [line 34]

requires helper_api

[ Top ]

require_once ($t_core_dir.'date_api.php') [line 38]

requires date_api

[ Top ]

require_once ($t_core_dir.'cfdefs'.DIRECTORY_SEPARATOR.'cfdef_'.$type.'.php') [line 60]
[ Top ]


Functions
custom_field_allow_manage_display  [line 63]

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

Parameters:
array   $p_cf_id_array:  array of custom field id's

API Tags:
Access:  public


[ Top ]
custom_field_cache_row  [line 90]

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.

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

API Tags:
Return:  array representing custom field
Access:  public


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

Parameters:
int   $p_field_id:  custom field id

API Tags:
Access:  public


[ Top ]
custom_field_create  [line 392]

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

Parameters:
string   $p_name:  custom field name

API Tags:
Return:  custom field id
Access:  public


[ Top ]
custom_field_database_to_value  [line 1285]

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

Parameters:
mixed   $p_value: 
int   $p_type: 

API Tags:
Access:  public


[ Top ]
custom_field_default_to_value  [line 1301]

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.

Parameters:
mixed   $p_value: 
int   $p_type: 

API Tags:
Access:  public


[ Top ]
custom_field_delete_all_values  [line 762]

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().

Parameters:
int   $p_bug_id:  bug id

API Tags:
Access:  public


[ Top ]
custom_field_destroy  [line 703]

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

Parameters:
int   $p_field_id:  custom field id

API Tags:
Access:  public


[ Top ]
custom_field_distinct_values  [line 1223]

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

Get All Possible Values for a Field.

Parameters:
array   $p_field_def:  custom field definition
int   $p_project_id:  project id

API Tags:
Access:  public


[ 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

Parameters:
int   $p_field_id:  custom field id

API Tags:
Access:  public


[ Top ]
custom_field_ensure_name_unique  [line 297]

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

Parameters:
string   $p_name:  Custom field name

API Tags:
Access:  public


[ 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

Parameters:
int   $p_field_id:  custom field id

API Tags:
Access:  public


[ Top ]
custom_field_get_all_linked_fields  [line 1053]

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'

Parameters:
int   $p_bug_id:  bug id

API Tags:
Access:  public


[ Top ]
custom_field_get_definition  [line 956]

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

Parameters:
int   $p_field_id:  custom field id

API Tags:
Return:  custom field definition
Access:  public


[ Top ]
custom_field_get_field  [line 968]

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

Parameters:
int   $p_field_id:  custom field id
int   $p_field_name:  custom field name

API Tags:
Access:  public


[ Top ]
custom_field_get_ids  [line 896]

array custom_field_get_ids( )

Return an array all custom field ids sorted by name


API Tags:
Access:  public


[ Top ]
custom_field_get_id_from_name  [line 782]

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.

Parameters:
string   $p_field_name:  custom field name
int   $p_truncated_length: 

API Tags:
Return:  false or custom field id
Access:  public


[ Top ]
custom_field_get_linked_fields  [line 1033]

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'

Parameters:
int   $p_bug_id:  bug id
int   $p_user_access_level:  Access level

API Tags:
Access:  public


[ Top ]
custom_field_get_linked_ids  [line 820]

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

Parameters:
int   $p_project_id:  project id

API Tags:
Access:  public


[ Top ]
custom_field_get_project_ids  [line 929]

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)

Parameters:
int   $p_field_id:  custom field id

API Tags:
Access:  public


[ Top ]
custom_field_get_sequence  [line 1113]

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.

Parameters:
int   $p_field_id:  custom field id
int   $p_project_id:  project id

API Tags:
Access:  public


[ Top ]
custom_field_get_value  [line 989]

mixed custom_field_get_value( int $p_field_id, int $p_bug_id  )

Get the value of a custom field for the given bug

Parameters:
int   $p_field_id:  custom field id
int   $p_bug_id:  bug id

API Tags:
Access:  public

Information Tags:
Todo:  return values are unclear... should we error when access is denied and provide an api to check whether it will be?

[ Top ]
custom_field_has_read_access  [line 314]

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.

Parameters:
int   $p_field_id:  custom field id
int   $p_bug_id:  bug id
int   $p_user_id:  user id

API Tags:
Access:  public


[ Top ]
custom_field_has_read_access_by_project_id  [line 337]

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.

Parameters:
int   $p_field_id:  custom field id
int   $p_project_id:  bug id
int   $p_user_id:  user id

API Tags:
Access:  public


[ Top ]
custom_field_has_write_access  [line 379]

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.

Parameters:
int   $p_field_id:  custom field id
int   $p_bug_id:  bug id
int   $p_user_id:  user id

API Tags:
Access:  public


[ Top ]
custom_field_has_write_access_to_project  [line 358]

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.

Parameters:
int   $p_field_id:  custom field id
int   $p_project_id:  bug id
int   $p_user_id:  user id

API Tags:
Access:  public


[ 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

Parameters:
int   $p_field_id:  custom field id
int   $p_project_id:  project id

API Tags:
Access:  public


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

Parameters:
string   $p_name:  custom field name
int   $p_custom_field_id:  custom field id

API Tags:
Access:  public


[ Top ]
custom_field_link  [line 648]

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

Parameters:
int   $p_field_id:  custom field id
int   $p_project_id:  project id

API Tags:
Access:  public


[ Top ]
custom_field_prepare_possible_values  [line 1206]

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.

Parameters:
string   $p_possible_values: 

API Tags:
Access:  public


[ Top ]
custom_field_set_sequence  [line 1377]

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.

Parameters:
int   $p_field_id:  custom field id
int   $p_project_id:  project id
int   $p_sequence: 

API Tags:
Access:  public


[ Top ]
custom_field_set_value  [line 1320]

bool custom_field_set_value( int $p_field_id, int $p_bug_id, mixed $p_value  )

Set the value of a custom field for a given bug

return true on success, false on failure

Parameters:
int   $p_field_id:  custom field id
int   $p_bug_id:  bug id
mixed   $p_value: 

API Tags:
Access:  public


[ Top ]
custom_field_type  [line 234]

int custom_field_type( int $p_field_id  )

Return the type of a custom field if it exists.

Parameters:
int   $p_field_id:  custom field id

API Tags:
Return:  custom field type
Access:  public


[ Top ]
custom_field_unlink  [line 682]

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.

Parameters:
int   $p_field_id:  custom field id
int   $p_project_id:  project id

API Tags:
Access:  public


[ Top ]
custom_field_unlink_all  [line 740]

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().

Parameters:
int   $p_project_id:  project id

API Tags:
Access:  public


[ Top ]
custom_field_update  [line 425]

bool custom_field_update( int $p_field_id, array $p_def_array  )

Update the field definition

return true on success, false on failure

Parameters:
int   $p_field_id:  custom field id
array   $p_def_array:  custom field definition

API Tags:
Access:  public


[ Top ]
custom_field_validate  [line 1141]

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.

Parameters:
int   $p_field_id:  custom field id
string   $p_value:  custom field value

API Tags:
Access:  public


[ Top ]
custom_field_value_to_database  [line 1269]

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

Parameters:
mixed   $p_value: 
int   $p_type: 

API Tags:
Access:  public


[ Top ]
print_custom_field_input  [line 1405]

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

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

API Tags:
Access:  public


[ Top ]
print_custom_field_value  [line 1449]

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

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

API Tags:
Access:  public


[ Top ]
string_custom_field_value  [line 1431]

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

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

API Tags:
Access:  public

Information Tags:
Todo:  This probably belongs in the string_api.php

[ Top ]
string_custom_field_value_for_email  [line 1461]

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

Parameters:
string   $p_value:  value of custom field
int   $p_type:  type of custom field

API Tags:
Return:  value ready for sending via email
Access:  public


[ Top ]


Documentation generated on Sun, 05 Apr 2009 23:01:09 +0100 by phpDocumentor 1.4.1