- ⌂ System Task
- Methods
- Static Methods
SystemTask::log_result()
Record a new result to the System Task, which will display as a colored rectangle with rounded corners in the webCOMAND Notifications & Tasks sidebar.
Prototype
void log_result($type, $message, $action = '', $extra = '', $timestamp = NULL)
Parameters
- type - The event type of the message, which indicates success (green) or the severity.
- message - The message to display in the rectangle.
- action - If set to 'url', extra will be interpreted as a URL. No other action is recognized.
- extra - If a URL is provided and action is set to 'url', the rectangle will include the popup icon (two rectangles) and open the specified URL in a new browser tab or window when clicked.
- timestamp - If not specified, the current time will be used.
Example
/**
* "Runnable" class to define a background System Task that will
* produce and publish a report, and provide a link to the PDF.
*/
use io_comand_systemtask\models\SystemTask;
use io_comand_systemtask\runnable;
use io_comand_systemtask\event\type;
class wait_thirty extends runnable {
public function run(SystemTask $task, array $params = []) {
$task->log_status('Producing report...');
// produce a web-accessible PDF report...
$task->log_result(
type::SUCCESS,
'Produced report.',
'url',
'https://example.com/report.pdf'
);
}
}