PHP Class CommonDBTM, glpi

Inheritance: extends CommonGLPI
Afficher le fichier Open project: glpi-project/glpi Class Usage Examples

Méthodes publiques

Свойство Type Description
$additional_fields_for_dictionnary Additional fiedls for dictionnary processing
$auto_message_on_action Set false to desactivate automatic message on action
$dohistory Make an history of the changes
$fields Data of the Item
$get_item_to_display_tab Need to get item to show tab
$history_blacklist Black list fields for history log or date mod update
$mailqueueonaction FLush mail queue for
$no_form_page Set true to desactivate link generation because form page do not permit show/edit item
$rightname Profile name
$taborientation Tab orientation : horizontal or vertical

Protected Properties

Свойство Type Description
$fkfield Foreign key field cache : set dynamically calling getForeignKeyField
$forward_entity_to Forward entity datas to linked items
$notable Set true to desactivate auto compute table name
$plugins_forward_entity Forward entity to plugins itemtypes
$searchopt Search options of the item : to avoid multiple load
$usenotepad Is this item use notepad ?

Méthodes publiques

Méthode Description
__construct ( ) Constructor
add ( array $input, $options = [], $history = true ) : integer Add an item in the database with all it's items.
addForwardEntity ( $for_itemtype, $to_itemtype ) : nothing Specificy a plugin itemtype for which entities_id and is_recursive should be forwarded
addMessageOnAddAction ( ) Add a message on add action
addMessageOnDeleteAction ( ) Add a message on delete action
addMessageOnPurgeAction ( ) Add a message on purge action
addMessageOnRestoreAction ( ) Add a message on restore action
addMessageOnUpdateAction ( ) Add a message on update action
addNeededInfoToInput ( $input ) : the Add needed information to $input (example entities_id)
addToDB ( ) : new Add an item to the database
can ( $ID, $right, array &$input = NULL ) : boolean Check right on an item
canAddItem ( $type ) : rights Have I the global right to add an item for the Object May be overloaded if needed (ex Ticket)
canCreate ( ) : booleen Have I the global right to "create" the Object May be overloaded if needed (ex KnowbaseItem)
canCreateItem ( ) : booleen Have I the right to "create" the Object
canDelete ( ) : booleen Have I the global right to "delete" the Object
canDeleteItem ( ) : booleen Have I the right to "delete" the Object
canEdit ( $ID ) : booleen Have i right to see action button
canGlobal ( $right ) : nothing Get global right on an object
canMassiveAction ( $action, $field, $value ) check if this action can be done on this field of this item by massive actions
canPurge ( ) : booleen Have I the global right to "purge" the Object
canPurgeItem ( ) : booleen Have I the right to "purge" the Object
canUnrecurs ( ) : booleen Can I change recursive flag to false check if there is "linked" object in another entity
canUpdate ( ) : booleen Have I the global right to "update" the Object
canUpdateItem ( ) : booleen Have I the right to "update" the Object
canView ( ) : booleen Have I the global right to "view" the Object
canViewItem ( ) : booleen Have I the right to "view" the Object May be overloaded if needed
check ( $ID, $right, array &$input = NULL ) : nothing Check right on an item with block
checkEntity ( $recursive = false ) : booleen Check if have right on this entity
checkGlobal ( $right ) : nothing Check global right on an object
checkSpecificValues ( $datatype, &$value ) : true Add more check for values
checkUnicity ( $add = false, $options = [] ) : true Check field unicity before insert or update
cleanDBonMarkDeleted ( ) : nothing Actions done when item flag deleted is set to an item
cleanDBonPurge ( ) : nothing Actions done when item is deleted from the database
cleanHistory ( ) : nothing Clean data in the tables which have linked the deleted item
cleanRelationData ( ) : nothing Clean data in the tables which have linked the deleted item Clear 1/N Relation
cleanRelationTable ( ) Clean the date in the relation tables for the deleted item Clear N/N Relation
cleanTranslations ( ) Clean translations associated to a dropdown
delete ( array $input, $force, $history = 1 ) : boolean Delete an item in the database.
deleteByCriteria ( $crit = [], $force, $history = 1 ) Clean all infos which match some criteria
deleteFromDB ( $force ) : true Mark deleted or purge an item in the database
dropdown ( $options = [] ) : nothing Print out an HTML "
filterValues ( $display = true ) : input Check float and decimal values
find ( $condition = "", $order = "", $limit = "" ) : all Retrieve all items from the database
forceTable ( $table ) : nothing force table value (used for config management for old versions)
generateLinkContents ( $link, CommonDBTM $item ) : array Generate link
getComments ( ) : String: Get comments of the Object
getCompleteNameField ( )
getEmpty ( ) : true Get an empty item
getEntityID ( ) : ID Get the ID of entity assigned to the object
getField ( $field ) : value Return a field Value if exists
getForbiddenStandardMassiveAction ( ) : an Get the standard massive actions which are forbidden
getForeignKeyField ( )
getFromDB ( $ID ) : true Retrieve an item from the database
getFromDBByQuery ( $query ) : true Retrieve an item from the database by query. The query must include the WHERE keyword. Thus, we can replace "WHERE" to make complex SQL JOINED queries (for instance, see User::getFromDBbyEmail()).
getID ( ) : ID Get the identifier of the current item
getIndexName ( ) : name Get the name of the index field
getItemEntity ( $itemtype, $items_id ) : integer get the Entity of an Item
getLink ( $options = [] ) : string Get the link to an item
getLinkURL ( ) : string Get the link url to an item
getLinkedItems ( ) : an Return the linked items (in computers_items)
getLinkedItemsCount ( ) : number Return the count of linked items (in computers_items)
getLogTypeID ( ) : array Get type to register log on
getMassiveActionsForItemtype ( array &$actions, $itemtype, $is_deleted, CommonDBTM $checkitem = NULL ) : nothing Get all the massive actions available for the current class regarding given itemtype
getName ( $options = [] ) : String: Get the name of the object
getNameField ( )
getNameID ( $options = [] ) : String: Get the name of the object with the ID if the config is set Should Not be overloaded (overload getName() instead)
getOptions ( ) : then Get search options
getPostAdditionalInfosForName ( ) : String: Get additionals information to add after name
getPreAdditionalInfosForName ( ) : String: Get additionals information to add before name
getRawCompleteName ( ) Get raw completename of the object Maybe overloaded
getRawName ( ) Get raw name of the object Maybe overloaded
getRights ( $interface = 'central' ) : array Get rights for an item _ may be overload by object
getSearchOptionByField ( $field, $value, $table = '' ) : then Return a search option by looking for a value of a specific field and maybe a specific table
getSearchOptionIDByField ( $field, $value, $table = '' ) : then Return a search option ID by looking for a value of a specific field and maybe a specific table
getSearchOptions ( ) : an Get the Search options for the given Type
getSpecificMassiveActions ( $checkitem = NULL ) : an Get the specific massive actions
getSpecificValueToDisplay ( $field, $values, array $options = [] ) : return display a specific field value
getSpecificValueToSelect ( $field, $name = '', $values = '', array $options = [] ) : return display a specific field selection system
getTable ( ) : string Return the table used to stor this object
getUnallowedFieldsForUnicity ( )
getUnicityErrorMessage ( $msgs, $unicity, $doubles ) Build an unicity error message
getUnicityFieldsToDisplayInErrorMessage ( ) : an Get fields to display in the unicity error message
getValueToDisplay ( $field_id_or_search_options, $values, $options = [] ) : return display a field using standard system
getValueToSelect ( $field_id_or_search_options, $name = '', $values = '', $options = [] ) : return Select a field using standard system
initForm ( $ID, array $options = [] ) : value Initialize item and check right before managing the edit form
isDeleted ( ) : boolean Is the object deleted
isDynamic ( ) : boolean Is an object dynamic or not
isEntityAssign ( ) : boolean Is the object assigned to an entity
isEntityForwardTo ( $itemtype ) : boolean Is entity informations forward To ?
isField ( $field ) : boolean Determine if a field exists
isNewID ( $ID ) : boolean is the parameter ID must be considered as new one ? Default is empty of <0 may be overriden (for entity for example)
isNewItem ( ) : boolean is the current object a new one
isPrivate ( ) : boolean Is the object private
isRecursive ( ) : boolean Is the object recursive
isTemplate ( ) : boolean Is the object a template
listTemplates ( $itemtype, $target, $add )
maybeDeleted ( ) : boolean Is the object may be deleted
maybeDynamic ( ) : boolean Can the object be dynamic
maybePrivate ( ) : boolean Is the object may be private
maybeRecursive ( ) : boolean Is the object may be recursive
maybeTemplate ( ) : boolean Is the object may be a template
post_addItem ( ) : nothing Actions done after the ADD of the item in the database
post_deleteFromDB ( ) : nothing Actions done after the DELETE of the item in the database
post_deleteItem ( ) : nothing Actions done after the DELETE (mark as deleted) of the item in the database
post_getEmpty ( ) : nothing Actions done at the end of the getEmpty function
post_getFromDB ( ) : nothing Actions done at the end of the getFromDB function
post_purgeItem ( ) : nothing Actions done after the PURGE of the item in the database
post_restoreItem ( ) : nothing Actions done after the restore of the item
post_updateItem ( $history = 1 ) : nothing Actions done after the UPDATE of the item in the database
pre_deleteItem ( ) : boolean Actions done before the DELETE of the item in the database / Maybe used to add another check for deletion
pre_updateInDB ( ) : nothing Actions done before the UPDATE of the item in the database
prepareInputForAdd ( $input ) : the Prepare input datas for adding the item
prepareInputForUpdate ( $input ) : the Prepare input datas for updating the item
processMassiveActionsForOneItemtype ( MassiveAction $ma, CommonDBTM $item, array $ids ) : nothing Class specific execution of the massive action (new system) by itemtypes
reset ( ) Reset fields of the item
restore ( array $input, $history = 1 ) : boolean Restore an item put in the dustbin in the database.
restoreInDB ( ) : true Restore item = set deleted flag to 0
showDates ( $options = [] ) : boolean
showFormButtons ( $options = [] ) Display a 2 columns Footer for Form buttons Close the form is user can edit
showFormHeader ( $options = [] ) Display a 2 columns Header 1 for ID, 1 for recursivity menu Open the form is user can edit
showMassiveActionsSubForm ( MassiveAction $ma ) : false Class-specific method used to show the fields to specify the massive action
unsetUndisclosedFields ( array &$fields ) Actions done to not show some fields when geting a single item from API calls
update ( array $input, $history = 1, $options = [] ) : boolean Update some elements of an item in the database.
updateInDB ( $updates, $oldvalues = [] ) : nothing Update the item in the database
useDeletedToLockIfDynamic ( ) : boolean Use deleted field in case of dynamic management to lock ?

