public function TMGMTJob::setState in Translation Management Tool 7
Updates the state of the job.
Parameters
$state: The new state of the job. Has to be one of the job state constants.
$message: (Optional) The log message to be saved along with the state change.
$variables: (Optional) An array of variables to replace in the message on display.
Return value
int The updated state of the job if it could be set.
See also
4 calls to TMGMTJob::setState()
- TMGMTJob::aborted in entity/
tmgmt.entity.job.inc - Sets the state of the job to 'aborted'.
- TMGMTJob::finished in entity/
tmgmt.entity.job.inc - Set the state of the job to 'finished'.
- TMGMTJob::rejected in entity/
tmgmt.entity.job.inc - Sets the state of the job to 'rejected'.
- TMGMTJob::submitted in entity/
tmgmt.entity.job.inc - Set the state of the job to 'submitted'.
File
- entity/
tmgmt.entity.job.inc, line 405
Class
- TMGMTJob
- Entity class for the tmgmt_job entity.
Code
public function setState($state, $message = NULL, $variables = array(), $type = 'debug') {
// Return TRUE if the state could be set. Return FALSE otherwise.
if (array_key_exists($state, tmgmt_job_states())) {
$this->state = $state;
$this
->save();
// If a message is attached to this state change add it now.
if (!empty($message)) {
$this
->addMessage($message, $variables, $type);
}
}
return $this->state;
}