PHP Класс CommonDBTM, glpi

Наследование: extends CommonGLPI
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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)

Свойство Тип Описание
$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 ?

Открытые методы

Метод Описание
__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 ?

Защищенные методы

Метод Описание
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

Описание методов

__construct() публичный Метод

Constructor
public __construct ( )

add() публичный Метод

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)
Результат integer the new ID of the added item (or false if fail)

addForwardEntity() статический публичный Метод

Specificy a plugin itemtype for which entities_id and is_recursive should be forwarded
С версии: 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
Результат nothing

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() публичный Метод

Add needed information to $input (example entities_id)
public addNeededInfoToInput ( $input ) : the
$input datas used to add the item
Результат the modified $input array

addToDB() публичный Метод

Add an item to the database
public addToDB ( ) : new
Результат new ID of the item is insert successfull else false

can() публичный Метод

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
Результат boolean

canAddItem() публичный Метод

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
Результат rights

canCreate() статический публичный Метод

Have I the global right to "create" the Object May be overloaded if needed (ex KnowbaseItem)
static public canCreate ( ) : booleen
Результат booleen

canCreateItem() публичный Метод

Default is true and check entity if the objet is entity assign May be overloaded if needed
public canCreateItem ( ) : booleen
Результат booleen

canDelete() статический публичный Метод

May be overloaded if needed
static public canDelete ( ) : booleen
Результат booleen

canDeleteItem() публичный Метод

Default is true and check entity if the objet is entity assign May be overloaded if needed
public canDeleteItem ( ) : booleen
Результат booleen

canEdit() публичный Метод

Have i right to see action button
public canEdit ( $ID ) : booleen
$ID integer ID to check
Результат booleen

canGlobal() публичный Метод

Get global right on an object
public canGlobal ( $right ) : nothing
$right Right to check : c / r / w / d / READ / UPDATE / CREATE / DELETE
Результат nothing

canMassiveAction() публичный Метод

check if this action can be done on this field of this item by massive actions
С версии: 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() статический публичный Метод

May be overloaded if needed
static public canPurge ( ) : booleen
Результат booleen

canPurgeItem() публичный Метод

Default is true and check entity if the objet is entity assign
public canPurgeItem ( ) : booleen
Результат booleen

canUnrecurs() публичный Метод

May be overloaded if needed
public canUnrecurs ( ) : booleen
Результат booleen

canUpdate() статический публичный Метод

Default is calling canCreate May be overloaded if needed
static public canUpdate ( ) : booleen
Результат booleen

canUpdateItem() публичный Метод

Default is true and check entity if the objet is entity assign May be overloaded if needed
public canUpdateItem ( ) : booleen
Результат booleen

canView() статический публичный Метод

Default is true and check entity if the objet is entity assign May be overloaded if needed
static public canView ( ) : booleen
Результат booleen

canViewItem() публичный Метод

Have I the right to "view" the Object May be overloaded if needed
public canViewItem ( ) : booleen
Результат booleen

check() публичный Метод

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
Результат nothing

checkEntity() публичный Метод

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)
Результат booleen

checkGlobal() публичный Метод

Check global right on an object
public checkGlobal ( $right ) : nothing
$right Right to check : c / r / w / d
Результат nothing

checkSpecificValues() публичный Метод

Add more check for values
public checkSpecificValues ( $datatype, &$value ) : true
$datatype datatype of the value
Результат true if value is ok, false if not

checkUnicity() публичный Метод

Check field unicity before insert or update
public checkUnicity ( $add = false, $options = [] ) : true
$options array
Результат true if item can be written in DB, false if not

cleanDBonMarkDeleted() публичный Метод

Actions done when item flag deleted is set to an item
public cleanDBonMarkDeleted ( ) : nothing
Результат nothing

cleanDBonPurge() публичный Метод

Actions done when item is deleted from the database
public cleanDBonPurge ( ) : nothing
Результат nothing

cleanHistory() публичный Метод

Clean data in the tables which have linked the deleted item
public cleanHistory ( ) : nothing
Результат nothing

cleanRelationData() публичный Метод

Clean data in the tables which have linked the deleted item Clear 1/N Relation
public cleanRelationData ( ) : nothing
Результат nothing

cleanRelationTable() публичный Метод

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

cleanTranslations() публичный Метод

Clean translations associated to a dropdown
public cleanTranslations ( )

clearSavedInput() защищенный Метод

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

delete() публичный Метод

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)
Результат boolean : true on success

deleteByCriteria() публичный Метод

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() публичный Метод

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)
Результат true if succeed else false

dropdown() статический публичный Метод

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)
Результат nothing display the dropdown

filterValues() публичный Метод

Check float and decimal values
public filterValues ( $display = true ) : input
$display display or not messages in and addAfterRedirect (true by default)
Результат input the data checked

find() публичный Метод

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 '')
Результат all retrieved data in a associative array by id

forceTable() статический публичный Метод

force table value (used for config management for old versions)
static public forceTable ( $table ) : nothing
$table name of the table to be forced
Результат nothing

forwardEntityInformations() защищенный Метод

Forward entity information to linked items

generateLinkContents() статический публичный Метод

Generate link
static public generateLinkContents ( $link, CommonDBTM $item ) : array
$link string original string content
$item CommonDBTM CommonDBTM object: item used to make replacements
Результат array of link contents (may have several when item have several IP / MAC cases)

getComments() публичный Метод

Get comments of the Object
public getComments ( ) : String:
Результат String:

getCompleteNameField() статический публичный Метод

static public getCompleteNameField ( )

getEmpty() публичный Метод

Get an empty item
public getEmpty ( ) : true
Результат true if succeed else false

getEntityID() публичный Метод

Can be overloaded (ex : infocom)
public getEntityID ( ) : ID
Результат ID of the entity

getField() публичный Метод

Return a field Value if exists
public getField ( $field ) : value
$field field name
Результат value of the field / false if not exists

getForbiddenStandardMassiveAction() публичный Метод

Get the standard massive actions which are forbidden
public getForbiddenStandardMassiveAction ( ) : an
Результат an array of massive actions

getForeignKeyField() статический публичный Метод

static public getForeignKeyField ( )

getFromDB() публичный Метод

Retrieve an item from the database
public getFromDB ( $ID ) : true
$ID ID of the item to get
Результат true if succeed else false

getFromDBByQuery() публичный Метод

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
Результат true if succeed else false

getID() публичный Метод

Get the identifier of the current item
public getID ( ) : ID
Результат ID

getIndexName() статический публичный Метод

Get the name of the index field
static public getIndexName ( ) : name
Результат name of the index field

getItemEntity() статический публичный Метод

get the Entity of an Item
static public getItemEntity ( $itemtype, $items_id ) : integer
$itemtype string item type
$items_id integer id of the item
Результат integer ID of the entity or -1

getLinkURL() публичный Метод

Get the link url to an item
public getLinkURL ( ) : string
Результат string : HTML link

getLinkedItems() публичный Метод

Return the linked items (in computers_items)
public getLinkedItems ( ) : an
Результат an array of linked items like array('Computer' => array(1,2), 'Printer' => array(5,6))

getLinkedItemsCount() публичный Метод

Return the count of linked items (in computers_items)
public getLinkedItemsCount ( ) : number
Результат number of linked items

getLogTypeID() публичный Метод

Get type to register log on
public getLogTypeID ( ) : array
Результат array of type + ID

getMassiveActionsForItemtype() статический публичный Метод

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)
Результат nothing (update is set inside $actions)

getName() публичный Метод

Get the name of the object
См. также: CommonDBTM::getRawCompleteName
См. также: 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
Результат String:

getNameField() статический публичный Метод

static public getNameField ( )

getNameID() публичный Метод

Get the name of the object with the ID if the config is set Should Not be overloaded (overload getName() instead)
См. также: 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)
Результат String:

getOptions() публичный Метод

Get search options
public getOptions ( ) : then
Результат then search option array

getPostAdditionalInfosForName() публичный Метод

Get additionals information to add after name
public getPostAdditionalInfosForName ( ) : String:
Результат String:

getPreAdditionalInfosForName() публичный Метод

