32 lines
885 B
PHP
32 lines
885 B
PHP
<?php
|
|
|
|
namespace Kanboard\Plugin\OrganonTweaks\Helper;
|
|
|
|
use Kanboard\Core\Base;
|
|
use Kanboard\Model\TaskModel;
|
|
|
|
/**
|
|
* Template helper for column tweaks. Exposes an emptiness check that counts BOTH open and
|
|
* closed tasks (the board's own $column['nb_tasks'] is open-only), so a column that only
|
|
* holds closed tasks is still treated as non-empty.
|
|
*/
|
|
class OrganonColumnHelper extends Base
|
|
{
|
|
private static $emptyCache = array();
|
|
|
|
public function hasNoTasks($project_id, $column_id)
|
|
{
|
|
if (! isset(self::$emptyCache[$column_id])) {
|
|
$count = $this->taskFinderModel->countByColumnId(
|
|
$project_id,
|
|
$column_id,
|
|
array(TaskModel::STATUS_OPEN, TaskModel::STATUS_CLOSED)
|
|
);
|
|
|
|
self::$emptyCache[$column_id] = ($count === 0);
|
|
}
|
|
|
|
return self::$emptyCache[$column_id];
|
|
}
|
|
}
|