mirror of
https://github.com/standardebooks/web.git
synced 2025-07-12 09:32:24 -04:00
Add more information to user info page
This commit is contained in:
parent
228efdc780
commit
7ac427dad5
3 changed files with 14 additions and 19 deletions
17
lib/User.php
17
lib/User.php
|
@ -9,7 +9,6 @@ use function Safe\preg_match;
|
|||
* @property bool $IsRegistered A user is "registered" if they have an entry in the `Benefits` table; a password is required to log in.
|
||||
* @property Benefits $Benefits
|
||||
* @property string $Url
|
||||
* @property bool $IsPatron
|
||||
* @property ?Patron $Patron
|
||||
* @property ?NewsletterSubscription $NewsletterSubscription
|
||||
*/
|
||||
|
@ -30,7 +29,6 @@ class User{
|
|||
protected array $_Payments;
|
||||
protected Benefits $_Benefits;
|
||||
protected string $_Url;
|
||||
protected bool $_IsPatron;
|
||||
protected ?Patron $_Patron;
|
||||
protected ?NewsletterSubscription $_NewsletterSubscription;
|
||||
|
||||
|
@ -39,14 +37,6 @@ class User{
|
|||
// GETTERS
|
||||
// *******
|
||||
|
||||
protected function GetIsPatron(): bool{
|
||||
if(!isset($this->_IsPatron)){
|
||||
$this->GetPatron();
|
||||
}
|
||||
|
||||
return $this->_IsPatron;
|
||||
}
|
||||
|
||||
protected function GetNewsletterSubscription(): ?NewsletterSubscription{
|
||||
if(!isset($this->_NewsletterSubscription)){
|
||||
try{
|
||||
|
@ -64,16 +54,9 @@ class User{
|
|||
if(!isset($this->_Patron)){
|
||||
try{
|
||||
$this->_Patron = Patron::Get($this->UserId);
|
||||
if($this->_Patron->Ended === null){
|
||||
$this->IsPatron = true;
|
||||
}
|
||||
else{
|
||||
$this->IsPatron = false;
|
||||
}
|
||||
}
|
||||
catch(Exceptions\PatronNotFoundException){
|
||||
$this->_Patron = null;
|
||||
$this->IsPatron = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,10 @@ label:has(input[name="password-action"]) + label{
|
|||
margin-top: .5rem;
|
||||
}
|
||||
|
||||
h2 + table{
|
||||
margin-top: .5rem;
|
||||
}
|
||||
|
||||
table td{
|
||||
padding: .5rem;
|
||||
vertical-align: top;
|
||||
|
|
|
@ -78,13 +78,21 @@ catch(Exceptions\SeeOtherException $ex){
|
|||
<tbody>
|
||||
<tr>
|
||||
<td>Is Patron:</td>
|
||||
<td><? if($user->IsPatron){ ?>☑<? }else{ ?>☐<? } ?></td>
|
||||
<td><? if($user->Patron !== null && $user->Patron->Ended === null){ ?>☑<? }else{ ?>☐<? } ?></td>
|
||||
</tr>
|
||||
<? if($user->IsPatron && $user->Patron !== null){ ?>
|
||||
<? if($user->Patron !== null && $user->Patron->Ended === null){ ?>
|
||||
<tr>
|
||||
<td>Created:</td>
|
||||
<td><?= $user->Patron->Created->format(Enums\DateTimeFormat::FullDateTime->value) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cycle type:</td>
|
||||
<td><?= ucfirst($user->Patron->CycleType->value) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Base cost:</td>
|
||||
<td>$<?= number_format($user->Patron->BaseCost) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Is anonymous:</td>
|
||||
<td><? if($user->Patron->IsAnonymous){ ?>☑<? }else{ ?>☐<? } ?></td>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue