diff --git a/Controller/ApiController.php b/Controller/ApiController.php index fb533e1..eb63c39 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -84,7 +84,7 @@ final class ApiController extends Controller */ public function apiProfileCreateDbEntry(Profile $profile, RequestAbstract $request) : bool { - if ($profile->getId() !== 0) { + if ($profile->id !== 0) { return false; } @@ -144,7 +144,7 @@ final class ApiController extends Controller /** @var Profile $isInDb */ $isInDb = ProfileMapper::get()->where('account', $account)->execute(); - if ($isInDb->getId() !== 0) { + if ($isInDb->id !== 0) { $profiles[] = $isInDb; continue; } @@ -190,8 +190,8 @@ final class ApiController extends Controller fileNames: $request->getDataList('filenames'), files: $uploadedFiles, account: $request->header->account, - basePath: __DIR__ . '/../../../Modules/Media/Files/Accounts/' . $profile->account->getId(), - virtualPath: '/Accounts/' . $profile->account->getId() . ' ' . $profile->account->login, + basePath: __DIR__ . '/../../../Modules/Media/Files/Accounts/' . $profile->account->id, + virtualPath: '/Accounts/' . $profile->account->id . ' ' . $profile->account->login, pathSettings: PathSettings::FILE_PATH ); @@ -199,7 +199,7 @@ final class ApiController extends Controller foreach ($uploaded as $file) { $this->createModelRelation( $request->header->account, - $file->getId(), + $file->id, $request->getDataInt('type'), MediaMapper::class, 'types', @@ -210,7 +210,7 @@ final class ApiController extends Controller } $profile->image = !empty($uploaded) ? \reset($uploaded) : new NullMedia(); - if (!($profile->image instanceof NullMedia)) { + if ($profile->image->id > 0) { $profile->image = $this->app->moduleManager->get('Media')->resizeImage($profile->image, 100, 100, false); } @@ -249,13 +249,13 @@ final class ApiController extends Controller ->where('account', $request->getDataInt('account') ?? 0) ->execute(); - $profile = $profileObj->getId(); + $profile = $profileObj->id; } $contactElement = $this->createContactElementFromRequest($request); $this->createModel($request->header->account, $contactElement, ContactElementMapper::class, 'profile-contactElement', $request->getOrigin()); - $this->createModelRelation($request->header->account, $profile, $contactElement->getId(), ProfileMapper::class, 'contactElements', '', $request->getOrigin()); + $this->createModelRelation($request->header->account, $profile, $contactElement->id, ProfileMapper::class, 'contactElements', '', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Contact Element', 'Contact element successfully created', $contactElement); } @@ -334,13 +334,13 @@ final class ApiController extends Controller ->where('account', $request->getDataInt('account') ?? 0) ->execute(); - $profile = $profileObj->getId(); + $profile = $profileObj->id; } $address = $this->createAddressFromRequest($request); $this->createModel($request->header->account, $address, AddressMapper::class, 'profile-address', $request->getOrigin()); - $this->createModelRelation($request->header->account, $profile, $address->getId(), ProfileMapper::class, 'location', '', $request->getOrigin()); + $this->createModelRelation($request->header->account, $profile, $address->id, ProfileMapper::class, 'location', '', $request->getOrigin()); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Address', 'Address successfully created', $address); } diff --git a/Controller/BackendController.php b/Controller/BackendController.php index b8e1465..d58d8c8 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -153,9 +153,9 @@ final class BackendController extends Controller $view->setData('account', $profile); $l11n = null; - if ($profile->account->getId() === $request->header->account) { + if ($profile->account->id === $request->header->account) { /** @var \phpOMS\Localization\Localization $l11n */ - $l11n = LocalizationMapper::get()->where('id', $profile->account->l11n->getId())->execute(); + $l11n = LocalizationMapper::get()->where('id', $profile->account->l11n->id)->execute(); } $view->setData('l11n', $l11n ?? new NullLocalization()); @@ -166,7 +166,7 @@ final class BackendController extends Controller /** @var \Modules\Media\Models\Media[] $media */ $media = MediaMapper::getAll() ->with('createdBy') - ->where('createdBy', (int) $profile->account->getId()) + ->where('createdBy', (int) $profile->account->id) ->limit(25) ->execute(); diff --git a/Models/Contact.php b/Models/Contact.php index 5212eb2..0e6cdcc 100755 --- a/Models/Contact.php +++ b/Models/Contact.php @@ -34,7 +34,7 @@ class Contact * @var int * @since 1.0.0 */ - protected int $id = 0; + public int $id = 0; /** * Name1 @@ -134,58 +134,6 @@ class Contact $this->image = new NullMedia(); } - /** - * Get account locations. - * - * @return Location[] - * - * @since 1.0.0 - */ - public function getLocations() : array - { - return $this->locations; - } - - /** - * Add location. - * - * @param Location $location Location - * - * @return void - * - * @since 1.0.0 - */ - public function addLocation(Location $location) : void - { - $this->locations[] = $location; - } - - /** - * Get account contact element. - * - * @return Contact[] - * - * @since 1.0.0 - */ - public function getContacts() : array - { - return $this->contacts; - } - - /** - * Add contact element. - * - * @param Contact $contact Contact Element - * - * @return void - * - * @since 1.0.0 - */ - public function addContact(Contact $contact) : void - { - $this->contacts[] = $contact; - } - /** * Get id. * diff --git a/Models/ContactElement.php b/Models/ContactElement.php index 72c7969..f44ca7e 100755 --- a/Models/ContactElement.php +++ b/Models/ContactElement.php @@ -32,7 +32,7 @@ class ContactElement * @var int * @since 1.0.0 */ - protected int $id = 0; + public int $id = 0; /** * Contact element type. @@ -40,7 +40,7 @@ class ContactElement * @var int * @since 1.0.0 */ - private int $type = 0; + public int $type = 0; /** * Contact element subtype. diff --git a/Models/Profile.php b/Models/Profile.php index dd5e66a..6e96b45 100755 --- a/Models/Profile.php +++ b/Models/Profile.php @@ -19,7 +19,6 @@ use Modules\Admin\Models\NullAccount; use Modules\Media\Models\Media; use Modules\Media\Models\NullMedia; use phpOMS\Stdlib\Base\Exception\InvalidEnumValue; -use phpOMS\Stdlib\Base\Location; /** * Profile class. @@ -37,7 +36,7 @@ class Profile implements \JsonSerializable * @var int * @since 1.0.0 */ - protected int $id = 0; + public int $id = 0; /** * Profile image. diff --git a/Theme/Backend/Components/AccountGroupSelector/BaseView.php b/Theme/Backend/Components/AccountGroupSelector/BaseView.php index 036c452..503f772 100755 --- a/Theme/Backend/Components/AccountGroupSelector/BaseView.php +++ b/Theme/Backend/Components/AccountGroupSelector/BaseView.php @@ -44,7 +44,7 @@ class BaseView extends View * @var bool * @since 1.0.0 */ - private bool $isRequired = false; + public bool $isRequired = false; /** * Dom name diff --git a/Theme/Backend/Components/AccountGroupSelector/base.tpl.php b/Theme/Backend/Components/AccountGroupSelector/base.tpl.php index 7dcf5b2..977f14f 100755 --- a/Theme/Backend/Components/AccountGroupSelector/base.tpl.php +++ b/Theme/Backend/Components/AccountGroupSelector/base.tpl.php @@ -2,10 +2,10 @@
| Name | |||||||||
| @@ -43,8 +43,8 @@ - | |||||||||
| = $this->printHtml($account->account->name3 . ' ' . $account->account->name2 . ' ' . $account->account->name1); ?> | = $this->printHtml($account->account->getLastActive()->format('Y-m-d')); ?>
diff --git a/Theme/Backend/profile-single.tpl.php b/Theme/Backend/profile-single.tpl.php
index 7d4bd05..b5b1605 100755
--- a/Theme/Backend/profile-single.tpl.php
+++ b/Theme/Backend/profile-single.tpl.php
@@ -45,7 +45,7 @@ echo $this->getData('nav')->render();
render();
= $this->getHtml('Address'); ?>
|
account->getLocations();
+ $locations = $profile->account->locations;
if (empty($locations)) :
?>
| = $this->getHtml('Contact'); ?>
|
account->getContacts();
+ $contacts = $profile->account->contacts;
if (empty($contacts)) :
?>
| = $this->getHtml(':s' . $account->getStatus(), 'Admin'); ?>
| |