Example #1
0
 /**
  * @param ActiveModel $cron_jobs
  * @param ActiveModel $cron_log
  */
 public function index($cron_jobs, $cron_log)
 {
     $allHandlers = [];
     $loader = Loader::getInstance();
     $dirs = $loader->findDirectories(['App\\']);
     foreach ($dirs as $dir_id => $dir) {
         if ($cronPath = realpath("{$dir}/Controllers/Cron")) {
             $classes = glob("{$cronPath}/*.php");
             foreach ($classes as $class) {
                 if ($classPath = $loader->toPSR4('Cron', basename($class), 'App\\Controllers')) {
                     //ucfirst(basename(dirname(dirname($class)))))) {
                     if ($reflector = new ReflectionClass($classPath)) {
                         foreach ($reflector->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
                             if (!preg_match('/^\\_/', $method->name)) {
                                 $parts = explode('vendor', $dir);
                                 $methodValue = sprintf("%s@%s", $method->class, $method->name);
                                 $methodName = sprintf("%s (in %s)", $methodValue, @$parts[1] ?: 'app');
                                 $allHandlers[] = ['value' => $methodValue, 'name' => $methodName, 'type' => $method->class];
                             }
                         }
                     }
                 }
             }
         }
     }
     View::forge('Admin/Select2/EditCronJob.php', $cron_jobs, $cron_log, ['allHandlers' => $allHandlers]);
 }
 public function todo(AddContentEvent $event)
 {
     $todos[] = TodoUtils::createAutoItem(Swf2Vid::swf2vidKey . '/image', "Setup EC2 image details", '/admin/config/private');
     $todos[] = TodoUtils::createAutoItem(Swf2Vid::swf2vidKey . '/bucket_name', "Setup S3 upload details", '/admin/config/private');
     /** @var Model $page */
     if ($page = Loader::getInstance()->moduleExists('App\\Models\\Page')) {
         $todos[] = ['name' => 'Create page: "/video-credits" for buying additional video credits', 'status' => $page::find_by_slug_and_enabled('/video-credits', 'y') ? 'complete' : 'incomplete', 'link' => '/admin/pages'];
     }
     $contents = $event->getContents();
     $event->setContents(array_merge($contents, ['Swf2Vid' => $todos]));
 }