| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace UserAccessManager\Controller\Backend; |
| 6 |
|
| 7 |
use UserAccessManager\Object\ObjectHandler; |
| 8 |
use UserAccessManager\UserGroup\UserGroupTypeException; |
| 9 |
|
| 10 |
class UserObjectController extends ObjectController |
| 11 |
{ |
| 12 |
public function addUserColumnsHeader(array $defaults): array |
| 13 |
{ |
| 14 |
$defaults[self::COLUMN_NAME] = TXT_UAM_COLUMN_USER_GROUPS; |
| 15 |
return $defaults; |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* @throws UserGroupTypeException |
| 20 |
*/ |
| 21 |
public function addUserColumn(?string $return, string $columnName, int|string $id): ?string |
| 22 |
{ |
| 23 |
if ($columnName === self::COLUMN_NAME) { |
| 24 |
$this->setObjectInformation(ObjectHandler::GENERAL_USER_OBJECT_TYPE, $id); |
| 25 |
$return .= $this->getIncludeContents('UserColumn.php'); |
| 26 |
} |
| 27 |
|
| 28 |
return $return; |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* @throws UserGroupTypeException |
| 33 |
*/ |
| 34 |
public function showUserProfile(): void |
| 35 |
{ |
| 36 |
$userId = $this->getRequestParameter('user_id'); |
| 37 |
$this->setObjectInformation(ObjectHandler::GENERAL_USER_OBJECT_TYPE, $userId); |
| 38 |
|
| 39 |
echo $this->getIncludeContents('UserProfileEditForm.php'); |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* @throws UserGroupTypeException |
| 44 |
*/ |
| 45 |
public function saveUserData(int|string $userId): void |
| 46 |
{ |
| 47 |
$this->saveObjectData(ObjectHandler::GENERAL_USER_OBJECT_TYPE, $userId); |
| 48 |
} |
| 49 |
|
| 50 |
public function removeUserData(int|string $userId): void |
| 51 |
{ |
| 52 |
$this->removeObjectData(ObjectHandler::GENERAL_USER_OBJECT_TYPE, $userId); |
| 53 |
} |
| 54 |
} |
| 55 |
|