Common DataBase Relation Table Manager Class. More...

List of all members.

Public Member Functions

 getOnePeer ($number)
 getFromDBForItems (CommonDBTM $item1, CommonDBTM $item2)
 Get link object between 2 items.
 getSearchOptions ()
 Get search function for the class.
 isAttach2Valid (Array &$input)
 Specific check for check attach for relation 2.
 isAttach1Valid (Array &$input)
 Specific check for check attach for relation 1.
 canRelationItem ($method, $methodNotItem, $check_entity=true, $forceCheckBoth=false)
 canCreateItem ()
 canViewItem ()
 canUpdateItem ()
 canDeleteItem ()
 addNeededInfoToInput ($input)
 prepareInputForAdd ($input)
 prepareInputForUpdate ($input)
 getHistoryNameForItem1 (CommonDBTM $item, $case)
 Get the history name of first item.
 getHistoryNameForItem2 (CommonDBTM $item, $case)
 Get the history name of second item.
 post_addItem ()
 Actions done after the ADD of the item in the database.
 post_updateItem ($history=1)
 Actions done after the UPDATE of the item in the database.
 cleanDBonMarkDeleted ()
 Actions done when item flag deleted is set to an item.
 post_restoreItem ()
 Actions done after the restore of the item.
 post_deleteFromDB ()
 Actions done after the DELETE of the item in the database.

Static Public Member Functions

static getSQLRequestToSearchForItem ($itemtype, $items_id)
static getOpposite (CommonDBTM $item, &$relations_id=NULL)
static getOppositeByTypeAndID ($itemtype, $items_id, &$relations_id=NULL)
static canRelation ($method, $forceCheckBoth=false)
static canCreate ()
static canView ()
static canUpdate ()
static canDelete ()
static getHTMLTableHeader ($itemtype, HTMLTableBase $base, HTMLTableSuperHeader $super=NULL, HTMLTableHeader $father=NULL, array $options=array())
static getHTMLTableCellsForItem (HTMLTableRow $row=NULL, CommonDBTM $item=NULL, HTMLTableCell $father=NULL, array $options=array())

Public Attributes

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

Static Public Attributes

static $itemtype_1
static $items_id_1
static $take_entity_1 = true
static $checkItem_1_Rights = self::HAVE_SAME_RIGHT_ON_ITEM
static $mustBeAttached_1 = true
static $logs_for_item_1 = true
static $log_history_1_add = Log::HISTORY_ADD_RELATION
static $log_history_1_update = Log::HISTORY_UPDATE_RELATION
static $log_history_1_delete = Log::HISTORY_DEL_RELATION
static $log_history_1_lock = Log::HISTORY_LOCK_RELATION
static $log_history_1_unlock = Log::HISTORY_UNLOCK_RELATION
static $itemtype_2
static $items_id_2
static $take_entity_2 = false
static $checkItem_2_Rights = self::HAVE_SAME_RIGHT_ON_ITEM
static $mustBeAttached_2 = true
static $logs_for_item_2 = true
static $log_history_2_add = Log::HISTORY_ADD_RELATION
static $log_history_2_update = Log::HISTORY_UPDATE_RELATION
static $log_history_2_delete = Log::HISTORY_DEL_RELATION
static $log_history_2_lock = Log::HISTORY_LOCK_RELATION
static $log_history_2_unlock = Log::HISTORY_UNLOCK_RELATION
static $checkAlwaysBothItems = false
 If both items must be checked for rights (default is only one)
static $check_entity_coherency = true
 If both items must be in viewable each other entities.

Detailed Description

Common DataBase Relation Table Manager Class.

Definition at line 39 of file commondbrelation.class.php.


Member Function Documentation

addNeededInfoToInput ( input)
Since:
version 0.84

Reimplemented from CommonDBTM.

Definition at line 545 of file commondbrelation.class.php.

References $input, CommonDBConnexity\getItemFromArray(), and CommonDBConnexity\tryEntityForwarding().

Referenced by prepareInputForAdd(), and prepareInputForUpdate().

static canCreate ( ) [static]
Since:
version 0.84

Reimplemented from CommonDBTM.

Definition at line 475 of file commondbrelation.class.php.

References canRelation().

Since:
version 0.84

Reimplemented from CommonDBTM.

Reimplemented in Profile_User, and Contract_Item.

Definition at line 507 of file commondbrelation.class.php.

References canRelationItem().

static canDelete ( ) [static]
Since:
version 0.84

Reimplemented from CommonDBTM.

Definition at line 499 of file commondbrelation.class.php.

References canRelation().

Since:
version 0.84

Reimplemented from CommonDBTM.

Reimplemented in CommonITILActor.

Definition at line 535 of file commondbrelation.class.php.

References canRelationItem().

static canRelation ( method,
forceCheckBoth = false 
) [static]
Since:
version 0.84
Parameters:
$method
$forceCheckBothboolean force check both items(false by default)
Returns:
boolean

Check only one if SAME RIGHT for both items and not force checkBoth

Definition at line 338 of file commondbrelation.class.php.

References CommonDBConnexity\canConnexity().

Referenced by canCreate(), canDelete(), canUpdate(), and canView().

canRelationItem ( method,
methodNotItem,
check_entity = true,
forceCheckBoth = false 
)
Since:
version 0.84
Parameters:
$method
$methodNotItem
$check_entity(true by default)
$forceCheckBothboolean force check both items (false by default)
Returns:
boolean

Definition at line 384 of file commondbrelation.class.php.

References $checkItem_1_Rights, CommonDBConnexity\canConnexityItem(), and getAncestorsOf().

Referenced by canCreateItem(), canDeleteItem(), canUpdateItem(), and canViewItem().

static canUpdate ( ) [static]
Since:
version 0.84

Reimplemented from CommonDBTM.

Definition at line 491 of file commondbrelation.class.php.

References canRelation().

Referenced by Group_User\showForGroup().

Since:
version 0.84

Reimplemented from CommonDBTM.

Reimplemented in CommonITILActor.

Definition at line 525 of file commondbrelation.class.php.

References canRelationItem().

static canView ( ) [static]
Since:
version 0.84

Reimplemented from CommonDBTM.

Definition at line 482 of file commondbrelation.class.php.

References canRelation().

Since:
version 0.84

Reimplemented from CommonDBTM.

Definition at line 517 of file commondbrelation.class.php.

References canRelationItem().

Actions done when item flag deleted is set to an item.

Since:
version 0.84
Returns:
nothing

Reimplemented from CommonDBTM.

Definition at line 808 of file commondbrelation.class.php.

References $log_history_1_lock, $log_history_2_lock, CommonDBConnexity\getConnexityItem(), getHistoryNameForItem1(), getHistoryNameForItem2(), Log\history(), CommonDBTM\isDynamic(), and CommonDBTM\useDeletedToLockIfDynamic().

getFromDBForItems ( CommonDBTM item1,
CommonDBTM item2 
)

Get link object between 2 items.

Since:
version 0.84
Parameters:
$item1object 1
$item2object 2
Returns:
boolean founded ?

Definition at line 238 of file commondbrelation.class.php.

References CommonDBTM\getFromDBByQuery(), CommonDBTM\getID(), and CommonGLPI\getType().

Referenced by Group_User\doSpecificMassiveActions().

getHistoryNameForItem1 ( CommonDBTM item,
case 
)

Get the history name of first item.

Since:
version 0.84
Parameters:
$itemCommonDBTM object the other item (ie. : $item2)
$case: can be overwrite by object
  • 'add' when this CommonDBRelation is added (to and item)
  • 'update item previous' transfert : this is removed from the old item
  • 'update item next' transfert : this is added to the new item
  • 'delete' when this CommonDBRelation is remove (from an item)
Returns:
(string) the name of the entry for the database (ie. : correctly slashed)

Definition at line 629 of file commondbrelation.class.php.

References CommonDBTM\getNameID().

Referenced by cleanDBonMarkDeleted(), post_addItem(), post_deleteFromDB(), post_restoreItem(), and post_updateItem().

getHistoryNameForItem2 ( CommonDBTM item,
case 
)

Get the history name of second item.

Since:
version 0.84
Parameters:
$itemthe other item (ie. : $item1)
$case: can be overwrite by object
  • 'add' when this CommonDBRelation is added (to and item)
  • 'update item previous' transfert : this is removed from the old item
  • 'update item next' transfert : this is added to the new item
  • 'delete' when this CommonDBRelation is remove (from an item)
Returns:
(string) the name of the entry for the database (ie. : correctly slashed)

Definition at line 650 of file commondbrelation.class.php.

References CommonDBTM\getNameID().

Referenced by cleanDBonMarkDeleted(), post_addItem(), post_deleteFromDB(), post_restoreItem(), and post_updateItem().

static getHTMLTableCellsForItem ( HTMLTableRow row = NULL,
CommonDBTM item = NULL,
HTMLTableCell father = NULL,
array $  options = array() 
) [static]
Since:
version 0.84
Parameters:
$rowHTMLTableRow object (default NULL)
$itemCommonDBTM object (default NULL)
$fatherHTMLTableCell object (default NULL)
$optionsarray

