PHP Class Profile, glpi

Mostra file Open project: glpi-project/glpi Class Usage Examples

Public Properties

Property Type Description
$common_fields Common fields used for all profiles type
$dohistory
$helpdesk_rights Helpdesk fields of helpdesk profiles
$rightname

Public Methods

Method Description
cleanDBonPurge ( )
cleanProfile ( ) Unset unused rights for helpdesk
currentUserHaveMoreRightThan ( $IDs = [] ) : boolean Is the current user have more right than all profiles in parameters
defineTabs ( $options = [] )
displayLifeCycleMatrix ( $title, $html_field, $db_field, $statuses, $canedit ) : nothing Display the matrix of the elements lifecycle of the elements
displayLifeCycleMatrixTicketHelpdesk ( $title, $html_field, $db_field, $canedit ) : nothing Display the matrix of the elements lifecycle of the elements
displayRightsChoiceMatrix ( array $rights, array $options = [] ) : random Display rights choice matrix
displayTabContentForItem ( CommonGLPI $item, $tabnum = 1, $withtemplate )
dropdownHelpdeskItemtypes ( $options ) Dropdown profiles which have rights under the active one
dropdownNoneReadWrite ( $name, $value, $none = 1, $read = 1, $write = 1 ) : nothing Make a select box for a None Read Write choice
dropdownRight ( $name, $options = [] ) : nothing Make a select box for a None Read Write choice
dropdownRights ( array $values, $name, $current, $options = [] ) Make a select box for rights
dropdownUnder ( $options = [] ) Dropdown profiles which have rights under the active one
getDefault ( ) : integer Get the default Profile for new user
getForbiddenStandardMassiveAction ( )
getHelpdeskHardwareTypeName ( $value )
getHelpdeskHardwareTypes ( $rights = false )
getHelpdeskItemtypes ( )
getInterfaceName ( $value )
getInterfaces ( )
getLinearRightChoice ( array $elements, array $options = [] ) : content Get right linear right choice.
getRightsFor ( $itemtype, $interface = 'central' ) : rights Get rights for an itemtype
getSearchOptions ( )
getSpecificValueToDisplay ( $field, $values, array $options = [] )
getSpecificValueToSelect ( $field, $name = '', $values = '', array $options = [] )
getTabNameForItem ( CommonGLPI $item, $withtemplate )
getTypeName ( $nb )
getUnderActiveProfileRestrictRequest ( $separator = "AND" ) : SQL Get SQL restrict request to determine profiles with less rights than the active one
haveUserRight ( $user, $right, $valright, $entity ) : boolean function to check one right of a user
post_addItem ( )
post_getEmpty ( )
post_getFromDB ( )
post_updateItem ( $history = 1 )
pre_deleteItem ( ) : boolean check right before delete
prepareInputForAdd ( $input )
prepareInputForUpdate ( $input )
showForm ( $ID, $options = [] ) : boolean Print the profile form headers
showFormAdmin ( $openform = true, $closeform = true ) Print the central form for a profile
showFormAsset ( $openform = true, $closeform = true ) Print the Asset rights form for the current profile
showFormLifeCycle ( $openform = true, $closeform = true ) Print the Life Cycles form for the current profile
showFormLifeCycleHelpdesk ( $openform = true, $closeform = true ) Print the Life Cycles form for the current profile
showFormManagement ( $openform = true, $closeform = true ) Print the Management rights form for the current profile
showFormSetup ( $openform = true, $closeform = true ) Print the central form for a profile
showFormTools ( $openform = true, $closeform = true ) Print the Tools rights form for the current profile
showFormToolsHelpdesk ( ) Print the helpdesk right form for the current profile
showFormTracking ( $openform = true, $closeform = true ) Print the Tracking right form for the current profile
showFormTrackingHelpdesk ( ) Print the helpdesk right form for the current profile
showLegend ( )

Method Details

cleanDBonPurge() public method

public cleanDBonPurge ( )

cleanProfile() public method

Unset unused rights for helpdesk
public cleanProfile ( )

currentUserHaveMoreRightThan() static public method

Is the current user have more right than all profiles in parameters
static public currentUserHaveMoreRightThan ( $IDs = [] ) : boolean
$IDs array of profile ID to test
return boolean true if have more right

defineTabs() public method

public defineTabs ( $options = [] )

displayLifeCycleMatrix() public method

Display the matrix of the elements lifecycle of the elements
public displayLifeCycleMatrix ( $title, $html_field, $db_field, $statuses, $canedit ) : nothing
$title the kind of lifecycle
$html_field field that is sent to _POST
$db_field field inside the DB (to get current state)
$statuses all available statuses for the given cycle (obj::getAllStatusArray())
$canedit can we edit the elements ?
return nothing

displayLifeCycleMatrixTicketHelpdesk() public method

Display the matrix of the elements lifecycle of the elements
public displayLifeCycleMatrixTicketHelpdesk ( $title, $html_field, $db_field, $canedit ) : nothing
$title the kind of lifecycle
$html_field field that is sent to _POST
$db_field field inside the DB (to get current state)
$canedit can we edit the elements ?
return nothing

displayRightsChoiceMatrix() public method

Display rights choice matrix
public displayRightsChoiceMatrix ( array $rights, array $options = [] ) : random
$rights array array possible: 'itemtype' => the type of the item to check (as passed to self::getRightsFor()) 'rights' => when use of self::getRightsFor() is impossible 'label' => the label for the right 'field' => the name of the field inside the DB and HTML form (prefixed by '_') 'html_field' => when $html_field != '_'.$field
$options array array possible: 'title' the title of the matrix 'canedit' 'default_class' the default CSS class used for the row
return random value used to generate the ids

displayTabContentForItem() static public method

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

dropdownHelpdeskItemtypes() static public method

Dropdown profiles which have rights under the active one
static public dropdownHelpdeskItemtypes ( $options )
$options array of possible options: - name : string / name of the select (default is profiles_id) - values : array of values

dropdownNoneReadWrite() static public method

Make a select box for a None Read Write choice
static public dropdownNoneReadWrite ( $name, $value, $none = 1, $read = 1, $write = 1 ) : nothing
$name select name
$value preselected value.
$none display none choice ? (default 1)
$read display read choice ? (default 1)
$write display write choice ? (default 1)
return nothing (print out an HTML select box) \deprecated since version 0.84 use dropdownRight instead

dropdownRight() static public method

Make a select box for a None Read Write choice
static public dropdownRight ( $name, $options = [] ) : nothing
$name select name
$options array of possible options: - value : preselected value. - nonone : hide none choice ? (default false) - noread : hide read choice ? (default false) - nowrite : hide write choice ? (default false) - display : display or get string (default true) - rand : specific rand (default is generated one)
return nothing (print out an HTML select box)

dropdownRights() static public method

Make a select box for rights
static public dropdownRights ( array $values, $name, $current, $options = [] )
$values array array of values to display
$name integer name of the dropdown
$current integer value in database (sum of rights)
$options array

dropdownUnder() static public method

Dropdown profiles which have rights under the active one
static public dropdownUnder ( $options = [] )
$options array of possible options: - name : string / name of the select (default is profiles_id) - value : integer / preselected value (default 0)

getDefault() static public method

Get the default Profile for new user
static public getDefault ( ) : integer
return integer profiles_id

getForbiddenStandardMassiveAction() public method

getHelpdeskHardwareTypeName() static public method

static public getHelpdeskHardwareTypeName ( $value )
$value

getHelpdeskHardwareTypes() static public method

static public getHelpdeskHardwareTypes ( $rights = false )
$rights boolean (false by default)

getHelpdeskItemtypes() static public method

static public getHelpdeskItemtypes ( )

getInterfaceName() static public method

static public getInterfaceName ( $value )
$value

getInterfaces() static public method

static public getInterfaces ( )

getLinearRightChoice() static public method

Get right linear right choice.
static public getLinearRightChoice ( array $elements, array $options = [] ) : content
$elements array array all pair identifier => label
$options array array possible: 'canedit' 'field' name of the HTML field 'value' the value inside the database 'max_per_line' maximum number of elements per line 'check_all' add a checkbox to check or uncheck every checkbox 'rand' random value used to generate the ids 'zero_on_empty' do we send 0 when checkbox is not checked ? 'display' 'check_method' method used to check the right
return content if !display

getRightsFor() static public method

Get rights for an itemtype
static public getRightsFor ( $itemtype, $interface = 'central' ) : rights
$itemtype string itemtype
$interface string (default 'central')
return rights

getSearchOptions() public method

public getSearchOptions ( )

getSpecificValueToDisplay() static public method

static public getSpecificValueToDisplay ( $field, $values, array $options = [] )
$field
$values
$options array array

getSpecificValueToSelect() static public method

static public getSpecificValueToSelect ( $field, $name = '', $values = '', array $options = [] )
$field
$name (default '')
$values (default '')
$options array array

getTabNameForItem() public method

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

getTypeName() static public method

static public getTypeName ( $nb )

getUnderActiveProfileRestrictRequest() static public method

Get SQL restrict request to determine profiles with less rights than the active one
static public getUnderActiveProfileRestrictRequest ( $separator = "AND" ) : SQL
$separator string Separator used at the beginning of the request (default 'AND')
return SQL restrict string

haveUserRight() static public method

function to check one right of a user
static public haveUserRight ( $user, $right, $valright, $entity ) : boolean
$user integer id of the user to check rights
$right string right to check
$valright integer/string/array value of the rights searched
$entity integer id of the entity
return boolean

post_addItem() public method

public post_addItem ( )

post_getEmpty() public method

public post_getEmpty ( )

post_getFromDB() public method

public post_getFromDB ( )

post_updateItem() public method

public post_updateItem ( $history = 1 )

pre_deleteItem() public method

check right before delete
public pre_deleteItem ( ) : boolean
return boolean

prepareInputForAdd() public method

public prepareInputForAdd ( $input )

prepareInputForUpdate() public method

public prepareInputForUpdate ( $input )

showForm() public method

Print the profile form headers
public showForm ( $ID, $options = [] ) : boolean
$ID integer : Id of the item to print
$options array of possible options - target filename : where to go when done. - withtemplate boolean : template or basic item
return boolean item found

showFormAdmin() public method

Print the central form for a profile
public showFormAdmin ( $openform = true, $closeform = true )
$openform boolean open the form (true by default)
$closeform boolean close the form (true by default)

showFormAsset() public method

Print the Asset rights form for the current profile
public showFormAsset ( $openform = true, $closeform = true )
$openform boolean open the form (true by default)
$closeform boolean close the form (true by default)

showFormLifeCycle() public method

Print the Life Cycles form for the current profile
public showFormLifeCycle ( $openform = true, $closeform = true )
$openform boolean open the form (true by default)
$closeform boolean close the form (true by default)

showFormLifeCycleHelpdesk() public method

@since version 0.85
public showFormLifeCycleHelpdesk ( $openform = true, $closeform = true )
$openform boolean open the form (true by default)
$closeform boolean close the form (true by default)

showFormManagement() public method

Print the Management rights form for the current profile
public showFormManagement ( $openform = true, $closeform = true )
$openform boolean open the form (true by default)
$closeform boolean close the form (true by default)

showFormSetup() public method

Print the central form for a profile
public showFormSetup ( $openform = true, $closeform = true )
$openform boolean open the form (true by default)
$closeform boolean close the form (true by default)

showFormTools() public method

Print the Tools rights form for the current profile
public showFormTools ( $openform = true, $closeform = true )
$openform boolean open the form (true by default)
$closeform boolean close the form (true by default)

showFormToolsHelpdesk() public method

Print the helpdesk right form for the current profile

showFormTracking() public method

Print the Tracking right form for the current profile
public showFormTracking ( $openform = true, $closeform = true )
$openform boolean open the form (true by default)
$closeform boolean close the form (true by default)

showFormTrackingHelpdesk() public method

Print the helpdesk right form for the current profile

showLegend() public method

public showLegend ( )

Property Details

$common_fields public_oe static_oe property

Common fields used for all profiles type
public static $common_fields

$dohistory public_oe property

public $dohistory

$helpdesk_rights public_oe static_oe property

Helpdesk fields of helpdesk profiles
public static $helpdesk_rights

$rightname static_oe public_oe property

static public $rightname