Get additionals information to add before name
public getPreAdditionalInfosForName ( ) : String:
Результат String:

getRawCompleteName() публичный Метод

Get raw completename of the object Maybe overloaded
См. также: CommonDBTM::getCompleteNameField
public getRawCompleteName ( )

getRawName() публичный Метод

Get raw name of the object Maybe overloaded
См. также: CommonDBTM::getNameField
public getRawName ( )

getRights() публичный Метод

Get rights for an item _ may be overload by object
public getRights ( $interface = 'central' ) : array
$interface string (defalt 'central')
Результат array of rights to display

getSearchOptionByField() публичный Метод

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 '')
Результат then search option array, or an empty array if not found

getSearchOptionIDByField() публичный Метод

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 '')
Результат then search option id, or -1 if not found

getSearchOptions() публичный Метод

This should be overloaded in Class
public getSearchOptions ( ) : an
Результат an array of search options More information on https://forge.indepnet.net/wiki/glpi/SearchEngine

getSpecificMassiveActions() публичный Метод

Get the specific massive actions
public getSpecificMassiveActions ( $checkitem = NULL ) : an
$checkitem link item to check right (default NULL)
Результат an array of massive actions

getSpecificValueToDisplay() статический публичный Метод

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

getSpecificValueToSelect() статический публичный Метод

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

getTable() статический публичный Метод

Return the table used to stor this object
static public getTable ( ) : string
Результат string

getUnallowedFieldsForUnicity() публичный Метод

getUnicityErrorMessage() публичный Метод

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() публичный Метод

Get fields to display in the unicity error message
public getUnicityFieldsToDisplayInErrorMessage ( ) : an
Результат an array which contains field => label

getValueToDisplay() публичный Метод

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

getValueToSelect() публичный Метод

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

initForm() публичный Метод

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
Результат value of withtemplate option (exit of no right)

isDeleted() публичный Метод

Is the object deleted
public isDeleted ( ) : boolean
Результат boolean

isDynamic() публичный Метод

Is an object dynamic or not
С версии: 0.84
public isDynamic ( ) : boolean
Результат boolean

isEntityAssign() публичный Метод

Can be overloaded (ex : infocom)
public isEntityAssign ( ) : boolean
Результат boolean

isEntityForwardTo() статический публичный Метод

Is entity informations forward To ?
С версии: 0.84
static public isEntityForwardTo ( $itemtype ) : boolean
$itemtype itemtype to check
Результат boolean

isField() публичный Метод

Determine if a field exists
public isField ( $field ) : boolean
$field field name
Результат boolean

isNewID() статический публичный Метод

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)
Результат boolean

isNewItem() публичный Метод

is the current object a new one
public isNewItem ( ) : boolean
Результат boolean

isPrivate() публичный Метод

Is the object private
public isPrivate ( ) : boolean
Результат boolean

isRecursive() публичный Метод

Can be overloaded (ex : infocom)
public isRecursive ( ) : boolean
Результат boolean

isTemplate() публичный Метод

Is the object a template
public isTemplate ( ) : boolean
Результат boolean

listTemplates() статический публичный Метод

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

maybeDeleted() публичный Метод

Is the object may be deleted
public maybeDeleted ( ) : boolean
Результат boolean

maybeDynamic() публичный Метод

Can the object be dynamic
С версии: 0.84
public maybeDynamic ( ) : boolean
Результат boolean

maybePrivate() публичный Метод

Is the object may be private
public maybePrivate ( ) : boolean
Результат boolean

maybeRecursive() публичный Метод

Can be overloaded (ex : infocom)
public maybeRecursive ( ) : boolean
Результат boolean

maybeTemplate() публичный Метод

Is the object may be a template
public maybeTemplate ( ) : boolean
Результат boolean

post_addItem() публичный Метод

Actions done after the ADD of the item in the database
public post_addItem ( ) : nothing
Результат nothing

post_deleteFromDB() публичный Метод

Actions done after the DELETE of the item in the database
public post_deleteFromDB ( ) : nothing
Результат nothing

post_deleteItem() публичный Метод

Actions done after the DELETE (mark as deleted) of the item in the database
public post_deleteItem ( ) : nothing
Результат nothing

