Add projects to the dashboard and rename some methods

This commit is contained in:
Frédéric Guillot
2014-11-09 12:47:49 -05:00
parent e0117cb8ed
commit 3df63e051f
30 changed files with 262 additions and 75 deletions

View File

@@ -27,7 +27,7 @@ class Action extends Base
'available_events' => $this->action->getAvailableEvents(),
'available_params' => $this->action->getAllActionParameters(),
'columns_list' => $this->board->getColumnsList($project['id']),
'users_list' => $this->projectPermission->getUsersList($project['id']),
'users_list' => $this->projectPermission->getMemberList($project['id']),
'projects_list' => $this->project->getList(false),
'colors_list' => $this->color->getList(),
'categories_list' => $this->category->getList($project['id']),
@@ -85,7 +85,7 @@ class Action extends Base
'values' => $values,
'action_params' => $action_params,
'columns_list' => $this->board->getColumnsList($project['id']),
'users_list' => $this->projectPermission->getUsersList($project['id']),
'users_list' => $this->projectPermission->getMemberList($project['id']),
'projects_list' => $projects_list,
'colors_list' => $this->color->getList(),
'categories_list' => $this->category->getList($project['id']),

View File

@@ -20,12 +20,14 @@ class App extends Base
public function index()
{
$user_id = $this->acl->getUserId();
$projects = $this->projectPermission->getAllowedProjects($user_id);
$projects = $this->projectPermission->getMemberProjects($user_id);
$project_ids = array_keys($projects);
$this->response->html($this->template->layout('app_index', array(
'board_selector' => $projects,
'events' => $this->projectActivity->getProjects(array_keys($projects), 10),
'board_selector' => $this->projectPermission->getAllowedProjects($user_id),
'events' => $this->projectActivity->getProjects($project_ids, 10),
'tasks' => $this->taskFinder->getAllTasksByUser($user_id),
'projects' => $this->project->getSummary($project_ids),
'title' => t('Dashboard'),
)));
}

View File

