summaryrefslogtreecommitdiff
path: root/app/Controller/Link.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller/Link.php')
-rw-r--r--app/Controller/Link.php38
1 files changed, 11 insertions, 27 deletions
diff --git a/app/Controller/Link.php b/app/Controller/Link.php
index 0eb3d679..ec7ab1af 100644
--- a/app/Controller/Link.php
+++ b/app/Controller/Link.php
@@ -12,22 +12,6 @@ namespace Kanboard\Controller;
class Link extends Base
{
/**
- * Common layout for config views
- *
- * @access private
- * @param string $template Template name
- * @param array $params Template parameters
- * @return string
- */
- private function layout($template, array $params)
- {
- $params['board_selector'] = $this->projectPermission->getAllowedProjects($this->userSession->getId());
- $params['config_content_for_layout'] = $this->template->render($template, $params);
-
- return $this->template->layout('config/layout', $params);
- }
-
- /**
* Get the current link
*
* @access private
@@ -51,7 +35,7 @@ class Link extends Base
*/
public function index(array $values = array(), array $errors = array())
{
- $this->response->html($this->layout('link/index', array(
+ $this->response->html($this->helper->layout->config('link/index', array(
'links' => $this->link->getMergedList(),
'values' => $values,
'errors' => $errors,
@@ -67,14 +51,14 @@ class Link extends Base
public function save()
{
$values = $this->request->getValues();
- list($valid, $errors) = $this->link->validateCreation($values);
+ list($valid, $errors) = $this->linkValidator->validateCreation($values);
if ($valid) {
if ($this->link->create($values['label'], $values['opposite_label']) !== false) {
- $this->session->flash(t('Link added successfully.'));
+ $this->flash->success(t('Link added successfully.'));
$this->response->redirect($this->helper->url->to('link', 'index'));
} else {
- $this->session->flashError(t('Unable to create your link.'));
+ $this->flash->failure(t('Unable to create your link.'));
}
}
@@ -91,7 +75,7 @@ class Link extends Base
$link = $this->getLink();
$link['label'] = t($link['label']);
- $this->response->html($this->layout('link/edit', array(
+ $this->response->html($this->helper->layout->config('link/edit', array(
'values' => $values ?: $link,
'errors' => $errors,
'labels' => $this->link->getList($link['id']),
@@ -108,14 +92,14 @@ class Link extends Base
public function update()
{
$values = $this->request->getValues();
- list($valid, $errors) = $this->link->validateModification($values);
+ list($valid, $errors) = $this->linkValidator->validateModification($values);
if ($valid) {
if ($this->link->update($values)) {
- $this->session->flash(t('Link updated successfully.'));
+ $this->flash->success(t('Link updated successfully.'));
$this->response->redirect($this->helper->url->to('link', 'index'));
} else {
- $this->session->flashError(t('Unable to update your link.'));
+ $this->flash->failure(t('Unable to update your link.'));
}
}
@@ -131,7 +115,7 @@ class Link extends Base
{
$link = $this->getLink();
- $this->response->html($this->layout('link/remove', array(
+ $this->response->html($this->helper->layout->config('link/remove', array(
'link' => $link,
'title' => t('Remove a link')
)));
@@ -148,9 +132,9 @@ class Link extends Base
$link = $this->getLink();
if ($this->link->remove($link['id'])) {
- $this->session->flash(t('Link removed successfully.'));
+ $this->flash->success(t('Link removed successfully.'));
} else {
- $this->session->flashError(t('Unable to remove this link.'));
+ $this->flash->failure(t('Unable to remove this link.'));
}
$this->response->redirect($this->helper->url->to('link', 'index'));