post_getEmpty() публичный Метод

Actions done at the end of the getEmpty function
public post_getEmpty ( ) : nothing
Результат nothing

post_getFromDB() публичный Метод

Actions done at the end of the getFromDB function
public post_getFromDB ( ) : nothing
Результат nothing

post_purgeItem() публичный Метод

Actions done after the PURGE of the item in the database
public post_purgeItem ( ) : nothing
Результат nothing

post_restoreItem() публичный Метод

Actions done after the restore of the item
public post_restoreItem ( ) : nothing
Результат nothing

post_updateItem() публичный Метод

Actions done after the UPDATE of the item in the database
public post_updateItem ( $history = 1 ) : nothing
$history store changes history ? (default 1)
Результат nothing

pre_deleteItem() публичный Метод

Actions done before the DELETE of the item in the database / Maybe used to add another check for deletion
public pre_deleteItem ( ) : boolean
Результат boolean : true if item need to be deleted else false

pre_updateInDB() публичный Метод

Actions done before the UPDATE of the item in the database
public pre_updateInDB ( ) : nothing
Результат nothing

prepareInputForAdd() публичный Метод

Prepare input datas for adding the item
public prepareInputForAdd ( $input ) : the
$input datas used to add the item
Результат the modified $input array

prepareInputForUpdate() публичный Метод

Prepare input datas for updating the item
public prepareInputForUpdate ( $input ) : the
$input datas used to update the item
Результат the modified $input array

processMassiveActionsForOneItemtype() статический публичный Метод

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
Результат nothing (direct submit to $ma object)

reset() публичный Метод

Reset fields of the item
public reset ( )

restore() публичный Метод

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)
Результат boolean : true on success

restoreInDB() публичный Метод

Restore item = set deleted flag to 0
public restoreInDB ( ) : true
Результат true if succeed else false

restoreInput() защищенный Метод

Get the data saved in the session
protected restoreInput ( array $default = [] ) : Array
$default array Array of value used if session is empty
Результат Array of value

saveInput() защищенный Метод

Save the input data in the Session
protected saveInput ( )

showDates() публичный Метод

public showDates ( $options = [] ) : boolean
$options array
Результат boolean

showFormButtons() публичный Метод

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() публичный Метод

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() статический публичный Метод

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
Результат false if parameters displayed ?

unsetUndisclosedFields() публичный статический Метод

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() публичный Метод

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)
Результат boolean : true on success

updateInDB() публичный Метод

Update the item in the database
public updateInDB ( $updates, $oldvalues = [] ) : nothing
$updates fields to update
$oldvalues array of old values of the updated fields
Результат nothing

useDeletedToLockIfDynamic() публичный Метод

need to be overriden if object need to use standard deleted management (Computer...)
С версии: 0.84
public useDeletedToLockIfDynamic ( ) : boolean
Результат boolean

Описание свойств

$additional_fields_for_dictionnary публичное свойство

Additional fiedls for dictionnary processing
public $additional_fields_for_dictionnary

$auto_message_on_action публичное свойство

Set false to desactivate automatic message on action
public $auto_message_on_action

$dohistory публичное свойство

Make an history of the changes
public $dohistory

$fields публичное свойство

Data of the Item
public $fields

$fkfield защищенное свойство

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

$forward_entity_to защищенное статическое свойство

Forward entity datas to linked items
protected static $forward_entity_to

$get_item_to_display_tab публичное свойство

Need to get item to show tab
public $get_item_to_display_tab

$history_blacklist публичное свойство

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

$mailqueueonaction публичное свойство

FLush mail queue for
public $mailqueueonaction

$no_form_page публичное свойство

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

$notable защищенное статическое свойство

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

$plugins_forward_entity защищенное статическое свойство

Forward entity to plugins itemtypes
protected static $plugins_forward_entity

$rightname статическое публичное свойство

Profile name
static public $rightname

$searchopt защищенное свойство

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

$taborientation публичное свойство

Tab orientation : horizontal or vertical
public $taborientation

$usenotepad защищенное свойство

Is this item use notepad ?
protected $usenotepad