@@ -42,12 +42,11 @@ class Board extends Base
{
$task = $this->getTask();
$project = $this->project->getById($task['project_id']);
$projects = $this->projectPermission->getAllowedProjects($this->acl->getUserId());
$params = array(
'errors' => array(),
'values' => $task,
'users_list' => $this->projectPermission->getUsersList($project['id']),
'projects' => $projects,
'users_list' => $this->projectPermission->getMemberList($project['id']),
'current_project_id' => $project['id'],
'current_project_name' => $project['name'],
);
@@ -95,12 +94,11 @@ class Board extends Base
{
$task = $this->getTask();
$project = $this->project->getById($task['project_id']);
$projects = $this->projectPermission->getAllowedProjects($this->acl->getUserId());
$params = array(
'errors' => array(),
'values' => $task,
'categories_list' => $this->category->getList($project['id']),
'projects' => $projects,
'current_project_id' => $project['id'],
'current_project_name' => $project['name'],
);
@@ -213,7 +211,7 @@ class Board extends Base
$this->user->storeLastSeenProjectId($project['id']);
$this->response->html($this->template->layout('board_index', array(
'users' => $this->projectPermission->getUsersList($project['id'], true, true),
'users' => $this->projectPermission->getMemberList($project['id'], true, true),
'filters' => array('user_id' => UserModel::EVERYBODY_ID),
'projects' => $projects,
'current_project_id' => $project['id'],

View File

@@ -146,7 +146,7 @@ class Project extends Base
public function update()
{
$project = $this->getProjectManagement();
$values = $this->request->getValues() + array('is_active' => 0);
$values = $this->request->getValues();
list($valid, $errors) = $this->project->validateModification($values);
if ($valid) {
@@ -527,9 +527,11 @@ class Project extends Base
if ($valid) {
if ($this->project->create($values, $this->acl->getUserId())) {
$project_id = $this->project->create($values, $this->acl->getUserId());
if ($project_id) {
$this->session->flash(t('Your project have been created successfully.'));
$this->response->redirect('?controller=project');
$this->response->redirect('?controller=project&action=show&project_id='.$project_id);
}
else {
$this->session->flashError(t('Unable to create your project.'));

View File

@@ -42,7 +42,7 @@ class Subtask extends Base
'another_subtask' => $this->request->getIntegerParam('another_subtask', 0)
),
'errors' => array(),
'users_list' => $this->projectPermission->getUsersList($task['project_id']),
'users_list' => $this->projectPermission->getMemberList($task['project_id']),
'task' => $task,
)));
}
@@ -78,7 +78,7 @@ class Subtask extends Base
$this->response->html($this->taskLayout('subtask_create', array(
'values' => $values,
'errors' => $errors,
'users_list' => $this->projectPermission->getUsersList($task['project_id']),
'users_list' => $this->projectPermission->getMemberList($task['project_id']),
'task' => $task,
)));
}
@@ -96,7 +96,7 @@ class Subtask extends Base
$this->response->html($this->taskLayout('subtask_edit', array(
'values' => $subtask,
'errors' => array(),
'users_list' => $this->projectPermission->getUsersList($task['project_id']),
'users_list' => $this->projectPermission->getMemberList($task['project_id']),
'status_list' => $this->subTask->getStatusList(),
'subtask' => $subtask,
'task' => $task,
@@ -131,7 +131,7 @@ class Subtask extends Base
$this->response->html($this->taskLayout('subtask_edit', array(
'values' => $values,
'errors' => $errors,
'users_list' => $this->projectPermission->getUsersList($task['project_id']),
'users_list' => $this->projectPermission->getMemberList($task['project_id']),
'status_list' => $this->subTask->getStatusList(),
'subtask' => $subtask,
'task' => $task,

View File

@@ -101,7 +101,7 @@ class Task extends Base
),
'projects_list' => $this->project->getListByStatus(ProjectModel::ACTIVE),
'columns_list' => $this->board->getColumnsList($project['id']),
'users_list' => $this->projectPermission->getUsersList($project['id']),
'users_list' => $this->projectPermission->getMemberList($project['id']),
'colors_list' => $this->color->getList(),
'categories_list' => $this->category->getList($project['id']),
'date_format' => $this->config->get('application_date_format'),
@@ -149,7 +149,7 @@ class Task extends Base
'values' => $values,
'projects_list' => $this->project->getListByStatus(ProjectModel::ACTIVE),
'columns_list' => $this->board->getColumnsList($project['id']),
'users_list' => $this->projectPermission->getUsersList($project['id']),
'users_list' => $this->projectPermission->getMemberList($project['id']),
'colors_list' => $this->color->getList(),
'categories_list' => $this->category->getList($project['id']),
'date_format' => $this->config->get('application_date_format'),
@@ -174,7 +174,7 @@ class Task extends Base
'values' => $task,
'errors' => array(),
'task' => $task,
'users_list' => $this->projectPermission->getUsersList($task['project_id']),
'users_list' => $this->projectPermission->getMemberList($task['project_id']),
'colors_list' => $this->color->getList(),
'categories_list' => $this->category->getList($task['project_id']),
'date_format' => $this->config->get('application_date_format'),
@@ -224,7 +224,7 @@ class Task extends Base
'errors' => $errors,
'task' => $task,
'columns_list' => $this->board->getColumnsList($values['project_id']),
'users_list' => $this->projectPermission->getUsersList($values['project_id']),
'users_list' => $this->projectPermission->getMemberList($values['project_id']),
'colors_list' => $this->color->getList(),
'categories_list' => $this->category->getList($values['project_id']),
'date_format' => $this->config->get('application_date_format'),
@@ -451,7 +451,7 @@ class Task extends Base
$task = $this->getTask();
$values = $task;
$errors = array();
$projects_list = $this->projectPermission->getAllowedProjects($this->acl->getUserId());
$projects_list = $this->projectPermission->getMemberProjects($this->acl->getUserId());
unset($projects_list[$task['project_id']]);