Méthodes protégées

Méthode Description
clearSavedInput ( ) Clear the saved data stored in the session
forwardEntityInformations ( ) Forward entity information to linked items
restoreInput ( array $default = [] ) : Array Get the data saved in the session
saveInput ( ) Save the input data in the Session

Method Details

__construct() public méthode

Constructor
public __construct ( )

add() public méthode

Add an item in the database with all it's items.
public add ( array $input, $options = [], $history = true ) : integer
$input array array the _POST vars returned by the item form when press add
$history boolean do history log ? (true by default)
Résultat integer the new ID of the added item (or false if fail)

addForwardEntity() static public méthode

Specificy a plugin itemtype for which entities_id and is_recursive should be forwarded
Since: 0.83
static public addForwardEntity ( $for_itemtype, $to_itemtype ) : nothing
$for_itemtype change of entity for this itemtype will be forwarder
$to_itemtype change of entity will affect this itemtype
Résultat nothing

addMessageOnAddAction() public méthode

Add a message on add action

addMessageOnDeleteAction() public méthode

Add a message on delete action

addMessageOnPurgeAction() public méthode

Add a message on purge action

addMessageOnRestoreAction() public méthode

Add a message on restore action

addMessageOnUpdateAction() public méthode

Add a message on update action

addNeededInfoToInput() public méthode

