-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4988 from ChurchCRM/feature-link-custom-person-fi…
…eld-to-the-person Refactor or the Logic to display Custom fields for Person/Family
- Loading branch information
Showing
7 changed files
with
206 additions
and
32 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?php | ||
|
||
namespace ChurchCRM\dto; | ||
|
||
use ChurchCRM\PersonQuery; | ||
|
||
Class PeopleCustomField { | ||
|
||
private $name; | ||
private $value; | ||
private $formattedValue; | ||
private $link; | ||
private $icon = "fa fa-tag"; | ||
private $displayValue; | ||
|
||
/** | ||
* PeopleCustomField constructor. | ||
* @param $name | ||
*/ | ||
public function __construct($masterField, $value) | ||
{ | ||
$this->value = trim($value); | ||
$this->formattedValue = $this->value; | ||
$this->displayValue = $masterField->getName(); | ||
$masterField->getName(); | ||
|
||
if ($masterField->getTypeId() == 9) { | ||
$this->icon = "fa fa-user"; | ||
$this->link = SystemURLs::getRootPath() .'/PersonView.php?PersonID=' . $this->value; | ||
$person = PersonQuery::create()->findPk($this->value); | ||
if ($person) { | ||
$this->formattedValue = $person->getFullName(); | ||
} else { | ||
$this->formattedValue = gettext("Unexpected Person Id"). " : " . $this->value; | ||
} | ||
} elseif ($masterField->getTypeId() == 11) { | ||
//$custom_Special = $sPhoneCountry; | ||
$this->icon = "fa fa-phone"; | ||
$this->link = "tel:".$this->value; | ||
} | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getFormattedValue() | ||
{ | ||
return $this->formattedValue; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getLink() | ||
{ | ||
return $this->link; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getName() | ||
{ | ||
return $this->name; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getValue() | ||
{ | ||
return $this->value; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getIcon() | ||
{ | ||
return $this->icon; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getDisplayValue() | ||
{ | ||
return $this->displayValue; | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters