diff --git a/database.mwb b/database.mwb index 0d55c98..af3129d 100644 Binary files a/database.mwb and b/database.mwb differ diff --git a/langs/en/labels.json b/langs/en/labels.json index b137f74..429fd9a 100644 --- a/langs/en/labels.json +++ b/langs/en/labels.json @@ -34,5 +34,14 @@ "DOCX": "DOCX", "Amount": "Amount", "Date": "Date", - "Paid": "Paid" + "Status": "Status", + "Paid": "Paid", + "Unpaid": "Unpaid", + "Type": "Type", + "Online": "Online", + "Cash": "Cash", + "Check": "Check", + "Other": "Other", + "Free": "Free", + "Expires": "Expires" } diff --git a/lib/Family.lib.php b/lib/Family.lib.php index 384de00..96aa626 100644 --- a/lib/Family.lib.php +++ b/lib/Family.lib.php @@ -21,6 +21,7 @@ class Family { private $photo = false; private $newsletter = 1; private $children = []; + private $expires = 0; public function __construct() { @@ -53,7 +54,8 @@ class Family { 'zip', 'father_name (father)', 'mother_name (mother)', - 'photo_permission (photo)' + 'photo_permission (photo)', + 'expires' ], [ "familyid" => $this->id ]); @@ -71,6 +73,7 @@ class Family { $this->zip = $f['zip']; $this->photo = $f['photo'] == 1; $this->newsletter = $f['newsletter']; + $this->expires = $f['expires']; foreach ($children as $c) { $this->children[] = (new Child())->load($c); @@ -93,7 +96,8 @@ class Family { "state" => $this->getState(), "zip" => $this->getZip(), "photo_permission" => $this->getPhotoPermission(), - "newsletter_method" => $this->getNewsletter() + "newsletter_method" => $this->getNewsletter(), + "expires" => date("Y-m-d", $this->getExpires()) ], [ "familyid" => $this->id ]); @@ -109,7 +113,8 @@ class Family { "state" => $this->getState(), "zip" => $this->getZip(), "photo_permission" => $this->getPhotoPermission(), - "newsletter_method" => $this->getNewsletter() + "newsletter_method" => $this->getNewsletter(), + "expires" => date("Y-m-d", $this->getExpires()) ]); $this->id = $database->id(); } @@ -172,6 +177,10 @@ class Family { return $this->children; } + public function getExpires(): int { + return $this->expires; + } + public function setName(string $name) { @@ -252,4 +261,18 @@ class Family { $this->children[] = $child; } + /** + * Set the membership expiration date to either a UNIX timestamp or a date + * string. + * @param int $timestamp + * @param string $date A string parseable by strtotime(). + */ + public function setExpires(int $timestamp = null, string $date = null) { + if (is_null($timestamp) && !is_null($date)) { + $this->expires = strtotime($date); + } else if (!is_null($timestamp) && is_null($date)) { + $this->expires = $timestamp; + } + } + } diff --git a/pages/families.php b/pages/families.php index 5367ce0..4ddb6ea 100644 --- a/pages/families.php +++ b/pages/families.php @@ -14,7 +14,7 @@ if (!$user->hasPermission("HACHEPORTAL_VIEW")) { $writeaccess = $user->hasPermission("HACHEPORTAL_EDIT"); -$families = $database->select("families", ['familyid (id)', 'familyname', 'phone', 'email', 'father_name (father)', 'mother_name (mother)']); +$families = $database->select("families", ['familyid (id)', 'familyname', 'phone', 'email', 'father_name (father)', 'mother_name (mother)', 'expires']); ?>