Added a page & table for viewing a list of installed tasks
This commit is contained in:
64
src/Twig/FormatCronExtension.php
Normal file
64
src/Twig/FormatCronExtension.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* AVSDev UF Scheduler (https://avsdev.uk)
|
||||
*
|
||||
* @link https://git.avsdev.uk/avsdev/sprinkle-scheduler
|
||||
* @license https://git.avsdev.uk/avsdev/sprinkle-scheduler/blob/master/LICENSE.md (LGPL-3.0 License)
|
||||
*/
|
||||
|
||||
namespace UserFrosting\Sprinkle\Scheduler\Twig;
|
||||
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
use Lorisleiva\CronTranslator\CronTranslator;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\Extension\GlobalsInterface;
|
||||
use Twig\TwigFilter;
|
||||
use UserFrosting\Support\Repository\Repository as Config;
|
||||
|
||||
/**
|
||||
* Extends Twig functionality to add formatCron.
|
||||
*
|
||||
* @author Craig Williams (https://avsdev.uk)
|
||||
*/
|
||||
class FormatCronExtension extends AbstractExtension implements GlobalsInterface
|
||||
{
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
protected $services;
|
||||
|
||||
/**
|
||||
* @var Config
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @param ContainerInterface $services
|
||||
*/
|
||||
public function __construct(ContainerInterface $services)
|
||||
{
|
||||
$this->services = $services;
|
||||
$this->config = $services->config;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'avsdev/schedule-formatCron';
|
||||
}
|
||||
|
||||
public function getFilters()
|
||||
{
|
||||
return [
|
||||
new TwigFilter('formatCron', function ($cron) {
|
||||
return CronTranslator::translate($cron);
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
public function getGlobals()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user