Offer the possibility to override internal formatter objects from plugins
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
namespace Kanboard\Controller;
|
||||
|
||||
use Kanboard\Core\Controller\AccessForbiddenException;
|
||||
use Kanboard\Formatter\BoardFormatter;
|
||||
use Kanboard\Model\UserMetadataModel;
|
||||
|
||||
/**
|
||||
@@ -139,7 +138,7 @@ class BoardAjaxController extends BaseController
|
||||
'board_highlight_period' => $this->configModel->get('board_highlight_period'),
|
||||
'swimlanes' => $this->taskLexer
|
||||
->build($this->userSession->getFilters($project_id))
|
||||
->format(BoardFormatter::getInstance($this->container)->withProjectId($project_id))
|
||||
->format($this->boardFormatter->withProjectId($project_id))
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace Kanboard\Controller;
|
||||
|
||||
use Kanboard\Core\Controller\AccessForbiddenException;
|
||||
use Kanboard\Formatter\BoardFormatter;
|
||||
use Kanboard\Model\TaskModel;
|
||||
|
||||
/**
|
||||
@@ -35,7 +34,7 @@ class BoardViewController extends BaseController
|
||||
|
||||
$this->response->html($this->helper->layout->app('board/view_public', array(
|
||||
'project' => $project,
|
||||
'swimlanes' => BoardFormatter::getInstance($this->container)
|
||||
'swimlanes' => $this->boardFormatter
|
||||
->withProjectId($project['id'])
|
||||
->withQuery($query)
|
||||
->format()
|
||||
@@ -68,7 +67,7 @@ class BoardViewController extends BaseController
|
||||
'board_highlight_period' => $this->configModel->get('board_highlight_period'),
|
||||
'swimlanes' => $this->taskLexer
|
||||
->build($search)
|
||||
->format(BoardFormatter::getInstance($this->container)->withProjectId($project['id']))
|
||||
->format($this->boardFormatter->withProjectId($project['id']))
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace Kanboard\Controller;
|
||||
|
||||
use Kanboard\Formatter\GroupAutoCompleteFormatter;
|
||||
|
||||
/**
|
||||
* Group Ajax Controller
|
||||
*
|
||||
@@ -20,7 +18,7 @@ class GroupAjaxController extends BaseController
|
||||
public function autocomplete()
|
||||
{
|
||||
$search = $this->request->getStringParam('term');
|
||||
$formatter = new GroupAutoCompleteFormatter($this->groupManager->find($search));
|
||||
$this->response->json($formatter->format());
|
||||
$groups = $this->groupManager->find($search);
|
||||
$this->response->json($this->groupAutoCompleteFormatter->withGroups($groups)->format());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ use Kanboard\Core\Filter\QueryBuilder;
|
||||
use Kanboard\Filter\TaskAssigneeFilter;
|
||||
use Kanboard\Filter\TaskProjectFilter;
|
||||
use Kanboard\Filter\TaskStatusFilter;
|
||||
use Kanboard\Formatter\TaskICalFormatter;
|
||||
use Kanboard\Model\TaskModel;
|
||||
use Eluceo\iCal\Component\Calendar as iCalendar;
|
||||
|
||||
@@ -94,8 +93,6 @@ class ICalendarController extends BaseController
|
||||
$end = $this->request->getStringParam('end', strtotime('+6 months'));
|
||||
|
||||
$this->helper->ical->addTaskDateDueEvents($queryBuilder, $calendar, $start, $end);
|
||||
|
||||
$formatter = new TaskICalFormatter($this->container);
|
||||
$this->response->ical($formatter->setCalendar($calendar)->format());
|
||||
$this->response->ical($this->taskICalFormatter->setCalendar($calendar)->format());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace Kanboard\Controller;
|
||||
use Kanboard\Filter\ProjectIdsFilter;
|
||||
use Kanboard\Filter\ProjectStatusFilter;
|
||||
use Kanboard\Filter\ProjectTypeFilter;
|
||||
use Kanboard\Formatter\ProjectGanttFormatter;
|
||||
use Kanboard\Model\ProjectModel;
|
||||
|
||||
/**
|
||||
@@ -30,7 +29,7 @@ class ProjectGanttController extends BaseController
|
||||
$filter->getQuery()->asc(ProjectModel::TABLE.'.start_date');
|
||||
|
||||
$this->response->html($this->helper->layout->app('project_gantt/show', array(
|
||||
'projects' => $filter->format(new ProjectGanttFormatter($this->container)),
|
||||
'projects' => $filter->format($this->projectGanttFormatter),
|
||||
'title' => t('Gantt chart for all projects'),
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ use Kanboard\Filter\TaskProjectsFilter;
|
||||
use Kanboard\Filter\TaskStartsWithIdFilter;
|
||||
use Kanboard\Filter\TaskStatusFilter;
|
||||
use Kanboard\Filter\TaskTitleFilter;
|
||||
use Kanboard\Formatter\TaskAutoCompleteFormatter;
|
||||
use Kanboard\Formatter\TaskSuggestMenuFormatter;
|
||||
use Kanboard\Model\TaskModel;
|
||||
|
||||
/**
|
||||
@@ -46,7 +44,7 @@ class TaskAjaxController extends BaseController
|
||||
$filter->withFilter(new TaskTitleFilter($search));
|
||||
}
|
||||
|
||||
$this->response->json($filter->format(new TaskAutoCompleteFormatter($this->container)));
|
||||
$this->response->json($filter->format($this->taskAutoCompleteFormatter));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +64,7 @@ class TaskAjaxController extends BaseController
|
||||
->withFilter(new TaskStatusFilter(TaskModel::STATUS_OPEN))
|
||||
->withFilter(new TaskStartsWithIdFilter($taskId));
|
||||
|
||||
$this->response->json($filter->format(new TaskSuggestMenuFormatter($this->container)));
|
||||
$this->response->json($filter->format($this->taskSuggestMenuFormatter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace Kanboard\Controller;
|
||||
|
||||
use Kanboard\Filter\TaskProjectFilter;
|
||||
use Kanboard\Formatter\TaskGanttFormatter;
|
||||
use Kanboard\Model\TaskModel;
|
||||
|
||||
/**
|
||||
@@ -35,7 +34,7 @@ class TaskGanttController extends BaseController
|
||||
'title' => $project['name'],
|
||||
'description' => $this->helper->projectHeader->getDescription($project),
|
||||
'sorting' => $sorting,
|
||||
'tasks' => $filter->format(new TaskGanttFormatter($this->container)),
|
||||
'tasks' => $filter->format($this->taskGanttFormatter),
|
||||
)));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace Kanboard\Controller;
|
||||
|
||||
use Kanboard\Core\Controller\AccessForbiddenException;
|
||||
use Kanboard\Formatter\BoardFormatter;
|
||||
use Kanboard\Model\TaskModel;
|
||||
|
||||
/**
|
||||
@@ -20,7 +19,7 @@ class TaskMovePositionController extends BaseController
|
||||
|
||||
$this->response->html($this->template->render('task_move_position/show', array(
|
||||
'task' => $task,
|
||||
'board' => BoardFormatter::getInstance($this->container)
|
||||
'board' => $this->boardFormatter
|
||||
->withProjectId($task['project_id'])
|
||||
->withQuery($this->taskFinderModel->getExtendedQuery()
|
||||
->eq(TaskModel::TABLE.'.is_active', TaskModel::STATUS_OPEN)
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
namespace Kanboard\Controller;
|
||||
|
||||
use Kanboard\Filter\UserNameFilter;
|
||||
use Kanboard\Formatter\UserAutoCompleteFormatter;
|
||||
use Kanboard\Formatter\UserMentionFormatter;
|
||||
use Kanboard\Model\UserModel;
|
||||
|
||||
/**
|
||||
@@ -25,7 +23,7 @@ class UserAjaxController extends BaseController
|
||||
$search = $this->request->getStringParam('term');
|
||||
$filter = $this->userQuery->withFilter(new UserNameFilter($search));
|
||||
$filter->getQuery()->asc(UserModel::TABLE.'.name')->asc(UserModel::TABLE.'.username');
|
||||
$this->response->json($filter->format(new UserAutoCompleteFormatter($this->container)));
|
||||
$this->response->json($filter->format($this->userAutoCompleteFormatter));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,11 +37,7 @@ class UserAjaxController extends BaseController
|
||||
$query = $this->request->getStringParam('search');
|
||||
$users = $this->projectPermissionModel->findUsernames($project_id, $query);
|
||||
|
||||
$this->response->json(
|
||||
UserMentionFormatter::getInstance($this->container)
|
||||
->withUsers($users)
|
||||
->format()
|
||||
);
|
||||
$this->response->json($this->userMentionFormatter->withUsers($users)->format());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user