39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Kanboard\Plugin\RecoReco\Helper;
|
|
|
|
use Kanboard\Core\Base;
|
|
use Kanboard\Model\TaskModel;
|
|
|
|
/**
|
|
* Board helper: which RecoReco icon a card should show.
|
|
*
|
|
* Single-icon rule -- RecoReco only renders when the card is NOT native-recurring
|
|
* (recurrence_status == NONE), so native's icon and RecoReco's icon can never appear together.
|
|
*/
|
|
class RecoRecoHelper extends Base
|
|
{
|
|
/**
|
|
* @param array $task A board task row (has recurrence_status and id).
|
|
* @return string 'template', 'clone', or '' (no RecoReco icon).
|
|
*/
|
|
public function iconType(array $task)
|
|
{
|
|
if ((int) $task['recurrence_status'] !== TaskModel::RECURRING_STATUS_NONE) {
|
|
return '';
|
|
}
|
|
|
|
$meta = $this->taskMetadataModel->getAll($task['id']);
|
|
|
|
if (isset($meta['recoreco_enabled']) && $meta['recoreco_enabled'] == 1) {
|
|
return 'template';
|
|
}
|
|
|
|
if (isset($meta['recoreco_clone']) && $meta['recoreco_clone'] == 1) {
|
|
return 'clone';
|
|
}
|
|
|
|
return '';
|
|
}
|
|
}
|