Add needed information to $input (example entities_id)
public addNeededInfoToInput ( $input ) : the
$input datas used to add the item
Résultat the modified $input array

addToDB() public méthode

Add an item to the database
public addToDB ( ) : new
Résultat new ID of the item is insert successfull else false

can() public méthode

Check right on an item
public can ( $ID, $right, array &$input = NULL ) : boolean
$ID ID of the item (-1 if new item)
$right Right to check : r / w / recursive / READ / UPDATE / DELETE
$input array
Résultat boolean

canAddItem() public méthode

Have I the global right to add an item for the Object May be overloaded if needed (ex Ticket)
public canAddItem ( $type ) : rights
$type itemtype of object to add
Résultat rights

canCreate() static public méthode

Have I the global right to "create" the Object May be overloaded if needed (ex KnowbaseItem)
static public canCreate ( ) : booleen
Résultat booleen

canCreateItem() public méthode

Default is true and check entity if the objet is entity assign May be overloaded if needed
public canCreateItem ( ) : booleen
Résultat booleen

canDelete() static public méthode

May be overloaded if needed
static public canDelete ( ) : booleen
Résultat booleen

canDeleteItem() public méthode

Default is true and check entity if the objet is entity assign May be overloaded if needed
public canDeleteItem ( ) : booleen
Résultat booleen

