addTitleTab($this->translate('Jobs')); $this->getTabs()->add('sni', [ 'title' => $this->translate('Configure SNI'), 'label' => $this->translate('SNI'), 'url' => 'x509/sni', 'baseTarget' => '_main' ]); $jobs = X509Job::on(Database::get()); if ($this->hasPermission('config/x509')) { $this->addControl( (new ButtonLink($this->translate('New Job'), Url::fromPath('x509/jobs/new'), 'plus')) ->openInModal() ); } $sortControl = $this->createSortControl($jobs, [ 'name' => $this->translate('Name'), 'author' => $this->translate('Author'), 'ctime' => $this->translate('Date Created'), 'mtime' => $this->translate('Date Modified') ]); $this->controls->getAttributes()->add('class', 'default-layout'); $this->addControl($sortControl); $this->addContent(new Jobs($jobs)); } public function newAction() { $this->assertPermission('config/x509'); $this->addTitleTab($this->translate('New Job')); $form = (new JobConfigForm()) ->setAction((string) Url::fromRequest()) ->on(JobConfigForm::ON_SUCCESS, function () { $this->closeModalAndRefreshRelatedView(Url::fromPath('x509/jobs')); }) ->handleRequest($this->getServerRequest()); $this->addContent($form); } }