Definition at line 979 of file commondbrelation.class.php.

References $CFG_GLPI, $DB, $item, $options, $query, and getSQLRequestToSearchForItem().

Referenced by NetworkPortInstantiation\getInstantiationHTMLTable().

static getHTMLTableHeader ( itemtype,
HTMLTableBase base,
HTMLTableSuperHeader super = NULL,
HTMLTableHeader father = NULL,
array $  options = array() 
) [static]
Since:
version 0.84
Parameters:
$itemtype
$baseHTMLTableBase object
$superHTMLTableSuperHeader object (default NULL)
$fatherHTMLTableHeader object (default NULL)
$optionsarray

Definition at line 946 of file commondbrelation.class.php.

References $itemtype, $itemtype_1, $itemtype_2, and $options.

Referenced by NetworkPortInstantiation\getInstantiationHTMLTableHeaders(), and Item_Devices\getTableGroup().

getOnePeer ( number)
Since:
version 0.84
Parameters:
$number
Returns:
boolean

Definition at line 213 of file commondbrelation.class.php.

References $items_id_1, $items_id_2, $itemtype, $itemtype_1, $itemtype_2, and CommonDBConnexity\getConnexityItem().

static getOpposite ( CommonDBTM item,
&$  relations_id = NULL 
) [static]
Since:
version 0.84
Parameters:
$itemCommonDBTM object
$relations_id(default NULL)

Definition at line 153 of file commondbrelation.class.php.

References CommonDBTM\getID(), getOppositeByTypeAndID(), and CommonGLPI\getType().

Referenced by NetworkPortInstantiation\getInstantiationHTMLTableWithPeer(), and NetworkPortInstantiation\showConnection().

static getOppositeByTypeAndID ( itemtype,
items_id,
&$  relations_id = NULL 
) [static]
Since:
version 0.84
Parameters:
$itemtypeType of the item to search for its opposite
$items_idID of the item to search for its opposite
$relations_id(default NULL)

Definition at line 164 of file commondbrelation.class.php.

References $DB, $itemtype, $query, $result, CommonDBTM\getIndexName(), getItemForItemtype(), and getSQLRequestToSearchForItem().

Referenced by getOpposite().

Get search function for the class.

Returns:
array of search option

Reimplemented from CommonDBTM.

Reimplemented in Profile_User, Group_User, Contract_Item, Change_Problem, Problem_Ticket, Change_Ticket, IPNetwork_Vlan, NetworkPort_Vlan, Contact_Supplier, and Computer_SoftwareLicense.

Definition at line 271 of file commondbrelation.class.php.

References $items_id_1, $items_id_2, __(), CommonDBTM\getTable(), and getTableForItemType().

static getSQLRequestToSearchForItem ( itemtype,
items_id 
) [static]
Since:
version 0.84
Parameters:
$itemtype
$items_id
Returns:
string

Reimplemented from CommonDBConnexity.

Definition at line 92 of file commondbrelation.class.php.

References CommonDBTM\$fields, $itemtype, and CommonDBTM\getTable().

Referenced by getHTMLTableCellsForItem(), and getOppositeByTypeAndID().

isAttach1Valid ( Array &$  input)

Specific check for check attach for relation 1.

Since:
version 0.84
Parameters:
$inputArray of data to be added
Returns:
boolean

Definition at line 325 of file commondbrelation.class.php.

isAttach2Valid ( Array &$  input)

Specific check for check attach for relation 2.

Since:
version 0.84
Parameters:
$inputArray of data to be added
Returns:
boolean

Reimplemented in CommonITILActor.

Definition at line 311 of file commondbrelation.class.php.

Actions done after the ADD of the item in the database.

Returns:
nothing

Reimplemented from CommonDBTM.

Reimplemented in CommonITILActor, Ticket_Ticket, Document_Item, and Problem_Ticket.

Definition at line 662 of file commondbrelation.class.php.

References $log_history_1_add, $log_history_2_add, CommonDBConnexity\getConnexityItem(), getHistoryNameForItem1(), getHistoryNameForItem2(), and Log\history().

Actions done after the DELETE of the item in the database.

Since:
version 0.84
Returns:
nothing

Reimplemented from CommonDBTM.

Reimplemented in CommonITILActor, Ticket_Ticket, and Problem_Ticket.

Definition at line 900 of file commondbrelation.class.php.

References $log_history_1_delete, $log_history_2_delete, CommonDBConnexity\getConnexityItem(), getHistoryNameForItem1(), getHistoryNameForItem2(), and Log\history().