canEdit() public méthode

Have i right to see action button
public canEdit ( $ID ) : booleen
$ID integer ID to check
Résultat booleen

canGlobal() public méthode

Get global right on an object
public canGlobal ( $right ) : nothing
$right Right to check : c / r / w / d / READ / UPDATE / CREATE / DELETE
Résultat nothing

canMassiveAction() public méthode

check if this action can be done on this field of this item by massive actions
Since: 0.83
public canMassiveAction ( $action, $field, $value )
$action string name of the action
$field integer id of the field
$value string value of the field

canPurge() static public méthode

May be overloaded if needed
static public canPurge ( ) : booleen
Résultat booleen

canPurgeItem() public méthode

Default is true and check entity if the objet is entity assign
public canPurgeItem ( ) : booleen
Résultat booleen

canUnrecurs() public méthode

May be overloaded if needed
public canUnrecurs ( ) : booleen
Résultat booleen

canUpdate() static public méthode

Default is calling canCreate May be overloaded if needed
static public canUpdate ( ) : booleen
Résultat booleen

canUpdateItem() public méthode

Default is true and check entity if the objet is entity assign May be overloaded if needed
public canUpdateItem ( ) : booleen
Résultat booleen

canView() static public méthode

Default is true and check entity if the objet is entity assign May be overloaded if needed
static public canView ( ) : booleen
Résultat booleen

canViewItem() public méthode

Have I the right to "view" the Object May be overloaded if needed
public canViewItem ( ) : booleen
Résultat booleen

check() public méthode

Check right on an item with block
public check ( $ID, $right, array &$input = NULL ) : nothing
$ID ID of the item (-1 if new item)
$right Right to check : r / w / recursive
$input array
Résultat nothing

checkEntity() public méthode

Check if have right on this entity
public checkEntity ( $recursive = false ) : booleen
$recursive boolean set true to accept recursive items of ancestors of active entities (View case for example) (default false)
Résultat booleen

checkGlobal() public méthode

Check global right on an object
public checkGlobal ( $right ) : nothing
$right Right to check : c / r / w / d
Résultat nothing

checkSpecificValues() public méthode

Add more check for values
public checkSpecificValues ( $datatype, &$value ) : true
$datatype datatype of the value
Résultat true if value is ok, false if not

checkUnicity() public méthode

Check field unicity before insert or update
public checkUnicity ( $add = false, $options = [] ) : true
$options array
Résultat true if item can be written in DB, false if not

cleanDBonMarkDeleted() public méthode

Actions done when item flag deleted is set to an item
public cleanDBonMarkDeleted ( ) : nothing
Résultat nothing

cleanDBonPurge() public méthode

Actions done when item is deleted from the database
public cleanDBonPurge ( ) : nothing
Résultat nothing

cleanHistory() public méthode

Clean data in the tables which have linked the deleted item
public cleanHistory ( ) : nothing
Résultat nothing

cleanRelationData() public méthode

Clean data in the tables which have linked the deleted item Clear 1/N Relation
public cleanRelationData ( ) : nothing
Résultat nothing

cleanRelationTable() public méthode

Clean the date in the relation tables for the deleted item Clear N/N Relation
public cleanRelationTable ( )

cleanTranslations() public méthode

Clean translations associated to a dropdown
public cleanTranslations ( )

clearSavedInput() protected méthode

Clear the saved data stored in the session
protected clearSavedInput ( )

delete() public méthode

Delete an item in the database.
public delete ( array $input, $force, $history = 1 ) : boolean
$input array array the _POST vars returned by the item form when press delete
$force boolean force deletion (default 0)
$history boolean do history log ? (default 1)
Résultat boolean : true on success

deleteByCriteria() public méthode

Clean all infos which match some criteria
public deleteByCriteria ( $crit = [], $force, $history = 1 )
$crit array of criteria (ex array('is_active'=>'1'))
$force boolean force purge not on put in dustbin (default 0)
$history boolean do history log ? (true by default)

deleteFromDB() public méthode

Mark deleted or purge an item in the database
public deleteFromDB ( $force ) : true
$force force the purge of the item (not used if the table do not have a deleted field) (default 0)
Résultat true if succeed else false

dropdown() static public méthode

This should be overloaded in Class
static public dropdown ( $options = [] ) : nothing
$options array of possible options: Parameters which could be used in options array : - name : string / name of the select (default is depending itemtype) - value : integer / preselected value (default 0) - comments : boolean / is the comments displayed near the dropdown (default true) - entity : integer or array / restrict to a defined entity or array of entities (default -1 : no restriction) - toupdate : array / Update a specific item on select change on dropdown (need value_fieldname, to_update, url (see Ajax::updateItemOnSelectEvent for information) and may have moreparams) - used : array / Already used items ID: not to display in dropdown (default empty)
Résultat nothing display the dropdown

filterValues() public méthode

Check float and decimal values
public filterValues ( $display = true ) : input
$display display or not messages in and addAfterRedirect (true by default)
Résultat input the data checked

find() public méthode

Retrieve all items from the database
public find ( $condition = "", $order = "", $limit = "" ) : all
$condition condition used to search if needed (empty get all) (default '')
$order order field if needed (default '')
$limit limit retrieved datas if needed (default '')
Résultat all retrieved data in a associative array by id

forceTable() static public méthode

force table value (used for config management for old versions)
static public forceTable ( $table ) : nothing
$table name of the table to be forced
Résultat nothing

forwardEntityInformations() protected méthode

Forward entity information to linked items

generateLinkContents() static public méthode

Generate link
static public generateLinkContents ( $link, CommonDBTM $item ) : array
$link string original string content
$item CommonDBTM CommonDBTM object: item used to make replacements
Résultat array of link contents (may have several when item have several IP / MAC cases)

getComments() public méthode

Get comments of the Object
public getComments ( ) : String:
Résultat String:

getCompleteNameField() static public méthode

static public getCompleteNameField ( )

getEmpty() public méthode

Get an empty item
public getEmpty ( ) : true
Résultat true if succeed else false

getEntityID() public méthode

Can be overloaded (ex : infocom)
public getEntityID ( ) : ID
Résultat ID of the entity

getField() public méthode

Return a field Value if exists
public getField ( $field ) : value
$field field name
Résultat value of the field / false if not exists

getForbiddenStandardMassiveAction() public méthode

Get the standard massive actions which are forbidden
public getForbiddenStandardMassiveAction ( ) : an
Résultat an array of massive actions

getForeignKeyField() static public méthode

static public getForeignKeyField ( )

getFromDB() public méthode

Retrieve an item from the database
public getFromDB ( $ID ) : true
$ID ID of the item to get
Résultat true if succeed else false

getFromDBByQuery() public méthode

Retrieve an item from the database by query. The query must include the WHERE keyword. Thus, we can replace "WHERE" to make complex SQL JOINED queries (for instance, see User::getFromDBbyEmail()).
public getFromDBByQuery ( $query ) : true
$query the "WHERE" or "JOIN" part of the SQL query
Résultat true if succeed else false

getID() public méthode

Get the identifier of the current item
public getID ( ) : ID
Résultat ID

getIndexName() static public méthode

Get the name of the index field
static public getIndexName ( ) : name
Résultat name of the index field

getItemEntity() static public méthode

get the Entity of an Item
static public getItemEntity ( $itemtype, $items_id ) : integer
$itemtype string item type
$items_id integer id of the item
Résultat integer ID of the entity or -1

getLinkURL() public méthode

Get the link url to an item
public getLinkURL ( ) : string
Résultat string : HTML link

getLinkedItems() public méthode

Return the linked items (in computers_items)
public getLinkedItems ( ) : an
Résultat an array of linked items like array('Computer' => array(1,2), 'Printer' => array(5,6))

getLinkedItemsCount() public méthode

Return the count of linked items (in computers_items)
public getLinkedItemsCount ( ) : number
Résultat number of linked items

getLogTypeID() public méthode

Get type to register log on
public getLogTypeID ( ) : array
Résultat array of type + ID

getMassiveActionsForItemtype() static public méthode

Get all the massive actions available for the current class regarding given itemtype
static public getMassiveActionsForItemtype ( array &$actions, $itemtype, $is_deleted, CommonDBTM $checkitem = NULL ) : nothing
$actions array array of the actions to update
$itemtype the type of the item for which we want the actions
$is_deleted (default 0)
$checkitem CommonDBTM (default NULL)
Résultat nothing (update is set inside $actions)

getName() public méthode

Get the name of the object
See also: CommonDBTM::getRawCompleteName
See also: CommonDBTM::getRawName
public getName ( $options = [] ) : String:
$options array of options - comments : boolean / display comments - complete : boolean / display completename instead of name - additional : boolean / display aditionals information
Résultat String:

