diff --git a/Models/ContactElement.php b/Models/ContactElement.php index c1cfc74..b94d3f9 100644 --- a/Models/ContactElement.php +++ b/Models/ContactElement.php @@ -15,7 +15,7 @@ declare(strict_types=1); namespace Modules\Profile\Models; /** - * Account class. + * Contact element class. * * @package Modules\Profile\Models * @license OMS License 1.0 @@ -35,12 +35,12 @@ class ContactElement private int $type = 0; /** - * Description. + * Content. * * @var string * @since 1.0.0 */ - private string $description = ''; + private string $content = ''; /** * Get id. @@ -81,28 +81,28 @@ class ContactElement } /** - * Get description + * Get content * * @return string * * @since 1.0.0 */ - public function getDescription() : string + public function getContent() : string { - return $this->description; + return $this->content; } /** - * Set description + * Set content * - * @param string $description Description + * @param string $content Content * * @return void * * @since 1.0.0 */ - public function setDescription(string $description) : void + public function setContent(string $content) : void { - $this->description = $description; + $this->content = $content; } } diff --git a/Models/ContactElementMapper.php b/Models/ContactElementMapper.php index 05b1807..b3d0035 100644 --- a/Models/ContactElementMapper.php +++ b/Models/ContactElementMapper.php @@ -33,7 +33,7 @@ final class ContactElementMapper extends DataMapperAbstract * @since 1.0.0 */ protected static array $columns = [ - 'profile_contact_id' => ['name' => 'profile_contact_id', 'type' => 'int', 'internal' => 'id'], + 'profile_contactelement_id' => ['name' => 'profile_contactelement_id', 'type' => 'int', 'internal' => 'id'], ]; /** @@ -42,7 +42,7 @@ final class ContactElementMapper extends DataMapperAbstract * @var string * @since 1.0.0 */ - protected static string $table = 'profile_contact'; + protected static string $table = 'profile_contactelement'; /** * Primary field name. @@ -50,5 +50,5 @@ final class ContactElementMapper extends DataMapperAbstract * @var string * @since 1.0.0 */ - protected static string $primaryField = 'profile_contact_id'; + protected static string $primaryField = 'profile_contactelement_id'; } diff --git a/Models/NullContactElement.php b/Models/NullContactElement.php new file mode 100644 index 0000000..6896393 --- /dev/null +++ b/Models/NullContactElement.php @@ -0,0 +1,27 @@ +location[] = $location; } + /** + * Get account contact element. + * + * @return Location[] + * + * @since 1.0.0 + */ + public function getContactElements() : array + { + return $this->contactElements; + } + + /** + * Add contact element. + * + * @param ContactElements $contactElements Contact Element + * + * @return void + * + * @since 1.0.0 + */ + public function addContactElements(Location $contactElements) : void + { + $this->contactElements[] = $contactElements; + } + /** * Get account image. * diff --git a/Models/ProfileMapper.php b/Models/ProfileMapper.php index 56879ed..3e3912e 100644 --- a/Models/ProfileMapper.php +++ b/Models/ProfileMapper.php @@ -72,6 +72,12 @@ final class ProfileMapper extends DataMapperAbstract 'dst' => 'profile_address_address', 'src' => 'profile_address_profile', ], + 'contactElements' => [ + 'mapper' => ContactElementMapper::class, + 'table' => 'profile_contactelement', + 'src' => null, + 'dst' => 'profile_contactelement_contact', + ], ]; /** diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index b163ffd..d3de736 100644 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -21,6 +21,7 @@ return ['Profile' => [ 'Birthday' => 'Birthday', 'City' => 'City', 'Community' => 'Community', + 'Contact' => 'Contact', 'ContactInformation' => 'Contact Information', 'Country' => 'Country', 'CreateProfile' => 'Create Profile', diff --git a/Theme/Backend/profile-single.tpl.php b/Theme/Backend/profile-single.tpl.php index dcd73d2..19c14e5 100644 --- a/Theme/Backend/profile-single.tpl.php +++ b/Theme/Backend/profile-single.tpl.php @@ -17,6 +17,7 @@ use phpOMS\Uri\UriFactory; /** * @var \phpOMS\Views\View $this + * @var \Modules\Profile\Models\Profile $account */ $account = $this->getData('account'); $settings = $this->getData('settings') ?? []; @@ -79,34 +80,42 @@ echo $this->getData('nav')->render(); Sailor getHtml('Birthday') ?> - 06.09.1934 - - getHtml('Ranks') ?> - Gosling + getBirthday()->format('Y-m-d'); ?> getHtml('Email') ?> printHtml($account->getAccount()->getEmail()); ?> - Address + getHtml('Address') ?> + getLocation(); + if (empty($locations)) : + ?> + + + No address specified + + Private SMALLSYS INC
795 E DRAGRAM
TUCSON AZ 85705
USA + - Work - SMALLSYS INC
795 E DRAGRAM
TUCSON AZ 85705
USA - - getHtml('Phone') ?> + getHtml('Contact') ?> + getContactElements(); + if (empty($contacts)) : + ?> + + + No contact specified + + Private +01 12345-4567 - - Mobile - +01 12345-4567 - - Work - +01 12345-4567 + getHtml('Registered') ?> printHtml($account->getAccount()->getCreatedAt()->format('Y-m-d')); ?> @@ -115,7 +124,7 @@ echo $this->getData('nav')->render(); printHtml($account->getAccount()->getLastActive()->format('Y-m-d')); ?> getHtml('Status') ?> - printHtml($account->getAccount()->getStatus()); ?> + getHtml(':s' . $account->getAccount()->getStatus(), 'Admin'); ?>