Common DataBase Relation Table Manager Class. More...

List of all members.

Public Member Functions

 canCreateItem ()
 canViewItem ()
 canUpdateItem ()
 canDeleteItem ()
 canChildItem ($methodItem, $methodNotItem)
 getItem ($getFromDB=true, $getEmpty=true)
 Get the item associated with the current object.
 recursivelyGetItems ()
 Get all the items associated with the current object by recursive requests.
 getEntityID ()
 Get the ID of entity assigned to the object.
 isEntityAssign ()
 Is the object assigned to an entity.
 maybeRecursive ()
 Is the object may be recursive.
 isRecursive ()
 Is the object recursive.
 addNeededInfoToInput ($input)
 prepareInputForAdd ($input)
 prepareInputForUpdate ($input)
 getHistoryNameForItem (CommonDBTM $item, $case)
 Get the history name of 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.
 post_deleteFromDB ()
 Actions done after the DELETE 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.
 showChildForItemForm ($canedit, $field_name)
 display the field of a given child

Static Public Member Functions

static getSQLRequestToSearchForItem ($itemtype, $items_id)
static canCreate ()
static canView ()
static canUpdate ()
static canDelete ()
static canChild ($method)
static displayRecursiveItems (array $recursiveItems, $elementToDisplay)
 recursively display the items of this
static getJSCodeToAddForItemChild ($field_name, $child_count_js_var)
 get the Javascript "code" to add to the form when clicking on "+"
static showAddChildButtonForItemForm (CommonDBTM $item, $field_name, $canedit=NULL)
 We can add several single CommonDBChild to a given Item.
static showChildsForItemForm (CommonDBTM $item, $field_name, $canedit=NULL)
 We can add several single CommonDBChild to a given Item.

Static Public Attributes

static $itemtype
static $items_id
static $checkParentRights = self::HAVE_SAME_RIGHT_ON_ITEM
static $mustBeAttached = true
static $logs_for_parent = true
static $log_history_add = Log::HISTORY_ADD_SUBITEM
static $log_history_update = Log::HISTORY_UPDATE_SUBITEM
static $log_history_delete = Log::HISTORY_DELETE_SUBITEM
static $log_history_lock = Log::HISTORY_LOCK_SUBITEM
static $log_history_unlock = Log::HISTORY_UNLOCK_SUBITEM

Detailed Description

Common DataBase Relation Table Manager Class.

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


Member Function Documentation

addNeededInfoToInput ( input)
Since:
version 0.84

Reimplemented from CommonDBTM.

Definition at line 345 of file commondbchild.class.php.

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

Referenced by prepareInputForAdd(), and prepareInputForUpdate().

static canChild ( method) [static]
Since:
version 0.84
Parameters:
$method

Definition at line 160 of file commondbchild.class.php.

References $itemtype, and CommonDBConnexity\canConnexity().

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

canChildItem ( methodItem,
methodNotItem 
)
Since:
version 0.84
Parameters:
$methodItem
$methodNotItem
Returns:
boolean

Reimplemented in Reservation.

Definition at line 175 of file commondbchild.class.php.

References $item, $itemtype, $mustBeAttached, and CommonDBConnexity\canConnexityItem().

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

static canCreate ( ) [static]
Since:
version 0.84

Reimplemented from CommonDBTM.

Reimplemented in Reservation, IPAddress, TicketValidation, Infocom, NetworkName, NetworkPort, ReservationItem, NetworkPortMigration, TicketCost, and PlanningRecall.

Definition at line 94 of file commondbchild.class.php.

References canChild().

Since:
version 0.84

Reimplemented from CommonDBTM.

Reimplemented in PlanningRecall.

Definition at line 126 of file commondbchild.class.php.

References canChildItem().

static canDelete ( ) [static]
Since:
version 0.84

Reimplemented from CommonDBTM.

Reimplemented in Reservation, IPAddress, TicketValidation, Infocom, NetworkName, NetworkPort, ReservationItem, TicketCost, and NetworkPortMigration.

Definition at line 118 of file commondbchild.class.php.

References canChild().

Since:
version 0.84

Reimplemented from CommonDBTM.

Reimplemented in TicketValidation.

Definition at line 150 of file commondbchild.class.php.

References canChildItem().

static canUpdate ( ) [static]
Since:
version 0.84

Reimplemented from CommonDBTM.

Reimplemented in Reservation, IPAddress, TicketValidation, Infocom, NetworkName, NetworkPort, ReservationItem, TicketCost, and NetworkPortMigration.

Definition at line 110 of file commondbchild.class.php.

References canChild().

Since:
version 0.84

Reimplemented from CommonDBTM.

Reimplemented in TicketValidation.

Definition at line 142 of file commondbchild.class.php.

References canChildItem().

static canView ( ) [static]
Since:
version 0.84

Reimplemented from CommonDBTM.

Reimplemented in Reservation, IPAddress, TicketValidation, Infocom, NetworkName, NetworkPortMigration, ReservationItem, NetworkPort, and TicketCost.