getNameField() static public méthode

static public getNameField ( )

getNameID() public méthode

Get the name of the object with the ID if the config is set Should Not be overloaded (overload getName() instead)
See also: CommonDBTM::getName
public getNameID ( $options = [] ) : String:
$options array of options - comments : boolean / display comments - complete : boolean / display completename instead of name - additional : boolean / display aditionals information - forceid : boolean override config and display item's ID (false by default)
Résultat String:

getOptions() public méthode

Get search options
public getOptions ( ) : then
Résultat then search option array

getPostAdditionalInfosForName() public méthode

Get additionals information to add after name
public getPostAdditionalInfosForName ( ) : String:
Résultat String:

getPreAdditionalInfosForName() public méthode

Get additionals information to add before name
public getPreAdditionalInfosForName ( ) : String:
Résultat String:

getRawCompleteName() public méthode

Get raw completename of the object Maybe overloaded
See also: CommonDBTM::getCompleteNameField
public getRawCompleteName ( )

getRawName() public méthode

Get raw name of the object Maybe overloaded
See also: CommonDBTM::getNameField
public getRawName ( )

getRights() public méthode

Get rights for an item _ may be overload by object
public getRights ( $interface = 'central' ) : array
$interface string (defalt 'central')
Résultat array of rights to display

getSearchOptionByField() public méthode

Return a search option by looking for a value of a specific field and maybe a specific table
public getSearchOptionByField ( $field, $value, $table = '' ) : then
$field the field in which looking for the value (for example : table, name, etc)
$value the value to look for in the field
$table the table (default '')
Résultat then search option array, or an empty array if not found

getSearchOptionIDByField() public méthode

Return a search option ID by looking for a value of a specific field and maybe a specific table
public getSearchOptionIDByField ( $field, $value, $table = '' ) : then
$field the field in which looking for the value (for example : table, name, etc)
$value the value to look for in the field
$table the table (default '')
Résultat then search option id, or -1 if not found

getSearchOptions() public méthode

This should be overloaded in Class
public getSearchOptions ( ) : an
Résultat an array of search options More information on https://forge.indepnet.net/wiki/glpi/SearchEngine

getSpecificMassiveActions() public méthode

Get the specific massive actions
public getSpecificMassiveActions ( $checkitem = NULL ) : an
$checkitem link item to check right (default NULL)
Résultat an array of massive actions

getSpecificValueToDisplay() static public méthode

display a specific field value
static public getSpecificValueToDisplay ( $field, $values, array $options = [] ) : return
$field String name of the field
$values String/Array with the value to display or a Single value
$options array Array of options
Résultat return the string to display

getSpecificValueToSelect() static public méthode

display a specific field selection system
static public getSpecificValueToSelect ( $field, $name = '', $values = '', array $options = [] ) : return
$field String name of the field
$name string name of the select (if empty use linkfield) (default '')
$values String/Array with the value to select or a Single value (default '')
$options array Array of options
Résultat return the string to display

getTable() static public méthode

Return the table used to stor this object
static public getTable ( ) : string
Résultat string

getUnallowedFieldsForUnicity() public méthode

getUnicityErrorMessage() public méthode

Build an unicity error message
public getUnicityErrorMessage ( $msgs, $unicity, $doubles )
$msgs the string not transleted to be display on the screen, or to be sent in a notification
$unicity the unicity criterion that failed to match
$doubles the items that are already present in DB

getUnicityFieldsToDisplayInErrorMessage() public méthode

Get fields to display in the unicity error message
public getUnicityFieldsToDisplayInErrorMessage ( ) : an
Résultat an array which contains field => label

getValueToDisplay() public méthode

display a field using standard system
public getValueToDisplay ( $field_id_or_search_options, $values, $options = [] ) : return
$field_id_or_search_options integer/string/array id of the search option field or field name or search option array
$values mixed value to display
$options array of possible options: Parameters which could be used in options array : - comments : boolean / is the comments displayed near the value (default false) - any others options passed to specific display method
Résultat return the string to display

getValueToSelect() public méthode

Select a field using standard system
public getValueToSelect ( $field_id_or_search_options, $name = '', $values = '', $options = [] ) : return
$field_id_or_search_options integer/string/array id of the search option field or field name or search option array
$name string name of the select (if empty use linkfield) (default '')
$values mixed default value to display (default '')
$options array of possible options: Parameters which could be used in options array : - comments : boolean / is the comments displayed near the value (default false) - any others options passed to specific display method
Résultat return the string to display

