summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2015-01-02 21:48:26 -0500
committerFrédéric Guillot <fred@kanboard.net>2015-01-02 21:48:26 -0500
commit0ebdd4ddfd898628cc30e34e55e97f88e5e30a71 (patch)
tree4038cd9ad1ad440b033d221b4ffd637ec03a538d /app
parent45c95d74fc2115fe4cc7214553c0927d3ce9df8d (diff)
Cleanup and fixes
Diffstat (limited to 'app')
-rw-r--r--app/Controller/Base.php2
-rw-r--r--app/Controller/Subtask.php2
-rw-r--r--app/Controller/Swimlane.php2
-rw-r--r--app/Controller/Task.php27
-rw-r--r--app/Model/Authentication.php4
-rw-r--r--app/Model/Project.php2
-rw-r--r--app/Subscriber/NotificationSubscriber.php4
-rw-r--r--app/Subscriber/ProjectActivitySubscriber.php4
-rw-r--r--app/Template/app/subtasks.php4
-rw-r--r--app/Template/app/tasks.php4
-rw-r--r--app/Template/board/filters.php2
11 files changed, 24 insertions, 33 deletions
diff --git a/app/Controller/Base.php b/app/Controller/Base.php
index 4719ebe4..b5d59640 100644
--- a/app/Controller/Base.php
+++ b/app/Controller/Base.php
@@ -169,7 +169,7 @@ abstract class Base
*/
public function handleAuthenticatedUser($controller, $action)
{
- if (! $this->authentication->isAuthenticated($controller, $action)) {
+ if (! $this->authentication->isAuthenticated()) {
if ($this->request->isAjax()) {
$this->response->text('Not Authorized', 401);
diff --git a/app/Controller/Subtask.php b/app/Controller/Subtask.php
index 59e9fe5c..0521b893 100644
--- a/app/Controller/Subtask.php
+++ b/app/Controller/Subtask.php
@@ -110,7 +110,7 @@ class Subtask extends Base
public function update()
{
$task = $this->getTask();
- $subtask = $this->getSubtask();
+ $this->getSubtask();
$values = $this->request->getValues();
list($valid, $errors) = $this->subTask->validateModification($values);
diff --git a/app/Controller/Swimlane.php b/app/Controller/Swimlane.php
index 10b29569..de2f1f12 100644
--- a/app/Controller/Swimlane.php
+++ b/app/Controller/Swimlane.php
@@ -87,7 +87,7 @@ class Swimlane extends Base
$project = $this->getProject();
$values = $this->request->getValues();
- list($valid, $errors) = $this->swimlane->validateDefaultModification($values);
+ list($valid,) = $this->swimlane->validateDefaultModification($values);
if ($valid) {
diff --git a/app/Controller/Task.php b/app/Controller/Task.php
index 773183fe..7f85f36c 100644
--- a/app/Controller/Task.php
+++ b/app/Controller/Task.php
@@ -141,7 +141,7 @@ class Task extends Base
$this->response->redirect('?controller=task&action=create&'.http_build_query($values));
}
else {
- $this->response->redirect('?controller=board&action=show&project_id='.$values['project_id']);
+ $this->response->redirect('?controller=board&action=show&project_id='.$project['id']);
}
}
else {
@@ -157,16 +157,20 @@ class Task extends Base
*
* @access public
*/
- public function edit()
+ public function edit(array $values = array(), array $errors = array())
{
$task = $this->getTask();
$ajax = $this->request->isAjax();
- $this->dateParser->format($task, array('date_due'));
+ if (empty($values)) {
+ $values = $task;
+ }
+
+ $this->dateParser->format($values, array('date_due'));
$params = array(
- 'values' => $task,
- 'errors' => array(),
+ 'values' => $values,
+ 'errors' => $errors,
'task' => $task,
'users_list' => $this->projectPermission->getMemberList($task['project_id']),
'colors_list' => $this->color->getList(),
@@ -213,18 +217,7 @@ class Task extends Base
}
}
- $this->response->html($this->taskLayout('task/edit', array(
- 'values' => $values,
- 'errors' => $errors,
- 'task' => $task,
- 'columns_list' => $this->board->getColumnsList($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'),
- 'date_formats' => $this->dateParser->getAvailableFormats(),
- 'ajax' => $this->request->isAjax(),
- )));
+ $this->edit($values, $errors);
}
/**
diff --git a/app/Model/Authentication.php b/app/Model/Authentication.php
index f917bff4..92898cd5 100644
--- a/app/Model/Authentication.php
+++ b/app/Model/Authentication.php
@@ -35,11 +35,9 @@ class Authentication extends Base
* Check if the current user is authenticated
*
* @access public
- * @param string $controller Controller
- * @param string $action Action name
* @return bool
*/
- public function isAuthenticated($controller, $action)
+ public function isAuthenticated()
{
// If the user is already logged it's ok
if ($this->userSession->isLogged()) {
diff --git a/app/Model/Project.php b/app/Model/Project.php
index 6d8885b1..f9c5c39c 100644
--- a/app/Model/Project.php
+++ b/app/Model/Project.php
@@ -228,7 +228,7 @@ class Project extends Base
);
if (! $this->db->table(self::TABLE)->save($values)) {
- return false;
+ return 0;
}
return $this->db->getConnection()->getLastId();
diff --git a/app/Subscriber/NotificationSubscriber.php b/app/Subscriber/NotificationSubscriber.php
index 4412636f..1580f6dc 100644
--- a/app/Subscriber/NotificationSubscriber.php
+++ b/app/Subscriber/NotificationSubscriber.php
@@ -44,13 +44,13 @@ class NotificationSubscriber extends Base implements EventSubscriberInterface
);
}
- public function execute(GenericEvent $event)
+ public function execute(GenericEvent $event, $event_name)
{
$values = $this->getTemplateData($event);
$users = $this->notification->getUsersList($values['task']['project_id']);
if ($users) {
- $this->notification->sendEmails($this->templates[$event->getName()], $users, $values);
+ $this->notification->sendEmails($this->templates[$event_name], $users, $values);
}
}
diff --git a/app/Subscriber/ProjectActivitySubscriber.php b/app/Subscriber/ProjectActivitySubscriber.php
index 3daf2f4d..aae09ae2 100644
--- a/app/Subscriber/ProjectActivitySubscriber.php
+++ b/app/Subscriber/ProjectActivitySubscriber.php
@@ -27,7 +27,7 @@ class ProjectActivitySubscriber extends Base implements EventSubscriberInterface
);
}
- public function execute(GenericEvent $event)
+ public function execute(GenericEvent $event, $event_name)
{
// Executed only when someone is logged
if ($this->userSession->isLogged() && isset($event['task_id'])) {
@@ -38,7 +38,7 @@ class ProjectActivitySubscriber extends Base implements EventSubscriberInterface
$values['task']['project_id'],
$values['task']['id'],
$this->userSession->getId(),
- $event->getName(),
+ $event_name,
$values
);
}
diff --git a/app/Template/app/subtasks.php b/app/Template/app/subtasks.php
index 47d4782c..7081b174 100644
--- a/app/Template/app/subtasks.php
+++ b/app/Template/app/subtasks.php
@@ -12,7 +12,7 @@
<?php foreach ($subtasks as $subtask): ?>
<tr>
<td class="task-table task-<?= $subtask['color_id'] ?>">
- <?= $this->a('#'.$subtask['task_id'], 'task', 'show', array('task_id' => $subtask['task_id'])) ?>
+ <?= $this->a('#'.$subtask['task_id'], 'task', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?>
</td>
<td>
<?= $this->a($this->e($subtask['project_name']), 'board', 'show', array('project_id' => $subtask['project_id'])) ?>
@@ -21,7 +21,7 @@
<?= $this->e($subtask['status_name']) ?>
</td>
<td>
- <?= $this->a($this->e($subtask['title']), 'task', 'show', array('task_id' => $subtask['task_id'])) ?>
+ <?= $this->a($this->e($subtask['title']), 'task', 'show', array('task_id' => $subtask['task_id'], 'project_id' => $subtask['project_id'])) ?>
</td>
</tr>
<?php endforeach ?>
diff --git a/app/Template/app/tasks.php b/app/Template/app/tasks.php
index 57f1714f..a3d78a9d 100644
--- a/app/Template/app/tasks.php
+++ b/app/Template/app/tasks.php
@@ -12,13 +12,13 @@
<?php foreach ($tasks as $task): ?>
<tr>
<td class="task-table task-<?= $task['color_id'] ?>">
- <?= $this->a('#'.$task['id'], 'task', 'show', array('task_id' => $task['id'])) ?>
+ <?= $this->a('#'.$task['id'], 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</td>
<td>
<?= $this->a($this->e($task['project_name']), 'board', 'show', array('project_id' => $task['project_id'])) ?>
</td>
<td>
- <?= $this->a($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'])) ?>
+ <?= $this->a($this->e($task['title']), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</td>
<td>
<?= dt('%B %e, %Y', $task['date_due']) ?>
diff --git a/app/Template/board/filters.php b/app/Template/board/filters.php
index e99fe234..36259820 100644
--- a/app/Template/board/filters.php
+++ b/app/Template/board/filters.php
@@ -23,11 +23,11 @@
<i class="fa fa-dashboard fa-fw"></i>
<?= $this->a(t('Activity'), 'project', 'activity', array('project_id' => $project['id'])) ?>
</li>
+ <?php if ($this->acl->isManagerActionAllowed($project['id'])): ?>
<li>
<i class="fa fa-line-chart fa-fw"></i>
<?= $this->a(t('Analytics'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?>
</li>
- <?php if ($this->acl->isManagerActionAllowed($project['id'])): ?>
<li><i class="fa fa-cog fa-fw"></i>
<?= $this->a(t('Configure'), 'project', 'show', array('project_id' => $project['id'])) ?>
<?php endif ?>