From 00b391ab20e1b0d6e65bfe907819bceef3d1ed84 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Wed, 30 Dec 2015 22:51:42 -0500 Subject: + Added class file for group table --- app/class/group.class.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 app/class/group.class.php (limited to 'app/class/group.class.php') diff --git a/app/class/group.class.php b/app/class/group.class.php new file mode 100644 index 0000000..2f3af40 --- /dev/null +++ b/app/class/group.class.php @@ -0,0 +1,20 @@ +loadObj($guid); + } +} + +?> -- cgit v1.2.3 From ec7186ed4e1c2a41ff9052cdd1624b8cabbb047c Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Thu, 26 May 2016 23:46:22 -0400 Subject: Add copyright notice to Scrott class files --- app/class/group.class.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'app/class/group.class.php') diff --git a/app/class/group.class.php b/app/class/group.class.php index 2f3af40..dfa7deb 100644 --- a/app/class/group.class.php +++ b/app/class/group.class.php @@ -1,5 +1,19 @@ Date: Wed, 1 Jun 2016 21:59:02 -0400 Subject: Add function Group::createNewGroup() This function will initialize a new group object and write it to the database, with a given group name and owner user. --- app/class/group.class.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'app/class/group.class.php') diff --git a/app/class/group.class.php b/app/class/group.class.php index dfa7deb..246276a 100644 --- a/app/class/group.class.php +++ b/app/class/group.class.php @@ -29,6 +29,21 @@ class Group extends Object parent::__construct(); $this->loadObj($guid); } + + /* + * Create a new user group object. + * On success, this object should be initialized as the new group (use only on new + * Group() objects) + */ + function createNewGroup($name, $owner) + { + $this->perms = $this->DEFAULT_OBJECT_PERMISSIONS; + $this->owner = $owner->guid; + $this->name = $name; + $this->type = "group"; + + $this->saveObj(); + } } ?> -- cgit v1.2.3 From ed99654d2e139a847a63e9295bf976d17462ee34 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sat, 22 Oct 2016 00:29:30 -0400 Subject: Deprecate application code Setup to perform an iteration of development focused on a simpler implementation and eliminating redundancy in design. --- app/class/group.class.php | 49 ----------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 app/class/group.class.php (limited to 'app/class/group.class.php') diff --git a/app/class/group.class.php b/app/class/group.class.php deleted file mode 100644 index 246276a..0000000 --- a/app/class/group.class.php +++ /dev/null @@ -1,49 +0,0 @@ -loadObj($guid); - } - - /* - * Create a new user group object. - * On success, this object should be initialized as the new group (use only on new - * Group() objects) - */ - function createNewGroup($name, $owner) - { - $this->perms = $this->DEFAULT_OBJECT_PERMISSIONS; - $this->owner = $owner->guid; - $this->name = $name; - $this->type = "group"; - - $this->saveObj(); - } -} - -?> -- cgit v1.2.3 From 5e8f3fb2adb74a9eb5c841848cfaae6502c9e91a Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 26 Mar 2017 19:18:19 -0400 Subject: Add group class --- app/class/group.class.php | 66 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 app/class/group.class.php (limited to 'app/class/group.class.php') diff --git a/app/class/group.class.php b/app/class/group.class.php new file mode 100644 index 0000000..1e98aff --- /dev/null +++ b/app/class/group.class.php @@ -0,0 +1,66 @@ +fields['groups'] = array( + "guid", + ); + + parent::__construct($guid); + $this->expectType("group"); + } + + /* + * Get an array of all groups, sorted by name + */ + public static function getAll_ordByName() : array + { + $query = "SELECT guid FROM objects WHERE objtype = 'group' ORDER BY name"; + $res = database::query($query); + + $groups = array(); + + foreach ($res as $g) + $groups[] = new group($g['guid']); + + return $groups; + } + + /* + * Initialize a new group object with the given name and owner + */ + public static function initNew(string $name, user $owner) : group + { + $group = new group(); + $group->setOwner($owner); + $group->name = $name; + $group->objtype = "group"; + return $group; + } +} + +?> -- cgit v1.2.3 From f97e2dc2fe38ac26dde0ca18ba69bc2c412e699b Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 9 Apr 2017 23:22:03 -0400 Subject: Fix bug in group class --- app/class/group.class.php | 1 + 1 file changed, 1 insertion(+) (limited to 'app/class/group.class.php') diff --git a/app/class/group.class.php b/app/class/group.class.php index 1e98aff..5163cb8 100644 --- a/app/class/group.class.php +++ b/app/class/group.class.php @@ -59,6 +59,7 @@ class group extends agent $group->setOwner($owner); $group->name = $name; $group->objtype = "group"; + $group->saveObj(); return $group; } } -- cgit v1.2.3 From b8db87d3b814b1845e8282c066a895d9dcb5a0a9 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Tue, 6 Jun 2017 13:20:31 -0400 Subject: Implement function sendEmail() for group class --- app/class/group.class.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'app/class/group.class.php') diff --git a/app/class/group.class.php b/app/class/group.class.php index 5163cb8..1191d71 100644 --- a/app/class/group.class.php +++ b/app/class/group.class.php @@ -62,6 +62,32 @@ class group extends agent $group->saveObj(); return $group; } + + /* + * Send an email message to this group using stored configuration + * parameters. If config is not established, delivery is not + * attempted. Return status. If any delivery attempts fail, the + * rest are aborted and false is returned. + */ + public function sendEmail(string $subj, string $mesg, + ?string $attachPath = NULL, ?string $attachName = NULL, + bool $ignoreEmailConf = false) : bool + { + $owner = $this->getOwner(); + + if (!$owner->sendEmail($subj, $mesg, $attachPath, $attachName, + $ignoreEmailConf)) + return false; + + foreach ($this->getMembers() as $memb) + { + if (!$memb->sendEmail($subj, $mesg, $attachPath, $attachName, + $ignoreEmailConf)) + return false; + } + + return true; + } } ?> -- cgit v1.2.3