Add member privacy checkbox (#18)

master
Skylar Ittner 5 years ago
parent 223c37c04b
commit 48917e6bce

@ -138,6 +138,14 @@ switch ($VARS['action']) {
}
$family->setPhotoPermission($photopermission);
$private = $VARS['private'];
if (!empty($private) && $private == "1") {
$private = true;
} else {
$private = false;
}
$family->setPrivate($private);
$family->save();
//

Binary file not shown.

@ -54,5 +54,6 @@
"This payment is a membership renewal (automatically add one year to the family's membership)": "This payment is a membership renewal (automatically add one year to the family's membership)",
"All members expired or expiring within a month.": "All members expired or expiring within a month.",
"All the data from the member directory in a spreadsheet.": "All the data from the member directory in a spreadsheet.",
"A formatted and up-to-date HACHE member directory.": "A formatted and up-to-date HACHE member directory."
"A formatted and up-to-date HACHE member directory.": "A formatted and up-to-date HACHE member directory.",
"Member wishes to be remain private (excluded from member directory)": "Member wishes to be remain private (excluded from member directory)"
}

@ -22,6 +22,7 @@ class Family {
private $newsletter = 1;
private $children = [];
private $expires = 0;
private $private = false;
public function __construct() {
@ -55,7 +56,8 @@ class Family {
'father_name (father)',
'mother_name (mother)',
'photo_permission (photo)',
'expires'
'expires',
'private'
], [
"familyid" => $this->id
]);
@ -74,6 +76,7 @@ class Family {
$this->photo = $f['photo'] == 1;
$this->newsletter = $f['newsletter'];
$this->expires = strtotime($f['expires']);
$this->private = $f['private'] == 1;
foreach ($children as $c) {
$this->children[] = (new Child())->load($c);
@ -97,7 +100,8 @@ class Family {
"zip" => $this->getZip(),
"photo_permission" => $this->getPhotoPermission(),
"newsletter_method" => $this->getNewsletter(),
"expires" => date("Y-m-d", $this->getExpires())
"expires" => date("Y-m-d", $this->getExpires()),
"private" => $this->getPrivate()
], [
"familyid" => $this->id
]);
@ -114,7 +118,8 @@ class Family {
"zip" => $this->getZip(),
"photo_permission" => $this->getPhotoPermission(),
"newsletter_method" => $this->getNewsletter(),
"expires" => date("Y-m-d", $this->getExpires())
"expires" => date("Y-m-d", $this->getExpires()),
"private" => $this->getPrivate()
]);
$this->id = $database->id();
}
@ -181,6 +186,10 @@ class Family {
return $this->expires;
}
public function getPrivate(): bool {
return $this->private == true;
}
public function setName(string $name) {
@ -275,4 +284,8 @@ class Family {
}
}
public function setPrivate(bool $private) {
$this->private = $private;
}
}

@ -282,24 +282,40 @@ if (empty($VARS['id']) || !$database->has('families', ['familyid' => $VARS['id']
<h4><i class="fas fa-check-circle fa-fw"></i> Consent</h4>
<p class="mb-0">
<?php $Strings->get("Okay to use photos?"); ?>
<span class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="photo_permission" id="photo_permission" value="1" <?php
if ($family->getPhotoPermission()) {
echo "checked";
}
?> required>
<label class="form-check-label" for="photo_permission">Yes</label>
</span>
<span class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="photo_permission" id="photo_permission" value="0" <?php
if (!$family->getPhotoPermission()) {
echo "checked";
}
?> required>
<label class="form-check-label" for="photo_permission">No</label>
</span>
<div>
<div>
<?php $Strings->get("Okay to use photos?"); ?>
<br />
<span class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="photo_permission" id="photo_permission" value="1" <?php
if ($family->getPhotoPermission()) {
echo "checked";
}
?> required>
<label class="form-check-label" for="photo_permission">Yes</label>
</span>
<span class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="photo_permission" id="photo_permission" value="0" <?php
if (!$family->getPhotoPermission()) {
echo "checked";
}
?> required>
<label class="form-check-label" for="photo_permission">No</label>
</span>
</div>
<div class="mt-2">
<span class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" name="private" id="private" value="1" <?php
if ($family->getPrivate()) {
echo "checked";
}
?>>
<label class="form-check-label" for="private"><?php $Strings->get("Member wishes to be remain private (excluded from member directory)"); ?></label>
</span>
</div>
</div>
</div>
<?php

Loading…
Cancel
Save