initForm() public méthode

Initialize item and check right before managing the edit form
public initForm ( $ID, array $options = [] ) : value
$ID Integer ID of the item/template
$options array Array of possible options: - withtemplate : 1 for newtemplate, 2 for newobject from template
Résultat value of withtemplate option (exit of no right)

isDeleted() public méthode

Is the object deleted
public isDeleted ( ) : boolean
Résultat boolean

isDynamic() public méthode

Is an object dynamic or not
Since: 0.84
public isDynamic ( ) : boolean
Résultat boolean

isEntityAssign() public méthode

Can be overloaded (ex : infocom)
public isEntityAssign ( ) : boolean
Résultat boolean

isEntityForwardTo() static public méthode

Is entity informations forward To ?
Since: 0.84
static public isEntityForwardTo ( $itemtype ) : boolean
$itemtype itemtype to check
Résultat boolean

isField() public méthode

Determine if a field exists
public isField ( $field ) : boolean
$field field name
Résultat boolean

isNewID() static public méthode

is the parameter ID must be considered as new one ? Default is empty of <0 may be overriden (for entity for example)
static public isNewID ( $ID ) : boolean
$ID ID of the item (-1 if new item)
Résultat boolean

isNewItem() public méthode

is the current object a new one
public isNewItem ( ) : boolean
Résultat boolean

isPrivate() public méthode

Is the object private
public isPrivate ( ) : boolean
Résultat boolean

isRecursive() public méthode

Can be overloaded (ex : infocom)
public isRecursive ( ) : boolean
Résultat boolean

isTemplate() public méthode

Is the object a template
public isTemplate ( ) : boolean
Résultat boolean

listTemplates() static public méthode

static public listTemplates ( $itemtype, $target, $add )
$itemtype
$target
$add (default 0)

maybeDeleted() public méthode

Is the object may be deleted
public maybeDeleted ( ) : boolean
Résultat boolean

maybeDynamic() public méthode

Can the object be dynamic
Since: 0.84
public maybeDynamic ( ) : boolean
Résultat boolean

maybePrivate() public méthode

Is the object may be private
public maybePrivate ( ) : boolean
Résultat boolean

maybeRecursive() public méthode

Can be overloaded (ex : infocom)
public maybeRecursive ( ) : boolean
Résultat boolean

maybeTemplate() public méthode

Is the object may be a template
public maybeTemplate ( ) : boolean
Résultat boolean

post_addItem() public méthode

Actions done after the ADD of the item in the database
public post_addItem ( ) : nothing
Résultat nothing

post_deleteFromDB() public méthode

Actions done after the DELETE of the item in the database
public post_deleteFromDB ( ) : nothing
Résultat nothing

post_deleteItem() public méthode

Actions done after the DELETE (mark as deleted) of the item in the database
public post_deleteItem ( ) : nothing
Résultat nothing

post_getEmpty() public méthode

Actions done at the end of the getEmpty function
public post_getEmpty ( ) : nothing
Résultat nothing

post_getFromDB() public méthode

Actions done at the end of the getFromDB function
public post_getFromDB ( ) : nothing
Résultat nothing

post_purgeItem() public méthode

Actions done after the PURGE of the item in the database
public post_purgeItem ( ) : nothing
Résultat nothing

post_restoreItem() public méthode

Actions done after the restore of the item
public post_restoreItem ( ) : nothing
Résultat nothing

post_updateItem() public méthode

Actions done after the UPDATE of the item in the database
public post_updateItem ( $history = 1 ) : nothing
$history store changes history ? (default 1)
Résultat nothing

pre_deleteItem() public méthode

Actions done before the DELETE of the item in the database / Maybe used to add another check for deletion
public pre_deleteItem ( ) : boolean
Résultat boolean : true if item need to be deleted else false

pre_updateInDB() public méthode

Actions done before the UPDATE of the item in the database
public pre_updateInDB ( ) : nothing
Résultat nothing

prepareInputForAdd() public méthode

Prepare input datas for adding the item
public prepareInputForAdd ( $input ) : the
$input datas used to add the item
Résultat the modified $input array

prepareInputForUpdate() public méthode

Prepare input datas for updating the item
public prepareInputForUpdate ( $input ) : the
$input datas used to update the item
Résultat the modified $input array

processMassiveActionsForOneItemtype() static public méthode

