PHP Class NetworkPort, glpi

Inheritance: extends CommonDBChild
Show file Open project: glpi-project/glpi Class Usage Examples

Public Properties

Property Type Description
$checkParentRights
$dohistory
$items_id
$itemtype From CommonDBChild
$rightname

Protected Properties

Property Type Description
$forward_entity_to

Public Methods

Method Description
cleanDBonPurge ( )
cloneItem ( $itemtype, $old_items_id, $new_items_id ) Clone the current NetworkPort when the item is clone
countForItem ( CommonDBTM $item )
defineTabs ( $options = [] )
displayTabContentForItem ( CommonGLPI $item, $tabnum = 1, $withtemplate )
getAvailableDisplayOptions ( ) : all Get available display options array
getConnexityMassiveActionsSpecificities ( )
getContact ( $ID ) : ID Get port opposite port ID if linked item
getForbiddenStandardMassiveAction ( )
getInstantiation ( ) : the \brief get the instantiation of the current NetworkPort The instantiation rely on the instantiation_type field and the id of the NetworkPort. If the network port exists, but not its instantiation, then, the instantiation will be empty.
getNetworkPortInstantiations ( ) : array \brief get the list of available network port type.
getNetworkPortInstantiationsWithNames ( )
getPreAdditionalInfosForName ( )
getSearchOptions ( )
getSearchOptionsToAdd ( $itemtype )
getSpecificMassiveActions ( $checkitem = NULL )
getTabNameForItem ( CommonGLPI $item, $withtemplate )
getTypeName ( $nb )
post_addItem ( )
post_updateItem ( $history = 1 )
prepareInputForAdd ( $input )
prepareInputForUpdate ( $input )
resetConnections ( $ID ) : true Delete All connection of the given network port
showForItem ( CommonDBTM $item, $withtemplate = '' ) Show ports for an item
showForm ( $ID, $options = [] )
splitInputForElements ( $input ) \brief split input fields when validating a port
switchInstantiationType ( $new_instantiation_type ) : false Change the instantion type of a NetworkPort : check validity of the new type of instantiation and that it is not equal to current ones. Update the NetworkPort and delete the previous instantiation. It is up to the caller to create the new instantiation !
updateDependencies ( $history = true ) \brief update all related elements after adding or updating an element

Method Details

cleanDBonPurge() public method

public cleanDBonPurge ( )

cloneItem() static public method

Clone the current NetworkPort when the item is clone
static public cloneItem ( $itemtype, $old_items_id, $new_items_id )
$itemtype the type of the item that was clone
$old_items_id the id of the item that was clone
$new_items_id the id of the item after beeing cloned

countForItem() static public method

static public countForItem ( CommonDBTM $item )
$item CommonDBTM

defineTabs() public method

public defineTabs ( $options = [] )

displayTabContentForItem() static public method

static public displayTabContentForItem ( CommonGLPI $item, $tabnum = 1, $withtemplate )
$item CommonGLPI

getAvailableDisplayOptions() static public method

Get available display options array
static public getAvailableDisplayOptions ( ) : all
return all the options

getConnexityMassiveActionsSpecificities() static public method

See also: CommonDBConnexity::getConnexityMassiveActionsSpecificities()

getContact() public method

Get port opposite port ID if linked item
public getContact ( $ID ) : ID
$ID networking port ID
return ID of the NetworkPort found, false if not found

getForbiddenStandardMassiveAction() public method

getInstantiation() public method

\brief get the instantiation of the current NetworkPort The instantiation rely on the instantiation_type field and the id of the NetworkPort. If the network port exists, but not its instantiation, then, the instantiation will be empty.
public getInstantiation ( ) : the
return the instantiation object or false if the type of instantiation is not known

getNetworkPortInstantiations() static public method

\brief get the list of available network port type.
static public getNetworkPortInstantiations ( ) : array
return array of available type of network ports

getNetworkPortInstantiationsWithNames() static public method

getPreAdditionalInfosForName() public method

See also: CommonDBTM::getPreAdditionalInfosForName

getSearchOptions() public method

public getSearchOptions ( )

getSearchOptionsToAdd() static public method

static public getSearchOptionsToAdd ( $itemtype )
$itemtype

getSpecificMassiveActions() public method

See also: CommonDBTM::getSpecificMassiveActions()
public getSpecificMassiveActions ( $checkitem = NULL )

getTabNameForItem() public method

public getTabNameForItem ( CommonGLPI $item, $withtemplate )
$item CommonGLPI

getTypeName() static public method

static public getTypeName ( $nb )

post_addItem() public method

See also: CommonDBTM::post_addItem
public post_addItem ( )

post_updateItem() public method

See also: CommonDBTM::post_updateItem
public post_updateItem ( $history = 1 )

prepareInputForAdd() public method

See also: CommonDBTM::prepareInputForAdd
public prepareInputForAdd ( $input )

prepareInputForUpdate() public method

See also: CommonDBTM::prepareInputForUpdate
public prepareInputForUpdate ( $input )

resetConnections() public method

Delete All connection of the given network port
public resetConnections ( $ID ) : true
$ID ID of the port
return true on success

showForItem() static public method

Show ports for an item
static public showForItem ( CommonDBTM $item, $withtemplate = '' )
$item CommonDBTM CommonDBTM object
$withtemplate integer withtemplate param (default '')

showForm() public method

public showForm ( $ID, $options = [] )

splitInputForElements() public method

The form of the NetworkPort can contain the details of the NetworkPortInstantiation as well as NetworkName elements (if no more than one name is attached to this port). Feilds from both NetworkPortInstantiation and NetworkName must not be process by the NetworkPort::add or NetworkPort::update. But they must be kept for adding or updating these elements. This is done after creating or updating the current port. Otherwise, its ID may not be known (in case of new port). To keep the unused fields, we check each field key. If it is owned by NetworkPort (ie : exists inside the $this->fields array), then they remain inside $input. If they are prefix by "Networkname_", then they are added to $this->input_for_NetworkName. Else, they are for the instantiation and added to $this->input_for_instantiation. This method must be call before NetworkPort::add or NetworkPort::update in case of NetworkPort form. Otherwise, the entry of the database may contain wrong values.
See also: updateDependencies for the update
public splitInputForElements ( $input )
$input

switchInstantiationType() public method

Change the instantion type of a NetworkPort : check validity of the new type of instantiation and that it is not equal to current ones. Update the NetworkPort and delete the previous instantiation. It is up to the caller to create the new instantiation !
public switchInstantiationType ( $new_instantiation_type ) : false
$new_instantiation_type the name of the new instaniation type
return false on error, true if the previous instantiation is not available (ie.: invalid instantiation type) or the object of the previous instantiation.

updateDependencies() public method

splitInputForElements() prepare the data for adding or updating NetworkPortInstantiation and NetworkName. This method will update NetworkPortInstantiation and NetworkName. I must be call after NetworkPort::add or NetworkPort::update otherwise, the networkport ID will not be known and the dependencies won't have a valid items_id field.
See also: splitInputForElements() for preparing the input
public updateDependencies ( $history = true )
$history (default 1)

Property Details

$checkParentRights public static property

public static $checkParentRights

$dohistory public property

public $dohistory

$forward_entity_to protected static property

protected static $forward_entity_to

$items_id public static property

public static $items_id

$itemtype public static property

From CommonDBChild
public static $itemtype

$rightname static public property

static public $rightname