@@ -45,6 +45,9 @@ |
||
| 45 | 45 | return $this->cardMapper->find($cardId); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | + /** |
|
| 49 | + * @param integer $order |
|
| 50 | + */ |
|
| 48 | 51 | public function create($title, $stackId, $type, $order, $owner) { |
| 49 | 52 | $this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_EDIT); |
| 50 | 53 | $card = new Card(); |
@@ -32,117 +32,117 @@ |
||
| 32 | 32 | |
| 33 | 33 | class CardService { |
| 34 | 34 | |
| 35 | - private $cardMapper; |
|
| 36 | - |
|
| 37 | - public function __construct(CardMapper $cardMapper, StackMapper $stackMapper, PermissionService $permissionService) { |
|
| 38 | - $this->cardMapper = $cardMapper; |
|
| 39 | - $this->stackMapper = $stackMapper; |
|
| 40 | - $this->permissionService = $permissionService; |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - public function find($cardId) { |
|
| 44 | - $this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ); |
|
| 45 | - return $this->cardMapper->find($cardId); |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - public function create($title, $stackId, $type, $order, $owner) { |
|
| 49 | - $this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_EDIT); |
|
| 50 | - $card = new Card(); |
|
| 51 | - $card->setTitle($title); |
|
| 52 | - $card->setStackId($stackId); |
|
| 53 | - $card->setType($type); |
|
| 54 | - $card->setOrder($order); |
|
| 55 | - $card->setOwner($owner); |
|
| 56 | - return $this->cardMapper->insert($card); |
|
| 57 | - |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - public function delete($id) { |
|
| 61 | - $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
|
| 62 | - return $this->cardMapper->delete($this->cardMapper->find($id)); |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - public function update($id, $title, $stackId, $type, $order, $description, $owner) { |
|
| 66 | - $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
|
| 67 | - $card = $this->cardMapper->find($id); |
|
| 68 | - if ($card->getArchived()) { |
|
| 69 | - throw new CardArchivedException(); |
|
| 70 | - } |
|
| 71 | - $card->setTitle($title); |
|
| 72 | - $card->setStackId($stackId); |
|
| 73 | - $card->setType($type); |
|
| 74 | - $card->setOrder($order); |
|
| 75 | - $card->setOwner($owner); |
|
| 76 | - $card->setDescription($description); |
|
| 77 | - return $this->cardMapper->update($card); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - public function rename($id, $title) { |
|
| 81 | - $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
|
| 82 | - $card = $this->cardMapper->find($id); |
|
| 83 | - if ($card->getArchived()) { |
|
| 84 | - throw new CardArchivedException(); |
|
| 85 | - } |
|
| 86 | - $card->setTitle($title); |
|
| 87 | - return $this->cardMapper->update($card); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - public function reorder($id, $stackId, $order) { |
|
| 91 | - $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
|
| 92 | - $cards = $this->cardMapper->findAll($stackId); |
|
| 93 | - $result = []; |
|
| 94 | - $i = 0; |
|
| 95 | - foreach ($cards as $card) { |
|
| 96 | - if ($card->getArchived()) { |
|
| 97 | - throw new CardArchivedException(); |
|
| 98 | - } |
|
| 99 | - if ($card->id === $id) { |
|
| 100 | - $card->setOrder($order); |
|
| 101 | - $card->setLastModified(time()); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - if ($i === $order) |
|
| 105 | - $i++; |
|
| 106 | - |
|
| 107 | - if ($card->id !== $id) { |
|
| 108 | - $card->setOrder($i++); |
|
| 109 | - } |
|
| 110 | - $this->cardMapper->update($card); |
|
| 111 | - $result[$card->getOrder()] = $card; |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - return $result; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - public function archive($id) { |
|
| 118 | - $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
|
| 119 | - $card = $this->cardMapper->find($id); |
|
| 120 | - $card->setArchived(true); |
|
| 121 | - return $this->cardMapper->update($card); |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - public function unarchive($id) { |
|
| 125 | - $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
|
| 126 | - $card = $this->cardMapper->find($id); |
|
| 127 | - $card->setArchived(false); |
|
| 128 | - return $this->cardMapper->update($card); |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - public function assignLabel($cardId, $labelId) { |
|
| 132 | - $this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT); |
|
| 133 | - $card = $this->cardMapper->find($cardId); |
|
| 134 | - if ($card->getArchived()) { |
|
| 135 | - throw new CardArchivedException(); |
|
| 136 | - } |
|
| 137 | - $this->cardMapper->assignLabel($cardId, $labelId); |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - public function removeLabel($cardId, $labelId) { |
|
| 141 | - $this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT); |
|
| 142 | - $card = $this->cardMapper->find($cardId); |
|
| 143 | - if ($card->getArchived()) { |
|
| 144 | - throw new CardArchivedException(); |
|
| 145 | - } |
|
| 146 | - $this->cardMapper->removeLabel($cardId, $labelId); |
|
| 147 | - } |
|
| 35 | + private $cardMapper; |
|
| 36 | + |
|
| 37 | + public function __construct(CardMapper $cardMapper, StackMapper $stackMapper, PermissionService $permissionService) { |
|
| 38 | + $this->cardMapper = $cardMapper; |
|
| 39 | + $this->stackMapper = $stackMapper; |
|
| 40 | + $this->permissionService = $permissionService; |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + public function find($cardId) { |
|
| 44 | + $this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_READ); |
|
| 45 | + return $this->cardMapper->find($cardId); |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + public function create($title, $stackId, $type, $order, $owner) { |
|
| 49 | + $this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_EDIT); |
|
| 50 | + $card = new Card(); |
|
| 51 | + $card->setTitle($title); |
|
| 52 | + $card->setStackId($stackId); |
|
| 53 | + $card->setType($type); |
|
| 54 | + $card->setOrder($order); |
|
| 55 | + $card->setOwner($owner); |
|
| 56 | + return $this->cardMapper->insert($card); |
|
| 57 | + |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + public function delete($id) { |
|
| 61 | + $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
|
| 62 | + return $this->cardMapper->delete($this->cardMapper->find($id)); |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + public function update($id, $title, $stackId, $type, $order, $description, $owner) { |
|
| 66 | + $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
|
| 67 | + $card = $this->cardMapper->find($id); |
|
| 68 | + if ($card->getArchived()) { |
|
| 69 | + throw new CardArchivedException(); |
|
| 70 | + } |
|
| 71 | + $card->setTitle($title); |
|
| 72 | + $card->setStackId($stackId); |
|
| 73 | + $card->setType($type); |
|
| 74 | + $card->setOrder($order); |
|
| 75 | + $card->setOwner($owner); |
|
| 76 | + $card->setDescription($description); |
|
| 77 | + return $this->cardMapper->update($card); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + public function rename($id, $title) { |
|
| 81 | + $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
|
| 82 | + $card = $this->cardMapper->find($id); |
|
| 83 | + if ($card->getArchived()) { |
|
| 84 | + throw new CardArchivedException(); |
|
| 85 | + } |
|
| 86 | + $card->setTitle($title); |
|
| 87 | + return $this->cardMapper->update($card); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + public function reorder($id, $stackId, $order) { |
|
| 91 | + $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
|
| 92 | + $cards = $this->cardMapper->findAll($stackId); |
|
| 93 | + $result = []; |
|
| 94 | + $i = 0; |
|
| 95 | + foreach ($cards as $card) { |
|
| 96 | + if ($card->getArchived()) { |
|
| 97 | + throw new CardArchivedException(); |
|
| 98 | + } |
|
| 99 | + if ($card->id === $id) { |
|
| 100 | + $card->setOrder($order); |
|
| 101 | + $card->setLastModified(time()); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + if ($i === $order) |
|
| 105 | + $i++; |
|
| 106 | + |
|
| 107 | + if ($card->id !== $id) { |
|
| 108 | + $card->setOrder($i++); |
|
| 109 | + } |
|
| 110 | + $this->cardMapper->update($card); |
|
| 111 | + $result[$card->getOrder()] = $card; |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + return $result; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + public function archive($id) { |
|
| 118 | + $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
|
| 119 | + $card = $this->cardMapper->find($id); |
|
| 120 | + $card->setArchived(true); |
|
| 121 | + return $this->cardMapper->update($card); |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + public function unarchive($id) { |
|
| 125 | + $this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT); |
|
| 126 | + $card = $this->cardMapper->find($id); |
|
| 127 | + $card->setArchived(false); |
|
| 128 | + return $this->cardMapper->update($card); |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + public function assignLabel($cardId, $labelId) { |
|
| 132 | + $this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT); |
|
| 133 | + $card = $this->cardMapper->find($cardId); |
|
| 134 | + if ($card->getArchived()) { |
|
| 135 | + throw new CardArchivedException(); |
|
| 136 | + } |
|
| 137 | + $this->cardMapper->assignLabel($cardId, $labelId); |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + public function removeLabel($cardId, $labelId) { |
|
| 141 | + $this->permissionService->checkPermission($this->cardMapper, $cardId, Acl::PERMISSION_EDIT); |
|
| 142 | + $card = $this->cardMapper->find($cardId); |
|
| 143 | + if ($card->getArchived()) { |
|
| 144 | + throw new CardArchivedException(); |
|
| 145 | + } |
|
| 146 | + $this->cardMapper->removeLabel($cardId, $labelId); |
|
| 147 | + } |
|
| 148 | 148 | } |
| 149 | 149 | \ No newline at end of file |
@@ -101,8 +101,9 @@ |
||
| 101 | 101 | $card->setLastModified(time()); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - if ($i === $order) |
|
| 105 | - $i++; |
|
| 104 | + if ($i === $order) { |
|
| 105 | + $i++; |
|
| 106 | + } |
|
| 106 | 107 | |
| 107 | 108 | if ($card->id !== $id) { |
| 108 | 109 | $card->setOrder($i++); |
@@ -26,10 +26,8 @@ |
||
| 26 | 26 | use OCA\Deck\Db\Acl; |
| 27 | 27 | use OCA\Deck\Db\AclMapper; |
| 28 | 28 | use OCA\Deck\Db\BoardMapper; |
| 29 | - |
|
| 30 | 29 | use OCA\Deck\Db\IPermissionMapper; |
| 31 | 30 | use OCA\Deck\NoPermissionException; |
| 32 | - |
|
| 33 | 31 | use OCP\AppFramework\Db\DoesNotExistException; |
| 34 | 32 | use OCP\IGroupManager; |
| 35 | 33 | use OCP\ILogger; |
@@ -77,35 +77,35 @@ discard block |
||
| 77 | 77 | * @return bool |
| 78 | 78 | * @throws NoPermissionException |
| 79 | 79 | */ |
| 80 | - public function checkPermission($mapper, $id, $permission) { |
|
| 81 | - try { |
|
| 82 | - if ($mapper instanceof IPermissionMapper) { |
|
| 83 | - $boardId = $mapper->findBoardId($id); |
|
| 84 | - } else { |
|
| 85 | - $boardId = $id; |
|
| 86 | - } |
|
| 87 | - if ($boardId === null) { |
|
| 88 | - // Throw NoPermission to not leak information about existing entries |
|
| 89 | - throw new NoPermissionException('Permission denied'); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - if ($this->userIsBoardOwner($boardId)) { |
|
| 93 | - return true; |
|
| 94 | - } |
|
| 95 | - $acls = $this->aclMapper->findAll($boardId); |
|
| 96 | - $result = $this->userCan($acls, $permission); |
|
| 97 | - if ($result) { |
|
| 98 | - return true; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - } catch (DoesNotExistException $exception) { |
|
| 102 | - // Throw NoPermission to not leak information about existing entries |
|
| 103 | - throw new NoPermissionException('Permission denied'); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - throw new NoPermissionException('Permission denied.'); |
|
| 107 | - |
|
| 108 | - } |
|
| 80 | + public function checkPermission($mapper, $id, $permission) { |
|
| 81 | + try { |
|
| 82 | + if ($mapper instanceof IPermissionMapper) { |
|
| 83 | + $boardId = $mapper->findBoardId($id); |
|
| 84 | + } else { |
|
| 85 | + $boardId = $id; |
|
| 86 | + } |
|
| 87 | + if ($boardId === null) { |
|
| 88 | + // Throw NoPermission to not leak information about existing entries |
|
| 89 | + throw new NoPermissionException('Permission denied'); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + if ($this->userIsBoardOwner($boardId)) { |
|
| 93 | + return true; |
|
| 94 | + } |
|
| 95 | + $acls = $this->aclMapper->findAll($boardId); |
|
| 96 | + $result = $this->userCan($acls, $permission); |
|
| 97 | + if ($result) { |
|
| 98 | + return true; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + } catch (DoesNotExistException $exception) { |
|
| 102 | + // Throw NoPermission to not leak information about existing entries |
|
| 103 | + throw new NoPermissionException('Permission denied'); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + throw new NoPermissionException('Permission denied.'); |
|
| 107 | + |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * @param $boardId |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | if ($board && $this->userId === $board->getOwner()) { |
| 117 | 117 | return true; |
| 118 | 118 | } |
| 119 | - return false; |
|
| 119 | + return false; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -30,38 +30,38 @@ |
||
| 30 | 30 | |
| 31 | 31 | class LabelService { |
| 32 | 32 | |
| 33 | - private $labelMapper; |
|
| 33 | + private $labelMapper; |
|
| 34 | 34 | |
| 35 | - public function __construct(LabelMapper $labelMapper, PermissionService $permissionService) { |
|
| 36 | - $this->labelMapper = $labelMapper; |
|
| 37 | - $this->permissionService = $permissionService; |
|
| 38 | - } |
|
| 35 | + public function __construct(LabelMapper $labelMapper, PermissionService $permissionService) { |
|
| 36 | + $this->labelMapper = $labelMapper; |
|
| 37 | + $this->permissionService = $permissionService; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - public function find($labelId) { |
|
| 41 | - $this->permissionService->checkPermission($this->labelMapper, $labelId, Acl::PERMISSION_READ); |
|
| 42 | - return $this->labelMapper->find($labelId); |
|
| 43 | - } |
|
| 40 | + public function find($labelId) { |
|
| 41 | + $this->permissionService->checkPermission($this->labelMapper, $labelId, Acl::PERMISSION_READ); |
|
| 42 | + return $this->labelMapper->find($labelId); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - public function create($title, $color, $boardId) { |
|
| 46 | - $this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE); |
|
| 47 | - $label = new Label(); |
|
| 48 | - $label->setTitle($title); |
|
| 49 | - $label->setColor($color); |
|
| 50 | - $label->setBoardId($boardId); |
|
| 51 | - return $this->labelMapper->insert($label); |
|
| 52 | - } |
|
| 45 | + public function create($title, $color, $boardId) { |
|
| 46 | + $this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE); |
|
| 47 | + $label = new Label(); |
|
| 48 | + $label->setTitle($title); |
|
| 49 | + $label->setColor($color); |
|
| 50 | + $label->setBoardId($boardId); |
|
| 51 | + return $this->labelMapper->insert($label); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - public function delete($id) { |
|
| 55 | - $this->permissionService->checkPermission($this->labelMapper, $id, Acl::PERMISSION_MANAGE); |
|
| 56 | - return $this->labelMapper->delete($this->find($id)); |
|
| 57 | - } |
|
| 54 | + public function delete($id) { |
|
| 55 | + $this->permissionService->checkPermission($this->labelMapper, $id, Acl::PERMISSION_MANAGE); |
|
| 56 | + return $this->labelMapper->delete($this->find($id)); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - public function update($id, $title, $color) { |
|
| 60 | - $this->permissionService->checkPermission($this->labelMapper, $id, Acl::PERMISSION_MANAGE); |
|
| 61 | - $label = $this->find($id); |
|
| 62 | - $label->setTitle($title); |
|
| 63 | - $label->setColor($color); |
|
| 64 | - return $this->labelMapper->update($label); |
|
| 65 | - } |
|
| 59 | + public function update($id, $title, $color) { |
|
| 60 | + $this->permissionService->checkPermission($this->labelMapper, $id, Acl::PERMISSION_MANAGE); |
|
| 61 | + $label = $this->find($id); |
|
| 62 | + $label->setTitle($title); |
|
| 63 | + $label->setColor($color); |
|
| 64 | + return $this->labelMapper->update($label); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | 67 | } |
| 68 | 68 | \ No newline at end of file |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | use OCA\Deck\Db\LabelMapper; |
| 29 | 29 | |
| 30 | 30 | |
| 31 | -class LabelService { |
|
| 31 | +class LabelService { |
|
| 32 | 32 | |
| 33 | 33 | private $labelMapper; |
| 34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | private $boardMapper; |
| 41 | 41 | private $labelMapper; |
| 42 | - private $aclMapper; |
|
| 42 | + private $aclMapper; |
|
| 43 | 43 | private $l10n; |
| 44 | 44 | private $permissionService; |
| 45 | 45 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function find($boardId) { |
| 62 | - $this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_READ); |
|
| 62 | + $this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_READ); |
|
| 63 | 63 | return $this->boardMapper->find($boardId, true, true); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | // create new labels |
| 74 | 74 | $default_labels = [ |
| 75 | - '31CC7C' => $this->l10n->t('Finished'), |
|
| 76 | - '317CCC' => $this->l10n->t('To review'), |
|
| 75 | + '31CC7C' => $this->l10n->t('Finished'), |
|
| 76 | + '317CCC' => $this->l10n->t('To review'), |
|
| 77 | 77 | 'FF7A66' => $this->l10n->t('Action needed'), |
| 78 | 78 | 'F1DB50' => $this->l10n->t('Later') |
| 79 | - ]; |
|
| 79 | + ]; |
|
| 80 | 80 | $labels = []; |
| 81 | 81 | foreach ($default_labels as $color => $title) { |
| 82 | 82 | $label = new Label(); |
@@ -91,12 +91,12 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public function delete($id) { |
| 94 | - $this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_READ); |
|
| 94 | + $this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_READ); |
|
| 95 | 95 | return $this->boardMapper->delete($this->find($id)); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | public function update($id, $title, $color) { |
| 99 | - $this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_MANAGE); |
|
| 99 | + $this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_MANAGE); |
|
| 100 | 100 | $board = $this->find($id); |
| 101 | 101 | $board->setTitle($title); |
| 102 | 102 | $board->setColor($color); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | |
| 107 | 107 | public function addAcl($boardId, $type, $participant, $edit, $share, $manage) { |
| 108 | - $this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_SHARE); |
|
| 108 | + $this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_SHARE); |
|
| 109 | 109 | $acl = new Acl(); |
| 110 | 110 | $acl->setBoardId($boardId); |
| 111 | 111 | $acl->setType($type); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | public function updateAcl($id, $edit, $share, $manage) { |
| 120 | - $this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_SHARE); |
|
| 120 | + $this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_SHARE); |
|
| 121 | 121 | $acl = $this->aclMapper->find($id); |
| 122 | 122 | $acl->setPermissionEdit($edit); |
| 123 | 123 | $acl->setPermissionShare($share); |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | public function deleteAcl($id) { |
| 129 | - $this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_SHARE); |
|
| 129 | + $this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_SHARE); |
|
| 130 | 130 | $acl = $this->aclMapper->find($id); |
| 131 | 131 | return $this->aclMapper->delete($acl); |
| 132 | 132 | } |
@@ -35,71 +35,71 @@ |
||
| 35 | 35 | |
| 36 | 36 | class StackService { |
| 37 | 37 | |
| 38 | - private $stackMapper; |
|
| 39 | - private $cardMapper; |
|
| 40 | - private $labelMapper; |
|
| 41 | - private $permissionService; |
|
| 38 | + private $stackMapper; |
|
| 39 | + private $cardMapper; |
|
| 40 | + private $labelMapper; |
|
| 41 | + private $permissionService; |
|
| 42 | 42 | |
| 43 | - public function __construct(StackMapper $stackMapper, CardMapper $cardMapper, LabelMapper $labelMapper, PermissionService $permissionService) { |
|
| 44 | - $this->stackMapper = $stackMapper; |
|
| 45 | - $this->cardMapper = $cardMapper; |
|
| 46 | - $this->labelMapper = $labelMapper; |
|
| 47 | - $this->permissionService = $permissionService; |
|
| 48 | - } |
|
| 43 | + public function __construct(StackMapper $stackMapper, CardMapper $cardMapper, LabelMapper $labelMapper, PermissionService $permissionService) { |
|
| 44 | + $this->stackMapper = $stackMapper; |
|
| 45 | + $this->cardMapper = $cardMapper; |
|
| 46 | + $this->labelMapper = $labelMapper; |
|
| 47 | + $this->permissionService = $permissionService; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - public function findAll($boardId) { |
|
| 51 | - $this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_READ); |
|
| 52 | - $stacks = $this->stackMapper->findAll($boardId); |
|
| 53 | - $labels = $this->labelMapper->getAssignedLabelsForBoard($boardId); |
|
| 54 | - foreach ($stacks as $stackIndex => $stack) { |
|
| 55 | - $cards = $this->cardMapper->findAll($stack->id); |
|
| 56 | - foreach ($cards as $cardIndex => $card) { |
|
| 57 | - if(array_key_exists($card->id, $labels)) { |
|
| 58 | - $cards[$cardIndex]->setLabels($labels[$card->id]); |
|
| 50 | + public function findAll($boardId) { |
|
| 51 | + $this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_READ); |
|
| 52 | + $stacks = $this->stackMapper->findAll($boardId); |
|
| 53 | + $labels = $this->labelMapper->getAssignedLabelsForBoard($boardId); |
|
| 54 | + foreach ($stacks as $stackIndex => $stack) { |
|
| 55 | + $cards = $this->cardMapper->findAll($stack->id); |
|
| 56 | + foreach ($cards as $cardIndex => $card) { |
|
| 57 | + if(array_key_exists($card->id, $labels)) { |
|
| 58 | + $cards[$cardIndex]->setLabels($labels[$card->id]); |
|
| 59 | 59 | } |
| 60 | - } |
|
| 61 | - $stacks[$stackIndex]->setCards($cards); |
|
| 62 | - } |
|
| 63 | - return $stacks; |
|
| 64 | - } |
|
| 60 | + } |
|
| 61 | + $stacks[$stackIndex]->setCards($cards); |
|
| 62 | + } |
|
| 63 | + return $stacks; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - public function findAllArchived($boardId) { |
|
| 67 | - $this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_READ); |
|
| 68 | - $stacks = $this->stackMapper->findAll($boardId); |
|
| 69 | - $labels = $this->labelMapper->getAssignedLabelsForBoard($boardId); |
|
| 70 | - foreach ($stacks as $stackIndex => $stack) { |
|
| 71 | - $cards = $this->cardMapper->findAllArchived($stack->id); |
|
| 72 | - foreach ($cards as $cardIndex => $card) { |
|
| 73 | - if(array_key_exists($card->id, $labels)) { |
|
| 66 | + public function findAllArchived($boardId) { |
|
| 67 | + $this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_READ); |
|
| 68 | + $stacks = $this->stackMapper->findAll($boardId); |
|
| 69 | + $labels = $this->labelMapper->getAssignedLabelsForBoard($boardId); |
|
| 70 | + foreach ($stacks as $stackIndex => $stack) { |
|
| 71 | + $cards = $this->cardMapper->findAllArchived($stack->id); |
|
| 72 | + foreach ($cards as $cardIndex => $card) { |
|
| 73 | + if(array_key_exists($card->id, $labels)) { |
|
| 74 | 74 | $cards[$cardIndex]->setLabels($labels[$card->id]); |
| 75 | 75 | } |
| 76 | - } |
|
| 77 | - $stacks[$stackIndex]->setCards($cards); |
|
| 78 | - } |
|
| 79 | - return $stacks; |
|
| 80 | - } |
|
| 76 | + } |
|
| 77 | + $stacks[$stackIndex]->setCards($cards); |
|
| 78 | + } |
|
| 79 | + return $stacks; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - public function create($title, $boardId, $order) { |
|
| 83 | - $this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE); |
|
| 84 | - $stack = new Stack(); |
|
| 85 | - $stack->setTitle($title); |
|
| 86 | - $stack->setBoardId($boardId); |
|
| 87 | - $stack->setOrder($order); |
|
| 88 | - return $this->stackMapper->insert($stack); |
|
| 82 | + public function create($title, $boardId, $order) { |
|
| 83 | + $this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE); |
|
| 84 | + $stack = new Stack(); |
|
| 85 | + $stack->setTitle($title); |
|
| 86 | + $stack->setBoardId($boardId); |
|
| 87 | + $stack->setOrder($order); |
|
| 88 | + return $this->stackMapper->insert($stack); |
|
| 89 | 89 | |
| 90 | - } |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - public function delete($id) { |
|
| 93 | - $this->permissionService->checkPermission($this->stackMapper, $id, Acl::PERMISSION_MANAGE); |
|
| 94 | - return $this->stackMapper->delete($this->stackMapper->find($id)); |
|
| 95 | - } |
|
| 92 | + public function delete($id) { |
|
| 93 | + $this->permissionService->checkPermission($this->stackMapper, $id, Acl::PERMISSION_MANAGE); |
|
| 94 | + return $this->stackMapper->delete($this->stackMapper->find($id)); |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - public function update($id, $title, $boardId, $order) { |
|
| 98 | - $this->permissionService->checkPermission($this->stackMapper, $id, Acl::PERMISSION_MANAGE); |
|
| 99 | - $stack = $this->stackMapper->find($id); |
|
| 100 | - $stack->setTitle($title); |
|
| 101 | - $stack->setBoardId($boardId); |
|
| 102 | - $stack->setOrder($order); |
|
| 103 | - return $this->stackMapper->update($stack); |
|
| 104 | - } |
|
| 97 | + public function update($id, $title, $boardId, $order) { |
|
| 98 | + $this->permissionService->checkPermission($this->stackMapper, $id, Acl::PERMISSION_MANAGE); |
|
| 99 | + $stack = $this->stackMapper->find($id); |
|
| 100 | + $stack->setTitle($title); |
|
| 101 | + $stack->setBoardId($boardId); |
|
| 102 | + $stack->setOrder($order); |
|
| 103 | + return $this->stackMapper->update($stack); |
|
| 104 | + } |
|
| 105 | 105 | } |
| 106 | 106 | \ No newline at end of file |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | use OCA\Deck\Db\StackMapper; |
| 34 | 34 | |
| 35 | 35 | |
| 36 | -class StackService { |
|
| 36 | +class StackService { |
|
| 37 | 37 | |
| 38 | 38 | private $stackMapper; |
| 39 | 39 | private $cardMapper; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | foreach ($stacks as $stackIndex => $stack) { |
| 55 | 55 | $cards = $this->cardMapper->findAll($stack->id); |
| 56 | 56 | foreach ($cards as $cardIndex => $card) { |
| 57 | - if(array_key_exists($card->id, $labels)) { |
|
| 57 | + if (array_key_exists($card->id, $labels)) { |
|
| 58 | 58 | $cards[$cardIndex]->setLabels($labels[$card->id]); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | foreach ($stacks as $stackIndex => $stack) { |
| 71 | 71 | $cards = $this->cardMapper->findAllArchived($stack->id); |
| 72 | 72 | foreach ($cards as $cardIndex => $card) { |
| 73 | - if(array_key_exists($card->id, $labels)) { |
|
| 73 | + if (array_key_exists($card->id, $labels)) { |
|
| 74 | 74 | $cards[$cardIndex]->setLabels($labels[$card->id]); |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | |
| 27 | 27 | class NotFoundException extends StatusException { |
| 28 | 28 | |
| 29 | - public function __construct($message="") { |
|
| 29 | + public function __construct($message = "") { |
|
| 30 | 30 | parent::__construct($message); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -28,21 +28,21 @@ |
||
| 28 | 28 | |
| 29 | 29 | class Label extends Entity implements JsonSerializable { |
| 30 | 30 | |
| 31 | - public $id; |
|
| 32 | - protected $title; |
|
| 33 | - protected $color; |
|
| 34 | - protected $boardId; |
|
| 35 | - protected $cardId; |
|
| 36 | - public function __construct() { |
|
| 37 | - $this->addType('id','integer'); |
|
| 38 | - } |
|
| 39 | - public function jsonSerialize() { |
|
| 40 | - return [ |
|
| 41 | - 'id' => $this->id, |
|
| 42 | - 'title' => $this->title, |
|
| 43 | - 'boardId' => $this->boardId, |
|
| 44 | - 'cardId' => $this->cardId, |
|
| 45 | - 'color' => $this->color, |
|
| 46 | - ]; |
|
| 47 | - } |
|
| 31 | + public $id; |
|
| 32 | + protected $title; |
|
| 33 | + protected $color; |
|
| 34 | + protected $boardId; |
|
| 35 | + protected $cardId; |
|
| 36 | + public function __construct() { |
|
| 37 | + $this->addType('id','integer'); |
|
| 38 | + } |
|
| 39 | + public function jsonSerialize() { |
|
| 40 | + return [ |
|
| 41 | + 'id' => $this->id, |
|
| 42 | + 'title' => $this->title, |
|
| 43 | + 'boardId' => $this->boardId, |
|
| 44 | + 'cardId' => $this->cardId, |
|
| 45 | + 'color' => $this->color, |
|
| 46 | + ]; |
|
| 47 | + } |
|
| 48 | 48 | } |
| 49 | 49 | \ No newline at end of file |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | protected $boardId; |
| 35 | 35 | protected $cardId; |
| 36 | 36 | public function __construct() { |
| 37 | - $this->addType('id','integer'); |
|
| 37 | + $this->addType('id', 'integer'); |
|
| 38 | 38 | } |
| 39 | 39 | public function jsonSerialize() { |
| 40 | 40 | return [ |
@@ -28,44 +28,44 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | class LabelMapper extends DeckMapper implements IPermissionMapper { |
| 30 | 30 | |
| 31 | - public function __construct(IDBConnection $db) { |
|
| 32 | - parent::__construct($db, 'deck_labels', '\OCA\Deck\Db\Label'); |
|
| 33 | - } |
|
| 31 | + public function __construct(IDBConnection $db) { |
|
| 32 | + parent::__construct($db, 'deck_labels', '\OCA\Deck\Db\Label'); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - public function findAll($boardId, $limit=null, $offset=null) { |
|
| 36 | - $sql = 'SELECT * FROM `*PREFIX*deck_labels` WHERE `board_id` = ? ORDER BY `id`'; |
|
| 37 | - return $this->findEntities($sql, [$boardId], $limit, $offset); |
|
| 38 | - } |
|
| 35 | + public function findAll($boardId, $limit=null, $offset=null) { |
|
| 36 | + $sql = 'SELECT * FROM `*PREFIX*deck_labels` WHERE `board_id` = ? ORDER BY `id`'; |
|
| 37 | + return $this->findEntities($sql, [$boardId], $limit, $offset); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - public function delete(\OCP\AppFramework\Db\Entity $entity) { |
|
| 40 | + public function delete(\OCP\AppFramework\Db\Entity $entity) { |
|
| 41 | 41 | // delete assigned labels |
| 42 | 42 | $this->deleteLabelAssignments($entity->getId()); |
| 43 | 43 | // delete label |
| 44 | - return parent::delete($entity); |
|
| 45 | - } |
|
| 44 | + return parent::delete($entity); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - public function findAssignedLabelsForCard($cardId, $limit=null, $offset=null) { |
|
| 48 | - $sql = 'SELECT l.* FROM `*PREFIX*deck_assigned_labels` as al INNER JOIN *PREFIX*deck_labels as l ON l.id = al.label_id WHERE `card_id` = ? ORDER BY l.id'; |
|
| 49 | - return $this->findEntities($sql, [$cardId], $limit, $offset); |
|
| 50 | - } |
|
| 51 | - public function findAssignedLabelsForBoard($boardId, $limit=null, $offset=null) { |
|
| 52 | - $sql = "SELECT c.id as card_id, l.id as id, l.title as title, l.color as color FROM oc_deck_cards as c " . |
|
| 53 | - " INNER JOIN oc_deck_assigned_labels as al ON al.card_id = c.id INNER JOIN oc_deck_labels as l ON al.label_id = l.id WHERE board_id=? ORDER BY l.id"; |
|
| 54 | - $entities = $this->findEntities($sql, [$boardId], $limit, $offset); |
|
| 55 | - return $entities; |
|
| 56 | - } |
|
| 47 | + public function findAssignedLabelsForCard($cardId, $limit=null, $offset=null) { |
|
| 48 | + $sql = 'SELECT l.* FROM `*PREFIX*deck_assigned_labels` as al INNER JOIN *PREFIX*deck_labels as l ON l.id = al.label_id WHERE `card_id` = ? ORDER BY l.id'; |
|
| 49 | + return $this->findEntities($sql, [$cardId], $limit, $offset); |
|
| 50 | + } |
|
| 51 | + public function findAssignedLabelsForBoard($boardId, $limit=null, $offset=null) { |
|
| 52 | + $sql = "SELECT c.id as card_id, l.id as id, l.title as title, l.color as color FROM oc_deck_cards as c " . |
|
| 53 | + " INNER JOIN oc_deck_assigned_labels as al ON al.card_id = c.id INNER JOIN oc_deck_labels as l ON al.label_id = l.id WHERE board_id=? ORDER BY l.id"; |
|
| 54 | + $entities = $this->findEntities($sql, [$boardId], $limit, $offset); |
|
| 55 | + return $entities; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - public function getAssignedLabelsForBoard($boardId) { |
|
| 59 | - $labels = $this->findAssignedLabelsForBoard($boardId); |
|
| 60 | - $result = array(); |
|
| 61 | - foreach ($labels as $label) { |
|
| 62 | - if(!array_key_exists($label->getCardId(), $result)) { |
|
| 63 | - $result[$label->getCardId()] = array(); |
|
| 64 | - } |
|
| 65 | - $result[$label->getCardId()][] = $label; |
|
| 66 | - } |
|
| 67 | - return $result; |
|
| 68 | - } |
|
| 58 | + public function getAssignedLabelsForBoard($boardId) { |
|
| 59 | + $labels = $this->findAssignedLabelsForBoard($boardId); |
|
| 60 | + $result = array(); |
|
| 61 | + foreach ($labels as $label) { |
|
| 62 | + if(!array_key_exists($label->getCardId(), $result)) { |
|
| 63 | + $result[$label->getCardId()] = array(); |
|
| 64 | + } |
|
| 65 | + $result[$label->getCardId()][] = $label; |
|
| 66 | + } |
|
| 67 | + return $result; |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | 70 | public function deleteLabelAssignments($labelId) { |
| 71 | 71 | $sql = 'DELETE FROM `*PREFIX*deck_assigned_labels` WHERE label_id = ?'; |
@@ -81,15 +81,15 @@ discard block |
||
| 81 | 81 | $stmt->execute(); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public function isOwner($userId, $labelId) { |
|
| 85 | - $sql = 'SELECT owner FROM `*PREFIX*deck_boards` WHERE `id` IN (SELECT board_id FROM `*PREFIX*deck_labels` WHERE id = ?)'; |
|
| 86 | - $stmt = $this->execute($sql, [$labelId]); |
|
| 87 | - $row = $stmt->fetch(); |
|
| 88 | - return ($row['owner'] === $userId); |
|
| 89 | - } |
|
| 84 | + public function isOwner($userId, $labelId) { |
|
| 85 | + $sql = 'SELECT owner FROM `*PREFIX*deck_boards` WHERE `id` IN (SELECT board_id FROM `*PREFIX*deck_labels` WHERE id = ?)'; |
|
| 86 | + $stmt = $this->execute($sql, [$labelId]); |
|
| 87 | + $row = $stmt->fetch(); |
|
| 88 | + return ($row['owner'] === $userId); |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - public function findBoardId($labelId) { |
|
| 92 | - $entity = $this->find($labelId); |
|
| 93 | - return $entity->getBoardId(); |
|
| 94 | - } |
|
| 91 | + public function findBoardId($labelId) { |
|
| 92 | + $entity = $this->find($labelId); |
|
| 93 | + return $entity->getBoardId(); |
|
| 94 | + } |
|
| 95 | 95 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | parent::__construct($db, 'deck_labels', '\OCA\Deck\Db\Label'); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function findAll($boardId, $limit=null, $offset=null) { |
|
| 35 | + public function findAll($boardId, $limit = null, $offset = null) { |
|
| 36 | 36 | $sql = 'SELECT * FROM `*PREFIX*deck_labels` WHERE `board_id` = ? ORDER BY `id`'; |
| 37 | 37 | return $this->findEntities($sql, [$boardId], $limit, $offset); |
| 38 | 38 | } |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | return parent::delete($entity); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function findAssignedLabelsForCard($cardId, $limit=null, $offset=null) { |
|
| 47 | + public function findAssignedLabelsForCard($cardId, $limit = null, $offset = null) { |
|
| 48 | 48 | $sql = 'SELECT l.* FROM `*PREFIX*deck_assigned_labels` as al INNER JOIN *PREFIX*deck_labels as l ON l.id = al.label_id WHERE `card_id` = ? ORDER BY l.id'; |
| 49 | 49 | return $this->findEntities($sql, [$cardId], $limit, $offset); |
| 50 | 50 | } |
| 51 | - public function findAssignedLabelsForBoard($boardId, $limit=null, $offset=null) { |
|
| 51 | + public function findAssignedLabelsForBoard($boardId, $limit = null, $offset = null) { |
|
| 52 | 52 | $sql = "SELECT c.id as card_id, l.id as id, l.title as title, l.color as color FROM oc_deck_cards as c " . |
| 53 | 53 | " INNER JOIN oc_deck_assigned_labels as al ON al.card_id = c.id INNER JOIN oc_deck_labels as l ON al.label_id = l.id WHERE board_id=? ORDER BY l.id"; |
| 54 | 54 | $entities = $this->findEntities($sql, [$boardId], $limit, $offset); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $labels = $this->findAssignedLabelsForBoard($boardId); |
| 60 | 60 | $result = array(); |
| 61 | 61 | foreach ($labels as $label) { |
| 62 | - if(!array_key_exists($label->getCardId(), $result)) { |
|
| 62 | + if (!array_key_exists($label->getCardId(), $result)) { |
|
| 63 | 63 | $result[$label->getCardId()] = array(); |
| 64 | 64 | } |
| 65 | 65 | $result[$label->getCardId()][] = $label; |
@@ -70,14 +70,14 @@ discard block |
||
| 70 | 70 | public function deleteLabelAssignments($labelId) { |
| 71 | 71 | $sql = 'DELETE FROM `*PREFIX*deck_assigned_labels` WHERE label_id = ?'; |
| 72 | 72 | $stmt = $this->db->prepare($sql); |
| 73 | - $stmt->bindParam(1, $labelId, \PDO::PARAM_INT); |
|
| 73 | + $stmt->bindParam(1, $labelId, \PDO::PARAM_INT); |
|
| 74 | 74 | $stmt->execute(); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | public function deleteLabelAssignmentsForCard($cardId) { |
| 78 | 78 | $sql = 'DELETE FROM `*PREFIX*deck_assigned_labels` WHERE card_id = ?'; |
| 79 | 79 | $stmt = $this->db->prepare($sql); |
| 80 | - $stmt->bindParam(1, $cardId, \PDO::PARAM_INT); |
|
| 80 | + $stmt->bindParam(1, $cardId, \PDO::PARAM_INT); |
|
| 81 | 81 | $stmt->execute(); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -28,37 +28,37 @@ |
||
| 28 | 28 | |
| 29 | 29 | class Stack extends Entity implements JsonSerializable { |
| 30 | 30 | |
| 31 | - public $id; |
|
| 32 | - protected $title; |
|
| 33 | - protected $boardId; |
|
| 34 | - protected $cards = array(); |
|
| 35 | - protected $order; |
|
| 31 | + public $id; |
|
| 32 | + protected $title; |
|
| 33 | + protected $boardId; |
|
| 34 | + protected $cards = array(); |
|
| 35 | + protected $order; |
|
| 36 | 36 | |
| 37 | - public function __construct() { |
|
| 38 | - $this->addType('id', 'integer'); |
|
| 39 | - $this->addType('boardId', 'integer'); |
|
| 40 | - $this->addType('order', 'integer'); |
|
| 41 | - } |
|
| 37 | + public function __construct() { |
|
| 38 | + $this->addType('id', 'integer'); |
|
| 39 | + $this->addType('boardId', 'integer'); |
|
| 40 | + $this->addType('order', 'integer'); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - public function setCards($cards) { |
|
| 44 | - $this->cards = $cards; |
|
| 45 | - } |
|
| 43 | + public function setCards($cards) { |
|
| 44 | + $this->cards = $cards; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - public function jsonSerialize() { |
|
| 48 | - if (!empty($this->cards)) { |
|
| 49 | - return [ |
|
| 50 | - 'id' => $this->id, |
|
| 51 | - 'title' => $this->title, |
|
| 52 | - 'order' => $this->order, |
|
| 53 | - 'boardId' => $this->boardId, |
|
| 54 | - 'cards' => $this->cards |
|
| 55 | - ]; |
|
| 56 | - } |
|
| 57 | - return [ |
|
| 58 | - 'id' => $this->id, |
|
| 59 | - 'title' => $this->title, |
|
| 60 | - 'order' => $this->order, |
|
| 61 | - 'boardId' => $this->boardId |
|
| 62 | - ]; |
|
| 63 | - } |
|
| 47 | + public function jsonSerialize() { |
|
| 48 | + if (!empty($this->cards)) { |
|
| 49 | + return [ |
|
| 50 | + 'id' => $this->id, |
|
| 51 | + 'title' => $this->title, |
|
| 52 | + 'order' => $this->order, |
|
| 53 | + 'boardId' => $this->boardId, |
|
| 54 | + 'cards' => $this->cards |
|
| 55 | + ]; |
|
| 56 | + } |
|
| 57 | + return [ |
|
| 58 | + 'id' => $this->id, |
|
| 59 | + 'title' => $this->title, |
|
| 60 | + 'order' => $this->order, |
|
| 61 | + 'boardId' => $this->boardId |
|
| 62 | + ]; |
|
| 63 | + } |
|
| 64 | 64 | } |
| 65 | 65 | \ No newline at end of file |