Código PHP:
<?php
header("Content-type:image/gif");
$img = imagecreate(500,500); // Cria a imagem
class CronJob
{
var $color; // Varial que vamos usar
protected $Tasks = array( // Array das tarefas, você pode mudar e fazer por consultas mssql ou mysql, isto é somente um exemplo.
array('Tarefa' => 'Sincronizar Heros','Arquivo' => 'tasks/sicronize_heros.task.txt','Altura' => '45'),
array('Tarefa' => 'Sincronizar Usuarios','Arquivo' => 'tasks/sicronize_users.tasks.txt', 'Altura' => '85'),
array('Tarefa' => 'Sincronizar Personagens','Arquivo' => 'tasks/sicronize_characters.taks.txt', 'Altura' => '125'),
array('Tarefa' => 'Teste','Arquivo' => 'tasks/teste.taks.txt', 'Altura' => '165'),
array('Tarefa' => 'NULL','Arquivo' => 'NULL', 'Altura' => 'NULL'));
function colors($color) // Função de cores
{
global $img;
if($color == black) // Preto
{
return imagecolorallocate($img,0,0,0);
}
elseif($color == white) // Branco
{
return imagecolorallocate($img,255,255,255);
}
elseif($color == green) // Verde
{
return imagecolorallocate($img,0,255,0);
}
elseif($color == yellow) // Amarelo
{
return imagecolorallocate($img,255,255,106);
}
elseif($color == red) // Vermelho
{
return imagecolorallocate($img,187,0,0);
}
elseif($color == blue) // Azul
{
return imagecolorallocate($img,132,132,255);
}
}
function setSymbol($top,$left,$color) // Função que adiciona a bolinha antes do texto
{
global $img;
imageellipse($img, $left, $top, 9, 9, $this->colors('black')); // Cria a borda
imagefilledellipse($img, $left, $top, 7, 7, $color); // Cria a bola
}
function setText($txt,$left,$top,$color) // Função que Adiciona Texto a imagem, tem que definir a altura a distância do lado esquerdo
{
global $img;
ImageString($img, 1, $left, $top, $txt, $color);
}
function loadTasks() // Carrega as tarefas, você pode alterar essa função de acordo com suas necessidades
{
global $img;
$this->setSymbol(33,15,$this->colors('green'));
$this->setText('Procurando Tarefas',25,30,$this->colors('black'));
for($c = 0;$c < count($this->Tasks); ++$c)
{
if(isset($this->Tasks[$c+1]))
{
$this->setSymbol($this->Tasks[$c]['Altura'],23,$this->colors('yellow'));
$this->setText('Tarefa encontrada ['.$this->Tasks[$c]['Tarefa'].']',32,$this->Tasks[$c]['Altura']-4,$this->colors('black'));
if(file_exists($this->Tasks[$c]['Arquivo']))
{
$file = fopen($this->Tasks[$c]['Arquivo'],'r'); // Abre o arquivo da tarefa
$this->setSymbol($this->Tasks[$c]['Altura']+11,31,$this->colors('blue'));
$this->setText('O arquivo ['.$this->Tasks[$c]['Arquivo'].'] existe.',40,$this->Tasks[$c]['Altura']+8,$this->colors('black'));
$fRead = fread($file,filesize($this->Tasks[$c]['Arquivo']));
@eval($fRead);
$this->setSymbol($this->Tasks[$c]['Altura']+24,39,$this->colors('green'));
$this->setText('Arqivo executado.',48,$this->Tasks[$c]['Altura']+20,$this->colors('black'));
}
else
{
$this->setSymbol($this->Tasks[$c]['Altura']+11,31,$this->colors('red'));
$this->setText('O arquivo ['.$this->Tasks[$c]['Arquivo'].'] não existe existe.',40,$this->Tasks[$c]['Altura']+8,$this->colors('black'));
$this->setSymbol($this->Tasks[$c]['Altura']+24,39,$this->colors('black'));
$this->setText('Execução Travada.',48,$this->Tasks[$c]['Altura']+20,$this->colors('black'));
}
}
}
}
function __construct() // Carrega todo código
{
global $img;
$this->colors('white');
$this->setText('GRAPHIC VIEW DEBUG - POWERED BY 14BISS',5,16,$this->colors('black'));
$this->loadTasks();
imagegif($img);
}
}
new CronJob;
?>
Imagem gerada: