Skip to content

Commit

Permalink
2.7.0 Family Cleanup (ChurchCRM#2096)
Browse files Browse the repository at this point in the history
* fixed Image tag

also removed unused family service

* moved verify note to ORM

* import cleanup

* Apply fixes from StyleCI (ChurchCRM#2095)
  • Loading branch information
DawoudIO authored Mar 15, 2017
1 parent 9c8cda3 commit 7e150aa
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 32 deletions.
24 changes: 19 additions & 5 deletions src/ChurchCRM/model/ChurchCRM/Family.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function postInsert(ConnectionInterface $con = null)
{
$this->createTimeLineNote(true);
}

public function postUpdate(ConnectionInterface $con = null)
{
$this->createTimeLineNote(false);
Expand Down Expand Up @@ -254,22 +254,36 @@ public function setImageFromBase64($base64) {
return true;
}
return false;

}

public function isPhotoLocal() {
return $this->getPhoto()->isPhotoLocal();
}

public function isPhotoRemote() {
return $this->getPhoto()->isPhotoRemote();
}

public function getPhotoContentType() {
return $this->getPhoto()->getPhotoContentType();
}

/**
public function verify()
{
$note = new Note();
$note->setFamId($this->getId());
$note->setText(gettext('Family Data Verified'));
$note->setType('verify');
$note->setEntered($_SESSION['user']->getId());
$note->save();
}

public function getFamilyString()
{
return $this->getName(). " " . $this->getAddress();
}

/**
* if the latitude or longitude is empty find the lat/lng from the address and update the lat lng for the family.
* @return array of Lat/Lng
*/
Expand Down
17 changes: 5 additions & 12 deletions src/FamilyVerify.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,15 @@
require 'Include/Config.php';
require 'Include/Functions.php';

use ChurchCRM\Note;
use ChurchCRM\Service\FamilyService;

$familyService = new FamilyService();
use ChurchCRM\FamilyQuery;

//Get the FamilyID out of the querystring
$iFamilyID = FilterInput($_GET['FamilyID'], 'int');

$note = new Note();
$note->setFamId($iFamilyID);
$note->setText(gettext('Family Data Verified'));
$note->setType('verify');
$note->setEntered($_SESSION['iUserID']);
$note->save();
$family = FamilyQuery::create()
->findOneById($iFamilyID);

$familyURI = $familyService->getViewURI($iFamilyID);
$family->verify();

header('Location: '.$familyURI);
header('Location: '.$family->getViewURI());
exit;
12 changes: 6 additions & 6 deletions src/FamilyView.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
use ChurchCRM\dto\SystemConfig;
use ChurchCRM\FamilyQuery;
use ChurchCRM\dto\SystemURLs;
use ChurchCRM\Service\FamilyService;
use ChurchCRM\Service\MailChimpService;
use ChurchCRM\Service\TimelineService;

Expand Down Expand Up @@ -186,7 +185,7 @@
<div class="box box-primary">
<div class="box-body">
<div class="image-container">
<img data-src="<?= SystemURLs::getRootPath() ?>/api/families/<?= $family->getId() ?>/photo"
<img data-src="<?= SystemURLs::getRootPath() ?>/api/families/<?= $family->getId() ?>/photo"
data-name="<?= $family->getName()?>" alt="" class="initials-image img-rounded img-responsive profile-user-img profile-family-img"/>
<?php if ($bOkToEdit): ?>
<div class="after">
Expand Down Expand Up @@ -912,7 +911,7 @@ class="fa fa-cart-plus"></i> <?= gettext("Add All Family Members to Cart") ?></a

<!-- Modal -->
<div id="photoUploader"></div>

<div class="modal fade" id="confirm-delete-image" tabindex="-1" role="dialog" aria-labelledby="delete-Image-label"
aria-hidden="true">
<div class="modal-dialog">
Expand Down Expand Up @@ -971,7 +970,8 @@ class="fa fa-cart-plus"></i> <?= gettext("Add All Family Members to Cart") ?></a
<button type="button" id="onlineVerify"
class="btn btn-warning warning"><i class="fa fa-envelope"></i> <?= gettext("Online Verification") ?>
</button>
<?php
<?php

} ?>
<button type="button" id="verifyDownloadPDF"
class="btn btn-info"><i class="fa fa-download"></i> <?= gettext("PDF Report") ?></button>
Expand Down Expand Up @@ -1062,12 +1062,12 @@ class="btn btn-success"><i class="fa fa-check"></i> <?= gettext("Verified In Per
location.reload();
}
});


contentExists(window.CRM.root + "/api/families/" + window.CRM.currentFamily + "/photo", function(success) {
if (success) {
$("#view-larger-image-btn").removeClass('hide');

$("#view-larger-image-btn").click(function() {
bootbox.alert({
title: "<?= gettext('Family Photo') ?>",
Expand Down
16 changes: 7 additions & 9 deletions src/external/templates/verify/verify-family-info.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
use ChurchCRM\dto\SystemURLs;
use ChurchCRM\Service\FamilyService;
use ChurchCRM\ListOptionQuery;
use ChurchCRM\dto\SystemConfig;

Expand All @@ -18,10 +17,9 @@
<div class="panel-body">
<img class="img-circle center-block pull-right img-responsive initials-image" width="200" height="200"
data-name="<?= $family->getName() ?>"
<?php if ( $family->getThumbnailBytes() != FALSE )
{ ?>
src="data:image/png;base64,<?= base64_encode($family->getThumbnailBytes()) ?>">
<?php } ?>
<?php if ( $family->getThumbnailBytes() != FALSE ) { ?>
src="data:image/png;base64,<?= base64_encode($family->getThumbnailBytes()) ?>"
<?php } ?>>
<h2><?= $family->getName() ?></h2>
<div class="text-muted font-bold m-b-xs">
<i class="fa fa-fw fa-map-marker" title="<?= gettext("Home Address")?>"></i><?= $family->getAddress() ?><br/>
Expand Down Expand Up @@ -52,14 +50,14 @@
<?php foreach ($family->getPeopleSorted() as $person) { ?>
<div class="col-md-3 col-sm-4">
<div class="box box-primary">
<div class="box-body box-profile">
<div class="box-body box-profile">
<img class="profile-user-img img-responsive img-circle initials-image"
data-name="<?= $person->getFullName() ?>"
<?php if ( $person->getThumbnailBytes() != FALSE)
{?>
src="data:image/png;base64,<?= base64_encode($person->getThumbnailBytes()) ?>">
<?php } ?>


<h3 class="profile-username text-center"><?= $person->getTitle() ?> <?= $person->getFullName() ?></h3>

Expand Down Expand Up @@ -143,8 +141,8 @@ class="pull-right"><?= $listOption ?></span>
</div>
</div>



<style>

#verifyBox {
Expand Down

0 comments on commit 7e150aa

Please sign in to comment.