78 lines
2.8 KiB
PHP
78 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace Kanboard\Plugin\RecoReco;
|
|
|
|
use Kanboard\Core\Plugin\Base;
|
|
|
|
class Plugin extends Base
|
|
{
|
|
public function initialize()
|
|
{
|
|
// "Recurring schedule" entry in the task Actions sidebar, right after the basic actions
|
|
// (next to native "Edit recurrence"). Opens the RecoReco config modal.
|
|
$this->template->hook->attach('template:task:sidebar:after-basic-actions', 'recoReco:task/sidebar_action');
|
|
|
|
// Modal JS: keep "days before" within one period of the selected frequency.
|
|
$this->hook->on('template:layout:js', array(
|
|
'template' => 'plugins/RecoReco/Asset/js/recoreco-modal.js',
|
|
));
|
|
|
|
// Board card icon: black on a recurring template, white (inverse) on a generated copy.
|
|
$this->template->hook->attach('template:board:task:icons', 'recoReco:board/task_icon');
|
|
|
|
// Global settings page (Settings -> RecoReco) with a manual "Run now" button that triggers
|
|
// the same scheduler pass as cron. Admin-only for free via the shared 'ConfigController' ACL.
|
|
$this->template->hook->attach('template:config:sidebar', 'recoReco:config/sidebar');
|
|
|
|
// Activity-stream entries. The feed renders each event via event/<name-with-underscores>, so
|
|
// map our two event names to the plugin templates (a spawn on the new card, and the yield to
|
|
// native recurrence on the template). createEvent() writes the rows directly from the model.
|
|
$this->template->setTemplateOverride('event/recoreco_task_spawn', 'recoReco:event/recoreco_task_spawn');
|
|
$this->template->setTemplateOverride('event/recoreco_task_disable', 'recoReco:event/recoreco_task_disable');
|
|
$this->template->setTemplateOverride('event/recoreco_task_complete', 'recoReco:event/recoreco_task_complete');
|
|
|
|
// The scheduling engine runs from the CLI (cron). Registered CLI-only so web requests do
|
|
// not build the console app.
|
|
if (php_sapi_name() === 'cli') {
|
|
$this->container['cli']->add(new \Kanboard\Plugin\RecoReco\Console\RecoRecoCommand($this->container));
|
|
}
|
|
}
|
|
|
|
public function getHelpers()
|
|
{
|
|
return array(
|
|
'Plugin\RecoReco\Helper' => array('RecoRecoHelper'),
|
|
);
|
|
}
|
|
|
|
public function getPluginName()
|
|
{
|
|
return 'RecoReco';
|
|
}
|
|
|
|
public function getPluginDescription()
|
|
{
|
|
return t('Calendar-scheduled recurring cards: a template card spawns a copy on a date (yearly, monthly, weekly, daily), driven by the card due date.');
|
|
}
|
|
|
|
public function getPluginAuthor()
|
|
{
|
|
return 'Ruben (drbeco)';
|
|
}
|
|
|
|
public function getPluginVersion()
|
|
{
|
|
return '1.9.0';
|
|
}
|
|
|
|
public function getPluginHomepage()
|
|
{
|
|
return 'https://code.beco.cc/beco/RecoReco';
|
|
}
|
|
|
|
public function getCompatibleVersion()
|
|
{
|
|
return '>=1.2.0';
|
|
}
|
|
}
|