mirror of
https://github.com/Karaka-Management/oms-Profile.git
synced 2026-02-16 15:28:41 +00:00
prepare localization for profile
This commit is contained in:
parent
0c3c479696
commit
e98cef8827
|
|
@ -15,7 +15,7 @@ declare(strict_types=1);
|
||||||
namespace Modules\Profile\Models;
|
namespace Modules\Profile\Models;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account class.
|
* Contact element class.
|
||||||
*
|
*
|
||||||
* @package Modules\Profile\Models
|
* @package Modules\Profile\Models
|
||||||
* @license OMS License 1.0
|
* @license OMS License 1.0
|
||||||
|
|
@ -35,12 +35,12 @@ class ContactElement
|
||||||
private int $type = 0;
|
private int $type = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description.
|
* Content.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private string $description = '';
|
private string $content = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get id.
|
* Get id.
|
||||||
|
|
@ -81,28 +81,28 @@ class ContactElement
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get description
|
* Get content
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @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
|
* @return void
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function setDescription(string $description) : void
|
public function setContent(string $content) : void
|
||||||
{
|
{
|
||||||
$this->description = $description;
|
$this->content = $content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ final class ContactElementMapper extends DataMapperAbstract
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static array $columns = [
|
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
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static string $table = 'profile_contact';
|
protected static string $table = 'profile_contactelement';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Primary field name.
|
* Primary field name.
|
||||||
|
|
@ -50,5 +50,5 @@ final class ContactElementMapper extends DataMapperAbstract
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static string $primaryField = 'profile_contact_id';
|
protected static string $primaryField = 'profile_contactelement_id';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
27
Models/NullContactElement.php
Normal file
27
Models/NullContactElement.php
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.4
|
||||||
|
*
|
||||||
|
* @package Modules\Profile\Models
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://orange-management.org
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Modules\Profile\Models;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contact element class.
|
||||||
|
*
|
||||||
|
* @package Modules\Profile\Models
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link https://orange-management.org
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class NullContactElement implements ContactElement
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
@ -71,6 +71,14 @@ class Profile implements \JsonSerializable
|
||||||
*/
|
*/
|
||||||
protected array $location = [];
|
protected array $location = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contact data.
|
||||||
|
*
|
||||||
|
* @var ContactElements[]
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected array $contactElements = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
|
@ -123,6 +131,32 @@ class Profile implements \JsonSerializable
|
||||||
$this->location[] = $location;
|
$this->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.
|
* Get account image.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,12 @@ final class ProfileMapper extends DataMapperAbstract
|
||||||
'dst' => 'profile_address_address',
|
'dst' => 'profile_address_address',
|
||||||
'src' => 'profile_address_profile',
|
'src' => 'profile_address_profile',
|
||||||
],
|
],
|
||||||
|
'contactElements' => [
|
||||||
|
'mapper' => ContactElementMapper::class,
|
||||||
|
'table' => 'profile_contactelement',
|
||||||
|
'src' => null,
|
||||||
|
'dst' => 'profile_contactelement_contact',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ return ['Profile' => [
|
||||||
'Birthday' => 'Birthday',
|
'Birthday' => 'Birthday',
|
||||||
'City' => 'City',
|
'City' => 'City',
|
||||||
'Community' => 'Community',
|
'Community' => 'Community',
|
||||||
|
'Contact' => 'Contact',
|
||||||
'ContactInformation' => 'Contact Information',
|
'ContactInformation' => 'Contact Information',
|
||||||
'Country' => 'Country',
|
'Country' => 'Country',
|
||||||
'CreateProfile' => 'Create Profile',
|
'CreateProfile' => 'Create Profile',
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ use phpOMS\Uri\UriFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \phpOMS\Views\View $this
|
* @var \phpOMS\Views\View $this
|
||||||
|
* @var \Modules\Profile\Models\Profile $account
|
||||||
*/
|
*/
|
||||||
$account = $this->getData('account');
|
$account = $this->getData('account');
|
||||||
$settings = $this->getData('settings') ?? [];
|
$settings = $this->getData('settings') ?? [];
|
||||||
|
|
@ -79,34 +80,42 @@ echo $this->getData('nav')->render();
|
||||||
<td itemprop="jobTitle">Sailor
|
<td itemprop="jobTitle">Sailor
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= $this->getHtml('Birthday') ?>
|
<th><?= $this->getHtml('Birthday') ?>
|
||||||
<td itemprop="birthDate" itemprop="foundingDate">06.09.1934
|
<td itemprop="birthDate" itemprop="foundingDate"><?= $account->getBirthday()->format('Y-m-d'); ?>
|
||||||
<tr>
|
|
||||||
<th><?= $this->getHtml('Ranks') ?>
|
|
||||||
<td itemprop="memberOf">Gosling
|
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= $this->getHtml('Email') ?>
|
<th><?= $this->getHtml('Email') ?>
|
||||||
<td itemprop="email"><a href="mailto:>donald.duck@email.com<"><?= $this->printHtml($account->getAccount()->getEmail()); ?></a>
|
<td itemprop="email"><a href="mailto:>donald.duck@email.com<"><?= $this->printHtml($account->getAccount()->getEmail()); ?></a>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Address
|
<th><?= $this->getHtml('Address') ?>
|
||||||
<td>
|
<td>
|
||||||
|
<?php
|
||||||
|
$locations = $account->getLocation();
|
||||||
|
if (empty($locations)) :
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<td>No address specified
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php foreach ($locations as $location) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="vT">Private
|
<th class="vT">Private
|
||||||
<td itemprop="address">SMALLSYS INC<br>795 E DRAGRAM<br>TUCSON AZ 85705<br>USA
|
<td itemprop="address">SMALLSYS INC<br>795 E DRAGRAM<br>TUCSON AZ 85705<br>USA
|
||||||
|
<?php endforeach; ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="vT">Work
|
<th><?= $this->getHtml('Contact') ?>
|
||||||
<td itemprop="address">SMALLSYS INC<br>795 E DRAGRAM<br>TUCSON AZ 85705<br>USA
|
|
||||||
<tr>
|
|
||||||
<th><?= $this->getHtml('Phone') ?>
|
|
||||||
<td>
|
<td>
|
||||||
|
<?php
|
||||||
|
$contacts = $account->getContactElements();
|
||||||
|
if (empty($contacts)) :
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<td>No contact specified
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php foreach ($contacts as $location) : ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Private
|
<th>Private
|
||||||
<td itemprop="telephone">+01 12345-4567
|
<td itemprop="telephone">+01 12345-4567
|
||||||
<tr>
|
<?php endforeach; ?>
|
||||||
<th>Mobile
|
|
||||||
<td itemprop="telephone">+01 12345-4567
|
|
||||||
<tr>
|
|
||||||
<th>Work
|
|
||||||
<td itemprop="telephone">+01 12345-4567
|
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= $this->getHtml('Registered') ?>
|
<th><?= $this->getHtml('Registered') ?>
|
||||||
<td><?= $this->printHtml($account->getAccount()->getCreatedAt()->format('Y-m-d')); ?>
|
<td><?= $this->printHtml($account->getAccount()->getCreatedAt()->format('Y-m-d')); ?>
|
||||||
|
|
@ -115,7 +124,7 @@ echo $this->getData('nav')->render();
|
||||||
<td><?= $this->printHtml($account->getAccount()->getLastActive()->format('Y-m-d')); ?>
|
<td><?= $this->printHtml($account->getAccount()->getLastActive()->format('Y-m-d')); ?>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= $this->getHtml('Status') ?>
|
<th><?= $this->getHtml('Status') ?>
|
||||||
<td><span class="tag green"><?= $this->printHtml($account->getAccount()->getStatus()); ?></span>
|
<td><span class="tag green"><?= $this->getHtml(':s' . $account->getAccount()->getStatus(), 'Admin'); ?></span>
|
||||||
</table>
|
</table>
|
||||||
<!-- @formatter:on -->
|
<!-- @formatter:on -->
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user