Files
RecoReco/Controller/ConfigController.php

41 lines
1.4 KiB
PHP

<?php
namespace Kanboard\Plugin\RecoReco\Controller;
use Kanboard\Controller\BaseController;
use Kanboard\Plugin\RecoReco\Model\RecoRecoModel;
/**
* Global settings page for RecoReco.
*
* Admin-only for free: the application ACL is keyed by the SHORT controller name, and core maps
* 'ConfigController' => APP_ADMIN (AuthenticationProvider::getApplicationAccessMap), so every action
* on a controller named ConfigController requires an application administrator -- plugin included.
* Keep admin-only actions in THIS controller; a differently-named controller would default to
* APP_USER (any logged-in user).
*/
class ConfigController extends BaseController
{
public function show()
{
$this->response->html($this->helper->layout->config('recoReco:config/show', array(
'title' => t('Settings').' &gt; '.t('RecoReco'),
)));
}
/**
* Run the scheduler now -- the same pass cron runs: spawn every template card whose occurrence
* is due, across all boards. Idempotent (an occurrence is never spawned twice), so it is safe to
* trigger at any time.
*/
public function run()
{
$this->checkCSRFForm();
$count = (new RecoRecoModel($this->container))->run();
$this->flash->success(t('RecoReco: spawned %d card(s).', $count));
$this->response->redirect($this->helper->url->to('ConfigController', 'show', array('plugin' => 'RecoReco')));
}
}