resources added f1
This commit is contained in:
31
Helper/OrganonColumnHelper.php
Normal file
31
Helper/OrganonColumnHelper.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user