PHP Class CommonDBTM, glpi

Inheritance: extends CommonGLPI
Exibir arquivo Open project: glpi-project/glpi Class Usage Examples

Public Properties

Property 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

Property 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 ?

Public Methods

Method 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 ?

Protected Methods

Method 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 method

Constructor
public __construct ( )

add() public method

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)
return integer the new ID of the added item (or false if fail)

addForwardEntity() static public method

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
return nothing

addMessageOnAddAction() public method

Add a message on add action

addMessageOnDeleteAction() public method

Add a message on delete action

addMessageOnPurgeAction() public method

Add a message on purge action

addMessageOnRestoreAction() public method

Add a message on restore action

addMessageOnUpdateAction() public method

Add a message on update action

addNeededInfoToInput() public method

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

addToDB() public method

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

can() public method

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
return boolean

canAddItem() public method

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
return rights

canCreate() static public method

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

canCreateItem() public method

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

canDelete() static public method

May be overloaded if needed
static public canDelete ( ) : booleen
return booleen

canDeleteItem() public method

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

canEdit() public method

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

canGlobal() public method

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

canMassiveAction() public method

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 method

May be overloaded if needed
static public canPurge ( ) : booleen
return booleen

canPurgeItem() public method

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

canUnrecurs() public method

May be overloaded if needed
public canUnrecurs ( ) : booleen
return booleen

canUpdate() static public method

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

canUpdateItem() public method

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

canView() static public method

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

canViewItem() public method

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

check() public method

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
return nothing

checkEntity() public method

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)
return booleen

checkGlobal() public method

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

checkSpecificValues() public method

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

checkUnicity() public method

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

cleanDBonMarkDeleted() public method

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

cleanDBonPurge() public method

Actions done when item is deleted from the database
public cleanDBonPurge ( ) : nothing
return nothing

cleanHistory() public method

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

cleanRelationData() public method

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

cleanRelationTable() public method

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

cleanTranslations() public method

Clean translations associated to a dropdown
public cleanTranslations ( )

clearSavedInput() protected method

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

delete() public method

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)
return boolean : true on success

deleteByCriteria() public method

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 method

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)
return true if succeed else false

dropdown() static public method

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)
return nothing display the dropdown

filterValues() public method

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

find() public method

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 '')
return all retrieved data in a associative array by id

forceTable() static public method

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

forwardEntityInformations() protected method

Forward entity information to linked items

generateLinkContents() static public method

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

getComments() public method

Get comments of the Object
public getComments ( ) : String:
return String:

getCompleteNameField() static public method

static public getCompleteNameField ( )

getEmpty() public method

Get an empty item
public getEmpty ( ) : true
return true if succeed else false

getEntityID() public method

Can be overloaded (ex : infocom)
public getEntityID ( ) : ID
return ID of the entity

getField() public method

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

getForbiddenStandardMassiveAction() public method

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

getForeignKeyField() static public method

static public getForeignKeyField ( )

getFromDB() public method

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

getFromDBByQuery() public method

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
return true if succeed else false

getID() public method

Get the identifier of the current item
public getID ( ) : ID
return ID

getIndexName() static public method

Get the name of the index field
static public getIndexName ( ) : name
return name of the index field

getItemEntity() static public method

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

getLinkURL() public method

Get the link url to an item
public getLinkURL ( ) : string
return string : HTML link

getLinkedItems() public method

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

getLinkedItemsCount() public method

Return the count of linked items (in computers_items)
public getLinkedItemsCount ( ) : number
return number of linked items

getLogTypeID() public method

Get type to register log on
public getLogTypeID ( ) : array
return array of type + ID

getMassiveActionsForItemtype() static public method

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)
return nothing (update is set inside $actions)

getName() public method

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
return String:

getNameField() static public method

static public getNameField ( )

getNameID() public method

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)
return String:

getOptions() public method

Get search options
public getOptions ( ) : then
return then search option array

getPostAdditionalInfosForName() public method

Get additionals information to add after name
public getPostAdditionalInfosForName ( ) : String:
return String:

getPreAdditionalInfosForName() public method

Get additionals information to add before name
public getPreAdditionalInfosForName ( ) : String:
return String:

