public static function isUniqueAbbreviation($abbr, $db = null) { $user = new DinklyGroup(); if ($db == null) { $db = self::fetchDB(); } $query = $user->getSelectQuery() . " where abbreviation=" . $db->quote($abbr); $results = $db->query($query)->fetchAll(); if ($results != array() && $results != NULL) { return false; } else { return true; } }
public function loadAddPermission($parameters) { if (isset($parameters['id'])) { if (isset($_POST['permission'])) { $group = new DinklyGroup(); $group->init($parameters['id']); $group->addPermissions($_POST['permission']); DinklyFlash::set('good_group_message', 'Permissions updated'); return $this->loadModule('admin', 'group', 'detail', true, true, array('id' => $group->getId())); } } return false; }
public function addToGroups($group_ids) { if ($group_ids != array()) { foreach ($group_ids as $id) { $group = new DinklyGroup(); $group->init($id); //If the group isn't new, that means it exists, which is a good thing if (!$group->isNew()) { //Make sure this join record doesn't already exist first $group_join = new DinklyUserGroup(); $group_join->initWithUserAndGroup($this->getId(), $id); if ($group_join->isNew()) { $group_join->setDinklyUserId($this->getId()); $group_join->setDinklyGroupId($id); $group_join->save(); } } } return true; } return false; }