From e0d8f9e7763dbf4636bcd026c69080d2dbf97706 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 19 Sep 2020 21:22:51 +0200 Subject: [PATCH] add gender and sex --- Admin/Install/db.json | 8 +++ Models/GenderType.php | 34 ++++++++++++ Models/Profile.php | 81 ++++++++++++++++++++++++++++ Models/ProfileMapper.php | 2 + Models/SexType.php | 34 ++++++++++++ Theme/Backend/profile-single.tpl.php | 12 +---- 6 files changed, 160 insertions(+), 11 deletions(-) create mode 100644 Models/GenderType.php create mode 100644 Models/SexType.php diff --git a/Admin/Install/db.json b/Admin/Install/db.json index ee9f7bd..5bbea45 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -20,6 +20,14 @@ "gdpr": true } }, + "profile_account_gender": { + "name": "profile_account_gender", + "type": "INT" + }, + "profile_account_sex": { + "name": "profile_account_sex", + "type": "INT" + }, "profile_account_birthday": { "name": "profile_account_birthday", "type": "DATETIME", diff --git a/Models/GenderType.php b/Models/GenderType.php new file mode 100644 index 0000000..0545f37 --- /dev/null +++ b/Models/GenderType.php @@ -0,0 +1,34 @@ +id; } + /** + * Get gender. + * + * @return int Returns the gender (GenderType) + * + * @since 1.0.0 + */ + public function getGender() : int + { + return $this->gender; + } + + /** + * Get gender. + * + * @param int $gender Gender + * + * @return void + * + * @throws InvalidEnumValue This exception is thrown if a invalid gender is used + * + * @since 1.0.0 + */ + public function setGender(int $gender) : void + { + if (!GenderType::isValidValue($gender)) { + throw new InvalidEnumValue($gender); + } + + $this->gender = $gender; + } + + /** + * Get sex. + * + * @return int Returns the sex (SexType) + * + * @since 1.0.0 + */ + public function getSex() : int + { + return $this->sex; + } + + /** + * Get sex. + * + * @param int $sex Sex + * + * @return void + * + * @throws InvalidEnumValue This exception is thrown if a invalid sex is used + * + * @since 1.0.0 + */ + public function setSex(int $sex) : void + { + if (!SexType::isValidValue($sex)) { + throw new InvalidEnumValue($sex); + } + + $this->sex = $sex; + } + /** * Get account locations. * diff --git a/Models/ProfileMapper.php b/Models/ProfileMapper.php index 34aa8e5..dce8218 100755 --- a/Models/ProfileMapper.php +++ b/Models/ProfileMapper.php @@ -39,6 +39,8 @@ final class ProfileMapper extends DataMapperAbstract 'profile_account_id' => ['name' => 'profile_account_id', 'type' => 'int', 'internal' => 'id'], 'profile_account_image' => ['name' => 'profile_account_image', 'type' => 'int', 'internal' => 'image', 'annotations' => ['gdpr' => true]], 'profile_account_birthday' => ['name' => 'profile_account_birthday', 'type' => 'DateTime', 'internal' => 'birthday', 'annotations' => ['gdpr' => true]], + 'profile_account_gender' => ['name' => 'profile_account_gender', 'type' => 'int', 'internal' => 'gender', 'annotations' => ['gdpr' => true]], + 'profile_account_sex' => ['name' => 'profile_account_sex', 'type' => 'int', 'internal' => 'sex', 'annotations' => ['gdpr' => true]], 'profile_account_account' => ['name' => 'profile_account_account', 'type' => 'int', 'internal' => 'account'], ]; diff --git a/Models/SexType.php b/Models/SexType.php new file mode 100644 index 0000000..3626916 --- /dev/null +++ b/Models/SexType.php @@ -0,0 +1,34 @@ +getData('nav')->render(); request->getUri()->getFragment() === 'c-tab-1' ? ' checked' : ''; ?>>
-
+
getName3()) || !empty($account->getName2())) : ?> @@ -144,16 +144,6 @@ echo $this->getData('nav')->render();
-
-
-
getHtml('Visibility'); ?>
-
-

Define which users and user groups can see your profile

- getData('accGrpSelector')->render('iVisibility', 'visibility', true); ?> -
-
-
-
getData('medialist')->render($media); ?>