getRawCompleteName() public method

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

getRawName() public method

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

getRights() public method

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

getSearchOptionByField() public method

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 '')
return then search option array, or an empty array if not found

getSearchOptionIDByField() public method

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 '')
return then search option id, or -1 if not found

getSearchOptions() public method

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

getSpecificMassiveActions() public method

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

getSpecificValueToDisplay() static public method

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
return return the string to display

getSpecificValueToSelect() static public method

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
return return the string to display

getTable() static public method

Return the table used to stor this object
static public getTable ( ) : string
return string

getUnallowedFieldsForUnicity() public method

getUnicityErrorMessage() public method

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 method

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

getValueToDisplay() public method

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
return return the string to display

getValueToSelect() public method

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
return return the string to display

initForm() public method

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
return value of withtemplate option (exit of no right)

isDeleted() public method

Is the object deleted
public isDeleted ( ) : boolean
return boolean

isDynamic() public method

Is an object dynamic or not
Since: 0.84
public isDynamic ( ) : boolean
return boolean

isEntityAssign() public method

Can be overloaded (ex : infocom)
public isEntityAssign ( ) : boolean
return boolean

isEntityForwardTo() static public method

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

isField() public method

Determine if a field exists
public isField ( $field ) : boolean
$field field name
return boolean

isNewID() static public method

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)
return boolean

isNewItem() public method

is the current object a new one
public isNewItem ( ) : boolean
return boolean

isPrivate() public method

Is the object private
public isPrivate ( ) : boolean
return boolean

isRecursive() public method

Can be overloaded (ex : infocom)
public isRecursive ( ) : boolean
return boolean

isTemplate() public method

Is the object a template
public isTemplate ( ) : boolean
return boolean

listTemplates() static public method

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

maybeDeleted() public method

Is the object may be deleted
public maybeDeleted ( ) : boolean
return boolean

maybeDynamic() public method

Can the object be dynamic
Since: 0.84
public maybeDynamic ( ) : boolean
return boolean

maybePrivate() public method

Is the object may be private
public maybePrivate ( ) : boolean
return boolean

maybeRecursive() public method

Can be overloaded (ex : infocom)
public maybeRecursive ( ) : boolean
return boolean

maybeTemplate() public method

Is the object may be a template
public maybeTemplate ( ) : boolean
return boolean

post_addItem() public method

Actions done after the ADD of the item in the database
public post_addItem ( ) : nothing
return nothing

post_deleteFromDB() public method

Actions done after the DELETE of the item in the database
public post_deleteFromDB ( ) : nothing
return nothing

post_deleteItem() public method

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

post_getEmpty() public method

Actions done at the end of the getEmpty function
public post_getEmpty ( ) : nothing
return nothing

post_getFromDB() public method

Actions done at the end of the getFromDB function
public post_getFromDB ( ) : nothing
return nothing

post_purgeItem() public method

Actions done after the PURGE of the item in the database
public post_purgeItem ( ) : nothing
return nothing

post_restoreItem() public method

Actions done after the restore of the item
public post_restoreItem ( ) : nothing
return nothing

post_updateItem() public method

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

pre_deleteItem() public method

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

pre_updateInDB() public method

Actions done before the UPDATE of the item in the database
public pre_updateInDB ( ) : nothing
return nothing

prepareInputForAdd() public method

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

prepareInputForUpdate() public method

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

processMassiveActionsForOneItemtype() static public method

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
return nothing (direct submit to $ma object)

reset() public method

Reset fields of the item
public reset ( )

restore() public method

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)
return boolean : true on success

restoreInDB() public method

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

restoreInput() protected method

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

saveInput() protected method

Save the input data in the Session
protected saveInput ( )

showDates() public method

public showDates ( $options = [] ) : boolean
$options array
return boolean

showFormButtons() public method

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 method

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 method

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
return false if parameters displayed ?

unsetUndisclosedFields() public static method

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 method

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)
return boolean : true on success

updateInDB() public method

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

useDeletedToLockIfDynamic() public method

need to be overriden if object need to use standard deleted management (Computer...)
Since: 0.84

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