/** * Set defaults for all datafields of a statusgruppe. * * @param String $role_id Id of the statusgruppe in question * @param bool $state Indicates whether the defaults should be used or not */ public function defaults_action($role_id, $state) { MakeDatafieldsDefault($this->user->user_id, $role_id, $state ? 'default_value' : ''); $this->redirect('settings/statusgruppen#' . $role_id); }
function InsertPersonStatusgruppe ($user_id, $statusgruppe_id, $is_institute_group = true) { $query = "SELECT 1 FROM statusgruppe_user WHERE user_id = ? AND statusgruppe_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($user_id, $statusgruppe_id)); $present = $statement->fetchColumn(); if ($present) { return false; } $position = CountMembersPerStatusgruppe($statusgruppe_id) + 1; $query = "INSERT INTO statusgruppe_user (statusgruppe_id, user_id, position) VALUES (?, ?, ?)"; $statement = DBManager::get()->prepare($query); $statement->execute(array($statusgruppe_id, $user_id, $position)); // Only make Datafields default if it is indeed an institute group. Ref.: #2207 if ($is_institute_group) { MakeDatafieldsDefault($user_id, $statusgruppe_id); } return true; }