Class specific execution of the massive action (new system) by itemtypes
static public processMassiveActionsForOneItemtype ( MassiveAction $ma, CommonDBTM $item, array $ids ) : nothing
$ma MassiveAction the current massive action object
$item CommonDBTM the item on which apply the massive action
$ids array an array of the ids of the item on which apply the action
Résultat nothing (direct submit to $ma object)

reset() public méthode

Reset fields of the item
public reset ( )

restore() public méthode

Restore an item put in the dustbin in the database.
public restore ( array $input, $history = 1 ) : boolean
$input array array the _POST vars returned by the item form when press restore
$history boolean do history log ? (default 1)
Résultat boolean : true on success

restoreInDB() public méthode

Restore item = set deleted flag to 0
public restoreInDB ( ) : true
Résultat true if succeed else false

restoreInput() protected méthode

Get the data saved in the session
protected restoreInput ( array $default = [] ) : Array
$default array Array of value used if session is empty
Résultat Array of value

saveInput() protected méthode

Save the input data in the Session
protected saveInput ( )

showDates() public méthode

public showDates ( $options = [] ) : boolean
$options array
Résultat boolean

showFormButtons() public méthode

Display a 2 columns Footer for Form buttons Close the form is user can edit
public showFormButtons ( $options = [] )
$options array of possible options: - withtemplate : 1 for newtemplate, 2 for newobject from template - colspan for each column (default 2) - candel : set to false to hide "delete" button - canedit : set to false to hide all buttons - addbuttons : array of buttons to add

showFormHeader() public méthode

Display a 2 columns Header 1 for ID, 1 for recursivity menu Open the form is user can edit
public showFormHeader ( $options = [] )
$options array of possible options: - target for the Form - withtemplate : 1 for newtemplate, 2 for newobject from template - colspan for each column (default 2) - formoptions string (javascript p.e.) - canedit boolean edit mode of form ?

showMassiveActionsSubForm() static public méthode

Class-specific method used to show the fields to specify the massive action
static public showMassiveActionsSubForm ( MassiveAction $ma ) : false
$ma MassiveAction the current massive action object
Résultat false if parameters displayed ?

unsetUndisclosedFields() public static méthode

Actions done to not show some fields when geting a single item from API calls
public static unsetUndisclosedFields ( array &$fields )
$fields array Fields to unset undiscloseds

update() public méthode

Update some elements of an item in the database.
public update ( array $input, $history = 1, $options = [] ) : boolean
$input array array the _POST vars returned by the item form when press update
$history boolean do history log ? (default 1)
Résultat boolean : true on success

updateInDB() public méthode

Update the item in the database
public updateInDB ( $updates, $oldvalues = [] ) : nothing
$updates fields to update
$oldvalues array of old values of the updated fields
Résultat nothing

useDeletedToLockIfDynamic() public méthode

need to be overriden if object need to use standard deleted management (Computer...)
Since: 0.84
public useDeletedToLockIfDynamic ( ) : boolean
Résultat boolean

Property Details

$additional_fields_for_dictionnary public_oe property

Additional fiedls for dictionnary processing
public $additional_fields_for_dictionnary

$auto_message_on_action public_oe property

Set false to desactivate automatic message on action
public $auto_message_on_action

$dohistory public_oe property

Make an history of the changes
public $dohistory

$fields public_oe property

Data of the Item
public $fields

$fkfield protected_oe property

Foreign key field cache : set dynamically calling getForeignKeyField
protected $fkfield

$forward_entity_to protected_oe static_oe property

Forward entity datas to linked items
protected static $forward_entity_to

$get_item_to_display_tab public_oe property

Need to get item to show tab
public $get_item_to_display_tab

$history_blacklist public_oe property

Black list fields for history log or date mod update
public $history_blacklist

$mailqueueonaction public_oe property

FLush mail queue for
public $mailqueueonaction

$no_form_page public_oe property

Set true to desactivate link generation because form page do not permit show/edit item
public $no_form_page

$notable protected_oe static_oe property

Set true to desactivate auto compute table name
protected static $notable

$plugins_forward_entity protected_oe static_oe property

Forward entity to plugins itemtypes
protected static $plugins_forward_entity

$rightname static_oe public_oe property

Profile name
static public $rightname

$searchopt protected_oe property

Search options of the item : to avoid multiple load
protected $searchopt

$taborientation public_oe property

Tab orientation : horizontal or vertical
public $taborientation

$usenotepad protected_oe property

Is this item use notepad ?
protected $usenotepad