This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/user/events.php

81 lines
1.6 KiB
PHP
Raw Normal View History

2021-12-14 18:32:47 +00:00
<?php
declare(strict_types=1);
namespace Shimmie2;
class UserBlockBuildingEvent extends Event
{
public array $parts = [];
public function add_link(string $name, string $link, int $position=50): void
{
while (isset($this->parts[$position])) {
$position++;
}
$this->parts[$position] = ["name" => $name, "link" => $link];
}
}
class UserOperationsBuildingEvent extends Event
{
public array $parts = [];
2023-02-24 21:08:05 +00:00
public function __construct(public User $user, public BaseConfig $user_config)
{
parent::__construct();
}
public function add_html(string $html): void
{
$this->parts[] = $html;
}
}
class UserPageBuildingEvent extends Event
{
public array $stats = [];
2023-02-24 21:08:05 +00:00
public function __construct(public User $display_user)
{
2020-01-26 13:19:35 +00:00
parent::__construct();
}
public function add_stats(string $html, int $position=50)
{
while (isset($this->stats[$position])) {
$position++;
}
$this->stats[$position] = $html;
}
}
class UserCreationEvent extends Event
{
2023-02-24 21:08:05 +00:00
public function __construct(
public string $username,
public string $password,
public string $password2,
public string $email,
public bool $login
) {
2020-01-26 13:19:35 +00:00
parent::__construct();
}
}
class UserLoginEvent extends Event
{
2023-02-24 21:08:05 +00:00
public function __construct(public User $user)
{
2020-01-26 13:19:35 +00:00
parent::__construct();
}
}
class UserDeletionEvent extends Event
{
2023-02-24 21:08:05 +00:00
public function __construct(public int $id)
{
2020-01-26 13:19:35 +00:00
parent::__construct();
}
}