\PluginFusioninventoryTaskjobstate

Manage the state of task jobs.

Summary

Methods
Properties
Constants
getTabNameForItem()
getStateNames()
displayTabContentForItem()
stateTaskjob()
stateTaskjobItem()
changeStatus()
getTaskjobsAgent()
ajaxGetLogs()
getLogs()
changeStatusFinish()
fail()
cancel()
cronCleantaskjob()
$method
PREPARED
SERVER_HAS_SENT_DATA
AGENT_HAS_SENT_DATA
FINISHED
IN_ERROR
CANCELLED
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

PREPARED

PREPARED

Define constant state prepared.

The job is just prepared and waiting for agent request

SERVER_HAS_SENT_DATA

SERVER_HAS_SENT_DATA

Define constant state has sent data to agent and not have the answer.

The job is running and the server sent the job config

AGENT_HAS_SENT_DATA

AGENT_HAS_SENT_DATA

Define constant state agent has sent data.

The job is running and the agent sent reply to the server

FINISHED

FINISHED

Define constant state finished.

The agent completed successfully the job

IN_ERROR

IN_ERROR

Define constant state in error.

The agent failed to complete the job

CANCELLED

CANCELLED

Define constant state cancelled The job has been cancelled either by a user or the agent himself (eg. if it has been forbidden to run this taskjob)

Properties

$method

$method : string

Initialize the public method

Type

string

Methods

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

getStateNames()

getStateNames() : array

Get all states name

Returns

array

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

stateTaskjob()

stateTaskjob(integer  $taskjobs_id, integer  $width = 930, string  $return = 'html', string  $style = '') : string

Display state of taskjob

Parameters

integer $taskjobs_id

id of the taskjob

integer $width

how large in pixel display array

string $return

display or return in var (html or htmlvar or other value to have state number in %)

string $style

'' = normal or 'simple' for very simple display

Returns

string

stateTaskjobItem()

stateTaskjobItem(integer  $items_id, string  $itemtype, string  $state = 'all') 

Display state of an item of a taskjob

Parameters

integer $items_id

id of the item

string $itemtype

type of the item

string $state

(all or each state : running, finished, nostarted)

changeStatus()

changeStatus(integer  $id, integer  $state) 

Change the state

Parameters

integer $id

id of the taskjobstate

integer $state

state to set

getTaskjobsAgent()

getTaskjobsAgent(integer  $agent_id) 

Get taskjobs of an agent

Parameters

integer $agent_id

id of the agent

ajaxGetLogs()

ajaxGetLogs(array  $params) : string

Process ajax parameters for getLogs() methods

since 0.85+1.0

Parameters

array $params

list of ajax expected 'id' and 'last_date' parameters

Returns

string —

in json format, encoded list of logs grouped by jobstates

getLogs()

getLogs(integer  $id, string  $last_date) : array

Get logs associated to a jobstate.

Parameters

integer $id
string $last_date

Returns

array

changeStatusFinish()

changeStatusFinish(integer  $taskjobstates_id, integer  $items_id, string  $itemtype, integer  $error, string  $message = '') 

Change the status to finish

Parameters

integer $taskjobstates_id

id of the taskjobstates

integer $items_id

id of the item

string $itemtype

type of the item

integer $error

error

string $message

message for the status

fail()

fail(string  $reason = '') 

Update taskjob(log) in error

Parameters

string $reason

cancel()

cancel(string  $reason = '') 

Cancel a taskjob

Parameters

string $reason

cronCleantaskjob()

cronCleantaskjob() 

Cron task: clean taskjob (retention time)