post_updateItem ( history = 1)

Actions done after the UPDATE of the item in the database.

Since:
version 0.84
Parameters:
$historystore changes history ? (default 1)
Returns:
nothing

TODO clean management of it

Reimplemented from CommonDBTM.

Definition at line 705 of file commondbrelation.class.php.

References $field, $log_history_1_add, $log_history_1_delete, $log_history_1_update, $log_history_2_add, $log_history_2_delete, $log_history_2_update, CommonDBConnexity\getHistoryChangeWhenUpdateField(), getHistoryNameForItem1(), getHistoryNameForItem2(), CommonDBConnexity\getItemsForLog(), and Log\history().

prepareInputForAdd ( input)
Since:
version 0.84
Parameters:
$input

Reimplemented from CommonDBTM.

Reimplemented in Ticket_Ticket, Computer_Item, Profile_User, Item_Problem, Document_Item, Change_Item, and Computer_SoftwareVersion.

Definition at line 584 of file commondbrelation.class.php.

References $input, and addNeededInfoToInput().

prepareInputForUpdate ( input)
Since:
version 0.84

Reimplemented from CommonDBTM.

Reimplemented in Computer_SoftwareVersion.

Definition at line 597 of file commondbrelation.class.php.

References $input, and addNeededInfoToInput().


Member Data Documentation

$check_entity_coherency = true [static]

If both items must be in viewable each other entities.

Reimplemented in Ticket_Ticket.

Definition at line 79 of file commondbrelation.class.php.

$checkAlwaysBothItems = false [static]

If both items must be checked for rights (default is only one)

Definition at line 77 of file commondbrelation.class.php.

$checkItem_1_Rights = self::HAVE_SAME_RIGHT_ON_ITEM [static]

Definition at line 48 of file commondbrelation.class.php.

Referenced by canRelationItem().

$log_history_1_add = Log::HISTORY_ADD_RELATION [static]
$log_history_1_delete = Log::HISTORY_DEL_RELATION [static]
$log_history_1_lock = Log::HISTORY_LOCK_RELATION [static]

Reimplemented in Item_Devices.

Definition at line 55 of file commondbrelation.class.php.

Referenced by cleanDBonMarkDeleted().

$log_history_1_unlock = Log::HISTORY_UNLOCK_RELATION [static]

Reimplemented in Item_Devices.

Definition at line 56 of file commondbrelation.class.php.

Referenced by post_restoreItem().

$log_history_1_update = Log::HISTORY_UPDATE_RELATION [static]

Reimplemented in Item_Devices.

Definition at line 53 of file commondbrelation.class.php.

Referenced by post_updateItem().

$log_history_2_add = Log::HISTORY_ADD_RELATION [static]

Reimplemented in Computer_SoftwareVersion, and NetworkPort_NetworkPort.

Definition at line 69 of file commondbrelation.class.php.

Referenced by post_addItem(), and post_updateItem().

$log_history_2_delete = Log::HISTORY_DEL_RELATION [static]

Reimplemented in Computer_SoftwareVersion, and NetworkPort_NetworkPort.

Definition at line 71 of file commondbrelation.class.php.

Referenced by post_deleteFromDB(), and post_updateItem().

$log_history_2_lock = Log::HISTORY_LOCK_RELATION [static]

Definition at line 72 of file commondbrelation.class.php.

Referenced by cleanDBonMarkDeleted().

$log_history_2_unlock = Log::HISTORY_UNLOCK_RELATION [static]

Definition at line 73 of file commondbrelation.class.php.

Referenced by post_restoreItem().

$log_history_2_update = Log::HISTORY_UPDATE_RELATION [static]

Definition at line 70 of file commondbrelation.class.php.

Referenced by post_updateItem().

$logs_for_item_1 = true [static]

Reimplemented in Profile_User, and Group_User.

Definition at line 51 of file commondbrelation.class.php.

$mustBeAttached_1 = true [static]

Definition at line 49 of file commondbrelation.class.php.

$mustBeAttached_2 = true [static]

Definition at line 66 of file commondbrelation.class.php.

$no_form_page = true

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

Reimplemented from CommonDBTM.

Definition at line 81 of file commondbrelation.class.php.

$take_entity_1 = true [static]

Reimplemented in Document_Item.

Definition at line 46 of file commondbrelation.class.php.

$take_entity_2 = false [static]

Reimplemented in Document_Item.

Definition at line 63 of file commondbrelation.class.php.


The documentation for this class was generated from the following file: