PHP Class Profile, glpi

Afficher le fichier Open project: glpi-project/glpi Class Usage Examples

Méthodes publiques

Свойство Type Description
$common_fields Common fields used for all profiles type
$dohistory
$helpdesk_rights Helpdesk fields of helpdesk profiles
$rightname

Méthodes publiques

Méthode 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 méthode

public cleanDBonPurge ( )

cleanProfile() public méthode

Unset unused rights for helpdesk
public cleanProfile ( )

currentUserHaveMoreRightThan() static public méthode

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

defineTabs() public méthode

public defineTabs ( $options = [] )

displayLifeCycleMatrix() public méthode

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 ?
Résultat nothing

displayLifeCycleMatrixTicketHelpdesk() public méthode

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 ?
Résultat nothing

displayRightsChoiceMatrix() public méthode

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
Résultat random value used to generate the ids

displayTabContentForItem() static public méthode

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

dropdownHelpdeskItemtypes() static public méthode

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 méthode

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)
Résultat nothing (print out an HTML select box) \deprecated since version 0.84 use dropdownRight instead

dropdownRight() static public méthode

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)
Résultat nothing (print out an HTML select box)

dropdownRights() static public méthode

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 méthode

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 méthode

Get the default Profile for new user
static public getDefault ( ) : integer
Résultat integer profiles_id

getForbiddenStandardMassiveAction() public méthode

getHelpdeskHardwareTypeName() static public méthode

static public getHelpdeskHardwareTypeName ( $value )
$value

getHelpdeskHardwareTypes() static public méthode

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

getHelpdeskItemtypes() static public méthode

static public getHelpdeskItemtypes ( )

getInterfaceName() static public méthode

static public getInterfaceName ( $value )
$value

getInterfaces() static public méthode

static public getInterfaces ( )

getLinearRightChoice() static public méthode

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
Résultat content if !display

getRightsFor() static public méthode

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

getSearchOptions() public méthode

public getSearchOptions ( )

getSpecificValueToDisplay() static public méthode

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

getSpecificValueToSelect() static public méthode

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

getTabNameForItem() public méthode

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

getTypeName() static public méthode

static public getTypeName ( $nb )

getUnderActiveProfileRestrictRequest() static public méthode

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')
Résultat SQL restrict string

haveUserRight() static public méthode

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
Résultat boolean

post_addItem() public méthode

public post_addItem ( )

post_getEmpty() public méthode

public post_getEmpty ( )

post_getFromDB() public méthode

public post_getFromDB ( )

post_updateItem() public méthode

public post_updateItem ( $history = 1 )

pre_deleteItem() public méthode

check right before delete
public pre_deleteItem ( ) : boolean
Résultat boolean

prepareInputForAdd() public méthode

public prepareInputForAdd ( $input )

prepareInputForUpdate() public méthode

public prepareInputForUpdate ( $input )

showForm() public méthode

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
Résultat boolean item found

showFormAdmin() public méthode

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 méthode

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 méthode

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 méthode

@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 méthode

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 méthode

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 méthode

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 méthode

Print the helpdesk right form for the current profile

showFormTracking() public méthode

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 méthode

Print the helpdesk right form for the current profile

showLegend() public méthode

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