diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 039a428..2f8f4c0 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -63,13 +63,13 @@ final class ApiController extends Controller { if (!empty($val = $this->validateKanbanCardCreate($request))) { $response->set('kanban_card_create', new FormValidation($val)); - $response->getHeader()->setStatusCode(RequestStatusCode::R_400); + $response->header->status = RequestStatusCode::R_400; return; } $card = $this->createKanbanCardFromRequest($request); - $this->createModel($request->getHeader()->getAccount(), $card, KanbanCardMapper::class, 'card', $request->getOrigin()); + $this->createModel($request->header->account, $card, KanbanCardMapper::class, 'card', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Card', 'Card successfully created.', $card); } @@ -85,14 +85,14 @@ final class ApiController extends Controller public function createKanbanCardFromRequest(RequestAbstract $request) : KanbanCard { $card = new KanbanCard(); - $card->setName((string) ($request->getData('title'))); - $card->setDescription((string) ($request->getData('plain') ?? '')); + $card->name = (string) ($request->getData('title')); + $card->description = (string) ($request->getData('plain') ?? ''); $card->setColumn((int) $request->getData('column')); $card->setOrder((int) ($request->getData('order') ?? 1)); $card->setRef((int) ($request->getData('ref') ?? 0)); $card->setStatus((int) ($request->getData('status') ?? CardStatus::ACTIVE)); $card->setType((int) ($request->getData('type') ?? CardType::TEXT)); - $card->setCreatedBy(new NullAccount($request->getHeader()->getAccount())); + $card->createdBy = new NullAccount($request->header->account); return $card; } @@ -143,13 +143,13 @@ final class ApiController extends Controller { if (!empty($val = $this->validateKanbanCardCommentCreate($request))) { $response->set('kanban_comment_create', new FormValidation($val)); - $response->getHeader()->setStatusCode(RequestStatusCode::R_400); + $response->header->status = RequestStatusCode::R_400; return; } $comment = $this->createKanbanCardCommentFromRequest($request); - $this->createModel($request->getHeader()->getAccount(), $comment, KanbanCardCommentMapper::class, 'comment', $request->getOrigin()); + $this->createModel($request->header->account, $comment, KanbanCardCommentMapper::class, 'comment', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Card', 'Card successfully created.', $comment); } @@ -165,9 +165,9 @@ final class ApiController extends Controller public function createKanbanCardCommentFromRequest(RequestAbstract $request) : KanbanCardComment { $comment = new KanbanCardComment(); - $comment->setDescription((string) ($request->getData('plain') ?? '')); + $comment->description = (string) ($request->getData('plain') ?? ''); $comment->setCard((int) $request->getData('card')); - $comment->setCreatedBy(new NullAccount($request->getHeader()->getAccount())); + $comment->createdBy = new NullAccount($request->header->account); return $comment; } @@ -210,13 +210,13 @@ final class ApiController extends Controller { if (!empty($val = $this->validateKanbanBoardCreate($request))) { $response->set('kanban_board_create', new FormValidation($val)); - $response->getHeader()->setStatusCode(RequestStatusCode::R_400); + $response->header->status = RequestStatusCode::R_400; return; } $board = $this->createKanbanBoardFromRequest($request); - $this->createModel($request->getHeader()->getAccount(), $board, KanbanBoardMapper::class, 'board',$request->getOrigin()); + $this->createModel($request->header->account, $board, KanbanBoardMapper::class, 'board',$request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Board', 'Board successfully created.', $board); } @@ -232,11 +232,11 @@ final class ApiController extends Controller public function createKanbanBoardFromRequest(RequestAbstract $request) : KanbanBoard { $board = new KanbanBoard(); - $board->setName((string) $request->getData('title')); - $board->setDescription((string) ($request->getData('plain') ?? '')); + $board->name = (string) $request->getData('title'); + $board->description = (string) ($request->getData('plain') ?? ''); $board->setOrder((int) ($request->getData('order') ?? 1)); $board->setStatus((int) ($request->getData('status') ?? BoardStatus::ACTIVE)); - $board->setCreatedBy(new NullAccount($request->getHeader()->getAccount())); + $board->createdBy = new NullAccount($request->header->account); return $board; } @@ -282,13 +282,13 @@ final class ApiController extends Controller { if (!empty($val = $this->validateKanbanColumnCreate($request))) { $response->set('kanban_column_create', new FormValidation($val)); - $response->getHeader()->setStatusCode(RequestStatusCode::R_400); + $response->header->status = RequestStatusCode::R_400; return; } $column = $this->createKanbanColumnFromRequest($request); - $this->createModel($request->getHeader()->getAccount(), $column, KanbanColumnMapper::class, 'column', $request->getOrigin()); + $this->createModel($request->header->account, $column, KanbanColumnMapper::class, 'column', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Column', 'Column successfully created.', $column); } @@ -304,7 +304,7 @@ final class ApiController extends Controller public function createKanbanColumnFromRequest(RequestAbstract $request) : KanbanColumn { $column = new KanbanColumn(); - $column->setName((string) $request->getData('title')); + $column->name = (string) $request->getData('title'); $column->setBoard((int) $request->getData('board')); $column->setOrder((int) ($request->getData('order') ?? 1)); diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 69f36d5..6a5ab52 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -103,14 +103,14 @@ final class BackendController extends Controller $view = new View($this->app->l11nManager, $request, $response); $board = KanbanBoardMapper::get((int) $request->getData('id')); - $accountId = $request->getHeader()->getAccount(); + $accountId = $request->header->account; - if ($board->getCreatedBy()->getId() !== $accountId + if ($board->createdBy->getId() !== $accountId && !$this->app->accountManager->get($accountId)->hasPermission( PermissionType::READ, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::BOARD, $board->getId()) ) { $view->setTemplate('/Web/Backend/Error/403_inline'); - $response->getHeader()->setStatusCode(RequestStatusCode::R_403); + $response->header->status = RequestStatusCode::R_403; return $view; } @@ -158,13 +158,13 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); - $accountId = $request->getHeader()->getAccount(); + $accountId = $request->header->account; if (!$this->app->accountManager->get($accountId)->hasPermission( PermissionType::CREATE, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::BOARD) ) { $view->setTemplate('/Web/Backend/Error/403_inline'); - $response->getHeader()->setStatusCode(RequestStatusCode::R_403); + $response->header->status = RequestStatusCode::R_403; return $view; } @@ -191,14 +191,14 @@ final class BackendController extends Controller $view = new View($this->app->l11nManager, $request, $response); $card = KanbanCardMapper::get((int) $request->getData('id')); - $accountId = $request->getHeader()->getAccount(); + $accountId = $request->header->account; - if ($card->getCreatedBy()->getId() !== $accountId + if ($card->createdBy->getId() !== $accountId && !$this->app->accountManager->get($accountId)->hasPermission( PermissionType::READ, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::CARD, $card->getId()) ) { $view->setTemplate('/Web/Backend/Error/403_inline'); - $response->getHeader()->setStatusCode(RequestStatusCode::R_403); + $response->header->status = RequestStatusCode::R_403; return $view; } diff --git a/Models/KanbanBoard.php b/Models/KanbanBoard.php index 2f132f7..b7f54fb 100755 --- a/Models/KanbanBoard.php +++ b/Models/KanbanBoard.php @@ -41,7 +41,7 @@ class KanbanBoard implements \JsonSerializable * @var string * @since 1.0.0 */ - private string $name = ''; + public string $name = ''; private int $status = BoardStatus::ACTIVE; @@ -53,11 +53,11 @@ class KanbanBoard implements \JsonSerializable * @var string * @since 1.0.0 */ - private string $description = ''; + public string $description = ''; - private Account $createdBy; + public Account $createdBy; - private \DateTimeImmutable $createdAt; + public \DateTimeImmutable $createdAt; private array $columns = []; @@ -84,32 +84,6 @@ class KanbanBoard implements \JsonSerializable return $this->id; } - /** - * Get name - * - * @return string - * - * @since 1.0.0 - */ - public function getName() : string - { - return $this->name; - } - - /** - * Set name - * - * @param string $name Name - * - * @return void - * - * @since 1.0.0 - */ - public function setName(string $name) : void - { - $this->name = $name; - } - /** * Get the status * @@ -162,70 +136,6 @@ class KanbanBoard implements \JsonSerializable $this->order = $order; } - /** - * Get description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescription() : string - { - return $this->description; - } - - /** - * Set description - * - * @param string $description Description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescription(string $description) : void - { - $this->description = $description; - } - - /** - * Get created by - * - * @return Account - * - * @since 1.0.0 - */ - public function getCreatedBy() : Account - { - return $this->createdBy; - } - - /** - * Set created by - * - * @param Account $account Created by - * - * @return void - * - * @since 1.0.0 - */ - public function setCreatedBy(Account $account) : void - { - $this->createdBy = $account; - } - - /** - * Get created at date time - * - * @return \DateTimeImmutable - * - * @since 1.0.0 - */ - public function getCreatedAt() : \DateTimeImmutable - { - return $this->createdAt; - } - /** * Get the columns * diff --git a/Models/KanbanCard.php b/Models/KanbanCard.php index e825099..af18dab 100755 --- a/Models/KanbanCard.php +++ b/Models/KanbanCard.php @@ -42,7 +42,7 @@ class KanbanCard implements \JsonSerializable * @var string * @since 1.0.0 */ - private string $name = ''; + public string $name = ''; private int $status = CardStatus::ACTIVE; @@ -54,7 +54,7 @@ class KanbanCard implements \JsonSerializable * @var string * @since 1.0.0 */ - private string $description = ''; + public string $description = ''; private $column = 0; @@ -62,9 +62,9 @@ class KanbanCard implements \JsonSerializable private $ref = 0; - private Account $createdBy; + public Account $createdBy; - private \DateTimeImmutable $createdAt; + public \DateTimeImmutable $createdAt; private array $comments = []; @@ -147,32 +147,6 @@ class KanbanCard implements \JsonSerializable return $this->column; } - /** - * Get name - * - * @return string - * - * @since 1.0.0 - */ - public function getName() : string - { - return $this->name; - } - - /** - * Set name - * - * @param string $name Name - * - * @return void - * - * @since 1.0.0 - */ - public function setName(string $name) : void - { - $this->name = $name; - } - /** * Get the status * @@ -251,70 +225,6 @@ class KanbanCard implements \JsonSerializable $this->ref = $ref; } - /** - * Get description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescription() : string - { - return $this->description; - } - - /** - * Set description - * - * @param string $description Description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescription(string $description) : void - { - $this->description = $description; - } - - /** - * Get created by - * - * @return Account - * - * @since 1.0.0 - */ - public function getCreatedBy() : Account - { - return $this->createdBy; - } - - /** - * Set created by - * - * @param Account $account Created by - * - * @return void - * - * @since 1.0.0 - */ - public function setCreatedBy(Account $account) : void - { - $this->createdBy = $account; - } - - /** - * Get created at date time - * - * @return \DateTimeImmutable - * - * @since 1.0.0 - */ - public function getCreatedAt() : \DateTimeImmutable - { - return $this->createdAt; - } - /** * Get the comments * diff --git a/Models/KanbanCardComment.php b/Models/KanbanCardComment.php index f7ccd39..d623ba5 100755 --- a/Models/KanbanCardComment.php +++ b/Models/KanbanCardComment.php @@ -41,13 +41,13 @@ class KanbanCardComment implements \JsonSerializable * @var string * @since 1.0.0 */ - private string $description = ''; + public string $description = ''; private $card = 0; - private Account $createdBy; + public Account $createdBy; - private \DateTimeImmutable $createdAt; + public \DateTimeImmutable $createdAt; private array $media = []; @@ -100,70 +100,6 @@ class KanbanCardComment implements \JsonSerializable return $this->card; } - /** - * Get description - * - * @return string - * - * @since 1.0.0 - */ - public function getDescription() : string - { - return $this->description; - } - - /** - * Set description - * - * @param string $description Description - * - * @return void - * - * @since 1.0.0 - */ - public function setDescription(string $description) : void - { - $this->description = $description; - } - - /** - * Get created by - * - * @return Account - * - * @since 1.0.0 - */ - public function getCreatedBy() : Account - { - return $this->createdBy; - } - - /** - * Set created by - * - * @param Account $account Created by - * - * @return void - * - * @since 1.0.0 - */ - public function setCreatedBy(Account $account) : void - { - $this->createdBy = $account; - } - - /** - * Get created at date time - * - * @return \DateTimeImmutable - * - * @since 1.0.0 - */ - public function getCreatedAt() : \DateTimeImmutable - { - return $this->createdAt; - } - /** * Get the media files * diff --git a/Models/KanbanColumn.php b/Models/KanbanColumn.php index 2563454..2c04607 100755 --- a/Models/KanbanColumn.php +++ b/Models/KanbanColumn.php @@ -38,7 +38,7 @@ class KanbanColumn implements \JsonSerializable * @var string * @since 1.0.0 */ - private string $name = ''; + public string $name = ''; /** * Column order @@ -122,32 +122,6 @@ class KanbanColumn implements \JsonSerializable return $this->board; } - /** - * Get name - * - * @return string - * - * @since 1.0.0 - */ - public function getName() : string - { - return $this->name; - } - - /** - * Set name - * - * @param string $name Name - * - * @return void - * - * @since 1.0.0 - */ - public function setName(string $name) : void - { - $this->name = $name; - } - /** * Get the cards * diff --git a/Theme/Backend/kanban-board.tpl.php b/Theme/Backend/kanban-board.tpl.php index b0c11f1..059f13a 100755 --- a/Theme/Backend/kanban-board.tpl.php +++ b/Theme/Backend/kanban-board.tpl.php @@ -10,13 +10,13 @@ $columns = $board->getColumns();