Definition at line 102 of file commondbchild.class.php.

References canChild().

Since:
version 0.84

Reimplemented from CommonDBTM.

Definition at line 134 of file commondbchild.class.php.

References canChildItem().

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

Since:
version 0.84
Returns:
nothing

Reimplemented from CommonDBTM.

Definition at line 546 of file commondbchild.class.php.

References $item, $log_history_lock, getHistoryNameForItem(), getItem(), CommonGLPI\getType(), Log\history(), CommonDBTM\isDynamic(), and CommonDBTM\useDeletedToLockIfDynamic().

static displayRecursiveItems ( array $  recursiveItems,
elementToDisplay 
) [static]

recursively display the items of this

Parameters:
$recursiveItemsarray of the items of the current elements (see recursivelyGetItems())
$elementToDisplaywhat to display : 'Type', 'Name', 'Link'

Definition at line 209 of file commondbchild.class.php.

References $item, and _e().

Referenced by NetworkAlias\showForm(), NetworkPortMigration\showForm(), NetworkName\showForm(), and NetworkPort\showForm().

Get the ID of entity assigned to the object.

Returns:
ID of the entity

Reimplemented from CommonDBTM.

Definition at line 264 of file commondbchild.class.php.

References $item, and getItem().

Referenced by IPAddress_IPNetwork\addIPAddress(), Infocom\showDebug(), NetworkAlias\showForm(), NetworkName\showForm(), and TicketValidation\showForm().

getHistoryNameForItem ( CommonDBTM item,
case 
)

Get the history name of item.

Parameters:
$itemthe other item
$case: can be overwrite by object
  • 'add' when this CommonDBChild 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 CommonDBChild is remove (from an item)
Returns:
(string) the name of the entry for the database (ie. : correctly slashed)

Reimplemented in TicketValidation.

Definition at line 414 of file commondbchild.class.php.

References CommonDBTM\getNameID().

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

getItem ( getFromDB = true,
getEmpty = true 
)

Get the item associated with the current object.

Rely on CommonDBConnexity::getItemFromArray()

Since:
version 0.84
Parameters:
$getFromDB(true by default)
$getEmpty(true by default)
Returns:
object of the concerned item or false on error

Definition at line 196 of file commondbchild.class.php.

References $itemtype, and CommonDBConnexity\getConnexityItem().

Referenced by Reservation\canChildItem(), cleanDBonMarkDeleted(), getEntityID(), NetworkPort\getPreAdditionalInfosForName(), isEntityAssign(), isRecursive(), maybeRecursive(), post_addItem(), post_deleteFromDB(), post_restoreItem(), recursivelyGetItems(), and NetworkPortInstantiation\showConnection().

static getJSCodeToAddForItemChild ( field_name,
child_count_js_var 
) [static]

get the Javascript "code" to add to the form when clicking on "+"

Since:
version 0.84
See also:
showAddChildButtonForItemForm()
Parameters:
$field_namethe name of the HTML field inside Item's form
$child_count_js_varthe name of the javascript variable containing current child number of items
Returns:
(string) the code

Reimplemented in UserEmail.

Definition at line 614 of file commondbchild.class.php.

Referenced by showAddChildButtonForItemForm().

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

Reimplemented from CommonDBConnexity.

Definition at line 64 of file commondbchild.class.php.

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

Is the object assigned to an entity.

Can be overloaded (ex : infocom)

Returns:
boolean

Reimplemented from CommonDBTM.

Definition at line 281 of file commondbchild.class.php.

References $item, and getItem().

Is the object recursive.

Returns:
booleanDONT_CHECK_ITEM_RIGHTS

Reimplemented from CommonDBTM.

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

References $item, and getItem().

Is the object may be recursive.

Returns:
boolean

Reimplemented from CommonDBTM.

Definition at line 303 of file commondbchild.class.php.

References $item, and getItem().

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

Returns:
nothing

Reimplemented from CommonDBTM.

Reimplemented in NetworkName, UserEmail, TicketValidation, IPAddress, Reservation, Cartridge, CalendarSegment, RuleCriteria, and RuleAction.

Definition at line 426 of file commondbchild.class.php.

References $item, $log_history_add, getHistoryNameForItem(), getItem(), CommonGLPI\getType(), and Log\history().

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

Returns:
nothing

Reimplemented from CommonDBTM.

Reimplemented in UserEmail, and CalendarSegment.

Definition at line 513 of file commondbchild.class.php.

References $item, $log_history_delete, getHistoryNameForItem(), getItem(), CommonGLPI\getType(), Log\history(), and Log\HISTORY_LOG_SIMPLE_MESSAGE.

Actions done after the restore of the item.

Since:
version 0.84
Returns:
nothing

Reimplemented from CommonDBTM.

Definition at line 578 of file commondbchild.class.php.

References $item, $log_history_unlock, getHistoryNameForItem(), getItem(), CommonGLPI\getType(), Log\history(), CommonDBTM\isDynamic(), and CommonDBTM\useDeletedToLockIfDynamic().

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

Reimplemented from CommonDBTM.

Reimplemented in NetworkName, TicketValidation, UserEmail, IPAddress, Reservation, PlanningRecall, and Cartridge.

Definition at line 455 of file commondbchild.class.php.

References $field, $item, $itemtype, $log_history_add, $log_history_delete, $log_history_update, CommonDBConnexity\getHistoryChangeWhenUpdateField(), getHistoryNameForItem(), CommonDBConnexity\getItemsForLog(), CommonGLPI\getType(), and Log\history().

Get all the items associated with the current object by recursive requests.

Since:
version 0.84
Returns:
an array containing all the items

Definition at line 246 of file commondbchild.class.php.

References $item, and getItem().

Referenced by NetworkPortInstantiation\getItemsByMac(), NetworkAlias\showForm(), NetworkPortMigration\showForm(), NetworkName\showForm(), and NetworkPort\showForm().

static showAddChildButtonForItemForm ( CommonDBTM item,
field_name,
canedit = NULL 
) [static]

We can add several single CommonDBChild to a given Item.

In such case, we display a "+" button and the fields already entered This method display the "+" button

Since:
version 0.84
Todo:
study if we cannot use these methods for the user emails
See also:
showChildsForItemForm(CommonDBTM $item, $field_name)
Parameters:
$itemCommonDBTM object: the item on which to add the current CommenDBChild
$field_namethe name of the HTML field inside Item's form
$canedit(default NULL) NULL to use default behaviour
Returns:
nothing (display only)

Definition at line 663 of file commondbchild.class.php.

References $CFG_GLPI, $items_id, __s(), CommonDBTM\can(), CommonDBTM\canCreate(), CommonDBTM\canUpdate(), CommonDBTM\getID(), getJSCodeToAddForItemChild(), CommonGLPI\getType(), and CommonDBTM\isNewItem().

Referenced by UserEmail\showAddEmailButton(), NetworkName\showForm(), and NetworkName\showFormForNetworkPort().

showChildForItemForm ( canedit,
field_name 
)

display the field of a given child

Since:
version 0.84
See also:
showChildsForItemForm()
Parameters:
$canedittrue if we can edit the child
$field_namethe name of the HTML field inside Item's form
Returns:
nothing (display only)

Reimplemented in UserEmail.

Definition at line 632 of file commondbchild.class.php.

References CommonDBTM\getID(), CommonDBTM\getName(), and CommonDBTM\isNewID().

static showChildsForItemForm ( CommonDBTM item,
field_name,
canedit = NULL 
) [static]

We can add several single CommonDBChild to a given Item.

In such case, we display a "+" button and the fields already entered. This method display the fields

Since:
version 0.84
Todo:
study if we cannot use these methods for the user emails
See also:
showAddChildButtonForItemForm()
Parameters:
$itemCommonDBTM object the item on which to add the current CommenDBChild
$field_namethe name of the HTML field inside Item's form
$canedit(default NULL) NULL to use default behaviour
Returns:
nothing (display only)

Definition at line 716 of file commondbchild.class.php.

References $CFG_GLPI, $DB, $items_id, $itemtype, $query, CommonDBTM\can(), CommonDBTM\canCreate(), CommonDBTM\canUpdate(), CommonDBTM\getID(), CommonDBTM\getTable(), CommonGLPI\getType(), and CommonDBTM\isNewItem().

Referenced by NetworkName\showForm(), NetworkName\showFormForNetworkPort(), and UserEmail\showForUser().


Member Data Documentation

$checkParentRights = self::HAVE_SAME_RIGHT_ON_ITEM [static]

Reimplemented in NetworkName, NetworkPort, NetworkAlias, and ReservationItem.

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

$log_history_add = Log::HISTORY_ADD_SUBITEM [static]

Reimplemented in TicketValidation.

Definition at line 50 of file commondbchild.class.php.

Referenced by post_addItem(), and post_updateItem().

$log_history_delete = Log::HISTORY_DELETE_SUBITEM [static]

Reimplemented in TicketValidation.

Definition at line 52 of file commondbchild.class.php.

Referenced by post_deleteFromDB(), and post_updateItem().

$log_history_lock = Log::HISTORY_LOCK_SUBITEM [static]

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

Referenced by cleanDBonMarkDeleted().

$log_history_unlock = Log::HISTORY_UNLOCK_SUBITEM [static]

Definition at line 54 of file commondbchild.class.php.

Referenced by post_restoreItem().

$log_history_update = Log::HISTORY_UPDATE_SUBITEM [static]

Reimplemented in TicketValidation.

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

Referenced by post_updateItem().

$logs_for_parent = true [static]

Reimplemented in Infocom.

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

$mustBeAttached = true [static]

Reimplemented in NetworkName, and NetworkPortMigration.

Definition at line 47 of file commondbchild.class.php.

Referenced by canChildItem().


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