Constants

MSG_INFO

MSG_INFO

Define the number for the message information constant

MSG_WARNING

MSG_WARNING

Define the number for the message warning constant

MSG_ERROR

MSG_ERROR

Define the number for the message error constant

Properties

$base_urls

$base_urls : array

Define default value for the base URLs

Type

array

$rightname

$rightname : string

The right name for this class

Type

string

Methods

__construct()

__construct() 

__contruct function and the different base URLs

getTabNameForItem()

getTabNameForItem(object  $item, integer  $withtemplate) : string

Get the tab name used for item

Parameters

object $item

the item object

integer $withtemplate

1 if is a template form

Returns

string —

name of the tab

defineTabs()

defineTabs(array  $options = array()) : array

Define tabs to display on form page

Parameters

array $options

Returns

array —

containing the tabs name

displayTabContentForItem()

displayTabContentForItem(object  $item, integer  $tabnum = 1, integer  $withtemplate) : boolean

Display the content of the tab

Parameters

object $item
integer $tabnum

number of the tab to display

integer $withtemplate

1 if is a template form

Returns

boolean

showJobLogs()

showJobLogs() 

Show job logs

ajaxGetJobLogs()

ajaxGetJobLogs(integer  $task_id) 

Ajax called to get job logs

Parameters

integer $task_id

getCounterTypeName()

getCounterTypeName(string  $type = "") : string

Get translated name of counter type

Parameters

string $type

Returns

string

getAgentsLogs()

getAgentsLogs(array  $agents = array(), array  $counters = array(), string  $target_id = "") : array

Get agents logs

Parameters

array $agents
array $counters
string $target_id

Returns

array

getRunLogs()

getRunLogs(array  $run = array()) : array

Get run logs

Parameters

array $run

Returns

array

showForm()

showForm(integer  $id,   $options = array()) : boolean

Display form for task configuration

Parameters

integer $id

ID of the task

$options

array

Returns

boolean —

TRUE if form is ok

submitForm()

submitForm(array  $postvars) 

Manage the different actions in when submit form (add, update,purge.

..)

Parameters

array $postvars

getEmpty()

getEmpty() 

Define reprepare_if_successful field when get empty item

getBaseUrlFor()

getBaseUrlFor(string  $name) : string

Get a specific url root by type name

Parameters

string $name

the type of url requested (can be used for ajax call or pictures location)

Returns

string —

the requested url if found otherwise empty string

showList()

showList() 

Show Search list for this itemtype

showTextField()

showTextField(string  $title, string  $varname) 

Display input form element

Parameters

string $title
string $varname

showIntegerField()

showIntegerField(string  $title, string  $varname, array  $options = array()) 

Display input form element only with numbers

Parameters

string $title
string $varname
array $options

showCheckboxField()

showCheckboxField(string  $title, string  $varname, array  $options = array()) 

Display checkbox form element

Parameters

string $title
string $varname
array $options

showDropdownForItemtype()

showDropdownForItemtype(string  $title, string  $itemtype, array  $options = array()) : string

Display dropdown form element for itemtype

Parameters

string $title
string $itemtype

a glpi/plugin itemtype

array $options

Returns

string —

the rand number can be used with ajax to update something

showDropdownFromArray()

showDropdownFromArray(string  $title, string  $varname, array  $values = array(), array  $options = array()) : string

Display dropdown form element with array data

Parameters

string $title
string $varname
array $values
array $options

Returns

string —

the rand number can be used with ajax to update something

showDateTimeField()

showDateTimeField(string  $title, string  $varname, array  $options = array()) 

Display date time select form element

Parameters

string $title
string $varname
array $options

showTextArea()

showTextArea(string  $title, string  $varname) 

Display a text area form element

Parameters

string $title
string $varname

getMessage()

getMessage(string  $msg, integer  $type = self::MSG_INFO) : string

Get a HTML message

Parameters

string $msg
integer $type

Returns

string

getTypeName()

getTypeName(integer  $nb) : string

Get name of this type by language of the user connected

Parameters

integer $nb

number of elements

Returns

string —

name of this type

canCreate()

canCreate() : boolean

Check if user can create a task

Returns

boolean

getSearchOptions()

getSearchOptions() : array

Get search function for the class

Returns

array

purgeTask()

purgeTask(array  $param) 

Purge elements linked to task when delete it

Parameters

array $param

cleanTasksbyMethod()

cleanTasksbyMethod(string  $method) 

Purge all tasks and taskjob related with method

Parameters

string $method

getTaskjobstatesForAgent()

getTaskjobstatesForAgent(integer  $agent_id, string  $methods = array(), array  $options = array()) : array

Get the list of taskjobstate for the agent

Parameters

integer $agent_id
string $methods
array $options

Returns

array

prepareTaskjobs()

prepareTaskjobs(array  $methods = array()) : true

Prepare task jobs

Parameters

array $methods

Returns

true

getAgentsFromActors()

getAgentsFromActors(array  $actors = array()) : array

Get agents of Computers from Actors defined in taskjobs TODO: this method should be rewritten to call directly a getAgents() method in the corresponding itemtype classes.

Parameters

array $actors

Returns

array —

list of agents

cronTaskscheduler()

cronTaskscheduler() : true

Cron task: prepare taskjobs

Returns

true

formatChrono()

formatChrono(array  $chrono) : string

Format chrono (interval) in hours, minutes, seconds, microseconds string

Parameters

array $chrono

Returns

string

getJoblogs()

getJoblogs(array  $task_ids = array()) : array

Get logs of job

Parameters

array $task_ids

list of tasks id

Returns

array

getTasksPlanned()

getTasksPlanned(integer  $tasks_id) : object

Get tasks planned

Parameters

integer $tasks_id

if 0, no restriction so get all

Returns

object

getItemsFromDB()

getItemsFromDB(array  $filter) : array

Get tasks filtered by relevant criteria

Parameters

array $filter

criteria to filter in the request

Returns

array

getTasksInerror()

getTasksInerror() : object

Get tasks in error

Returns

object

post_updateItem()

post_updateItem(integer  $history = 1) 

Do actions after updated the item

Parameters

integer $history

getSpecificMassiveActions()

getSpecificMassiveActions(object|null  $checkitem = NULL) : array

Get the massive actions for this object

Parameters

object|null $checkitem

Returns

array —

list of actions

showMassiveActionsSubForm()

showMassiveActionsSubForm(object  $ma) : boolean

Display form related to the massive action selected

Parameters

object $ma

MassiveAction instance

Returns

boolean

processMassiveActionsForOneItemtype()

processMassiveActionsForOneItemtype(object  $ma, object  $item, array  $ids) 

Execution code for massive action

Parameters

object $ma

MassiveAction instance

object $item

item on which execute the code

array $ids

list of ID on which execute the code