mirror of
https://github.com/Karaka-Management/oms-Profile.git
synced 2026-01-21 20:08:40 +00:00
Further implementations after using the app
This commit is contained in:
parent
df181b3a8d
commit
376aae7f88
|
|
@ -22,6 +22,7 @@ use Modules\Admin\Models\AccountMapper;
|
|||
use phpOMS\Account\PermissionType;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Message\NotificationLevel;
|
||||
use phpOMS\Module\ModuleAbstract;
|
||||
use phpOMS\Module\WebInterface;
|
||||
use phpOMS\Views\View;
|
||||
|
|
@ -236,7 +237,12 @@ final class Controller extends ModuleAbstract implements WebInterface
|
|||
$created[] = $profile->jsonSerialize();
|
||||
}
|
||||
|
||||
$response->set($request->getUri()->__toString(), $created);
|
||||
$response->set($request->getUri()->__toString(), [
|
||||
'status' => NotificationLevel::OK,
|
||||
'title' => 'Profile(s)',
|
||||
'message' => 'Profile(s) successfully created.',
|
||||
'response' => $created
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -251,19 +257,18 @@ final class Controller extends ModuleAbstract implements WebInterface
|
|||
private function createProfilesFromRequest(RequestAbstract $request) : array
|
||||
{
|
||||
$profiles = [];
|
||||
$accounts = \json_decode($request->getData('iaccount-idlist') ?? '[]', true);
|
||||
|
||||
if ($accounts === false) {
|
||||
return $profiles;
|
||||
}
|
||||
|
||||
if (\is_int($accounts)) {
|
||||
$accounts = [$accounts];
|
||||
}
|
||||
$accounts = $request->getDataList('iaccount-idlist');
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
$account = AccountMapper::get((int) $account);
|
||||
$profiles[] = new Profile(AccountMapper::get((int) $account));
|
||||
$account = (int) \trim($account);
|
||||
$isInDb = ProfileMapper::getFor($account, 'account');
|
||||
|
||||
if ($isInDb->getId() !== 0) {
|
||||
$profiles[] = $isInDb;
|
||||
continue;
|
||||
}
|
||||
|
||||
$profiles[] = new Profile(AccountMapper::get($account));
|
||||
}
|
||||
|
||||
return $profiles;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ echo $this->getData('nav')->render();
|
|||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-4">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<section class="box wf-100">
|
||||
<header><h1><?= $this->getHtml('CreateProfile'); ?></h1></header>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user