mirror of
https://github.com/standardebooks/web.git
synced 2025-07-12 01:22:23 -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 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 Benefits $Benefits
|
||||||
* @property string $Url
|
* @property string $Url
|
||||||
* @property bool $IsPatron
|
|
||||||
* @property ?Patron $Patron
|
* @property ?Patron $Patron
|
||||||
* @property ?NewsletterSubscription $NewsletterSubscription
|
* @property ?NewsletterSubscription $NewsletterSubscription
|
||||||
*/
|
*/
|
||||||
|
@ -30,7 +29,6 @@ class User{
|
||||||
protected array $_Payments;
|
protected array $_Payments;
|
||||||
protected Benefits $_Benefits;
|
protected Benefits $_Benefits;
|
||||||
protected string $_Url;
|
protected string $_Url;
|
||||||
protected bool $_IsPatron;
|
|
||||||
protected ?Patron $_Patron;
|
protected ?Patron $_Patron;
|
||||||
protected ?NewsletterSubscription $_NewsletterSubscription;
|
protected ?NewsletterSubscription $_NewsletterSubscription;
|
||||||
|
|
||||||
|
@ -39,14 +37,6 @@ class User{
|
||||||
// GETTERS
|
// GETTERS
|
||||||
// *******
|
// *******
|
||||||
|
|
||||||
protected function GetIsPatron(): bool{
|
|
||||||
if(!isset($this->_IsPatron)){
|
|
||||||
$this->GetPatron();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->_IsPatron;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function GetNewsletterSubscription(): ?NewsletterSubscription{
|
protected function GetNewsletterSubscription(): ?NewsletterSubscription{
|
||||||
if(!isset($this->_NewsletterSubscription)){
|
if(!isset($this->_NewsletterSubscription)){
|
||||||
try{
|
try{
|
||||||
|
@ -64,16 +54,9 @@ class User{
|
||||||
if(!isset($this->_Patron)){
|
if(!isset($this->_Patron)){
|
||||||
try{
|
try{
|
||||||
$this->_Patron = Patron::Get($this->UserId);
|
$this->_Patron = Patron::Get($this->UserId);
|
||||||
if($this->_Patron->Ended === null){
|
|
||||||
$this->IsPatron = true;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$this->IsPatron = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch(Exceptions\PatronNotFoundException){
|
catch(Exceptions\PatronNotFoundException){
|
||||||
$this->_Patron = null;
|
$this->_Patron = null;
|
||||||
$this->IsPatron = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,10 @@ label:has(input[name="password-action"]) + label{
|
||||||
margin-top: .5rem;
|
margin-top: .5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h2 + table{
|
||||||
|
margin-top: .5rem;
|
||||||
|
}
|
||||||
|
|
||||||
table td{
|
table td{
|
||||||
padding: .5rem;
|
padding: .5rem;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
|
|
|
@ -78,13 +78,21 @@ catch(Exceptions\SeeOtherException $ex){
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Is Patron:</td>
|
<td>Is Patron:</td>
|
||||||
<td><? if($user->IsPatron){ ?>☑<? }else{ ?>☐<? } ?></td>
|
<td><? if($user->Patron !== null && $user->Patron->Ended === null){ ?>☑<? }else{ ?>☐<? } ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<? if($user->IsPatron && $user->Patron !== null){ ?>
|
<? if($user->Patron !== null && $user->Patron->Ended === null){ ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Created:</td>
|
<td>Created:</td>
|
||||||
<td><?= $user->Patron->Created->format(Enums\DateTimeFormat::FullDateTime->value) ?></td>
|
<td><?= $user->Patron->Created->format(Enums\DateTimeFormat::FullDateTime->value) ?></td>
|
||||||
</tr>
|
</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>
|
<tr>
|
||||||
<td>Is anonymous:</td>
|
<td>Is anonymous:</td>
|
||||||
<td><? if($user->Patron->IsAnonymous){ ?>☑<? }else{ ?>☐<? } ?></td>
|
<td><? if($user->Patron->IsAnonymous){ ?>☑<? }else{ ?>☐<? } ?></td>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue