From 45fa10394f396ff70d0cd4749500b9b0ea6493a8 Mon Sep 17 00:00:00 2001 From: Vinzenz Rosenkranz Date: Tue, 31 May 2016 00:38:56 +0200 Subject: [PATCH] set sharing layout --- appinfo/database.xml | 36 +++++++++++++++++++++++++- appinfo/info.xml | 4 +-- db/share.php | 22 ++++++++++++++++ db/sharemapper.php | 28 ++++++++++++++++++++ templates/part.note-modal-editable.php | 1 + 5 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 db/share.php create mode 100644 db/sharemapper.php diff --git a/appinfo/database.xml b/appinfo/database.xml index 5389d05..61e0441 100644 --- a/appinfo/database.xml +++ b/appinfo/database.xml @@ -108,4 +108,38 @@ - \ No newline at end of file + + *dbprefix*quicknotes_shares + + + id + integer + true + true + true + true + 8 + + + note_id + integer + true + true + true + 8 + + + shared_user + text + 200 + + + + shared_group + text + 200 + + + +
+ diff --git a/appinfo/info.xml b/appinfo/info.xml index 4fe1fab..f0b9b76 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -5,7 +5,7 @@ Quick notes with text, check lists and pictures AGPL Matias De lellis - 0.1.0 + 0.1.1 QuickNotes tool https://github.com/matiasdelellis @@ -15,4 +15,4 @@ - \ No newline at end of file + diff --git a/db/share.php b/db/share.php new file mode 100644 index 0000000..c571140 --- /dev/null +++ b/db/share.php @@ -0,0 +1,22 @@ + $this->id, + 'note' => $this->noteId, + 'user' => $this->sharedUser, + 'group' => $this->sharedGroup + ]; + } +} diff --git a/db/sharemapper.php b/db/sharemapper.php new file mode 100644 index 0000000..bd295d5 --- /dev/null +++ b/db/sharemapper.php @@ -0,0 +1,28 @@ +findEntity($sql, [$id, $userId]); + }*/ + + public function findForUser($userId) { + $sql = 'SELECT * FROM *PREFIX*quicknotes_shares WHERE shared_user = ?'; + return $this->findEntities($sql, [$userId]); + } + + public function findForGroup($groupId) { + $sql = 'SELECT * FROM *PREFIX*quicknotes_shares WHERE shared_group = ?'; + return $this->findEntities($sql, [$groupId]); + } +} diff --git a/templates/part.note-modal-editable.php b/templates/part.note-modal-editable.php index 6c53453..0b7216a 100644 --- a/templates/part.note-modal-editable.php +++ b/templates/part.note-modal-editable.php @@ -5,6 +5,7 @@
+